aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hostapd/config_file.c30
-rw-r--r--hostapd/hostapd.conf7
-rw-r--r--src/ap/ap_config.c1
-rw-r--r--src/ap/ap_config.h1
-rw-r--r--src/ap/ap_drv_ops.c5
-rw-r--r--src/ap/ieee802_11.c8
6 files changed, 52 insertions, 0 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 5540059d..14ddad7f 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3295,6 +3295,36 @@ static int hostapd_config_fill(struct hostapd_config *conf,
wpabuf_free(bss->vendor_elements);
bss->vendor_elements = elems;
+ } else if (os_strcmp(buf, "assocresp_elements") == 0) {
+ struct wpabuf *elems;
+ size_t len = os_strlen(pos);
+ if (len & 0x01) {
+ wpa_printf(MSG_ERROR,
+ "Line %d: Invalid assocresp_elements '%s'",
+ line, pos);
+ return 1;
+ }
+ len /= 2;
+ if (len == 0) {
+ wpabuf_free(bss->assocresp_elements);
+ bss->assocresp_elements = NULL;
+ return 0;
+ }
+
+ elems = wpabuf_alloc(len);
+ if (elems == NULL)
+ return 1;
+
+ if (hexstr2bin(pos, wpabuf_put(elems, len), len)) {
+ wpabuf_free(elems);
+ wpa_printf(MSG_ERROR,
+ "Line %d: Invalid assocresp_elements '%s'",
+ line, pos);
+ return 1;
+ }
+
+ wpabuf_free(bss->assocresp_elements);
+ bss->assocresp_elements = elems;
} else if (os_strcmp(buf, "sae_anti_clogging_threshold") == 0) {
bss->sae_anti_clogging_threshold = atoi(pos);
} else if (os_strcmp(buf, "sae_groups") == 0) {
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index c9c4d7e3..9aa49f55 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -274,6 +274,13 @@ ignore_broadcast_ssid=0
# one or more elements)
#vendor_elements=dd0411223301
+# Additional vendor specific elements for (Re)Association Response frames
+# This parameter can be used to add additional vendor specific element(s) into
+# the end of the (Re)Association Response frames. The format for these
+# element(s) is a hexdump of the raw information elements (id+len+payload for
+# one or more elements)
+#assocresp_elements=dd0411223301
+
# TX queue parameters (EDCF / bursting)
# tx_queue_<queue name>_<param>
# queues: data0, data1, data2, data3, after_beacon, beacon
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 455013aa..3e396945 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -554,6 +554,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)
#endif /* CONFIG_HS20 */
wpabuf_free(conf->vendor_elements);
+ wpabuf_free(conf->assocresp_elements);
os_free(conf->sae_groups);
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 71fc06e4..254f4bca 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -535,6 +535,7 @@ struct hostapd_bss_config {
#endif /* CONFIG_RADIUS_TEST */
struct wpabuf *vendor_elements;
+ struct wpabuf *assocresp_elements;
unsigned int sae_anti_clogging_threshold;
int *sae_groups;
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 6cafcb74..b9029bb7 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -207,6 +207,11 @@ int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
if (wpabuf_resize(&proberesp, add) == 0)
wpabuf_put_buf(proberesp, hapd->conf->vendor_elements);
}
+ if (hapd->conf->assocresp_elements) {
+ size_t add = wpabuf_len(hapd->conf->assocresp_elements);
+ if (wpabuf_resize(&assocresp, add) == 0)
+ wpabuf_put_buf(assocresp, hapd->conf->assocresp_elements);
+ }
*beacon_ret = beacon;
*proberesp_ret = proberesp;
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 288852db..0176c442 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -1690,6 +1690,14 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
p = hostapd_eid_p2p_manage(hapd, p);
#endif /* CONFIG_P2P_MANAGER */
+ if (hapd->conf->assocresp_elements &&
+ (size_t) (buf + sizeof(buf) - p) >=
+ wpabuf_len(hapd->conf->assocresp_elements)) {
+ os_memcpy(p, wpabuf_head(hapd->conf->assocresp_elements),
+ wpabuf_len(hapd->conf->assocresp_elements));
+ p += wpabuf_len(hapd->conf->assocresp_elements);
+ }
+
send_len += p - reply->u.assoc_resp.variable;
if (hostapd_drv_send_mlme(hapd, reply, send_len, 0) < 0)