Author: adrian
Date: Thu Dec 18 05:17:18 2014
New Revision: 275875
URL: https://svnweb.freebsd.org/changeset/base/275875

Log:
  Fix the scan handling for 11b->11g upgrades in a world where, well,
  it's not just 11b/11g.
  
  The following was happening, and it's quite .. annoyingly grr-y.
  
  * create vap, setup wpa_supplicant with no bgscanning, etc - there's
    no call to ieee80211_media_change, so vap->iv_des_mode is
    IEEE80211_MODE_AUTO;
  * do ifconfig wlan0 scan - same thing, media_change doesn't get called,
    iv_des_mode stays as auto.
  * But then, run wpa_cli and do 'scan' - it'll do a media change.
  * if you're on 11ng, vap->iv_des_mode gets changed to IEEE80211_MODE_11NG
  * Then makescanlist() is called.  There's a block of code that gets
    called if iv_des_mode != IEEE80211_MODE_AUTO, and it does this:
  
                if (vap->iv_des_mode != IEEE80211_MODE_11G ||
                            mode != IEEE80211_MODE_11B)
                        continue;
                mode = IEEE80211_MODE_11G;      /* upgrade */
  
  * .. now, iv_des_mode is not IEEE80211_MODE_11G, so it always runs
    'continue'
  * .. and thus the scan list stays empty and no further channel
    scans occur. Ever.(1)
  
  If you then disassociate and try associating to something, your
  scan table has likely been purged / aged out and you'll never
  see anything in the scan list.
  
  (1) You need to do 'ifconfig wlan0 mode auto' or just destroy/re-create
      the VAP to get working wireless again.
  
  Tested:
  
  * iwn(4) - intel 5300 wifi; STA mode; using wpa_supplicant; bgscan
    enabled -and- wpa_supplicant scanning.
  
  Thanks to:
  
  * Everyone who kept poking me about this and wondering why the hell
    their wifi would eventually stop seeing scan lists.  Grr.
    I eventually snapped this evening and dug back into this code.

Modified:
  head/sys/net80211/ieee80211_scan_sta.c

Modified: head/sys/net80211/ieee80211_scan_sta.c
==============================================================================
--- head/sys/net80211/ieee80211_scan_sta.c      Thu Dec 18 03:51:09 2014        
(r275874)
+++ head/sys/net80211/ieee80211_scan_sta.c      Thu Dec 18 05:17:18 2014        
(r275875)
@@ -600,10 +600,12 @@ makescanlist(struct ieee80211_scan_state
                                 * so if the desired mode is 11g, then use
                                 * the 11b channel list but upgrade the mode.
                                 */
-                               if (vap->iv_des_mode != IEEE80211_MODE_11G ||
-                                   mode != IEEE80211_MODE_11B)
-                                       continue;
-                               mode = IEEE80211_MODE_11G;      /* upgrade */
+                               if (vap->iv_des_mode == IEEE80211_MODE_11G) {
+                                       if (mode == IEEE80211_MODE_11G) /* Skip 
the G check */
+                                               continue;
+                                       else if (mode == IEEE80211_MODE_11B)
+                                               mode = IEEE80211_MODE_11G;      
/* upgrade */
+                               }
                        }
                } else {
                        /*
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to