[PATCH] supplicant: Use ap_vendor_elements in probe and assoc requests.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

This lets user specify additional IEs for probe requests and
association requests.  This patch re-uses much of the existing
ap_vendor_elements support in wpa_supplicant.

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---
 wpa_supplicant/scan.c           |  8 ++++++++
 wpa_supplicant/sme.c            | 14 ++++++++++++++
 wpa_supplicant/wpa_supplicant.c | 13 +++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 619654b..2f68a90 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -512,6 +512,14 @@ static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s)
 		wpas_mbo_scan_ie(wpa_s, extra_ie);
 #endif /* CONFIG_MBO */
 
+	/* Add user-specified IE */
+	if (wpa_s->conf->ap_vendor_elements) {
+		int ln = wpabuf_len(wpa_s->conf->ap_vendor_elements);
+		if (wpabuf_resize(&extra_ie, ln) == 0) {
+			wpabuf_put_buf(extra_ie, wpa_s->conf->ap_vendor_elements);
+		}
+	}
+
 	return extra_ie;
 }
 
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index a6ace1a..35cadcc 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -464,6 +464,20 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
 		os_memcpy(pos, ext_capab, ext_capab_len);
 	}
 
+	/* Add user-specified IE */
+	if (wpa_s->conf->ap_vendor_elements) {
+		int v_ies_len = wpabuf_len(wpa_s->conf->ap_vendor_elements);
+
+		if (wpa_s->sme.assoc_req_ie_len + v_ies_len <= sizeof(wpa_s->sme.assoc_req_ie)) {
+			os_memcpy(wpa_s->sme.assoc_req_ie + wpa_s->sme.assoc_req_ie_len,
+				  wpabuf_head(wpa_s->conf->ap_vendor_elements), v_ies_len);
+			wpa_s->sme.assoc_req_ie_len += v_ies_len;
+			wpa_msg(wpa_s, MSG_INFO, "SME: added user-specified vendor elements, len: %d",
+				v_ies_len);
+		}
+	}
+
+
 #ifdef CONFIG_HS20
 	if (is_hs20_network(wpa_s, ssid, bss)) {
 		struct wpabuf *hs20;
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 3df1b7d..d3644d4 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2434,6 +2434,19 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
 	}
 #endif /* CONFIG_MBO */
 
+	/* Add user-specified IE */
+	if (wpa_s->conf->ap_vendor_elements) {
+		int v_ies_len = wpabuf_len(wpa_s->conf->ap_vendor_elements);
+
+		if (wpa_ie_len + v_ies_len <= sizeof(wpa_ie)) {
+			os_memcpy(wpa_ie + wpa_ie_len,
+				  wpabuf_head(wpa_s->conf->ap_vendor_elements), v_ies_len);
+			wpa_ie_len += v_ies_len;
+			wpa_msg(wpa_s, MSG_INFO, "start-assoc-cb, added user-specified vendor elements, len: %d",
+				v_ies_len);
+		}
+	}
+
 	wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL);
 	use_crypt = 1;
 	cipher_pairwise = wpa_s->pairwise_cipher;
-- 
1.9.3


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux