diff options
author | sam <sam@FreeBSD.org> | 2008-05-28 23:15:24 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2008-05-28 23:15:24 +0000 |
commit | 7c9c77d9fb48f254655ce890baf1c794f8757778 (patch) | |
tree | 2d7c6b960599e10bc9a6eb53bb427f4e33221067 /sys/net80211 | |
parent | 24e6f87d1f669ccf1ec84c9f5756542d09f3ef93 (diff) | |
download | FreeBSD-src-7c9c77d9fb48f254655ce890baf1c794f8757778.zip FreeBSD-src-7c9c77d9fb48f254655ce890baf1c794f8757778.tar.gz |
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)
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_scan.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/sys/net80211/ieee80211_scan.c b/sys/net80211/ieee80211_scan.c index e9c9246c..dabb404 100644 --- a/sys/net80211/ieee80211_scan.c +++ b/sys/net80211/ieee80211_scan.c @@ -551,7 +551,7 @@ ieee80211_check_scan(struct ieee80211vap *vap, int flags, 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 @@ ieee80211_check_scan(struct ieee80211vap *vap, int flags, 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 @@ ieee80211_check_scan(struct ieee80211vap *vap, int flags, */ 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); |