summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/if_ipw.c
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2021-03-28 18:02:32 +0000
committerstsp <stsp@openbsd.org>2021-03-28 18:02:32 +0000
commit81539fc1d40751849e7578ef75724dc2fb798ac3 (patch)
tree37683b25bdf9bd63a87af3e729551e4a783ecfb7 /sys/dev/pci/if_ipw.c
parentNow that the real time and monotonic time streams don't (diff)
downloadwireguard-openbsd-81539fc1d40751849e7578ef75724dc2fb798ac3.tar.xz
wireguard-openbsd-81539fc1d40751849e7578ef75724dc2fb798ac3.zip
Since ipw(4) doesn't call into net80211_newstate() the interface link state
must be updated by the driver in order to get packets to flow. In case of WPA the link state was updated as a side-effect of a successful WPA handshake. This commit fixes the WEP and plaintext cases. Problem reported and fix tested by Riccardo Mottola.
Diffstat (limited to 'sys/dev/pci/if_ipw.c')
-rw-r--r--sys/dev/pci/if_ipw.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c
index ab16cd51ba6..3448f032ed8 100644
--- a/sys/dev/pci/if_ipw.c
+++ b/sys/dev/pci/if_ipw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ipw.c,v 1.128 2021/03/12 17:54:50 stsp Exp $ */
+/* $OpenBSD: if_ipw.c,v 1.129 2021/03/28 18:02:32 stsp Exp $ */
/*-
* Copyright (c) 2004-2008
@@ -679,6 +679,10 @@ int
ipw_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
{
struct ipw_softc *sc = ic->ic_softc;
+ struct ifnet *ifp = &ic->ic_if;
+
+ if (LINK_STATE_IS_UP(ifp->if_link_state))
+ ieee80211_set_link_state(ic, LINK_STATE_DOWN);
switch (nstate) {
case IEEE80211_S_SCAN:
@@ -690,6 +694,14 @@ ipw_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg)
break;
case IEEE80211_S_RUN:
+ if (!(ic->ic_flags & IEEE80211_F_RSNON)) {
+ /*
+ * NB: When RSN is enabled, we defer setting
+ * the link up until the port is valid.
+ */
+ ieee80211_set_link_state(ic, LINK_STATE_UP);
+ }
+ break;
case IEEE80211_S_INIT:
case IEEE80211_S_ASSOC:
/* nothing to do */