Allow interfaces that aren't SCANNALLBAND drivers to benefit from the
authorphessler <phessler@openbsd.org>
Tue, 12 Dec 2017 13:38:10 +0000 (13:38 +0000)
committerphessler <phessler@openbsd.org>
Tue, 12 Dec 2017 13:38:10 +0000 (13:38 +0000)
strongest received signal.

OK stsp@

sys/net80211/ieee80211_node.c

index f77766c..57641fa 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ieee80211_node.c,v 1.123 2017/12/12 00:24:21 jcs Exp $        */
+/*     $OpenBSD: ieee80211_node.c,v 1.124 2017/12/12 13:38:10 phessler Exp $   */
 /*     $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $       */
 
 /*-
@@ -771,14 +771,15 @@ ieee80211_end_scan(struct ifnet *ifp)
                if (ieee80211_match_bss(ic, ni) != 0)
                        continue;
 
-               if ((ic->ic_caps & IEEE80211_C_SCANALLBAND) &&
-                   IEEE80211_IS_CHAN_2GHZ(ni->ni_chan) &&
-                   (selbs2 == NULL || ni->ni_rssi > selbs2->ni_rssi))
-                       selbs2 = ni;
-               else if ((ic->ic_caps & IEEE80211_C_SCANALLBAND) &&
-                   IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) &&
-                   (selbs5 == NULL || ni->ni_rssi > selbs5->ni_rssi))
-                       selbs5 = ni;
+               if (ic->ic_caps & IEEE80211_C_SCANALLBAND) {
+                       if (IEEE80211_IS_CHAN_2GHZ(ni->ni_chan) &&
+                           (selbs2 == NULL || ni->ni_rssi > selbs2->ni_rssi))
+                               selbs2 = ni;
+                       else if (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) &&
+                           (selbs5 == NULL || ni->ni_rssi > selbs5->ni_rssi))
+                               selbs5 = ni;
+               } else if (selbs == NULL || ni->ni_rssi > selbs->ni_rssi)
+                       selbs = ni;
        }
 
        if (ic->ic_max_rssi)