summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_iwn.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2019-09-02 12:50:13 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2019-09-02 12:50:13 +0000
commitfbe59ca116c64eb924e71fe936b301dabd78c0a9 (patch)
tree70b076b68d21b0ca608fb9393bf8f50d3fc21f95 /sys/dev/pci/if_iwn.c
parent90ef47811b34d92acdd2081164c0a3717090c055 (diff)
Reset the current wireless PHY mode to 'auto' when a scan begins if we
are in media autoselect mode. The interface might have been switched to a fixed PHY mode during association and keeping it fixed will mislead AP selection after roaming failure. Problem found and diagnosed at CCC camp 2019 Tested by myself, fkr@, chris@
Diffstat (limited to 'sys/dev/pci/if_iwn.c')
-rw-r--r--sys/dev/pci/if_iwn.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c
index 273d0f0b9e6..6be794c2cd4 100644
--- a/sys/dev/pci/if_iwn.c
+++ b/sys/dev/pci/if_iwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwn.c,v 1.213 2019/08/27 14:57:48 stsp Exp $ */
+/* $OpenBSD: if_iwn.c,v 1.214 2019/09/02 12:50:12 stsp Exp $ */
/*-
* Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -5199,6 +5199,13 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags, int bgscan)
DPRINTF(("sending scan command nchan=%d\n", hdr->nchan));
error = iwn_cmd(sc, IWN_CMD_SCAN, buf, buflen, 1);
if (error == 0) {
+ /*
+ * The current mode might have been fixed during association.
+ * Ensure all channels get scanned.
+ */
+ if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
+ ieee80211_setmode(ic, IEEE80211_MODE_AUTO);
+
sc->sc_flags |= IWN_FLAG_SCANNING;
if (bgscan)
sc->sc_flags |= IWN_FLAG_BGSCAN;