diff options
author | 2018-07-19 09:16:17 +0000 | |
---|---|---|
committer | 2018-07-19 09:16:17 +0000 | |
commit | f5c31c991c94649054bb674fd63c7abbfd8818b8 (patch) | |
tree | 4c39c44a9a40ea7df43408527fc03f597cd37f0d | |
parent | Add regress test for inheritance of unveil's across fork to children (diff) | |
download | wireguard-openbsd-f5c31c991c94649054bb674fd63c7abbfd8818b8.tar.xz wireguard-openbsd-f5c31c991c94649054bb674fd63c7abbfd8818b8.zip |
ieee80211_ess_is_better() returns 0 or 1, comparing > 1 is always
false so we always selected the first wifi available, not the best
one.
While here shuffle some deck chairs to make it clearer that anything is
better than nothing.
tweak & OK phessler
-rw-r--r-- | sys/net80211/ieee80211_node.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 738aa6c36fb..759d9e3296b 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.c,v 1.133 2018/07/16 12:42:22 phessler Exp $ */ +/* $OpenBSD: ieee80211_node.c,v 1.134 2018/07/19 09:16:17 florian Exp $ */ /* $NetBSD: ieee80211_node.c,v 1.14 2004/05/09 09:18:47 dyoung Exp $ */ /*- @@ -302,14 +302,15 @@ ieee80211_ess_is_better(struct ieee80211com *ic, struct ieee80211_node *nicur, { uint8_t min_5ghz_rssi; + /* anything is better than nothing */ + if (selni == NULL) + return 1; + if (ic->ic_max_rssi) min_5ghz_rssi = IEEE80211_RSSI_THRES_RATIO_5GHZ; else min_5ghz_rssi = (uint8_t)IEEE80211_RSSI_THRES_5GHZ; - if (selni == NULL) - return 1; - /* First 5GHz with acceptable signal */ if ((IEEE80211_IS_CHAN_5GHZ(nicur->ni_chan) && !IEEE80211_IS_CHAN_5GHZ(selni->ni_chan)) && @@ -399,8 +400,7 @@ ieee80211_match_ess(struct ieee80211com *ic) !IEEE80211_ADDR_EQ(ic->ic_des_bssid, ni->ni_bssid)) continue; - if (selni == NULL || - ieee80211_ess_is_better(ic, ni, selni) > 1) { + if (ieee80211_ess_is_better(ic, ni, selni) > 0) { seless = ess; selni = ni; } |