]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Add ap_get_link_sta() for non-AP MLD link STA lookup
authorKarthik M <karthik.m@oss.qualcomm.com>
Thu, 11 Sep 2025 22:02:06 +0000 (03:32 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 22 Sep 2025 18:41:42 +0000 (21:41 +0300)
Introduce a helper to find a station using its link-specific MAC address
for MLDs.

Signed-off-by: Karthik M <karthik.m@oss.qualcomm.com>
src/ap/sta_info.c
src/ap/sta_info.h

index 91538ec410acc97b9961d96a856850519d8b17d4..dd0e3a7acfeedd341dbc69936df97ff99b0dc665 100644 (file)
@@ -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)
 {
index a7f084f1848ddd9b59f94b5caf4222ac00dbae09..f963e8fd38bbe4e46359c5af420158b5d6209406 100644 (file)
@@ -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);