diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-09-13 12:11:05 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-09-13 12:11:05 +0000 |
commit | e3f2075749379ea50fffb8a4590e38627fa43f9e (patch) | |
tree | df3f7b04bb39448b6d6e366416436ac1e1a38694 /sys/net80211/ieee80211_input.c | |
parent | 9f7a761da34f11b13cabc604aeef3eb6b708481f (diff) |
replace the node hash table with a red-black tree. this fixes some
bugs in the node table (like duplicate nodes in hostap mode), we get
rid of possible hash collisions, and it simplifies the code.
tested by many, ok damien@, jsg@
Diffstat (limited to 'sys/net80211/ieee80211_input.c')
-rw-r--r-- | sys/net80211/ieee80211_input.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 9ab720414f7..eaa2559a2ec 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */ -/* $OpenBSD: ieee80211_input.c,v 1.10 2005/09/08 13:24:52 reyk Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.11 2005/09/13 12:11:03 reyk Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe @@ -1047,17 +1047,17 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, } /* - * Use mac and channel for lookup so we collect all - * potential AP's when scanning. Otherwise we may - * see the same AP on multiple channels and will only - * record the last one. We could filter APs here based - * on rssi, etc. but leave that to the end of the scan - * so we can keep the selection criteria in one spot. - * This may result in a bloat of the scanned AP list but - * it shouldn't be too much. + * 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); + if ((ni = ieee80211_find_node_for_beacon(ic, wh->i_addr2, + &ic->ic_channels[chan], ssid, rssi)) != NULL) + break; + #ifdef IEEE80211_DEBUG if (ieee80211_debug && (ni == NULL || ic->ic_state == IEEE80211_S_SCAN)) { @@ -1079,7 +1079,8 @@ ieee80211_recv_mgmt(struct ieee80211com *ic, struct mbuf *m0, } } #endif - if (ni == NULL) { + + if ((ni = ieee80211_find_node(ic, wh->i_addr2)) == NULL) { ni = ieee80211_alloc_node(ic, wh->i_addr2); if (ni == NULL) return; |