From e88183a84803edc1ff55fbc801ec0b0f65da57cf Mon Sep 17 00:00:00 2001 From: sephe Date: Mon, 26 Feb 2007 12:28:23 +0000 Subject: [PATCH] Discard deauth/disassoc that are not for us. Reception of these frames can only happen when promisc mode is enabled. Obtained-from: FreeBSD-p4/sam_wifi (sam@freebsd.org) --- sys/netproto/802_11/wlan/ieee80211_input.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/netproto/802_11/wlan/ieee80211_input.c b/sys/netproto/802_11/wlan/ieee80211_input.c index 4b59933dab..e4fe2417c7 100644 --- a/sys/netproto/802_11/wlan/ieee80211_input.c +++ b/sys/netproto/802_11/wlan/ieee80211_input.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_input.c,v 1.62.2.14 2006/09/02 15:16:12 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_input.c,v 1.16 2007/02/13 14:15:57 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_input.c,v 1.17 2007/02/26 12:28:23 sephe Exp $ */ #include @@ -2575,6 +2575,12 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, ic->ic_stats.is_rx_deauth++; IEEE80211_NODE_STAT(ni, rx_deauth); + if (!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { + /* NB: can happen when in promiscuous mode */ + ic->ic_stats.is_rx_mgtdiscard++; + break; + } + IEEE80211_DPRINTF(ic, IEEE80211_MSG_AUTH, "[%6D] recv deauthenticate (reason %d)\n", ni->ni_macaddr, ":", reason); @@ -2612,6 +2618,12 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, ic->ic_stats.is_rx_disassoc++; IEEE80211_NODE_STAT(ni, rx_disassoc); + if (!IEEE80211_ADDR_EQ(wh->i_addr1, ic->ic_myaddr)) { + /* NB: can happen when in promiscuous mode */ + ic->ic_stats.is_rx_mgtdiscard++; + break; + } + IEEE80211_DPRINTF(ic, IEEE80211_MSG_ASSOC, "[%6D] recv disassociate (reason %d)\n", ni->ni_macaddr, ":", reason); -- 2.11.4.GIT