Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 May 2008 22:27:52 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 142414 for review
Message-ID:  <200805272227.m4RMRqON046669@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142414

Change 142414 by sam@sam_ebb on 2008/05/27 22:27:47

	simplify some contorted logic that wrongly left ISCAN_DISCARD
	set in certain cases causing the current ap to be lost from
	the scan cache
	Obtained from:	Atheros (original bug)

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_scan.c#23 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_scan.c#23 (text+ko) ====

@@ -551,7 +551,7 @@
 	struct ieee80211com *ic = vap->iv_ic;
 	struct ieee80211_scan_state *ss = ic->ic_scan;
 	const struct ieee80211_scanner *scan;
-	int checkscanlist = 0, result;
+	int result;
 
 	scan = ieee80211_scanner_get(vap->iv_opmode);
 	if (scan == NULL) {
@@ -595,8 +595,8 @@
 			flags |= IEEE80211_SCAN_NOSSID;
 		}
 		if ((ic->ic_flags & IEEE80211_F_SCAN) == 0 &&
-		     (flags & IEEE80211_SCAN_FLUSH) == 0 &&
-		     time_before(ticks, ic->ic_lastscan + vap->iv_scanvalid)) {
+		    (flags & IEEE80211_SCAN_FLUSH) == 0 &&
+		    time_before(ticks, ic->ic_lastscan + vap->iv_scanvalid)) {
 			/*
 			 * We're not currently scanning and the cache is
 			 * deemed hot enough to consult.  Lock out others
@@ -607,21 +607,19 @@
 			 */
 			SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_DISCARD;
 			ic->ic_flags |= IEEE80211_F_SCAN;
-			/* NB: need to use supplied flags in check below */
+
+			/* NB: need to use supplied flags in check */
 			ss->ss_flags = flags & 0xff;
-			checkscanlist = 1;
-		}
-	}
-	if (checkscanlist) {
-		if (ss->ss_ops->scan_end(ss, vap)) {
-			/* found an ap, just clear the flag */
+			result = ss->ss_ops->scan_end(ss, vap);
+
 			ic->ic_flags &= ~IEEE80211_F_SCAN;
-			ieee80211_notify_scan_done(vap);
-			IEEE80211_UNLOCK(ic);
-			return 1;
+			SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_DISCARD;
+			if (result) {
+				ieee80211_notify_scan_done(vap);
+				IEEE80211_UNLOCK(ic);
+				return 1;
+			}
 		}
-		/* no ap, clear the flag before starting a scan */
-		ic->ic_flags &= ~IEEE80211_F_SCAN;
 	}
 	result = start_scan_locked(scan, vap, flags, duration,
 	    mindwell, maxdwell, nssid, ssids);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805272227.m4RMRqON046669>