From: Karthik M Date: Thu, 11 Sep 2025 22:02:06 +0000 (+0530) Subject: AP MLD: Add ap_get_link_sta() for non-AP MLD link STA lookup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea9148b662905330172a8a2756c459e251f9e532;p=thirdparty%2Fhostap.git AP MLD: Add ap_get_link_sta() for non-AP MLD link STA lookup Introduce a helper to find a station using its link-specific MAC address for MLDs. Signed-off-by: Karthik M --- diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index 91538ec41..dd0e3a7ac 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -77,6 +77,24 @@ struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta) } +#ifdef CONFIG_IEEE80211BE +struct sta_info * ap_get_link_sta(struct hostapd_data *hapd, + const u8 *link_addr) +{ + struct sta_info *link_sta; + + for (link_sta = hapd->sta_list; link_sta; link_sta = link_sta->next) { + if (link_sta->mld_info.mld_sta && + ether_addr_equal(link_sta->mld_info.links[hapd->mld_link_id].peer_addr, + link_addr)) + return link_sta; + } + + return NULL; +} +#endif /* CONFIG_IEEE80211BE */ + + #ifdef CONFIG_P2P struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr) { diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h index a7f084f18..f963e8fd3 100644 --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -347,6 +347,8 @@ int ap_for_each_sta(struct hostapd_data *hapd, void *ctx), void *ctx); struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta); +struct sta_info * ap_get_link_sta(struct hostapd_data *hapd, + const u8 *link_addr); struct sta_info * ap_get_sta_p2p(struct hostapd_data *hapd, const u8 *addr); void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta); void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta);