diff mbox

wpa_supplicant: Add extended capabilities IE to probe requests

Message ID 1426483249-7436-1-git-send-email-ilan.peer@intel.com
State Accepted
Headers show

Commit Message

Peer, Ilan March 16, 2015, 5:20 a.m. UTC
Always add the extended capabilities IE to probe requests
(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 IE was added for
interworking cases, but did not use the driver advertised ones and
did not handle other capabilities supported by the wpa_supplicant.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 wpa_supplicant/scan.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

Comments

Jouni Malinen March 22, 2015, 8:16 p.m. UTC | #1
On Mon, Mar 16, 2015 at 01:20:48AM -0400, Ilan Peer wrote:
> Always add the extended capabilities IE to probe requests
> (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 IE was added for
> interworking cases, but did not use the driver advertised ones and
> did not handle other capabilities supported by the wpa_supplicant.

Thanks, applied with the resize operation fixed to verify return value
to avoid crashing the process if running out of memory.
diff mbox

Patch

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 805891a..1da8ec4 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,20 @@  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);
+		wpabuf_put_data(extra_ie, ext_capab, ext_capab_len);
+	}
+
 #ifdef CONFIG_INTERWORKING
 	if (wpa_s->conf->interworking &&
 	    wpabuf_resize(&extra_ie, 100) == 0)