]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add user configured vendor IEs to default scan IEs
authorVinita S. Maloo <vmaloo@codeaurora.org>
Thu, 3 Dec 2020 14:34:20 +0000 (20:04 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 15 Jan 2021 09:45:13 +0000 (11:45 +0200)
Add user configured vendor IEs for Probe Request frames to default scan
IEs so that these IEs will be included in the Probe Request frames for
the scans issued also by components other than wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/scan.c

index 7ce2a90e8a96bc64f544d4edf97cf971513cfbaf..e63c3f7df8ccf9bcc18b2dd84b6e16e8ce646478 100644 (file)
@@ -9784,8 +9784,7 @@ static int wpas_ctrl_vendor_elem_add(struct wpa_supplicant *wpa_s, char *cmd)
 
        if (wpa_s->vendor_elem[frame] == NULL) {
                wpa_s->vendor_elem[frame] = buf;
-               wpas_vendor_elem_update(wpa_s);
-               return 0;
+               goto update_ies;
        }
 
        if (wpabuf_resize(&wpa_s->vendor_elem[frame], len) < 0) {
@@ -9795,8 +9794,14 @@ static int wpas_ctrl_vendor_elem_add(struct wpa_supplicant *wpa_s, char *cmd)
 
        wpabuf_put_buf(wpa_s->vendor_elem[frame], buf);
        wpabuf_free(buf);
+
+update_ies:
        wpas_vendor_elem_update(wpa_s);
 
+       if (frame == VENDOR_ELEM_PROBE_REQ ||
+           frame == VENDOR_ELEM_PROBE_REQ_P2P)
+               wpa_supplicant_set_default_scan_ies(wpa_s);
+
        return 0;
 }
 
index 5d301630506beea5f7f8faaac0b1c20186740e71..c53474dae26b9c1588ec33c4e43fb46215288f1c 100644 (file)
@@ -521,7 +521,7 @@ void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s)
 {
        struct wpabuf *default_ies = NULL;
        u8 ext_capab[18];
-       int ext_capab_len;
+       int ext_capab_len, frame_id;
        enum wpa_driver_if_type type = WPA_IF_STATION;
 
 #ifdef CONFIG_P2P
@@ -545,6 +545,20 @@ void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s)
                wpas_mbo_scan_ie(wpa_s, default_ies);
 #endif /* CONFIG_MBO */
 
+       if (type == WPA_IF_P2P_CLIENT)
+               frame_id = VENDOR_ELEM_PROBE_REQ_P2P;
+       else
+               frame_id = VENDOR_ELEM_PROBE_REQ;
+
+       if (wpa_s->vendor_elem[frame_id]) {
+               size_t len;
+
+               len = wpabuf_len(wpa_s->vendor_elem[frame_id]);
+               if (len > 0 && wpabuf_resize(&default_ies, len) == 0)
+                       wpabuf_put_buf(default_ies,
+                                      wpa_s->vendor_elem[frame_id]);
+       }
+
        if (default_ies)
                wpa_drv_set_default_scan_ies(wpa_s, wpabuf_head(default_ies),
                                             wpabuf_len(default_ies));