Extend VENDOR_ELEM parameters to cover non-P2P Association Request
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 13 Jan 2015 22:50:58 +0000 (00:50 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 13 Jan 2015 23:12:56 +0000 (01:12 +0200)
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 <jouni@qca.qualcomm.com>
src/common/wpa_ctrl.h
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c

index 1f747eb..82fad4b 100644 (file)
@@ -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
 };
 
index 80c280a..d34668a 100644 (file)
@@ -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
index 9994a7a..cabecac 100644 (file)
@@ -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;