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,6 +361,8 @@ 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;
|
||||||
|
#ifdef WEXT_COMPAT
|
||||||
|
if (!(drv->capa.flags & WPA_DRIVER_FLAGS_SME)) {
|
||||||
struct iwreq iwr;
|
struct iwreq iwr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -374,10 +378,12 @@ static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid)
|
||||||
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
|
||||||
|
* _not_ to include nul termination.
|
||||||
|
*/
|
||||||
if (ret > 0 && ssid[ret - 1] == '\0' &&
|
if (ret > 0 && ssid[ret - 1] == '\0' &&
|
||||||
drv->we_version_compiled < 21)
|
drv->we_version_compiled < 21)
|
||||||
ret--;
|
ret--;
|
||||||
|
@ -385,6 +391,12 @@ static int wpa_driver_nl80211_get_ssid(void *priv, u8 *ssid)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* WEXT_COMPAT */
|
||||||
|
if (!drv->associated)
|
||||||
|
return -1;
|
||||||
|
os_memcpy(ssid, drv->ssid, drv->ssid_len);
|
||||||
|
return drv->ssid_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef WEXT_COMPAT
|
#ifdef WEXT_COMPAT
|
||||||
|
@ -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