From: Ilan Peer <ilan.peer@xxxxxxxxx> So it could be used from different contexts. Signed-off-by: Ilan Peer <ilan.peer@xxxxxxxxx> --- src/ap/ieee802_11.c | 47 -------------------------------------- src/ap/ieee802_11.h | 4 +++- src/ap/ieee802_11_shared.c | 41 +++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 48 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 95b43029bb..9a8fad9f30 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -85,12 +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 +5725,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, diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h index 3f89874e23..485ea04e5c 100644 --- a/src/ap/ieee802_11.h +++ b/src/ap/ieee802_11.h @@ -255,5 +255,7 @@ 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 */ diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index eaeeba43e8..c2d38e7151 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -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; +} -- 2.43.0 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap