diff options
author | sam <sam@FreeBSD.org> | 2009-05-20 20:00:40 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-05-20 20:00:40 +0000 |
commit | 68f7a1034ab73897585652ceedd3727d57150c12 (patch) | |
tree | c9b0cc01e080db542eb19f65236177aacfa14b5d /sys/net80211/ieee80211_wds.c | |
parent | df90a80062bff5ee7300c9b15aaeeaa9c1b49b5e (diff) | |
download | FreeBSD-src-68f7a1034ab73897585652ceedd3727d57150c12.zip FreeBSD-src-68f7a1034ab73897585652ceedd3727d57150c12.tar.gz |
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
Diffstat (limited to 'sys/net80211/ieee80211_wds.c')
-rw-r--r-- | sys/net80211/ieee80211_wds.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index 6ab8f11..85ab544 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -63,10 +63,9 @@ __FBSDID("$FreeBSD$"); static void wds_vattach(struct ieee80211vap *); static int wds_newstate(struct ieee80211vap *, enum ieee80211_state, int); -static int wds_input(struct ieee80211_node *ni, struct mbuf *m, - int rssi, int noise, uint32_t rstamp); +static int wds_input(struct ieee80211_node *ni, struct mbuf *m, int, int); static void wds_recv_mgmt(struct ieee80211_node *, struct mbuf *, - int subtype, int rssi, int noise, u_int32_t rstamp); + int subtype, int, int); void ieee80211_wds_attach(struct ieee80211com *ic) @@ -199,12 +198,12 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) * Flush pending frames now that were setup. */ if (ni != NULL && IEEE80211_NODE_WDSQ_QLEN(ni) != 0) { - int8_t rssi, noise; + int8_t rssi, nf; IEEE80211_NOTE(vap, IEEE80211_MSG_WDS, ni, "flush wds queue, %u packets queued", IEEE80211_NODE_WDSQ_QLEN(ni)); - ic->ic_node_getsignal(ni, &rssi, &noise); + ic->ic_node_getsignal(ni, &rssi, &nf); for (;;) { struct mbuf *m; @@ -213,8 +212,7 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) IEEE80211_NODE_WDSQ_UNLOCK(ni); if (m == NULL) break; - /* XXX cheat and re-use last rstamp */ - ieee80211_input(ni, m, rssi, noise, ni->ni_rstamp); + ieee80211_input(ni, m, rssi, nf); } } return (ni == NULL ? ENOENT : 0); @@ -292,9 +290,6 @@ ieee80211_dwds_mcast(struct ieee80211vap *vap0, struct mbuf *m) mcopy->m_flags |= M_MCAST; mcopy->m_pkthdr.rcvif = (void *) ni; - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); - err = parent->if_transmit(parent, mcopy); if (err) { /* NB: IFQ_HANDOFF reclaims mbuf */ @@ -470,8 +465,7 @@ wds_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) * by the 802.11 layer. */ static int -wds_input(struct ieee80211_node *ni, struct mbuf *m, - int rssi, int noise, uint32_t rstamp) +wds_input(struct ieee80211_node *ni, struct mbuf *m, int rssi, int nf) { #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) #define HAS_SEQ(type) ((type & 0x4) == 0) @@ -553,8 +547,7 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, goto out; } IEEE80211_RSSI_LPF(ni->ni_avgrssi, rssi); - ni->ni_noise = noise; - ni->ni_rstamp = rstamp; + ni->ni_noise = nf; if (HAS_SEQ(type)) { uint8_t tid = ieee80211_gettid(wh); if (IEEE80211_QOS_HAS_SEQ(wh) && @@ -686,8 +679,8 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, } /* copy to listener after decrypt */ - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); + if (ieee80211_radiotap_active_vap(vap)) + ieee80211_radiotap_rx(vap, m); need_tap = 0; /* @@ -786,16 +779,14 @@ wds_input(struct ieee80211_node *ni, struct mbuf *m, vap->iv_stats.is_rx_mgtdiscard++; /* XXX */ goto out; } - if (bpf_peers_present(vap->iv_rawbpf)) - bpf_mtap(vap->iv_rawbpf, m); - vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); - m_freem(m); - return IEEE80211_FC0_TYPE_MGT; + vap->iv_recv_mgmt(ni, m, subtype, rssi, nf); + goto out; case IEEE80211_FC0_TYPE_CTL: vap->iv_stats.is_rx_ctl++; IEEE80211_NODE_STAT(ni, rx_ctrl); goto out; + default: IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY, wh, "bad", "frame type 0x%x", type); @@ -806,8 +797,8 @@ err: ifp->if_ierrors++; out: if (m != NULL) { - if (bpf_peers_present(vap->iv_rawbpf) && need_tap) - bpf_mtap(vap->iv_rawbpf, m); + if (need_tap) + ieee80211_radiotap_rx(vap, m); m_freem(m); } return type; @@ -816,7 +807,7 @@ out: static void wds_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, - int subtype, int rssi, int noise, u_int32_t rstamp) + int subtype, int rssi, int nf) { struct ieee80211vap *vap = ni->ni_vap; struct ieee80211com *ic = ni->ni_ic; |