wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/r07-hostapd-handle-ML-Secured-associations-properly.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

539 lines
19 KiB
Diff

From 9230b55f07de6916b84cad4ad4eae555b013f72f Mon Sep 17 00:00:00 2001
From: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Date: Mon, 15 Jan 2024 14:29:57 +0530
Subject: [PATCH] hostapd: handle ML Secured associations properly
When association request is recieved for a STA which AP MLD has
entry, it can be only accepted after SA procedure, while
accepting such associations, handle following cases,
- New association may request different set of links than the one
already exists, hence clean up all stale link STA entries.
in partner links and process and add requested link STA entries
- Overwrite Existing ML information only after SA procedure is
done and new association is accepted.
- When assoc link changes, reinit the ml data maintianed in Station's
wpa state machine and maintain only accpeted link's data.
- copy sa_query_timed_out field to all link stations and reset the same
after association is accepted.
- Reset rejected link's valid bit after association response is sent
so that it wont be referred and used anywhere.
- Do not copy all STA flags from assoc link STA to other link STA as
few flags can be link specifc (i.e. WLAN_STA_SHORT_PREAMBLE,
WLAN_STA_VHT,WLAN_STA_6GHZ etc,)
- When a link Station is freed, reset the corresponding link's valid
bit in state machine's ml info.
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Vignesh C <quic_vignc@quicinc.com>
---
src/ap/ieee802_11.c | 113 +++++++++++++++++++++++++------
src/ap/ieee802_11_eht.c | 3 +
src/ap/sta_info.c | 20 ++++++
src/ap/sta_info.h | 3 +
src/ap/wpa_auth.c | 144 +++++++++++++++++++---------------------
src/ap/wpa_auth.h | 2 +-
6 files changed, 188 insertions(+), 97 deletions(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 7339ffe..47a506e 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4052,12 +4052,6 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
elems->eht_240mhz_len);
if (resp != WLAN_STATUS_SUCCESS)
return resp;
-
- if (!link) {
- resp = hostapd_process_ml_assoc_req(hapd, elems, sta);
- if (resp != WLAN_STATUS_SUCCESS)
- return resp;
- }
}
#endif /* CONFIG_IEEE80211BE */
@@ -4130,6 +4124,36 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
wpa_ie -= 2;
wpa_ie_len += 2;
+#ifdef CONFIG_IEEE80211BE
+ if (!link && sta->mld_info.mld_sta && sta->mld_assoc_link_id != hapd->mld_link_id) {
+ struct hostapd_data *bss;
+ struct sta_info *lsta;
+ u8 link_id = hapd->mld_link_id;
+
+ wpa_printf(MSG_WARNING,
+ "Existing ML STA "MACSTR" on link %u is associating after "
+ "SA query timeout on a different link %u", MAC2STR(sta->addr),
+ sta->mld_assoc_link_id, link_id);
+ wpa_auth_sta_deinit(sta->wpa_sm);
+ sta->wpa_sm = NULL;
+ sta->mld_assoc_link_id = link_id;
+ for_each_partner_bss(bss, hapd) {
+ if (bss == hapd)
+ continue;
+ lsta = ap_get_sta(bss, sta->addr);
+ if (lsta) {
+ lsta->wpa_sm = NULL;
+ lsta->mld_assoc_link_id = link_id;
+ }
+ }
+ }
+ /* Overwrite existing ml info only after SA query procedure */
+ if (!link && hapd->iconf->ieee80211be && !hapd->conf->disable_11be) {
+ resp = hostapd_process_ml_assoc_req(hapd, elems, sta);
+ if (resp != WLAN_STATUS_SUCCESS)
+ return resp;
+ }
+#endif /* CONFIG_IEEE80211BE */
if (!sta->wpa_sm) {
#ifdef CONFIG_IEEE80211BE
struct mld_info *info = &sta->mld_info;
@@ -4152,6 +4176,7 @@ static int __check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
"MLD: Set ML info in RSN Authenticator");
wpa_auth_set_ml_info(sta->wpa_sm,
hapd->mld->mld_addr,
+ hapd->mld_link_id,
sta->mld_assoc_link_id,
info);
}
@@ -4553,8 +4578,10 @@ static void ieee80211_ml_process_link(struct hostapd_data *hapd,
goto out;
}
- sta->flags |= origin_sta->flags | WLAN_STA_ASSOC_REQ_OK;
+ sta->flags = (origin_sta->flags & WLAN_STA_AUTH);
sta->mld_assoc_link_id = origin_sta->mld_assoc_link_id;
+ sta->sa_query_timed_out = origin_sta->sa_query_timed_out;
+ sta->wpa_sm = origin_sta->wpa_sm;
status = __check_assoc_ies(hapd, sta, NULL, 0, &elems, reassoc, true);
if (status != WLAN_STATUS_SUCCESS) {
wpa_printf(MSG_DEBUG, "MLD: link: Element check failed");
@@ -4579,12 +4606,6 @@ static void ieee80211_ml_process_link(struct hostapd_data *hapd,
sta->listen_interval = origin_sta->listen_interval;
update_ht_state(hapd, sta);
- wpa_auth_sta_deinit(sta->wpa_sm);
- /* Maintain state machine reference on all link STAs, this is needed
- * during Group rekey handling.
- */
- sta->wpa_sm = origin_sta->wpa_sm;
-
/*
* Do not initialize the EAPOL state machine.
* TODO: Maybe it is needed?
@@ -4601,7 +4622,7 @@ static void ieee80211_ml_process_link(struct hostapd_data *hapd,
link->rsne = hostapd_wpa_ie(hapd, WLAN_EID_RSN);
link->rsnxe = hostapd_wpa_ie(hapd, WLAN_EID_RSNX);
- sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC_REQ_OK;
+ sta->flags |= WLAN_STA_ASSOC_REQ_OK;
sta->vlan_id = origin_sta->vlan_id;
/* TODO: What other processing is required? */
@@ -4613,10 +4634,17 @@ out:
link->status = status;
wpa_printf(MSG_DEBUG, "MLD: link: status=%u", status);
- if (sta && status != WLAN_STATUS_SUCCESS)
- ap_free_sta(hapd, sta);
+ if (sta) {
+ if (status != WLAN_STATUS_SUCCESS) {
+ ap_free_sta(hapd, sta);
+ } else {
+ /* Maintain only accepted link STAs information in wpa_sm */
+ wpa_auth_set_ml_info(sta->wpa_sm, hapd->mld->mld_addr,
+ hapd->mld_link_id, sta->mld_assoc_link_id,
+ &sta->mld_info);
+ }
+ }
- /* ToDO if link is not accepted remove its data from ml info of assoc sta? */
link->resp_sta_profile_len =
ieee80211_ml_build_assoc_resp(hapd, link->status,
link->resp_sta_profile,
@@ -4646,6 +4674,10 @@ static void hostapd_process_assoc_ml_info(struct hostapd_data *hapd,
{
#ifdef CONFIG_IEEE80211BE
unsigned int i, j;
+ const u8 *mld_link_addr = NULL;
+ bool mld_link_sta = false;
+ u16 eml_cap = 0;
+ u16 mld_cap = 0;
if (!hostapd_is_mld_ap(hapd))
return;
@@ -4659,6 +4691,46 @@ static void hostapd_process_assoc_ml_info(struct hostapd_data *hapd,
sta->mld_info.links[hapd->mld_link_id].rsnxe =
hostapd_wpa_ie(hapd, WLAN_EID_RSNX);
+ if (sta->mld_info.mld_sta) {
+ u8 mld_link_id = hapd->mld_link_id;
+
+ mld_link_sta = sta->mld_assoc_link_id != mld_link_id;
+ mld_link_addr = sta->mld_info.links[mld_link_id].peer_addr;
+ eml_cap = sta->mld_info.common_info.eml_capa;
+ mld_cap = sta->mld_info.common_info.mld_capa;
+ wpa_printf(MSG_DEBUG, "Add associated ML STA " MACSTR
+ " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)",
+ MAC2STR(sta->addr), sta->added_unassoc, sta->auth_alg,
+ sta->ft_over_ds, reassoc,
+ !!(sta->flags & WLAN_STA_AUTHORIZED),
+ wpa_auth_sta_ft_tk_already_set(sta->wpa_sm),
+ wpa_auth_sta_fils_tk_already_set(sta->wpa_sm));
+
+ if (!sta->added_unassoc && (!(sta->flags & WLAN_STA_AUTHORIZED) ||
+ (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
+ (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
+ !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) {
+ wpa_printf(MSG_DEBUG,
+ "ML STA was already created and we received assoc resp again (reassoc: %d)",
+ reassoc);
+ /* cleanup all link sta in kernel and add later on ml processing */
+ ap_sta_remove_link_sta(hapd, sta);
+ hostapd_drv_sta_remove(hapd, sta->addr);
+ sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_AUTHORIZED);
+
+ if (hostapd_sta_add(hapd, sta->addr, 0, 0,
+ sta->supported_rates,
+ sta->supported_rates_len,
+ 0, NULL, NULL, NULL, 0, NULL, 0, NULL,
+ sta->flags, 0, 0, 0, 0,
+ mld_link_addr, mld_link_sta, NULL, 0,
+ eml_cap, mld_cap)) {
+ hostapd_logger(hapd, sta->addr,HOSTAPD_MODULE_IEEE80211,HOSTAPD_LEVEL_NOTICE,
+ "Could not add STA to kernel driver");
+ return;
+ }
+ }
+ }
for (i = 0; i < MAX_NUM_MLD_LINKS; i++) {
struct hostapd_iface *iface = NULL;
struct hostapd_data *bss = NULL;
@@ -4732,11 +4804,13 @@ static int add_associated_sta(struct hostapd_data *hapd,
bool mld_link_sta = false;
u16 eml_cap = 0;
u16 mld_cap = 0;
+ bool ml_sta = false;
#ifdef CONFIG_IEEE80211BE
if (hapd->conf->mld_ap && sta->mld_info.mld_sta) {
u8 mld_link_id = hapd->mld_link_id;
+ ml_sta = true;
mld_link_sta = sta->mld_assoc_link_id != mld_link_id;
mld_link_addr = sta->mld_info.links[mld_link_id].peer_addr;
@@ -4782,7 +4856,7 @@ static int add_associated_sta(struct hostapd_data *hapd,
wpa_auth_sta_ft_tk_already_set(sta->wpa_sm),
wpa_auth_sta_fils_tk_already_set(sta->wpa_sm));
- if (!mld_link_sta && !sta->added_unassoc &&
+ if (!ml_sta && !sta->added_unassoc &&
(!(sta->flags & WLAN_STA_AUTHORIZED) ||
(reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
(!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
@@ -4846,7 +4920,7 @@ static int add_associated_sta(struct hostapd_data *hapd,
"Could not %s STA to kernel driver",
set ? "set" : "add");
- if (sta->added_unassoc) {
+ if (!ml_sta && sta->added_unassoc) {
hostapd_drv_sta_remove(hapd, sta->addr);
sta->added_unassoc = 0;
}
@@ -6555,6 +6629,7 @@ static void ieee80211_ml_link_sta_assoc_cb(struct hostapd_data *hapd,
ap_sta_set_authorized(hapd, sta, 1);
hostapd_set_sta_flags(hapd, sta);
+ sta->sa_query_timed_out = 0;
/*
* TODOs:
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
index 922ac3d..4407dda 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -745,6 +745,9 @@ u8 * hostapd_eid_eht_basic_ml(struct hostapd_data *hapd, u8 *eid,
ptr += slice_len;
}
}
+ /* Dont refer to rejected links info Anymore */
+ if (link->status != WLAN_STATUS_SUCCESS)
+ link->valid = false;
}
out:
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 080147f..efc576d 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -69,6 +69,26 @@ int ap_for_each_sta(struct hostapd_data *hapd,
}
+#ifdef CONFIG_IEEE80211BE
+void ap_sta_remove_link_sta(struct hostapd_data *hapd,
+ struct sta_info *sta)
+{
+ struct hostapd_data *tmp_hapd;
+
+ for_each_partner_bss(tmp_hapd, hapd) {
+ struct sta_info *tmp_sta;
+
+ if (tmp_hapd == hapd)
+ continue;
+
+ tmp_sta = ap_get_sta(tmp_hapd, sta->addr);
+ if (tmp_sta)
+ ap_free_sta(tmp_hapd, tmp_sta);
+ }
+}
+#endif /* CONFIG_IEEE80211BE */
+
+
struct hostapd_ft_over_ds_ml_sta_entry *ap_get_ft_ds_ml_sta(struct hostapd_data *hapd,
const u8 *sta)
{
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index b03fba0..b9c6ba5 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -372,6 +372,7 @@ struct sta_info {
/* Number of seconds to keep STA entry after it has been deauthenticated. */
#define AP_MAX_INACTIVITY_AFTER_DEAUTH (1 * 5)
+#ifdef CONFIG_IEEE80211BE
#define DEFINE_PARTNER_STA_FUNC_CB(obj_name) \
static inline int set_partner_sta_cb_##obj_name(struct hostapd_data *hapd, \
struct sta_info *sta, \
@@ -391,6 +392,8 @@ int set_for_each_partner_link_sta(struct hostapd_data *hapd,
int (*cb)(struct hostapd_data *hapd,
struct sta_info *sta,
void *data));
+void ap_sta_remove_link_sta(struct hostapd_data *hapd, struct sta_info *sta);
+#endif /* CONFIG_IEEE80211BE */
int ap_for_each_sta(struct hostapd_data *hapd,
int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
void *ctx),
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index d21f2ba..14aedf7 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -106,15 +106,18 @@ void wpa_update_gkeydone(struct wpa_state_machine *sm, int update)
void wpa_release_link_auth_ref(struct wpa_state_machine *sm, int release_link_id)
{
int link_id;
+ struct mld_link *link;
if (!sm || link_id >= MAX_NUM_MLD_LINKS)
return;
for_each_sm_auth(sm, link_id)
if (link_id == release_link_id) {
- wpa_group_put(sm->mld_links[link_id].wpa_auth,
- sm->mld_links[link_id].wpa_auth->group);
- sm->mld_links[link_id].wpa_auth = NULL;
+ link = &sm->mld_links[link_id];
+ wpa_group_put(link->wpa_auth, link->wpa_auth->group);
+ link->wpa_auth = NULL;
+ link->valid = false;
+ break;
}
}
@@ -448,14 +451,14 @@ static void wpa_update_all_gtks(struct wpa_authenticator *wpa_auth)
{
struct wpa_group *group, *next;
group = wpa_auth->group;
- while (group) {
- wpa_group_get(wpa_auth, group);
+ while (group) {
+ wpa_group_get(wpa_auth, group);
wpa_group_update_gtk(wpa_auth, group);
- next = group->next;
- wpa_group_put(wpa_auth, group);
- group = next;
- }
+ next = group->next;
+ wpa_group_put(wpa_auth, group);
+ group = next;
+ }
}
static int wpa_update_all_gtks_cb(struct wpa_authenticator *wpa_auth, void *ctx)
@@ -945,8 +948,11 @@ static void wpa_free_sta_sm(struct wpa_state_machine *sm)
os_free(sm->wpa_ie);
os_free(sm->rsnxe);
for_each_sm_auth(sm, link_id) {
- wpa_group_put(sm->mld_links[link_id].wpa_auth, sm->mld_links[link_id].wpa_auth->group);
- sm->mld_links[link_id].wpa_auth = NULL;
+ struct mld_link *link = &sm->mld_links[link_id];
+
+ wpa_group_put(link->wpa_auth, link->wpa_auth->group);
+ link->wpa_auth = NULL;
+ link->valid = false;
}
wpa_group_put(sm->wpa_auth, sm->group);
#ifdef CONFIG_DPP2
@@ -6844,16 +6850,22 @@ void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success)
void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr,
- u8 mld_assoc_link_id, struct mld_info *info)
+ u8 link_id, u8 mld_assoc_link_id,
+ struct mld_info *info)
{
#ifdef CONFIG_IEEE80211BE
- struct wpa_auth_ml_rsn_info ml_rsn_info;
- unsigned int link_id, i;
+ struct mld_link_info *link;
+ struct mld_link *sm_link;
+ struct wpa_get_link_auth_ctx ctx;
+ const u8 *rsn_ies;
+ size_t rsn_ies_len;
- if (!info)
+ if (!info || link_id >= MAX_NUM_MLD_LINKS)
return;
- os_memset(sm->mld_links, 0, sizeof(sm->mld_links));
+ link = &info->links[link_id];
+ sm_link = &sm->mld_links[link_id];
+ os_memset(sm_link, 0, sizeof(*sm_link));
wpa_auth_logger(sm->wpa_auth, wpa_auth_get_spa(sm), LOGGER_DEBUG,
"MLD: Initialization");
@@ -6863,75 +6875,53 @@ void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr,
sm->mld_assoc_link_id = mld_assoc_link_id;
- os_memset(&ml_rsn_info, 0, sizeof(ml_rsn_info));
+ sm_link->valid = link->valid;
- for (i = 0, link_id = 0; link_id < MAX_NUM_MLD_LINKS; link_id++) {
- struct mld_link_info *link = &info->links[link_id];
- struct mld_link *sm_link = &sm->mld_links[link_id];
- struct wpa_get_link_auth_ctx ctx;
+ os_memcpy(sm_link->peer_addr, link->peer_addr, ETH_ALEN);
+ os_memcpy(sm_link->own_addr, link->local_addr, ETH_ALEN);
- sm_link->valid = link->valid;
- if (!link->valid)
- continue;
-
- os_memcpy(sm_link->peer_addr, link->peer_addr, ETH_ALEN);
- os_memcpy(sm_link->own_addr, link->local_addr, ETH_ALEN);
-
- wpa_printf(MSG_DEBUG,
- "WPA_AUTH: MLD: id=%u, addr=" MACSTR " peer=" MACSTR,
- link_id,
- MAC2STR(sm_link->own_addr),
- MAC2STR(sm_link->peer_addr));
-
- ml_rsn_info.links[i++].link_id = link_id;
-
- if (link_id != mld_assoc_link_id) {
- sm->n_mld_affiliated_links++;
- ctx.addr = link->local_addr;
- ctx.wpa_auth = NULL;
- wpa_auth_for_each_auth(sm->wpa_auth, wpa_get_link_sta_auth, &ctx);
- if (ctx.wpa_auth) {
- sm_link->wpa_auth = ctx.wpa_auth;
- wpa_group_get(sm_link->wpa_auth, sm_link->wpa_auth->group);
- }
- } else {
- sm_link->wpa_auth = sm->wpa_auth;
+ wpa_printf(MSG_DEBUG,
+ "WPA_AUTH: MLD: id=%u, addr=" MACSTR " peer=" MACSTR,
+ link_id,
+ MAC2STR(sm_link->own_addr),
+ MAC2STR(sm_link->peer_addr));
+
+ if (link_id != mld_assoc_link_id) {
+ sm->n_mld_affiliated_links++;
+ ctx.addr = link->local_addr;
+ ctx.wpa_auth = NULL;
+ wpa_auth_for_each_auth(sm->wpa_auth, wpa_get_link_sta_auth, &ctx);
+ if (ctx.wpa_auth) {
+ sm_link->wpa_auth = ctx.wpa_auth;
+ wpa_group_get(sm_link->wpa_auth, sm_link->wpa_auth->group);
}
-
- if (!sm_link->wpa_auth)
- wpa_printf(MSG_ERROR, "Unable to find authenticator object for"
- "ML STA "MACSTR" on link "MACSTR" link id %d",
- MAC2STR(sm->own_mld_addr), MAC2STR(sm_link->own_addr), link_id);
+ } else {
+ /* Group get for assoc link would've been done during state machine init */
+ sm_link->wpa_auth = sm->wpa_auth;
}
- ml_rsn_info.n_mld_links = i;
-
- wpa_auth_get_ml_rsn_info(sm->wpa_auth, &ml_rsn_info);
-
- for (i = 0; i < ml_rsn_info.n_mld_links; i++) {
- struct mld_link *sm_link;
- const u8 *rsn_ies;
- u8 rsn_ies_len;
-
- sm_link = &sm->mld_links[ml_rsn_info.links[i].link_id];
- rsn_ies = ml_rsn_info.links[i].rsn_ies;
- rsn_ies_len = ml_rsn_info.links[i].rsn_ies_len;
+ if (!sm_link->wpa_auth) {
+ wpa_printf(MSG_ERROR, "Unable to find authenticator object for"
+ "ML STA "MACSTR" on link "MACSTR" link id %d",
+ MAC2STR(sm->own_mld_addr), MAC2STR(sm_link->own_addr), link_id);
+ return;
+ }
- /* This should not really happen */
- if (!rsn_ies || rsn_ies_len < 2 || rsn_ies[0] != WLAN_EID_RSN ||
- rsn_ies[1] + 2 > rsn_ies_len) {
- wpa_printf(MSG_INFO, "WPA_AUTH: MLD: Invalid RSNE");
- continue;
- }
+ rsn_ies = wpa_auth_get_wpa_ie(sm_link->wpa_auth, &rsn_ies_len);
+ /* This should not really happen */
+ if (!rsn_ies || rsn_ies_len < 2 || rsn_ies[0] != WLAN_EID_RSN ||
+ rsn_ies[1] + 2 > rsn_ies_len) {
+ wpa_printf(MSG_INFO, "WPA_AUTH: MLD: Invalid RSNE");
+ return;
+ }
- sm_link->rsne = rsn_ies;
- sm_link->rsne_len = rsn_ies[1] + 2;
+ sm_link->rsne = rsn_ies;
+ sm_link->rsne_len = rsn_ies[1] + 2;
- if (rsn_ies[1] + 2UL + 2UL < rsn_ies_len &&
- rsn_ies[rsn_ies[1] + 2] == WLAN_EID_RSNX) {
- sm_link->rsnxe = rsn_ies + 2 + rsn_ies[1];
- sm_link->rsnxe_len = sm_link->rsnxe[1] + 2;
- }
+ if (rsn_ies[1] + 2UL + 2UL < rsn_ies_len &&
+ rsn_ies[rsn_ies[1] + 2] == WLAN_EID_RSNX) {
+ sm_link->rsnxe = rsn_ies + 2 + rsn_ies[1];
+ sm_link->rsnxe_len = sm_link->rsnxe[1] + 2;
}
#endif /* CONFIG_IEEE80211BE */
}
diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h
index 30e1876..b263963 100644
--- a/src/ap/wpa_auth.h
+++ b/src/ap/wpa_auth.h
@@ -643,7 +643,7 @@ void wpa_auth_set_ocv_override_freq(struct wpa_authenticator *wpa_auth,
void wpa_auth_sta_radius_psk_resp(struct wpa_state_machine *sm, bool success);
void wpa_auth_set_ml_info(struct wpa_state_machine *sm, const u8 *mld_addr,
- u8 mld_assoc_link_id, struct mld_info *info);
+ u8 link_id, u8 mld_assoc_link_id, struct mld_info *info);
void wpa_auth_ml_get_rsn_info(struct wpa_authenticator *a,
struct wpa_auth_ml_link_rsn_info *info);
void wpa_auth_ml_get_key_info(struct wpa_authenticator *a,
--
2.34.1