]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP: Move hostapd_ml_get_assoc_sta() to shared
authorIlan Peer <ilan.peer@intel.com>
Mon, 25 Dec 2023 17:43:00 +0000 (19:43 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 13 Jan 2024 20:20:30 +0000 (22:20 +0200)
So it could be used from different contexts.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
src/ap/ieee802_11.c
src/ap/ieee802_11.h
src/ap/ieee802_11_shared.c

index e114c83c4caac2b84821bd91d0f90744c5f8940c..30a6394c506afb7d0ebe998156657e334210bcae 100644 (file)
@@ -85,11 +85,6 @@ static void handle_auth(struct hostapd_data *hapd,
                        int rssi, int from_queue);
 static int add_associated_sta(struct hostapd_data *hapd,
                              struct sta_info *sta, int reassoc);
-#ifdef CONFIG_IEEE80211BE
-static struct sta_info *
-hostapd_ml_get_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
-                        struct hostapd_data **assoc_hapd);
-#endif /* CONFIG_IEEE80211BE */
 
 
 u8 * hostapd_eid_multi_ap(struct hostapd_data *hapd, u8 *eid)
@@ -5731,47 +5726,6 @@ static void hostapd_disassoc_sta(struct hostapd_data *hapd,
 }
 
 
-#ifdef CONFIG_IEEE80211BE
-static struct sta_info *
-hostapd_ml_get_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
-                        struct hostapd_data **assoc_hapd)
-{
-       struct hostapd_data *other_hapd = NULL;
-       struct sta_info *tmp_sta;
-
-       if (!sta->mld_info.mld_sta)
-               return NULL;
-
-       *assoc_hapd = hapd;
-
-       /* The station is the one on which the association was performed */
-       if (sta->mld_assoc_link_id == hapd->mld_link_id)
-               return sta;
-
-       other_hapd = hostapd_mld_get_link_bss(hapd, sta->mld_assoc_link_id);
-       if (!other_hapd) {
-               wpa_printf(MSG_DEBUG, "MLD: No link match for link_id=%u",
-                          sta->mld_assoc_link_id);
-               return sta;
-       }
-
-       /*
-        * Iterate over the stations and find the one with the matching link ID
-        * and association ID.
-        */
-       for (tmp_sta = other_hapd->sta_list; tmp_sta; tmp_sta = tmp_sta->next) {
-               if (tmp_sta->mld_assoc_link_id == sta->mld_assoc_link_id &&
-                   tmp_sta->aid == sta->aid) {
-                       *assoc_hapd = other_hapd;
-                       return tmp_sta;
-               }
-       }
-
-       return sta;
-}
-#endif /* CONFIG_IEEE80211BE */
-
-
 static bool hostapd_ml_handle_disconnect(struct hostapd_data *hapd,
                                         struct sta_info *sta,
                                         const struct ieee80211_mgmt *mgmt,
index 3f89874e2366525d343c5ab0181db29ca1abcc23..ba973b06b35aa26c3b68c117498aae5cb0593e7b 100644 (file)
@@ -255,5 +255,8 @@ const char * sae_get_password(struct hostapd_data *hapd,
                              struct sta_info *sta, const char *rx_id,
                              struct sae_password_entry **pw_entry,
                              struct sae_pt **s_pt, const struct sae_pk **s_pk);
+struct sta_info * hostapd_ml_get_assoc_sta(struct hostapd_data *hapd,
+                                          struct sta_info *sta,
+                                          struct hostapd_data **assoc_hapd);
 
 #endif /* IEEE802_11_H */
index eaeeba43e88a7621aa7a44b8a7bc2461969d3f8e..c2d38e7151cc5af9630fb31c0d2a86a0691fba0b 100644 (file)
@@ -1148,3 +1148,44 @@ u16 check_ext_capab(struct hostapd_data *hapd, struct sta_info *sta,
 
        return WLAN_STATUS_SUCCESS;
 }
+
+
+struct sta_info * hostapd_ml_get_assoc_sta(struct hostapd_data *hapd,
+                                          struct sta_info *sta,
+                                          struct hostapd_data **assoc_hapd)
+{
+#ifdef CONFIG_IEEE80211BE
+       struct hostapd_data *other_hapd = NULL;
+       struct sta_info *tmp_sta;
+
+       if (!sta->mld_info.mld_sta)
+               return NULL;
+
+       *assoc_hapd = hapd;
+
+       /* The station is the one on which the association was performed */
+       if (sta->mld_assoc_link_id == hapd->mld_link_id)
+               return sta;
+
+       other_hapd = hostapd_mld_get_link_bss(hapd, sta->mld_assoc_link_id);
+       if (!other_hapd) {
+               wpa_printf(MSG_DEBUG, "MLD: No link match for link_id=%u",
+                          sta->mld_assoc_link_id);
+               return sta;
+       }
+
+       /*
+        * Iterate over the stations and find the one with the matching link ID
+        * and association ID.
+        */
+       for (tmp_sta = other_hapd->sta_list; tmp_sta; tmp_sta = tmp_sta->next) {
+               if (tmp_sta->mld_assoc_link_id == sta->mld_assoc_link_id &&
+                   tmp_sta->aid == sta->aid) {
+                       *assoc_hapd = other_hapd;
+                       return tmp_sta;
+               }
+       }
+#endif /* CONFIG_IEEE80211BE */
+
+       return sta;
+}