Add Extended Capabilities element to all Probe Request frames
authorIlan Peer <ilan.peer@intel.com>
Mon, 16 Mar 2015 05:20:48 +0000 (01:20 -0400)
committerJouni Malinen <j@w1.fi>
Sun, 22 Mar 2015 19:48:38 +0000 (21:48 +0200)
Always add the Extended Capabilities element to Probe Request frames (in
case it is not all zeros) to publish support for driver advertised
capabilities and wpa_supplicant specific capabilities.

This also fixes the case where Extended Capabilities element was added
for Interworking cases, but did not use the driver advertised ones and
did not handle other capabilities supported by wpa_supplicant.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
wpa_supplicant/scan.c

index 805891a..ae534ff 100644 (file)
@@ -421,19 +421,6 @@ static void wpas_add_interworking_elements(struct wpa_supplicant *wpa_s,
        if (wpa_s->conf->interworking == 0)
                return;
 
-       wpabuf_put_u8(buf, WLAN_EID_EXT_CAPAB);
-       wpabuf_put_u8(buf, 6);
-       wpabuf_put_u8(buf, 0x00);
-       wpabuf_put_u8(buf, 0x00);
-       wpabuf_put_u8(buf, 0x00);
-       wpabuf_put_u8(buf, 0x80); /* Bit 31 - Interworking */
-       wpabuf_put_u8(buf, 0x00);
-#ifdef CONFIG_HS20
-       wpabuf_put_u8(buf, 0x40); /* Bit 46 - WNM-Notification */
-#else /* CONFIG_HS20 */
-       wpabuf_put_u8(buf, 0x00);
-#endif /* CONFIG_HS20 */
-
        wpabuf_put_u8(buf, WLAN_EID_INTERWORKING);
        wpabuf_put_u8(buf, is_zero_ether_addr(wpa_s->conf->hessid) ? 1 :
                      1 + ETH_ALEN);
@@ -448,11 +435,19 @@ static void wpas_add_interworking_elements(struct wpa_supplicant *wpa_s,
 static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s)
 {
        struct wpabuf *extra_ie = NULL;
+       u8 ext_capab[18];
+       int ext_capab_len;
 #ifdef CONFIG_WPS
        int wps = 0;
        enum wps_request_type req_type = WPS_REQ_ENROLLEE_INFO;
 #endif /* CONFIG_WPS */
 
+       ext_capab_len = wpas_build_ext_capab(wpa_s, ext_capab,
+                                            sizeof(ext_capab));
+       if (ext_capab_len > 0 &&
+           wpabuf_resize(&extra_ie, ext_capab_len) == 0)
+               wpabuf_put_data(extra_ie, ext_capab, ext_capab_len);
+
 #ifdef CONFIG_INTERWORKING
        if (wpa_s->conf->interworking &&
            wpabuf_resize(&extra_ie, 100) == 0)