Date: Mon, 25 May 2009 16:38:47 +0000 (UTC) From: Sam Leffler <sam@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r192765 - head/sys/net80211 Message-ID: <200905251638.n4PGclq3029229@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: sam Date: Mon May 25 16:38:47 2009 New Revision: 192765 URL: http://svn.freebsd.org/changeset/base/192765 Log: Fix handling of devices w/o radiotap support: o do not attach DLT_IEEE802_11_RADIO unless both tx and rx headers are present; this is assumed in the capture code paths o verify the above with asserts in ieee80211_radiotap_{rx,tx} o add missing checks for active taps before calling ieee80211_radiotap_rx Modified: head/sys/net80211/ieee80211_adhoc.c head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_monitor.c head/sys/net80211/ieee80211_radiotap.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_wds.c Modified: head/sys/net80211/ieee80211_adhoc.c ============================================================================== --- head/sys/net80211/ieee80211_adhoc.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_adhoc.c Mon May 25 16:38:47 2009 (r192765) @@ -656,7 +656,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_hostap.c Mon May 25 16:38:47 2009 (r192765) @@ -850,7 +850,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_monitor.c ============================================================================== --- head/sys/net80211/ieee80211_monitor.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_monitor.c Mon May 25 16:38:47 2009 (r192765) @@ -128,7 +128,8 @@ monitor_input(struct ieee80211_node *ni, { struct ieee80211vap *vap = ni->ni_vap; - ieee80211_radiotap_rx(vap, m); + if (ieee80211_radiotap_active_vap(vap)) + ieee80211_radiotap_rx(vap, m); m_freem(m); return -1; } Modified: head/sys/net80211/ieee80211_radiotap.c ============================================================================== --- head/sys/net80211/ieee80211_radiotap.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_radiotap.c Mon May 25 16:38:47 2009 (r192765) @@ -102,12 +102,12 @@ ieee80211_radiotap_vattach(struct ieee80 struct ieee80211com *ic = vap->iv_ic; struct ieee80211_radiotap_header *th = ic->ic_th; - KASSERT(th != NULL, ("no radiotap setup")); - - /* radiotap DLT for raw 802.11 frames */ - bpfattach2(vap->iv_ifp, DLT_IEEE802_11_RADIO, - sizeof(struct ieee80211_frame) + le16toh(th->it_len), - &vap->iv_rawbpf); + if (th != NULL && ic->ic_rh != NULL) { + /* radiotap DLT for raw 802.11 frames */ + bpfattach2(vap->iv_ifp, DLT_IEEE802_11_RADIO, + sizeof(struct ieee80211_frame) + le16toh(th->it_len), + &vap->iv_rawbpf); + } } void @@ -193,6 +193,7 @@ dispatch_radiotap(struct ieee80211vap *v void ieee80211_radiotap_tx(struct ieee80211vap *vap0, struct mbuf *m) { + KASSERT(vap0->iv_ic->ic_th != NULL, ("no tx radiotap header")); dispatch_radiotap(vap0, m, vap0->iv_ic->ic_th); } @@ -202,6 +203,7 @@ ieee80211_radiotap_tx(struct ieee80211va void ieee80211_radiotap_rx(struct ieee80211vap *vap0, struct mbuf *m) { + KASSERT(vap0->iv_ic->ic_rh != NULL, ("no rx radiotap header")); dispatch_radiotap(vap0, m, vap0->iv_ic->ic_rh); } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_sta.c Mon May 25 16:38:47 2009 (r192765) @@ -885,7 +885,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); } Modified: head/sys/net80211/ieee80211_wds.c ============================================================================== --- head/sys/net80211/ieee80211_wds.c Mon May 25 16:35:31 2009 (r192764) +++ head/sys/net80211/ieee80211_wds.c Mon May 25 16:38:47 2009 (r192765) @@ -797,7 +797,7 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (need_tap) + if (need_tap && ieee80211_radiotap_active_vap(vap)) ieee80211_radiotap_rx(vap, m); m_freem(m); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905251638.n4PGclq3029229>