]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Support removal of link station from AP
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Wed, 6 Mar 2024 06:41:03 +0000 (12:11 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 27 Mar 2024 16:12:39 +0000 (18:12 +0200)
Whenever ap_free_sta() was called, it deleted the whole station entry
from the kernel as well. However, with MLD stations, there is a
requirement to delete only the link station.

Add support to remove the link station alone from an MLD station. If the
link going to be removed is the association link, the whole station
entry will be removed.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/ap/hostapd.c
src/ap/sta_info.c
src/ap/sta_info.h

index 323c02754cf7d06b2f3113d552e5c48b729ea68a..b1ae909a04ec82b577bc2decf4ae28e1f8cbb096 100644 (file)
@@ -418,6 +418,7 @@ static void hostapd_link_remove_timeout_handler(void *eloop_data,
        ieee802_11_set_beacon(hapd);
 
        if (!hapd->eht_mld_link_removal_count) {
+               hostapd_free_link_stas(hapd);
                hostapd_disable_iface(hapd->iface);
                return;
        }
index 23ed530fe588b20d82c67dc0abc494864ca95949..122880a3d87bdc2190e32750aad68517aab330a8 100644 (file)
@@ -187,6 +187,19 @@ void ap_free_sta_pasn(struct hostapd_data *hapd, struct sta_info *sta)
 
 #endif /* CONFIG_PASN */
 
+
+static void __ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
+{
+#ifdef CONFIG_IEEE80211BE
+       if (hostapd_sta_is_link_sta(hapd, sta) &&
+           !hostapd_drv_link_sta_remove(hapd, sta->addr))
+               return;
+#endif /* CONFIG_IEEE80211BE */
+
+       hostapd_drv_sta_remove(hapd, sta->addr);
+}
+
+
 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 {
        int set_beacon = 0;
@@ -209,7 +222,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 
        if (!hapd->iface->driver_ap_teardown &&
            !(sta->flags & WLAN_STA_PREAUTH)) {
-               hostapd_drv_sta_remove(hapd, sta->addr);
+               __ap_free_sta(hapd, sta);
                sta->added_unassoc = 0;
        }
 
@@ -454,6 +467,27 @@ void hostapd_free_stas(struct hostapd_data *hapd)
 }
 
 
+#ifdef CONFIG_IEEE80211BE
+void hostapd_free_link_stas(struct hostapd_data *hapd)
+{
+       struct sta_info *sta, *prev;
+
+       sta = hapd->sta_list;
+       while (sta) {
+               prev = sta;
+               sta = sta->next;
+
+               if (!hostapd_sta_is_link_sta(hapd, prev))
+                       continue;
+
+               wpa_printf(MSG_DEBUG, "Removing link station from MLD " MACSTR,
+                          MAC2STR(prev->addr));
+               ap_free_sta(hapd, prev);
+       }
+}
+#endif /* CONFIG_IEEE80211BE */
+
+
 /**
  * ap_handle_timer - Per STA timer handler
  * @eloop_ctx: struct hostapd_data *
index b136ff7bfab8632d9dc1d6084a45d04ca57e2007..153e4a000a32837b1f5d8c7073a32c2209075016 100644 (file)
@@ -440,4 +440,6 @@ static inline void ap_sta_set_mld(struct sta_info *sta, bool mld)
 
 void ap_sta_free_sta_profile(struct mld_info *info);
 
+void hostapd_free_link_stas(struct hostapd_data *hapd);
+
 #endif /* STA_INFO_H */