From cb99259775c14fab4efaf0f48ae14c5669a7a137 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 18 Oct 2019 15:49:32 +0300 Subject: [PATCH] Add RSNXE into (Re)Association Response frames Add the new RSNXE into (Re)Association Response frames if any of the capability bits is nonzero. Signed-off-by: Jouni Malinen --- src/ap/ap_drv_ops.c | 4 ++++ src/ap/ieee802_11.c | 2 ++ src/ap/ieee802_11.h | 1 + src/ap/ieee802_11_shared.c | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 45d46febd..de60c79fa 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -107,6 +107,10 @@ int hostapd_build_ap_extra_ies(struct hostapd_data *hapd, goto fail; #endif /* CONFIG_FILS */ + pos = hostapd_eid_rsnxe(hapd, buf, sizeof(buf)); + if (add_buf_data(&assocresp, buf, pos - buf) < 0) + goto fail; + if (add_buf(&beacon, hapd->wps_beacon_ie) < 0 || add_buf(&proberesp, hapd->wps_probe_resp_ie) < 0) goto fail; diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index c45009ced..306e98978 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -3717,6 +3717,8 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta, } #endif /* CONFIG_FST */ + p = hostapd_eid_rsnxe(hapd, p, buf + buflen - p); + #ifdef CONFIG_OWE if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && sta && sta->owe_ecdh && status_code == WLAN_STATUS_SUCCESS && diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index b8453c992..f592da54a 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -192,5 +192,6 @@ int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth, int ap_seg1_idx, int *bandwidth, int *seg1_idx); void auth_sae_process_commit(void *eloop_ctx, void *user_ctx); +u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len); #endif /* IEEE802_11_H */ diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 5007088b5..f24963e16 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -996,3 +996,22 @@ int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth, return 0; } #endif /* CONFIG_OCV */ + + +u8 * hostapd_eid_rsnxe(struct hostapd_data *hapd, u8 *eid, size_t len) +{ + u8 *pos = eid; + + if (!(hapd->conf->wpa & WPA_PROTO_RSN) || + (hapd->conf->sae_pwe != 1 && hapd->conf->sae_pwe != 2) || + len < 3) + return pos; + + *pos++ = WLAN_EID_RSNX; + *pos++ = 1; + /* bits 0-3 = 0 since only one octet of Extended RSN Capabilities is + * used for now */ + *pos++ = BIT(WLAN_RSNX_CAPAB_SAE_H2E); + + return pos; +}