summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_input.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2022-01-12 08:29:28 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2022-01-12 08:29:28 +0000
commit9d6d58a4b21dc8c9db2967564996219839dcedd5 (patch)
tree8247b052433dd3f049e45368757526c2e02c745f /sys/net80211/ieee80211_input.c
parent06148e1eb43f3c4e98d1f0153d0c28a90a781808 (diff)
Remove ieee80211_find_node_for_beacon().
The original purpose of ieee80211_find_node_for_beacon() was to avoid storing duplicate nodes with the same source MAC address in a hash table. Later on, our node table data structure was changed from a hash table to an RB tree. The RB tree can only store a single node per MAC address. However, find_node_for_beacon() was kept regardless, now documented to serve a different purpose. Its new purpose is to tell apart different nodes which happen to use the same MAC address and hence cannot both be stored in the RB tree. The idea is to filter such duplicate nodes out during a scan. But colliding nodes are told apart by RSSI and channel, and either may change over time. So this does not really prevent duplicate MAC addresses from causing issues. The code which decides which node is "better" can erroneously match an AP against itself, in case the AP uses a hidden SSID. This caused workarounds for hidden SSID to pile up over time. Just a bit further down, the code looks up the same node again and performs all of the intended node state updates. Simply skipping the ieee80211_find_node_for_beacon() check makes such state updates work. ok tobhe@
Diffstat (limited to 'sys/net80211/ieee80211_input.c')
-rw-r--r--sys/net80211/ieee80211_input.c39
1 files changed, 8 insertions, 31 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c
index 13673bda75f..d764aa0cc43 100644
--- a/sys/net80211/ieee80211_input.c
+++ b/sys/net80211/ieee80211_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_input.c,v 1.241 2022/01/05 05:18:25 dlg Exp $ */
+/* $OpenBSD: ieee80211_input.c,v 1.242 2022/01/12 08:29:27 stsp Exp $ */
/*-
* Copyright (c) 2001 Atsushi Onoe
@@ -1751,36 +1751,6 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
ic->ic_stats.is_rx_chanmismatch++;
return;
}
- /*
- * Use mac, channel and rssi so we collect only the
- * best potential AP with the equal bssid while scanning.
- * Collecting all potential APs may result in bloat of
- * the node tree. This call will return NULL if the node
- * for this APs does not exist or if the new node is the
- * potential better one.
- */
- ni = ieee80211_find_node_for_beacon(ic, wh->i_addr2,
- &ic->ic_channels[chan], ssid, rxi->rxi_rssi);
- if (ni != NULL) {
- /*
- * If we are doing a directed scan for an AP with a hidden SSID
- * we must collect the SSID from a probe response to override
- * a non-zero-length SSID filled with zeroes that we may have
- * received earlier in a beacon.
- */
- if (isprobe && ssid[1] != 0 && ni->ni_essid[0] == '\0') {
- ni->ni_esslen = ssid[1];
- memset(ni->ni_essid, 0, sizeof(ni->ni_essid));
- /* we know that ssid[1] <= IEEE80211_NWID_LEN */
- memcpy(ni->ni_essid, &ssid[2], ssid[1]);
- }
-
- /* Update channel in case AP has switched */
- if (ic->ic_opmode == IEEE80211_M_STA)
- ni->ni_chan = rni->ni_chan;
-
- return;
- }
#ifdef IEEE80211_DEBUG
if (ieee80211_debug > 1 &&
@@ -1977,6 +1947,13 @@ ieee80211_recv_probe_resp(struct ieee80211com *ic, struct mbuf *m,
}
}
+ /*
+ * Set our SSID if we do not know it yet.
+ * If we are doing a directed scan for an AP with a hidden SSID
+ * we must collect the SSID from a probe response to override
+ * a non-zero-length SSID filled with zeroes that we may have
+ * received earlier in a beacon.
+ */
if (ssid[1] != 0 && ni->ni_essid[0] == '\0') {
ni->ni_esslen = ssid[1];
memset(ni->ni_essid, 0, sizeof(ni->ni_essid));