From c69566957af5fafcccacb418ecae3516be5eaf86 Mon Sep 17 00:00:00 2001 From: Patrick Wildt Date: Fri, 5 Jan 2018 23:13:05 +0000 Subject: Drop incoming network packets as long as we are not in RUN state. This happens when we successfully associate and the AP tries to initiate the WPA2 handshake but we haven't received the asynchronous ASSOC event yet. Dropping the packet will make the AP retry, and at that point we should have successfully associated. While there, don't feed the event packets to our network stack. It's been helpful for debugging but now it's time to let go. --- sys/dev/ic/bwfm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c index b140486f4af..5903821136a 100644 --- a/sys/dev/ic/bwfm.c +++ b/sys/dev/ic/bwfm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwfm.c,v 1.26 2018/01/05 19:06:37 patrick Exp $ */ +/* $OpenBSD: bwfm.c,v 1.27 2018/01/05 23:13:04 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation * Copyright (c) 2016,2017 Patrick Wildt @@ -1412,8 +1412,17 @@ bwfm_rx(struct bwfm_softc *sc, struct mbuf *m) if (m->m_len >= sizeof(e->ehdr) && ntohs(e->ehdr.ether_type) == BWFM_ETHERTYPE_LINK_CTL && memcmp(BWFM_BRCM_OUI, e->hdr.oui, sizeof(e->hdr.oui)) == 0 && - ntohs(e->hdr.usr_subtype) == BWFM_BRCM_SUBTYPE_EVENT) + ntohs(e->hdr.usr_subtype) == BWFM_BRCM_SUBTYPE_EVENT) { bwfm_rx_event(sc, mtod(m, char *), m->m_len); + m_freem(m); + return; + } + + /* Drop network packets if we are not in RUN state. */ + if (ic->ic_state != IEEE80211_S_RUN) { + m_freem(m); + return; + } if ((ic->ic_flags & IEEE80211_F_RSNON) && m->m_len >= sizeof(e->ehdr) && -- cgit v1.2.3