From: stsp Date: Fri, 19 Nov 2021 13:05:19 +0000 (+0000) Subject: Fix monitor mode on iwm(4) and iwx(4). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f28d0cfab107a1f8dcb51b42184414112765a369;p=openbsd Fix monitor mode on iwm(4) and iwx(4). Set sc->ns_nstate when bypassing the driver's newstate handler while bringing the interface down. Otherwise, if the interface was already running, the INIT->RUN transition which kicks off monitor mode will appear as a RUN->RUN transition to the driver's newstate handler, and the handler will do nothing. Monitor mode did not work as a result. --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 6ecf1dd8915..32d831f78f3 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.379 2021/11/17 15:15:32 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.380 2021/11/19 13:05:19 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -10075,6 +10075,7 @@ iwm_stop(struct ifnet *ifp) sc->ba_tx.stop_tidmask = 0; sc->sc_newstate(ic, IEEE80211_S_INIT, -1); + sc->ns_nstate = IEEE80211_S_INIT; timeout_del(&sc->sc_calib_to); /* XXX refcount? */ for (i = 0; i < nitems(sc->sc_rxba_data); i++) { diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index c970310fe24..38768d23f50 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.120 2021/11/16 12:56:11 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.121 2021/11/19 13:05:19 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -8040,6 +8040,7 @@ iwx_stop(struct ifnet *ifp) sc->ba_tx.stop_tidmask = 0; sc->sc_newstate(ic, IEEE80211_S_INIT, -1); + sc->ns_nstate = IEEE80211_S_INIT; for (i = 0; i < nitems(sc->sc_rxba_data); i++) { struct iwx_rxba_data *rxba = &sc->sc_rxba_data[i];