From 663fb194023190ecbf983814d4d478f02ed8ada2 Mon Sep 17 00:00:00 2001 From: Huang Chenming Date: Sat, 26 Jul 2025 09:49:05 +0530 Subject: [PATCH] AP MLD: Fix hostapd_is_mld_ap() check hostapd_is_mld_ap() added in commit 5f5db9366cde ("AP: MLO: Process Multi-Link element from (Re)Association Request frame") is used to check whether there is need to process partner links' Association/Connection/ Authorization. An issue was found in the previous hostapd_is_mld_ap() logic when the interface count is larger than one and even when another interface is not affiliated to the same MLD or is not even affiliated with any MLD, hostapd_is_mld_ap() still returns true which makes hostapd try to process an unexisting partner link. Fix this by enhancing the logic of this helper function by returning false when no other partner link affiliated with the AP MLD exist. Signed-off-by: Huang Chenming --- src/ap/ieee802_11.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 5557b46ce..4952cc705 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -4947,6 +4947,8 @@ out: bool hostapd_is_mld_ap(struct hostapd_data *hapd) { + struct hostapd_data *bss; + if (!hapd->conf->mld_ap) return false; @@ -4954,7 +4956,18 @@ bool hostapd_is_mld_ap(struct hostapd_data *hapd) hapd->iface->interfaces->count <= 1) return false; - return true; + /* + * Checking for interfaces count above is not sufficient as there + * could be non-MLD interfaces or MLD interface that are not affiliated + * with the same MLD as the currently processing one. So need to check + * if other partner links exist for this the same AP MLD. + */ + for_each_mld_link(bss, hapd) { + if (bss != hapd) + return true; + } + + return false; } #endif /* CONFIG_IEEE80211BE */ -- 2.47.3