summaryrefslogtreecommitdiffstats
path: root/sys/net80211/ieee80211_node.c
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-06-07 23:37:49 +0000
committersam <sam@FreeBSD.org>2005-06-07 23:37:49 +0000
commit2a3c2a37f616272df82284bb11349d4078b217ac (patch)
tree6faada37a904bce2fe7fdaa45f81aa257a1dae0b /sys/net80211/ieee80211_node.c
parent7b035d47f2dbfa8860fdf691ed54e491b5b76010 (diff)
downloadFreeBSD-src-2a3c2a37f616272df82284bb11349d4078b217ac.zip
FreeBSD-src-2a3c2a37f616272df82284bb11349d4078b217ac.tar.gz
Change the MLME ASSOCIATE ioctl to accept either a ssid, a bssid,
or a bssid+ssid. This is needed for later versions of wpa_supplicant and for forthcoming addons to wpa_supplicant. Note this is an api change and applications must be rebuilt.
Diffstat (limited to 'sys/net80211/ieee80211_node.c')
-rw-r--r--sys/net80211/ieee80211_node.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c
index 470a358..82c5b42 100644
--- a/sys/net80211/ieee80211_node.c
+++ b/sys/net80211/ieee80211_node.c
@@ -1182,31 +1182,46 @@ ieee80211_find_node_with_ssid(struct ieee80211_node_table *nt,
const u_int8_t *macaddr, u_int ssidlen, const u_int8_t *ssid)
#endif
{
+#define MATCH_SSID(ni, ssid, ssidlen) \
+ (ni->ni_esslen == ssidlen && memcmp(ni->ni_essid, ssid, ssidlen) == 0)
+ static const u_int8_t zeromac[IEEE80211_ADDR_LEN];
struct ieee80211com *ic = nt->nt_ic;
struct ieee80211_node *ni;
int hash;
- hash = IEEE80211_NODE_HASH(macaddr);
IEEE80211_NODE_LOCK(nt);
- LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
- if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) &&
- ni->ni_esslen == ic->ic_des_esslen &&
- memcmp(ni->ni_essid, ic->ic_des_essid, ni->ni_esslen) == 0) {
- ieee80211_ref_node(ni); /* mark referenced */
- IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE,
+ /*
+ * A mac address that is all zero means match only the ssid;
+ * otherwise we must match both.
+ */
+ if (IEEE80211_ADDR_EQ(macaddr, zeromac)) {
+ TAILQ_FOREACH(ni, &nt->nt_node, ni_list) {
+ if (MATCH_SSID(ni, ssid, ssidlen))
+ break;
+ }
+ } else {
+ hash = IEEE80211_NODE_HASH(macaddr);
+ LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) &&
+ MATCH_SSID(ni, ssid, ssidlen))
+ break;
+ }
+ }
+ if (ni != NULL) {
+ ieee80211_ref_node(ni); /* mark referenced */
+ IEEE80211_DPRINTF(ic, IEEE80211_MSG_NODE,
#ifdef IEEE80211_DEBUG_REFCNT
- "%s (%s:%u) %p<%s> refcnt %d\n", __func__,
- func, line,
+ "%s (%s:%u) %p<%s> refcnt %d\n", __func__,
+ func, line,
#else
- "%s %p<%s> refcnt %d\n", __func__,
+ "%s %p<%s> refcnt %d\n", __func__,
#endif
- ni, ether_sprintf(ni->ni_macaddr),
- ieee80211_node_refcnt(ni));
- break;
- }
+ ni, ether_sprintf(ni->ni_macaddr),
+ ieee80211_node_refcnt(ni));
}
IEEE80211_NODE_UNLOCK(nt);
return ni;
+#undef MATCH_SSID
}
static void
OpenPOWER on IntegriCloud