-/* $OpenBSD: if_iwm.c,v 1.368 2021/09/24 19:02:16 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.369 2021/09/30 09:27:47 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
struct iwm_softc *sc = ifp->if_softc;
int i;
+ /*
+ * Prevent attemps to transition towards the same state, unless
+ * we are scanning in which case a SCAN -> SCAN transition
+ * triggers another scan iteration.
+ */
+ if (sc->ns_nstate == nstate && nstate != IEEE80211_S_SCAN)
+ return 0;
+
if (ic->ic_state == IEEE80211_S_RUN) {
timeout_del(&sc->sc_calib_to);
iwm_del_task(sc, systq, &sc->ba_task);
-/* $OpenBSD: if_iwx.c,v 1.111 2021/09/23 16:27:58 stsp Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.112 2021/09/30 09:27:47 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
struct iwx_softc *sc = ifp->if_softc;
int i;
+ /*
+ * Prevent attemps to transition towards the same state, unless
+ * we are scanning in which case a SCAN -> SCAN transition
+ * triggers another scan iteration.
+ */
+ if (sc->ns_nstate == nstate && nstate != IEEE80211_S_SCAN)
+ return 0;
+
if (ic->ic_state == IEEE80211_S_RUN) {
iwx_del_task(sc, systq, &sc->ba_task);
iwx_del_task(sc, systq, &sc->setkey_task);