diff mbox series

[v2,23/44] AP: Do not prune station when adding a link station

Message ID 20230522193412.658666-24-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series Add basic MLO support for AP | expand

Commit Message

Andrei Otcheretianski May 22, 2023, 7:33 p.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

As otherwise the original station would be pruned.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 src/ap/hostapd.c | 12 +++++++++++-
 src/ap/hostapd.h |  3 ++-
 src/ap/utils.c   | 14 +++++++++++++-
 3 files changed, 26 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 29346bc3cd..3a44b0f2dd 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -3378,13 +3378,23 @@  int hostapd_remove_iface(struct hapd_interfaces *interfaces, char *buf)
 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
 			   int reassoc)
 {
+	s8 mld_assoc_link_id = -1;
+
 	if (hapd->tkip_countermeasures) {
 		hostapd_drv_sta_deauth(hapd, sta->addr,
 				       WLAN_REASON_MICHAEL_MIC_FAILURE);
 		return;
 	}
 
-	hostapd_prune_associations(hapd, sta->addr);
+#ifdef CONFIG_IEEE80211BE
+	if (hapd->conf->mld_ap && sta->mld_info.mld_sta) {
+		mld_assoc_link_id = sta->mld_assoc_link_id;
+		if (sta->mld_assoc_link_id != hapd->mld_link_id)
+			return;
+	}
+#endif /* CONFIG_IEEE80211BE */
+
+	hostapd_prune_associations(hapd, sta->addr, mld_assoc_link_id);
 	ap_sta_clear_disconnect_timeouts(hapd, sta);
 	sta->post_csa_sa_query = 0;
 
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index ee4e0c0317..26d5075c99 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -718,7 +718,8 @@  int hostapd_register_probereq_cb(struct hostapd_data *hapd,
 					   const u8 *ie, size_t ie_len,
 					   int ssi_signal),
 				 void *ctx);
-void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr);
+void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr,
+				s8 mld_assoc_link_id);
 
 /* drv_callbacks.c (TODO: move to somewhere else?) */
 void hostapd_notify_assoc_fils_finish(struct hostapd_data *hapd,
diff --git a/src/ap/utils.c b/src/ap/utils.c
index bedad6eb02..1c42506a9b 100644
--- a/src/ap/utils.c
+++ b/src/ap/utils.c
@@ -43,6 +43,7 @@  int hostapd_register_probereq_cb(struct hostapd_data *hapd,
 struct prune_data {
 	struct hostapd_data *hapd;
 	const u8 *addr;
+	s8 mld_assoc_link_id;
 };
 
 static int prune_associations(struct hostapd_iface *iface, void *ctx)
@@ -72,6 +73,12 @@  static int prune_associations(struct hostapd_iface *iface, void *ctx)
 		if (!osta)
 			continue;
 
+#ifdef CONFIG_IEEE80211BE
+		if (data->mld_assoc_link_id >= 0 &&
+		    osta->mld_assoc_link_id == data->mld_assoc_link_id)
+			continue;
+#endif /* CONFIG_IEEE80211BE */
+
 		wpa_printf(MSG_INFO, "%s: Prune association for " MACSTR,
 			   ohapd->conf->iface, MAC2STR(osta->addr));
 		ap_sta_disassociate(ohapd, osta, WLAN_REASON_UNSPECIFIED);
@@ -84,15 +91,20 @@  static int prune_associations(struct hostapd_iface *iface, void *ctx)
  * hostapd_prune_associations - Remove extraneous associations
  * @hapd: Pointer to BSS data for the most recent association
  * @addr: Associated STA address
+ * @mld_assoc_link_id: MLD link id used for association or -1 for non MLO
  *
  * This function looks through all radios and BSS's for previous
  * (stale) associations of STA. If any are found they are removed.
  */
-void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr)
+void hostapd_prune_associations(struct hostapd_data *hapd, const u8 *addr,
+				s8 mld_assoc_link_id)
 {
 	struct prune_data data;
+
 	data.hapd = hapd;
 	data.addr = addr;
+	data.mld_assoc_link_id = mld_assoc_link_id;
+
 	if (hapd->iface->interfaces &&
 	    hapd->iface->interfaces->for_each_interface)
 		hapd->iface->interfaces->for_each_interface(