summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-01-05 23:13:05 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-01-05 23:13:05 +0000
commitc69566957af5fafcccacb418ecae3516be5eaf86 (patch)
tree7820816fec2d2f6239976cb6b2d20d18a4447e30
parent57ab7af4fe69128a9af9902f8298a585540f3727 (diff)
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.
-rw-r--r--sys/dev/ic/bwfm.c13
1 files 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 <patrick@blueri.se>
@@ -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) &&