diff options
author | Sam Leffler <sam@FreeBSD.org> | 2009-05-20 20:00:40 +0000 |
---|---|---|
committer | Sam Leffler <sam@FreeBSD.org> | 2009-05-20 20:00:40 +0000 |
commit | 5463c4a485ef2a317cc554b7699984484ec0983d (patch) | |
tree | c9b0cc01e080db542eb19f65236177aacfa14b5d /sys/net80211/ieee80211.c | |
parent | 29e890f126611d30e63a6aa1c515693bb63f43d3 (diff) | |
download | src-5463c4a485ef2a317cc554b7699984484ec0983d.tar.gz src-5463c4a485ef2a317cc554b7699984484ec0983d.zip |
Overhaul monitor mode handling:
o replace DLT_IEEE802_11 support in net80211 with DLT_IEEE802_11_RADIO
and remove explicit bpf support from wireless drivers; drivers now
use ieee80211_radiotap_attach to setup shared data structures that
hold the radiotap header for each packet tx/rx
o remove rx timestamp from the rx path; it was used only by the tdma support
for debugging and was mostly useless due to it being 32-bits and mostly
unavailable
o track DLT_IEEE80211_RADIO bpf attachments and maintain per-vap and
per-com state when there are active taps
o track the number of monitor mode vaps
o use bpf tap and monitor mode vap state to decide when to collect radiotap
state and dispatch frames; drivers no longer explicitly directly check
bpf state or use bpf calls to tap frames
o handle radiotap state updates on channel change in net80211; drivers
should not do this (unless they bypass net80211 which is almost always
a mistake)
o update various drivers to be more consistent/correct in handling radiotap
o update ral to include TSF in radiotap'd frames
o add promisc mode callback to wi
Reviewed by: cbzimmer, rpaulo, thompsa
Notes
Notes:
svn path=/head/; revision=192468
Diffstat (limited to 'sys/net80211/ieee80211.c')
-rw-r--r-- | sys/net80211/ieee80211.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 2e759652c0f4..22c690cd4a3c 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -465,6 +465,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ieee80211vap *vap, ieee80211_ht_vattach(vap); ieee80211_scan_vattach(vap); ieee80211_regdomain_vattach(vap); + ieee80211_radiotap_vattach(vap); return 0; } @@ -509,10 +510,11 @@ ieee80211_vap_attach(struct ieee80211vap *vap, vap->iv_output = ifp->if_output; ifp->if_output = ieee80211_output; /* NB: if_mtu set by ether_ifattach to ETHERMTU */ - bpfattach2(ifp, DLT_IEEE802_11, ifp->if_hdrlen, &vap->iv_rawbpf); IEEE80211_LOCK(ic); TAILQ_INSERT_TAIL(&ic->ic_vaps, vap, iv_next); + if (vap->iv_opmode == IEEE80211_M_MONITOR) + ic->ic_monvaps++; ieee80211_syncflag_locked(ic, IEEE80211_F_WME); #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP); @@ -573,6 +575,8 @@ ieee80211_vap_detach(struct ieee80211vap *vap) IEEE80211_LOCK(ic); KASSERT(vap->iv_state == IEEE80211_S_INIT , ("vap still running")); TAILQ_REMOVE(&ic->ic_vaps, vap, iv_next); + if (vap->iv_opmode == IEEE80211_M_MONITOR) + ic->ic_monvaps--; ieee80211_syncflag_locked(ic, IEEE80211_F_WME); #ifdef IEEE80211_SUPPORT_SUPERG ieee80211_syncflag_locked(ic, IEEE80211_F_TURBOP); @@ -581,16 +585,19 @@ ieee80211_vap_detach(struct ieee80211vap *vap) ieee80211_syncflag_locked(ic, IEEE80211_F_BURST); ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_HT); ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_USEHT40); + /* NB: this handles the bpfdetach done below */ + ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF); ieee80211_syncifflag_locked(ic, IFF_PROMISC); ieee80211_syncifflag_locked(ic, IFF_ALLMULTI); IEEE80211_UNLOCK(ic); /* XXX can't hold com lock */ - /* NB: bpfattach is called by ether_ifdetach and claims all taps */ + /* NB: bpfdetach is called by ether_ifdetach and claims all taps */ ether_ifdetach(ifp); ifmedia_removeall(&vap->iv_media); + ieee80211_radiotap_vdetach(vap); ieee80211_regdomain_vdetach(vap); ieee80211_scan_vdetach(vap); #ifdef IEEE80211_SUPPORT_SUPERG |