From ad4430971fb90cffe31c872e0e0e6cc8781048be Mon Sep 17 00:00:00 2001 From: Ilan Peer Date: Mon, 16 Mar 2015 01:20:48 -0400 Subject: [PATCH 1/1] Add Extended Capabilities element to all Probe Request frames 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 --- wpa_supplicant/scan.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 805891a..ae534ff 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -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) -- 2.1.4