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 <chenhuan@qti.qualcomm.com>
bool hostapd_is_mld_ap(struct hostapd_data *hapd)
{
+ struct hostapd_data *bss;
+
if (!hapd->conf->mld_ap)
return false;
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 */