1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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.
This commit is contained in:
Sam Leffler 2005-06-07 23:37:49 +00:00
parent 4f735865c7
commit f02a0bd2ac
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147118
3 changed files with 35 additions and 18 deletions

View File

@ -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.

View File

@ -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];
};
/*

View File

@ -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,
#ifdef IEEE80211_DEBUG_REFCNT
"%s (%s:%u) %p<%s> refcnt %d\n", __func__,
func, line,
#else
"%s %p<%s> refcnt %d\n", __func__,
#endif
ni, ether_sprintf(ni->ni_macaddr),
ieee80211_node_refcnt(ni));
break;
/*
* 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,
#else
"%s %p<%s> refcnt %d\n", __func__,
#endif
ni, ether_sprintf(ni->ni_macaddr),
ieee80211_node_refcnt(ni));
}
IEEE80211_NODE_UNLOCK(nt);
return ni;
#undef MATCH_SSID
}
static void