On Tue, Sep 05, 2017 at 09:05:18AM +0800, Kevin Lo wrote:
> On Sun, Sep 03, 2017 at 09:37:02PM +0200, Stefan Sperling wrote:
> >
> > Starting out in associated (not down!) state:
> > ifconfig iwn0 down; ifconfig iwn0 scan
> > shows 2 GHz and 5 GHz APs, whereas just
> > ifconfig iwn0 scan
> > does not show all APs. The diff below makes both cases show all APs.
> >
> > ok?
>
> I tested with iwn(4) on the sony vaio laptop.
>
> $ dmesg | grep iwn0
> iwn0 at pci2 dev 0 function 0 "Intel Wireless WiFi Link 4965" rev 0x61: msi,
> MIMO 2T3R, MoW1, address 00:1d:e0:b3:e6:c1
>
> Without this diff, 'ifconfig iwn0 scan' sometimes can scan the available
> 2ghz and 5ghz APs and sometimes not. With this diff, iwn(4) can scan
> the available 2ghz and 5ghz APs all the time.
>
> ok kevlo@
>
Thanks, the diff has been committed.
There is another problematic case which I missed in my first diff.
If we start scanning via ieee80211_begin_scan() and were previously associated,
the scan runs in the mode of the AP which we were previously associated to.
If that AP was an 11g one then we only scan 2 GHz channels.
This can be reproduced as follows:
be associated to an 11g-only AP
suspend
resume; ieee80211_begin_scan() is called via iwn_init_task()->iwn_init()
-> scan selects from 2GHz APs only
This diff fixes that problem.
Index: ieee80211_node.c
===================================================================
RCS file: /cvs/src/sys/net80211/ieee80211_node.c,v
retrieving revision 1.120
diff -u -p -r1.120 ieee80211_node.c
--- ieee80211_node.c 17 Aug 2017 06:01:05 -0000 1.120
+++ ieee80211_node.c 5 Sep 2017 12:12:57 -0000
@@ -276,7 +276,8 @@ ieee80211_begin_scan(struct ifnet *ifp)
* Reset the current mode. Setting the current mode will also
* reset scan state.
*/
- if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
+ if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO ||
+ (ic->ic_caps & IEEE80211_C_SCANALLBAND))
ic->ic_curmode = IEEE80211_MODE_AUTO;
ieee80211_setmode(ic, ic->ic_curmode);