]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WNM: Add WNM-Sleep Mode into Extended Capabilities element
authorJouni Malinen <jouni@qca.qualcomm.com>
Sun, 16 Dec 2012 10:45:59 +0000 (12:45 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 16 Dec 2012 10:45:59 +0000 (12:45 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c

index e273cb3fdf2c5c0c024c6a67ac8cc9a161e5917f..885219ffcd9e8a48959bff10ebe36fa5f0728b97 100644 (file)
@@ -94,6 +94,7 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_IEEE80211R */
        int i, bssid_changed;
        struct wpabuf *resp = NULL;
+       u32 ext_capab;
 
        if (bss == NULL) {
                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 */
 
+       ext_capab = 0;
 #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;
                if (wpa_s->sme.assoc_req_ie_len > 0 && pos[0] == WLAN_EID_RSN)
                        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;
                *pos++ = WLAN_EID_EXT_CAPAB;
                *pos++ = 4;
-               *pos++ = 0x00;
-               *pos++ = 0x00;
-               *pos++ = 0x00;
-               *pos++ = 0x80; /* Bit 31 - Interworking */
+               WPA_PUT_LE32(pos, ext_capab);
        }
-#endif /* CONFIG_INTERWORKING */
 
 #ifdef CONFIG_SAE
        if (params.auth_alg == WPA_AUTH_ALG_SAE) {
index 784a47142b85c708dd73c5c38a88215c51b61789..9d80555978a45bad96bc76112a8c5581f268e1b3 100644 (file)
@@ -1251,6 +1251,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
        struct wpa_driver_capa capa;
        int assoc_failed = 0;
        struct wpa_ssid *old_ssid;
+       u32 ext_capab;
 #ifdef CONFIG_HT_OVERRIDES
        struct ieee80211_ht_capabilities htcaps;
        struct ieee80211_ht_capabilities htcaps_mask;
@@ -1461,8 +1462,16 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
        }
 #endif /* CONFIG_HS20 */
 
+       ext_capab = 0;
 #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;
                if (wpa_ie_len > 0 && pos[0] == WLAN_EID_RSN)
                        pos += 2 + pos[1];
@@ -1470,12 +1479,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
                wpa_ie_len += 6;
                *pos++ = WLAN_EID_EXT_CAPAB;
                *pos++ = 4;
-               *pos++ = 0x00;
-               *pos++ = 0x00;
-               *pos++ = 0x00;
-               *pos++ = 0x80; /* Bit 31 - Interworking */
+               WPA_PUT_LE32(pos, ext_capab);
        }
-#endif /* CONFIG_INTERWORKING */
 
        wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL);
        use_crypt = 1;