diff options
author | sam <sam@FreeBSD.org> | 2005-06-07 23:37:49 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2005-06-07 23:37:49 +0000 |
commit | 2a3c2a37f616272df82284bb11349d4078b217ac (patch) | |
tree | 6faada37a904bce2fe7fdaa45f81aa257a1dae0b /sys | |
parent | 7b035d47f2dbfa8860fdf691ed54e491b5b76010 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/net80211/ieee80211_ioctl.c | 4 | ||||
-rw-r--r-- | sys/net80211/ieee80211_ioctl.h | 2 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.c | 43 |
3 files changed, 33 insertions, 16 deletions
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index e40c4af..e716818 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -1618,14 +1618,14 @@ ieee80211_ioctl_setmlme(struct ieee80211com *ic, struct ieee80211req *ireq) return EINVAL; /* XXX must be in S_SCAN state? */ - if (ic->ic_des_esslen != 0) { + if (mlme.im_ssid_len != 0) { /* * Desired ssid specified; must match both bssid and * ssid to distinguish ap advertising multiple ssid's. */ ni = ieee80211_find_node_with_ssid(&ic->ic_scan, mlme.im_macaddr, - ic->ic_des_esslen, ic->ic_des_essid); + mlme.im_ssid_len, mlme.im_ssid); } else { /* * Normal case; just match bssid. diff --git a/sys/net80211/ieee80211_ioctl.h b/sys/net80211/ieee80211_ioctl.h index e968a27..b561b15 100644 --- a/sys/net80211/ieee80211_ioctl.h +++ b/sys/net80211/ieee80211_ioctl.h @@ -228,8 +228,10 @@ struct ieee80211req_mlme { #define IEEE80211_MLME_DEAUTH 3 /* deauthenticate station */ #define IEEE80211_MLME_AUTHORIZE 4 /* authorize station */ #define IEEE80211_MLME_UNAUTHORIZE 5 /* unauthorize station */ + u_int8_t im_ssid_len; /* length of optional ssid */ u_int16_t im_reason; /* 802.11 reason code */ u_int8_t im_macaddr[IEEE80211_ADDR_LEN]; + u_int8_t im_ssid[IEEE80211_NWID_LEN]; }; /* 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 |