Date: Fri, 3 Oct 2008 21:24:07 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 150900 for review Message-ID: <200810032124.m93LO77b090450@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=150900 Change 150900 by sam@sam_ebb on 2008/10/03 21:23:19 o add ahdemo vap mgt frame handler instead of using inline code so it's possible to override o add debug msgs for frame discard cases Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_adhoc.c#16 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_adhoc.c#16 (text+ko) ==== @@ -66,6 +66,8 @@ int rssi, int noise, uint32_t rstamp); static void adhoc_recv_mgmt(struct ieee80211_node *, struct mbuf *, int subtype, int rssi, int noise, uint32_t rstamp); +static void ahdemo_recv_mgmt(struct ieee80211_node *, struct mbuf *, + int subtype, int rssi, int noise, uint32_t rstamp); void ieee80211_adhoc_attach(struct ieee80211com *ic) @@ -89,7 +91,10 @@ { vap->iv_newstate = adhoc_newstate; vap->iv_input = adhoc_input; - vap->iv_recv_mgmt = adhoc_recv_mgmt; + if (vap->iv_opmode == IEEE80211_M_IBSS) + vap->iv_recv_mgmt = adhoc_recv_mgmt; + else + vap->iv_recv_mgmt = ahdemo_recv_mgmt; vap->iv_opdetach = adhoc_vdetach; } @@ -609,9 +614,7 @@ } if (bpf_peers_present(vap->iv_rawbpf)) bpf_mtap(vap->iv_rawbpf, m); - /* NB: only IBSS mode gets mgt frames */ - if (vap->iv_opmode == IEEE80211_M_IBSS) - vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); + vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp); m_freem(m); return IEEE80211_FC0_TYPE_MGT; @@ -735,11 +738,16 @@ case IEEE80211_FC0_SUBTYPE_PROBE_REQ: if (vap->iv_state != IEEE80211_S_RUN) { + IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, + wh, NULL, "wrong state %s", + ieee80211_state_name[vap->iv_state]); vap->iv_stats.is_rx_mgtdiscard++; return; } if (IEEE80211_IS_MULTICAST(wh->i_addr2)) { /* frame must be directed */ + IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, + wh, NULL, "%s", "not unicast"); vap->iv_stats.is_rx_mgtdiscard++; /* XXX stat */ return; } @@ -798,6 +806,9 @@ const struct ieee80211_action *ia; if (vap->iv_state != IEEE80211_S_RUN) { + IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, + wh, NULL, "wrong state %s", + ieee80211_state_name[vap->iv_state]); vap->iv_stats.is_rx_mgtdiscard++; return; } @@ -857,6 +868,8 @@ case IEEE80211_FC0_SUBTYPE_REASSOC_RESP: case IEEE80211_FC0_SUBTYPE_DEAUTH: case IEEE80211_FC0_SUBTYPE_DISASSOC: + IEEE80211_DISCARD(vap, IEEE80211_MSG_INPUT, + wh, NULL, "%s", "not handled"); vap->iv_stats.is_rx_mgtdiscard++; return; @@ -869,3 +882,20 @@ } #undef IEEE80211_VERIFY_LENGTH #undef IEEE80211_VERIFY_ELEMENT + +static void +ahdemo_recv_mgmt(struct ieee80211_node *ni, struct mbuf *m0, + int subtype, int rssi, int noise, uint32_t rstamp) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; + + /* + * Process management frames when scanning; useful for doing + * a site-survey. + */ + if (ic->ic_flags & IEEE80211_F_SCAN) + adhoc_recv_mgmt(ni, m0, subtype, rssi, noise, rstamp); + else + vap->iv_stats.is_rx_mgtdiscard++; +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810032124.m93LO77b090450>