From owner-p4-projects@FreeBSD.ORG Tue May 27 22:27:53 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0C4A01065674; Tue, 27 May 2008 22:27:53 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1A6A1065673 for ; Tue, 27 May 2008 22:27:52 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B509E8FC0A for ; Tue, 27 May 2008 22:27:52 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4RMRqM2046671 for ; Tue, 27 May 2008 22:27:52 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4RMRqON046669 for perforce@freebsd.org; Tue, 27 May 2008 22:27:52 GMT (envelope-from sam@freebsd.org) Date: Tue, 27 May 2008 22:27:52 GMT Message-Id: <200805272227.m4RMRqON046669@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 142414 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2008 22:27:53 -0000 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);