From fbe59ca116c64eb924e71fe936b301dabd78c0a9 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Mon, 2 Sep 2019 12:50:13 +0000 Subject: 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@ --- sys/dev/pci/if_iwm.c | 9 ++++++++- sys/dev/pci/if_iwn.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'sys/dev/pci') 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 @@ -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 @@ -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; -- cgit v1.2.3