From d29fa3a767f1d612a25b44bb2891e038e0fd3f9c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 14 Jan 2015 00:50:58 +0200 Subject: [PATCH] Extend VENDOR_ELEM parameters to cover non-P2P Association Request The new VENDOR_ELEM value 13 can now be used to add a vendor element into all (Re)Association Request frames, not just for P2P use cases like the previous item was for. Signed-off-by: Jouni Malinen --- src/common/wpa_ctrl.h | 1 + wpa_supplicant/sme.c | 14 ++++++++++++++ wpa_supplicant/wpa_supplicant.c | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 1f747eb1f..82fad4b44 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -277,6 +277,7 @@ enum wpa_vendor_elem_frame { VENDOR_ELEM_P2P_INV_RESP = 10, VENDOR_ELEM_P2P_ASSOC_REQ = 11, VENDOR_ELEM_P2P_ASSOC_RESP = 12, + VENDOR_ELEM_ASSOC_REQ = 13, NUM_VENDOR_ELEM_FRAMES }; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 80c280a1e..d34668a5a 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -449,6 +449,20 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s, os_memcpy(pos, ext_capab, ext_capab_len); } + if (wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]) { + struct wpabuf *buf = wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]; + size_t len; + + len = sizeof(wpa_s->sme.assoc_req_ie) - + wpa_s->sme.assoc_req_ie_len; + if (wpabuf_len(buf) <= len) { + os_memcpy(wpa_s->sme.assoc_req_ie + + wpa_s->sme.assoc_req_ie_len, + wpabuf_head(buf), wpabuf_len(buf)); + wpa_s->sme.assoc_req_ie_len += wpabuf_len(buf); + } + } + sme_auth_handle_rrm(wpa_s, bss); #ifdef CONFIG_SAE diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 9994a7a95..cabecac17 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2029,6 +2029,18 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit) } } + if (wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]) { + struct wpabuf *buf = wpa_s->vendor_elem[VENDOR_ELEM_ASSOC_REQ]; + size_t len; + + len = sizeof(wpa_ie) - wpa_ie_len; + if (wpabuf_len(buf) <= len) { + os_memcpy(wpa_ie + wpa_ie_len, + wpabuf_head(buf), wpabuf_len(buf)); + wpa_ie_len += wpabuf_len(buf); + } + } + wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL); use_crypt = 1; cipher_pairwise = wpa_s->pairwise_cipher;