nl80211: Make get_ssid behave like get_bssid with SME
Use a local copy of SSID instead of WEXT when using wpa_supplicant-based SME.
This commit is contained in:
parent
ed384c2c67
commit
fd05d64ecf
1 changed files with 38 additions and 22 deletions
|
@ -86,6 +86,8 @@ struct wpa_driver_nl80211_data {
|
||||||
|
|
||||||
u8 bssid[ETH_ALEN];
|
u8 bssid[ETH_ALEN];
|
||||||
int associated;
|
int associated;
|
||||||
|
u8 ssid[32];
|
||||||
|
size_t ssid_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,31 +361,41 @@ static int wpa_driver_nl80211_set_bssid(void *priv, const u8 *bssid)
|
||||||
static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid)
|
static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid)
|
||||||
{
|
{
|
||||||
struct wpa_driver_nl80211_data *drv = priv;
|
struct wpa_driver_nl80211_data *drv = priv;
|
||||||
struct iwreq iwr;
|
#ifdef WEXT_COMPAT
|
||||||
int ret = 0;
|
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) {
|
||||||
|
struct iwreq iwr;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
os_memset(&iwr, 0, sizeof(iwr));
|
os_memset(&iwr, 0, sizeof(iwr));
|
||||||
os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
os_strlcpy(iwr.ifr_name, drv->ifname, IFNAMSIZ);
|
||||||
iwr.u.essid.pointer = (caddr_t) ssid;
|
iwr.u.essid.pointer = (caddr_t) ssid;
|
||||||
iwr.u.essid.length = 32;
|
iwr.u.essid.length = 32;
|
||||||
|
|
||||||
if (ioctl(drv->ioctl_sock, SIOCGIWESSID, &iwr) < 0) {
|
if (ioctl(drv->ioctl_sock, SIOCGIWESSID, &iwr) < 0) {
|
||||||
perror("ioctl[SIOCGIWESSID]");
|
perror("ioctl[SIOCGIWESSID]");
|
||||||
ret = -1;
|
ret = -1;
|
||||||
} else {
|
} else {
|
||||||
ret = iwr.u.essid.length;
|
ret = iwr.u.essid.length;
|
||||||
if (ret > 32)
|
if (ret > 32)
|
||||||
ret = 32;
|
ret = 32;
|
||||||
/* Some drivers include nul termination in the SSID, so let's
|
/*
|
||||||
* remove it here before further processing. WE-21 changes this
|
* Some drivers include nul termination in the SSID, so
|
||||||
* to explicitly require the length _not_ to include nul
|
* let's remove it here before further processing.
|
||||||
* termination. */
|
* WE-21 changes this to explicitly require the length
|
||||||
if (ret > 0 && ssid[ret - 1] == '\0' &&
|
* _not_ to include nul termination.
|
||||||
drv->we_version_compiled < 21)
|
*/
|
||||||
ret--;
|
if (ret > 0 && ssid[ret - 1] == '\0' &&
|
||||||
|
drv->we_version_compiled < 21)
|
||||||
|
ret--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* WEXT_COMPAT */
|
||||||
return ret;
|
if (!drv->associated)
|
||||||
|
return -1;
|
||||||
|
os_memcpy(ssid, drv->ssid, drv->ssid_len);
|
||||||
|
return drv->ssid_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2348,6 +2360,10 @@ static int wpa_driver_nl80211_associate(
|
||||||
params->ssid, params->ssid_len);
|
params->ssid, params->ssid_len);
|
||||||
NLA_PUT(msg, NL80211_ATTR_SSID, params->ssid_len,
|
NLA_PUT(msg, NL80211_ATTR_SSID, params->ssid_len,
|
||||||
params->ssid);
|
params->ssid);
|
||||||
|
if (params->ssid_len > sizeof(drv->ssid))
|
||||||
|
goto nla_put_failure;
|
||||||
|
os_memcpy(drv->ssid, params->ssid, params->ssid_len);
|
||||||
|
drv->ssid_len = params->ssid_len;
|
||||||
}
|
}
|
||||||
wpa_hexdump(MSG_DEBUG, " * IEs", params->wpa_ie, params->wpa_ie_len);
|
wpa_hexdump(MSG_DEBUG, " * IEs", params->wpa_ie, params->wpa_ie_len);
|
||||||
if (params->wpa_ie)
|
if (params->wpa_ie)
|
||||||
|
|
Loading…
Reference in a new issue