wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/r00-001-hostapd-avoid-usage-of-mld_id-as-user-configuration.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

279 lines
8.9 KiB
Diff

From 376b1b8023409e14c365a5e0b79dddaff925d776 Mon Sep 17 00:00:00 2001
From: Sriram R <quic_srirrama@quicinc.com>
Date: Thu, 31 Aug 2023 22:07:16 +0530
Subject: [PATCH 2/3] hostapd: avoid usage of mld_id as user configuration
Currently mld_id is provided as a user configuration to
identify partner bss belonging to the same MLD. The same
id is used at protocol level also to indicate the MLD ID
of the MLD.
But, in general mld_id is a relative reference of the MLD
where 0 is used as the mld_id to represent the self MLD and
in case of MLO MBSSID mld_id of a non transmitted BSS affiliated
to a MLD is based on the relative bss index of the non transmitted
BSS from the transmitted BSS. Hence mld_id need not be fetched
from users, rather it can be identified wherever required.
To verify if the partners are belonging to the same MLD the
interface name can be checked, since all link BSS partners
of the same MLD belongs to the same interface.
Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
---
hostapd/config_file.c | 2 --
hostapd/hostapd.conf | 3 ---
hostapd/main.c | 10 ++++++++--
src/ap/ap_config.h | 3 ---
src/ap/beacon.c | 2 +-
src/ap/ctrl_iface_ap.c | 2 +-
src/ap/drv_callbacks.c | 2 +-
src/ap/hostapd.c | 23 ++++++++++++++++++++++-
src/ap/hostapd.h | 4 +++-
src/ap/ieee802_11.c | 15 ++++++---------
src/ap/ieee802_11_eht.c | 7 +++----
src/ap/ieee802_1x.c | 3 +--
src/ap/wpa_auth_glue.c | 6 ++----
13 files changed, 48 insertions(+), 34 deletions(-)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4802,8 +4802,6 @@ static int hostapd_config_fill(struct ho
conf->punct_acs_threshold = val;
} else if (os_strcmp(buf, "mld_ap") == 0) {
bss->mld_ap = !!atoi(pos);
- } else if (os_strcmp(buf, "mld_id") == 0) {
- bss->mld_id = atoi(pos);
} else if (os_strcmp(buf, "ru_punct_acs_threshold") == 0) {
conf->ru_punct_acs_threshold = atoi(pos);
if (conf->ru_punct_acs_threshold > 100) {
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1070,9 +1070,6 @@ wmm_ac_vo_acm=0
# 1 = yes (MLO)
#mld_ap=0
-# MLD ID - Affiliated MLD ID
-#mld_id=1
-
# Multiple BSSID element support in beacon and probe response frames.
# 0 = Disabled
# 1 = Enabled
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -185,9 +185,15 @@ static int hostapd_driver_init(struct ho
continue;
}
- if (!hconf->mld_ap || hconf->mld_id != conf->mld_id) {
+ if (!hconf->mld_ap) {
wpa_printf(MSG_DEBUG,
- "MLD: Skip non matching mld_id");
+ "MLD: Skip non MLD");
+ continue;
+ }
+
+ if (!hostapd_is_ml_partner(hapd, h_hapd)) {
+ wpa_printf(MSG_DEBUG,
+ "MLD: Skip non matching mld vif name");
continue;
}
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -2328,7 +2328,7 @@ int ieee802_11_set_beacon(struct hostapd
#ifdef CONFIG_IEEE80211BE
if (hapd->conf->mld_ap && other->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == other->bss[0]->conf->mld_id)
+ hostapd_is_ml_partner(hapd, other->bss[0]))
mld_ap = true;
#endif /* CONFIG_IEEE80211BE */
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -1255,7 +1255,7 @@ int hostapd_ctrl_iface_status(struct hos
"mld_id[%d]=%d\n"
"mld_link_id[%d]=%d\n",
(int) i, MAC2STR(bss->mld_addr),
- (int) i, bss->conf->mld_id,
+ (int) i, hostapd_get_mld_id(bss),
(int) i, bss->mld_link_id);
if (os_snprintf_error(buflen - len, ret))
return len;
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -1677,7 +1677,7 @@ static void hostapd_event_eapol_rx(struc
struct hostapd_bss_config *hconf = h_hapd->conf;
if (!hconf->mld_ap ||
- hconf->mld_id != hapd->conf->mld_id)
+ !hostapd_is_ml_partner(hapd, h_hapd))
continue;
h_hapd = hostapd_find_by_sta(h, src);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -4588,7 +4588,7 @@ struct hostapd_data * hostapd_mld_get_li
struct hostapd_data *h_hapd = h->bss[0];
struct hostapd_bss_config *hconf = h_hapd->conf;
- if (!hconf->mld_ap || hconf->mld_id != hapd->conf->mld_id)
+ if (!hconf->mld_ap || !hostapd_is_ml_partner(hapd, h_hapd))
continue;
if (h_hapd->mld_link_id == link_id)
@@ -4597,4 +4597,25 @@ struct hostapd_data * hostapd_mld_get_li
return NULL;
}
+
+bool hostapd_is_ml_partner(struct hostapd_data *hapd1, struct hostapd_data *hapd2)
+{
+
+ if (!hapd1->conf->mld_ap || !hapd2->conf->mld_ap)
+ return false;
+
+ return !(os_strcmp(hapd1->conf->iface, hapd2->conf->iface));
+}
+
+
+u8 hostapd_get_mld_id(struct hostapd_data *hapd)
+{
+ if (!hapd->conf->mld_ap)
+ return 255;
+
+ /* MLD ID 0 represents self */
+ return 0;
+
+ /* TODO MLD ID for MBSS cases */
+}
#endif /* CONFIG_IEEE80211BE */
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -808,5 +808,7 @@ struct hostapd_data * hostapd_mbssid_get
int hostapd_mbssid_get_bss_index(struct hostapd_data *hapd);
struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
u8 link_id);
-
+bool hostapd_is_ml_partner(struct hostapd_data *hapd1,
+ struct hostapd_data *hapd2);
+u8 hostapd_get_mld_id(struct hostapd_data *hapd);
#endif /* HOSTAPD_H */
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4543,7 +4543,7 @@ static void hostapd_process_assoc_ml_inf
continue;
if (iface->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == iface->bss[0]->conf->mld_id &&
+ hostapd_is_ml_partner(hapd, iface->bss[0]) &&
i == iface->bss[0]->mld_link_id)
break;
}
@@ -5741,7 +5741,7 @@ static bool hostapd_ml_handle_disconnect
assoc_hapd->iface->interfaces->iface[i]->bss[0];
if (!tmp_hapd->conf->mld_ap ||
- assoc_hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ hostapd_is_ml_partner(assoc_hapd, tmp_hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
@@ -6379,8 +6379,7 @@ static void hostapd_ml_handle_assoc_cb(s
struct hostapd_data *tmp_hapd =
hapd->iface->interfaces->iface[i]->bss[0];
- if (tmp_hapd->conf->mld_ap ||
- hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(tmp_hapd, hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
@@ -7447,8 +7446,7 @@ static size_t hostapd_eid_rnr_multi_ifac
bool ap_mld = false;
#ifdef CONFIG_IEEE80211BE
- if (hapd->conf->mld_ap && iface->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == iface->bss[0]->conf->mld_id)
+ if (hostapd_is_ml_partner(hapd, iface->bss[0]))
ap_mld = true;
#endif /* CONFIG_IEEE80211BE */
@@ -7659,7 +7657,7 @@ static u8 * hostapd_eid_rnr_iface(struct
len += RNR_TBTT_INFO_LEN;
} else {
#ifdef CONFIG_IEEE80211BE
- *eid++ = hapd->conf->mld_id;
+ *eid++ = hostapd_get_mld_id(hapd);
*eid++ = hapd->mld_link_id | (1 << 4);
*eid++ = 0;
len += RNR_TBTT_INFO_MLD_LEN;
@@ -7696,8 +7694,7 @@ static u8 * hostapd_eid_rnr_multi_iface(
bool ap_mld = false;
#ifdef CONFIG_IEEE80211BE
- if (hapd->conf->mld_ap && iface->bss[0]->conf->mld_ap &&
- hapd->conf->mld_id == iface->bss[0]->conf->mld_id)
+ if (hostapd_is_ml_partner(hapd, iface->bss[0]))
ap_mld = true;
#endif /* CONFIG_IEEE80211BE */
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -610,8 +610,8 @@ u8 * hostapd_eid_eht_basic_ml(struct hos
if (include_mld_id) {
wpa_printf(MSG_DEBUG, "MLD: AP MLD ID=0x%x",
- hapd->conf->mld_id);
- wpabuf_put_u8(buf, hapd->conf->mld_id);
+ hostapd_get_mld_id(hapd));
+ wpabuf_put_u8(buf, hostapd_get_mld_id(hapd));
}
if (!info)
@@ -986,8 +986,7 @@ static int hostapd_mld_validate_assoc_in
if (hapd == other_hapd)
continue;
- if (other_hapd->conf->mld_ap &&
- other_hapd->conf->mld_id == hapd->conf->mld_id &&
+ if (hostapd_is_ml_partner(hapd, other_hapd) &&
link_id == other_hapd->mld_link_id)
break;
}
--- a/src/ap/ieee802_1x.c
+++ b/src/ap/ieee802_1x.c
@@ -169,8 +169,7 @@ static void ieee802_1x_ml_set_sta_author
struct hostapd_data *tmp_hapd =
hapd->iface->interfaces->iface[i]->bss[0];
- if (tmp_hapd->conf->mld_ap ||
- hapd->conf->mld_id != tmp_hapd->conf->mld_id)
+ if (!hostapd_is_ml_partner(hapd, tmp_hapd))
continue;
for (tmp_sta = tmp_hapd->sta_list; tmp_sta;
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1520,8 +1520,7 @@ static int hostapd_wpa_auth_get_ml_rsn_i
struct hostapd_iface *iface =
hapd->iface->interfaces->iface[j];
- if (!iface->bss[0]->conf->mld_ap ||
- hapd->conf->mld_id != iface->bss[0]->conf->mld_id ||
+ if (!hostapd_is_ml_partner(hapd, iface->bss[0]) ||
link_id != iface->bss[0]->mld_link_id)
continue;
@@ -1562,8 +1561,7 @@ static int hostapd_wpa_auth_get_ml_key_i
struct hostapd_iface *iface =
hapd->iface->interfaces->iface[j];
- if (!iface->bss[0]->conf->mld_ap ||
- hapd->conf->mld_id != iface->bss[0]->conf->mld_id ||
+ if (!hostapd_is_ml_partner(hapd, iface->bss[0]) ||
link_id != iface->bss[0]->mld_link_id)
continue;