developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame^] | 1 | From 097f4b42d450ba1ae1f9acbb52cbae5f061d2ded Mon Sep 17 00:00:00 2001 |
| 2 | From: Allen Ye <allen.ye@mediatek.com> |
| 3 | Date: Mon, 20 May 2024 17:29:36 +0800 |
| 4 | Subject: [PATCH 101/126] mtk: hostapd: Temporary non-inheritance IE solution |
| 5 | |
| 6 | Remove MBSSID IE and FILS indication IE in per-STA profile |
| 7 | The patch append non-inheritance IE in per-STA profile of a ML IE. |
| 8 | To add new IE in non-inheritance IE, just append the tag to IE list. |
| 9 | |
| 10 | Fix the EHT-4.6.1_RUN1_ITER2 (2G+5G) BRCM assoc issue. |
| 11 | 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). |
| 12 | |
| 13 | Note: Regardless of whether this patch is applied, EHT-4.6.1_RUN1_ITER1 (2G+5G, with 2G as the setup link) can pass. |
| 14 | |
| 15 | Signed-off-by: Allen Ye <allen.ye@mediatek.com> |
| 16 | Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com> |
| 17 | --- |
| 18 | src/ap/beacon.c | 28 +++++++++++------ |
| 19 | src/ap/ieee802_11.c | 2 ++ |
| 20 | src/ap/ieee802_11.h | 2 ++ |
| 21 | src/ap/ieee802_11_eht.c | 68 ++++++++++++++++++++++++++++++++++++++++- |
| 22 | 4 files changed, 90 insertions(+), 10 deletions(-) |
| 23 | |
| 24 | diff --git a/src/ap/beacon.c b/src/ap/beacon.c |
| 25 | index 36f4feb3a..50d45d532 100644 |
| 26 | --- a/src/ap/beacon.c |
| 27 | +++ b/src/ap/beacon.c |
| 28 | @@ -766,15 +766,20 @@ static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, |
| 29 | buflen += hostapd_eid_eht_ml_beacon_len( |
| 30 | ml_elem_ap, params->mld_info, !!params->mld_ap); |
| 31 | } |
| 32 | + /* non-inheritance element */ |
| 33 | + if (params->is_ml_sta_info) |
| 34 | + buflen += hostapd_eid_non_inheritance_len(hapd); |
| 35 | } |
| 36 | #endif /* CONFIG_IEEE80211BE */ |
| 37 | |
| 38 | - buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL, |
| 39 | - params->known_bss, |
| 40 | - params->known_bss_len, NULL); |
| 41 | - if (!params->is_ml_sta_info) |
| 42 | + if (!params->is_ml_sta_info) { |
| 43 | + buflen += hostapd_eid_mbssid_len(hapd, WLAN_FC_STYPE_PROBE_RESP, NULL, |
| 44 | + params->known_bss, |
| 45 | + params->known_bss_len, NULL); |
| 46 | buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP, |
| 47 | true); |
| 48 | + } |
| 49 | + |
| 50 | buflen += hostapd_mbo_ie_len(hapd); |
| 51 | buflen += hostapd_eid_owe_trans_len(hapd); |
| 52 | buflen += hostapd_eid_dpp_cc_len(hapd); |
| 53 | @@ -835,9 +840,10 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, |
| 54 | |
| 55 | pos = hostapd_get_rsne(hapd, pos, epos - pos); |
| 56 | pos = hostapd_eid_bss_load(hapd, pos, epos - pos); |
| 57 | - pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0, |
| 58 | - NULL, params->known_bss, params->known_bss_len, |
| 59 | - NULL, NULL, NULL, 0); |
| 60 | + if (!params->is_ml_sta_info) |
| 61 | + pos = hostapd_eid_mbssid(hapd, pos, epos, WLAN_FC_STYPE_PROBE_RESP, 0, |
| 62 | + NULL, params->known_bss, params->known_bss_len, |
| 63 | + NULL, NULL, NULL, 0); |
| 64 | pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); |
| 65 | pos = hostapd_get_mde(hapd, pos, epos - pos); |
| 66 | |
| 67 | @@ -897,10 +903,11 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, |
| 68 | pos = hostapd_eid_wb_chsw_wrapper(hapd, pos); |
| 69 | pos = hostapd_eid_max_chsw_time(hapd, pos); |
| 70 | |
| 71 | - if (!params->is_ml_sta_info) |
| 72 | + if (!params->is_ml_sta_info) { |
| 73 | pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP, |
| 74 | true); |
| 75 | - pos = hostapd_eid_fils_indic(hapd, pos, 0); |
| 76 | + pos = hostapd_eid_fils_indic(hapd, pos, 0); |
| 77 | + } |
| 78 | pos = hostapd_get_rsnxe(hapd, pos, epos - pos); |
| 79 | |
| 80 | #ifdef CONFIG_IEEE80211AX |
| 81 | @@ -999,6 +1006,9 @@ static u8 * hostapd_probe_resp_fill_elems(struct hostapd_data *hapd, |
| 82 | } |
| 83 | #endif /* CONFIG_TESTING_OPTIONS */ |
| 84 | |
| 85 | + if (params->is_ml_sta_info) |
| 86 | + pos = hostapd_eid_non_inheritance(hapd, pos); |
| 87 | + |
| 88 | return pos; |
| 89 | } |
| 90 | |
| 91 | diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c |
| 92 | index 7dac7a896..fd954b6f5 100644 |
| 93 | --- a/src/ap/ieee802_11.c |
| 94 | +++ b/src/ap/ieee802_11.c |
| 95 | @@ -4520,6 +4520,8 @@ static void ieee80211_ml_build_assoc_resp(struct hostapd_data *hapd, |
| 96 | p = hostapd_eid_mbo(hapd, p, buf + buflen - p); |
| 97 | p = hostapd_eid_wmm(hapd, p); |
| 98 | |
| 99 | + p = hostapd_eid_non_inheritance(hapd, p); |
| 100 | + |
| 101 | if (hapd->conf->assocresp_elements && |
| 102 | (size_t) (buf + buflen - p) >= |
| 103 | wpabuf_len(hapd->conf->assocresp_elements)) { |
| 104 | diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h |
| 105 | index 18f97890b..2d9adb910 100644 |
| 106 | --- a/src/ap/ieee802_11.h |
| 107 | +++ b/src/ap/ieee802_11.h |
| 108 | @@ -239,6 +239,7 @@ size_t hostapd_eid_eht_capab_len(struct hostapd_data *hapd, |
| 109 | enum ieee80211_op_mode opmode); |
| 110 | u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid, |
| 111 | enum ieee80211_op_mode opmode); |
| 112 | +u8 * hostapd_eid_non_inheritance(struct hostapd_data *hapd, u8 *eid); |
| 113 | u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid); |
| 114 | u16 copy_sta_eht_capab(struct hostapd_data *hapd, struct sta_info *sta, |
| 115 | enum ieee80211_op_mode opmode, |
| 116 | @@ -252,6 +253,7 @@ u8 * hostapd_eid_mbssid(struct hostapd_data *hapd, u8 *eid, u8 *end, |
| 117 | u8 **elem_offset, |
| 118 | const u8 *known_bss, size_t known_bss_len, u8 *rnr_eid, |
| 119 | u8 *rnr_count, u8 **rnr_offset, size_t rnr_len); |
| 120 | +size_t hostapd_eid_non_inheritance_len(struct hostapd_data *hapd); |
| 121 | bool hostapd_is_mld_ap(struct hostapd_data *hapd); |
| 122 | const char * sae_get_password(struct hostapd_data *hapd, |
| 123 | struct sta_info *sta, const char *rx_id, |
| 124 | diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c |
| 125 | index 8fc239f36..63713bc39 100644 |
| 126 | --- a/src/ap/ieee802_11_eht.c |
| 127 | +++ b/src/ap/ieee802_11_eht.c |
| 128 | @@ -131,7 +131,6 @@ size_t hostapd_eid_eht_capab_len(struct hostapd_data *hapd, |
| 129 | return len; |
| 130 | } |
| 131 | |
| 132 | - |
| 133 | u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid, |
| 134 | enum ieee80211_op_mode opmode) |
| 135 | { |
| 136 | @@ -284,7 +283,74 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid) |
| 137 | return pos + elen; |
| 138 | } |
| 139 | |
| 140 | +u8 mlo_non_inherit_list_6ghz[] = { |
| 141 | + WLAN_EID_AP_CHANNEL_REPORT, |
| 142 | + WLAN_EID_HT_CAP, |
| 143 | + WLAN_EID_HT_OPERATION, |
| 144 | + WLAN_EID_VHT_CAP, |
| 145 | + WLAN_EID_VHT_OPERATION, |
| 146 | +}; |
| 147 | + |
| 148 | +u8 mlo_non_inherit_list_6ghz_ext[] = { |
| 149 | +}; |
| 150 | + |
| 151 | +u8 mlo_non_inherit_list_2_5ghz[] = { |
| 152 | + WLAN_EID_VHT_CAP, |
| 153 | + WLAN_EID_VHT_OPERATION, |
| 154 | + WLAN_EID_TRANSMIT_POWER_ENVELOPE, |
| 155 | +}; |
| 156 | + |
| 157 | +u8 mlo_non_inherit_list_2_5ghz_ext[] = { |
| 158 | + WLAN_EID_EXT_HE_6GHZ_BAND_CAP, |
| 159 | +}; |
| 160 | + |
| 161 | +size_t hostapd_eid_non_inheritance_len(struct hostapd_data *hapd) |
| 162 | +{ |
| 163 | + size_t len = 4; |
| 164 | |
| 165 | + if (is_6ghz_op_class(hapd->iconf->op_class)) { |
| 166 | + len += sizeof(mlo_non_inherit_list_6ghz); |
| 167 | + len += sizeof(mlo_non_inherit_list_6ghz_ext); |
| 168 | + } else { |
| 169 | + len += sizeof(mlo_non_inherit_list_2_5ghz); |
| 170 | + len += sizeof(mlo_non_inherit_list_2_5ghz_ext); |
| 171 | + } |
| 172 | + |
| 173 | + return len; |
| 174 | +} |
| 175 | + |
| 176 | +u8 * hostapd_eid_non_inheritance(struct hostapd_data *hapd, u8 *eid) |
| 177 | +{ |
| 178 | + u8 *pos = eid, *len_pos; |
| 179 | + int i; |
| 180 | + |
| 181 | + *pos++ = WLAN_EID_EXTENSION; |
| 182 | + len_pos = pos++; |
| 183 | + *pos++ = WLAN_EID_EXT_NON_INHERITANCE; |
| 184 | + if (is_6ghz_op_class(hapd->iconf->op_class)) { |
| 185 | + /* Element ID list */ |
| 186 | + *pos++ = sizeof(mlo_non_inherit_list_6ghz); |
| 187 | + for (i = 0; i < sizeof(mlo_non_inherit_list_6ghz); i++) |
| 188 | + *pos++ = mlo_non_inherit_list_6ghz[i]; |
| 189 | + |
| 190 | + /* Element ID Extension list */ |
| 191 | + *pos++ = sizeof(mlo_non_inherit_list_6ghz_ext); |
| 192 | + for (i = 0; i < sizeof(mlo_non_inherit_list_6ghz_ext); i++) |
| 193 | + *pos++ = mlo_non_inherit_list_6ghz_ext[i]; |
| 194 | + } else { |
| 195 | + /* Element ID list */ |
| 196 | + *pos++ = sizeof(mlo_non_inherit_list_2_5ghz); |
| 197 | + for (i = 0; i < sizeof(mlo_non_inherit_list_2_5ghz); i++) |
| 198 | + *pos++ = mlo_non_inherit_list_2_5ghz[i]; |
| 199 | + |
| 200 | + /* Element ID Extension list */ |
| 201 | + *pos++ = sizeof(mlo_non_inherit_list_2_5ghz_ext); |
| 202 | + for (i = 0; i < sizeof(mlo_non_inherit_list_2_5ghz_ext); i++) |
| 203 | + *pos++ = mlo_non_inherit_list_2_5ghz_ext[i]; |
| 204 | + } |
| 205 | + *len_pos = pos - (eid + 2); |
| 206 | + return pos; |
| 207 | +} |
| 208 | static bool check_valid_eht_mcs_nss(struct hostapd_data *hapd, const u8 *ap_mcs, |
| 209 | const u8 *sta_mcs, u8 mcs_count, u8 map_len) |
| 210 | { |
| 211 | -- |
| 212 | 2.18.0 |
| 213 | |