blob: 2759e8e881bf1d64dc2644df1b636808928ba208 [file] [log] [blame]
From 097f4b42d450ba1ae1f9acbb52cbae5f061d2ded Mon Sep 17 00:00:00 2001
From: Allen Ye <allen.ye@mediatek.com>
Date: Mon, 20 May 2024 17:29:36 +0800
Subject: [PATCH 101/126] mtk: hostapd: Temporary non-inheritance IE solution
Remove MBSSID IE and FILS indication IE in per-STA profile
The patch append non-inheritance IE in per-STA profile of a ML IE.
To add new IE in non-inheritance IE, just append the tag to IE list.
Fix the EHT-4.6.1_RUN1_ITER2 (2G+5G) BRCM assoc issue.
Without this patch, if the AP is an AP MLD 2G+5G (with 5G as the Setup link), the BRCM station will only connect to the AP using one link (i.e., the per-station profile count in the Association request is 0).
Note: Regardless of whether this patch is applied, EHT-4.6.1_RUN1_ITER1 (2G+5G, with 2G as the setup link) can pass.
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com>
---
src/ap/beacon.c | 28 +++++++++++------
src/ap/ieee802_11.c | 2 ++
src/ap/ieee802_11.h | 2 ++
src/ap/ieee802_11_eht.c | 68 ++++++++++++++++++++++++++++++++++++++++-
4 files changed, 90 insertions(+), 10 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 36f4feb3a..50d45d532 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -766,15 +766,20 @@ static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd,
buflen += hostapd_eid_eht_ml_beacon_len(
ml_elem_ap, params->mld_info, !!params->mld_ap);
}
+ /* non-inheritance element */
+ if (params->is_ml_sta_info)
+ buflen += hostapd_eid_non_inheritance_len(hapd);
}
#endif /* CONFIG_IEEE80211BE */
- buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL,
- params->known_bss,
- params->known_bss_len, NULL);
- if (!params->is_ml_sta_info)
+ if (!params->is_ml_sta_info) {
+ buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL,
+ params->known_bss,
+ params->known_bss_len, NULL);
buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP,
true);
+ }
+
buflen += hostapd_mbo_ie_len(hapd);
buflen += hostapd_eid_owe_trans_len(hapd);
buflen += hostapd_eid_dpp_cc_len(hapd);
@@ -835,9 +840,10 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd,
pos = hostapd_get_rsne(hapd, pos, epos - pos);
pos = hostapd_eid_bss_load(hapd, pos, epos - pos);
- pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0,
- NULL, params->known_bss, params->known_bss_len,
- NULL, NULL, NULL, 0);
+ if (!params->is_ml_sta_info)
+ pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0,
+ NULL, params->known_bss, params->known_bss_len,
+ NULL, NULL, NULL, 0);
pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos);
pos = hostapd_get_mde(hapd, pos, epos - pos);
@@ -897,10 +903,11 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd,
pos = hostapd_eid_wb_chsw_wrapper(hapd, pos);
pos = hostapd_eid_max_chsw_time(hapd, pos);
- if (!params->is_ml_sta_info)
+ if (!params->is_ml_sta_info) {
pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP,
true);
- pos = hostapd_eid_fils_indic(hapd, pos, 0);
+ pos = hostapd_eid_fils_indic(hapd, pos, 0);
+ }
pos = hostapd_get_rsnxe(hapd, pos, epos - pos);
#ifdef CONFIG_IEEE80211AX
@@ -999,6 +1006,9 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd,
}
#endif /* CONFIG_TESTING_OPTIONS */
+ if (params->is_ml_sta_info)
+ pos = hostapd_eid_non_inheritance(hapd, pos);
+
return pos;
}
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 7dac7a896..fd954b6f5 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4520,6 +4520,8 @@ static void ieee80211_ml_build_assoc_resp(struct hostapd_data *hapd,
p = hostapd_eid_mbo(hapd, p, buf + buflen - p);
p = hostapd_eid_wmm(hapd, p);
+ p = hostapd_eid_non_inheritance(hapd, p);
+
if (hapd->conf->assocresp_elements &&
(size_t) (buf + buflen - p) >=
wpabuf_len(hapd->conf->assocresp_elements)) {
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index 18f97890b..2d9adb910 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -239,6 +239,7 @@ size_t hostapd_eid_eht_capab_len(struct hostapd_data *hapd,
enum ieee80211_op_mode opmode);
u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid,
enum ieee80211_op_mode opmode);
+u8 * hostapd_eid_non_inheritance(struct hostapd_data *hapd, u8 *eid);
u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid);
u16 copy_sta_eht_capab(struct hostapd_data *hapd, struct sta_info *sta,
enum ieee80211_op_mode opmode,
@@ -252,6 +253,7 @@ u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end,
u8 **elem_offset,
const u8 *known_bss, size_t known_bss_len, u8 *rnr_eid,
u8 *rnr_count, u8 **rnr_offset, size_t rnr_len);
+size_t hostapd_eid_non_inheritance_len(struct hostapd_data *hapd);
bool hostapd_is_mld_ap(struct hostapd_data *hapd);
const char * sae_get_password(struct hostapd_data *hapd,
struct sta_info *sta, const char *rx_id,
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
index 8fc239f36..63713bc39 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -131,7 +131,6 @@ size_t hostapd_eid_eht_capab_len(struct hostapd_data *hapd,
return len;
}
-
u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid,
enum ieee80211_op_mode opmode)
{
@@ -284,7 +283,74 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
return pos + elen;
}
+u8 mlo_non_inherit_list_6ghz[] = {
+ WLAN_EID_AP_CHANNEL_REPORT,
+ WLAN_EID_HT_CAP,
+ WLAN_EID_HT_OPERATION,
+ WLAN_EID_VHT_CAP,
+ WLAN_EID_VHT_OPERATION,
+};
+
+u8 mlo_non_inherit_list_6ghz_ext[] = {
+};
+
+u8 mlo_non_inherit_list_2_5ghz[] = {
+ WLAN_EID_VHT_CAP,
+ WLAN_EID_VHT_OPERATION,
+ WLAN_EID_TRANSMIT_POWER_ENVELOPE,
+};
+
+u8 mlo_non_inherit_list_2_5ghz_ext[] = {
+ WLAN_EID_EXT_HE_6GHZ_BAND_CAP,
+};
+
+size_t hostapd_eid_non_inheritance_len(struct hostapd_data *hapd)
+{
+ size_t len = 4;
+ if (is_6ghz_op_class(hapd->iconf->op_class)) {
+ len += sizeof(mlo_non_inherit_list_6ghz);
+ len += sizeof(mlo_non_inherit_list_6ghz_ext);
+ } else {
+ len += sizeof(mlo_non_inherit_list_2_5ghz);
+ len += sizeof(mlo_non_inherit_list_2_5ghz_ext);
+ }
+
+ return len;
+}
+
+u8 * hostapd_eid_non_inheritance(struct hostapd_data *hapd, u8 *eid)
+{
+ u8 *pos = eid, *len_pos;
+ int i;
+
+ *pos++ = WLAN_EID_EXTENSION;
+ len_pos = pos++;
+ *pos++ = WLAN_EID_EXT_NON_INHERITANCE;
+ if (is_6ghz_op_class(hapd->iconf->op_class)) {
+ /* Element ID list */
+ *pos++ = sizeof(mlo_non_inherit_list_6ghz);
+ for (i = 0; i < sizeof(mlo_non_inherit_list_6ghz); i++)
+ *pos++ = mlo_non_inherit_list_6ghz[i];
+
+ /* Element ID Extension list */
+ *pos++ = sizeof(mlo_non_inherit_list_6ghz_ext);
+ for (i = 0; i < sizeof(mlo_non_inherit_list_6ghz_ext); i++)
+ *pos++ = mlo_non_inherit_list_6ghz_ext[i];
+ } else {
+ /* Element ID list */
+ *pos++ = sizeof(mlo_non_inherit_list_2_5ghz);
+ for (i = 0; i < sizeof(mlo_non_inherit_list_2_5ghz); i++)
+ *pos++ = mlo_non_inherit_list_2_5ghz[i];
+
+ /* Element ID Extension list */
+ *pos++ = sizeof(mlo_non_inherit_list_2_5ghz_ext);
+ for (i = 0; i < sizeof(mlo_non_inherit_list_2_5ghz_ext); i++)
+ *pos++ = mlo_non_inherit_list_2_5ghz_ext[i];
+ }
+ *len_pos = pos - (eid + 2);
+ return pos;
+}
static bool check_valid_eht_mcs_nss(struct hostapd_data *hapd, const u8 *ap_mcs,
const u8 *sta_mcs, u8 mcs_count, u8 map_len)
{
--
2.18.0