summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/if_iwm.c9
-rw-r--r--sys/dev/pci/if_iwn.c9
-rw-r--r--sys/net80211/ieee80211.c17
3 files changed, 29 insertions, 6 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index 42cb00c62cc..d0dba0daa30 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.247 2019/08/29 07:49:15 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.248 2019/09/02 12:50:12 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -5693,6 +5693,13 @@ iwm_scan(struct iwm_softc *sc)
return err;
}
+ /*
+ * 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 |= IWM_FLAG_SCANNING;
if (ifp->if_flags & IFF_DEBUG)
printf("%s: %s -> %s\n", ifp->if_xname,
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;
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index 9424dd2a492..ace97a38cc4 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211.c,v 1.77 2019/07/29 10:50:08 stsp Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.78 2019/09/02 12:50:12 stsp Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
@@ -1035,13 +1035,22 @@ ieee80211_next_mode(struct ifnet *ifp)
/*
* Indicate a wrap-around if we're running in a fixed, user-specified
- * phy mode or if the driver scans all bands in one scan iteration.
+ * phy mode.
*/
- if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) != IFM_AUTO ||
- (ic->ic_caps & IEEE80211_C_SCANALLBAND))
+ if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) != IFM_AUTO)
return (IEEE80211_MODE_AUTO);
/*
+ * Always scan in AUTO mode if the driver scans all bands.
+ * The current mode might have changed during association
+ * so we must reset it here.
+ */
+ if (ic->ic_caps & IEEE80211_C_SCANALLBAND) {
+ ieee80211_setmode(ic, IEEE80211_MODE_AUTO);
+ return (ic->ic_curmode);
+ }
+
+ /*
* Get the next supported mode; effectively, this alternates between
* the 11a (5GHz) and 11b/g (2GHz) modes. What matters is that each
* supported channel gets scanned.