WNM: Add WNM-Sleep Mode into Extended Capabilities element

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-12-16 12:45:59 +02:00 committed by Jouni Malinen
parent bd896433af
commit e6955ba9f9
2 changed files with 22 additions and 12 deletions

View file

@ -94,6 +94,7 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
#endif /* CONFIG_IEEE80211R */ #endif /* CONFIG_IEEE80211R */
int i, bssid_changed; int i, bssid_changed;
struct wpabuf *resp = NULL; struct wpabuf *resp = NULL;
u32 ext_capab;
if (bss == NULL) { if (bss == NULL) {
wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for " wpa_msg(wpa_s, MSG_ERROR, "SME: No scan result available for "
@ -308,8 +309,16 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
} }
#endif /* CONFIG_HS20 */ #endif /* CONFIG_HS20 */
ext_capab = 0;
#ifdef CONFIG_INTERWORKING #ifdef CONFIG_INTERWORKING
if (wpa_s->conf->interworking) { if (wpa_s->conf->interworking)
ext_capab |= BIT(31); /* Interworking */
#endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_WNM
ext_capab |= BIT(17); /* WNM-Sleep Mode */
#endif /* CONFIG_WNM */
if (ext_capab) {
u8 *pos = wpa_s->sme.assoc_req_ie; u8 *pos = wpa_s->sme.assoc_req_ie;
if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN) if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN)
pos += 2 + pos[1]; pos += 2 + pos[1];
@ -319,12 +328,8 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
wpa_s->sme.assoc_req_ie_len += 6; wpa_s->sme.assoc_req_ie_len += 6;
*pos++ = WLAN_EID_EXT_CAPAB; *pos++ = WLAN_EID_EXT_CAPAB;
*pos++ = 4; *pos++ = 4;
*pos++ = 0x00; WPA_PUT_LE32(pos, ext_capab);
*pos++ = 0x00;
*pos++ = 0x00;
*pos++ = 0x80; /* Bit 31 - Interworking */
} }
#endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_SAE #ifdef CONFIG_SAE
if (params.auth_alg == WPA_AUTH_ALG_SAE) { if (params.auth_alg == WPA_AUTH_ALG_SAE) {

View file

@ -1251,6 +1251,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
struct wpa_driver_capa capa; struct wpa_driver_capa capa;
int assoc_failed = 0; int assoc_failed = 0;
struct wpa_ssid *old_ssid; struct wpa_ssid *old_ssid;
u32 ext_capab;
#ifdef CONFIG_HT_OVERRIDES #ifdef CONFIG_HT_OVERRIDES
struct ieee80211_ht_capabilities htcaps; struct ieee80211_ht_capabilities htcaps;
struct ieee80211_ht_capabilities htcaps_mask; struct ieee80211_ht_capabilities htcaps_mask;
@ -1461,8 +1462,16 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
} }
#endif /* CONFIG_HS20 */ #endif /* CONFIG_HS20 */
ext_capab = 0;
#ifdef CONFIG_INTERWORKING #ifdef CONFIG_INTERWORKING
if (wpa_s->conf->interworking) { if (wpa_s->conf->interworking)
ext_capab |= BIT(31); /* Interworking */
#endif /* CONFIG_INTERWORKING */
#ifdef CONFIG_WNM
ext_capab |= BIT(17); /* WNM-Sleep Mode */
#endif /* CONFIG_WNM */
if (ext_capab) {
u8 *pos = wpa_ie; u8 *pos = wpa_ie;
if (wpa_ie_len > 0 && pos[0] == WLAN_EID_RSN) if (wpa_ie_len > 0 && pos[0] == WLAN_EID_RSN)
pos += 2 + pos[1]; pos += 2 + pos[1];
@ -1470,12 +1479,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
wpa_ie_len += 6; wpa_ie_len += 6;
*pos++ = WLAN_EID_EXT_CAPAB; *pos++ = WLAN_EID_EXT_CAPAB;
*pos++ = 4; *pos++ = 4;
*pos++ = 0x00; WPA_PUT_LE32(pos, ext_capab);
*pos++ = 0x00;
*pos++ = 0x00;
*pos++ = 0x80; /* Bit 31 - Interworking */
} }
#endif /* CONFIG_INTERWORKING */
wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL); wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL);
use_crypt = 1; use_crypt = 1;