]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Stop AP per link
authorChenming Huang <quic_chenhuan@quicinc.com>
Fri, 24 Nov 2023 08:18:59 +0000 (13:48 +0530)
committerJouni Malinen <j@w1.fi>
Wed, 28 Feb 2024 20:32:09 +0000 (22:32 +0200)
For AP MLD cases, the link id is required to determine the correct link
to stop in the stop_ap() driver op.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
src/ap/ap_drv_ops.h
src/drivers/driver.h
src/drivers/driver_nl80211.c

index 331b0eaf4cdeccbe073092d4b6fe62a371a947d2..f38b1850aca3562fef3e8bc5dd301cf34b751770 100644 (file)
@@ -388,9 +388,15 @@ static inline int hostapd_drv_vendor_cmd(struct hostapd_data *hapd,
 
 static inline int hostapd_drv_stop_ap(struct hostapd_data *hapd)
 {
+       int link_id = -1;
+
        if (!hapd->driver || !hapd->driver->stop_ap || !hapd->drv_priv)
                return 0;
-       return hapd->driver->stop_ap(hapd->drv_priv);
+#ifdef CONFIG_IEEE80211BE
+       if (hapd->conf->mld_ap)
+               link_id = hapd->mld_link_id;
+#endif /* CONFIG_IEEE80211BE */
+       return hapd->driver->stop_ap(hapd->drv_priv, link_id);
 }
 
 static inline int hostapd_drv_channel_info(struct hostapd_data *hapd,
index bff7502f1cc583610bafb53a07fffbfdf0451e75..ed76037d2507cb72b5eb8a9489178b326984694b 100644 (file)
@@ -4544,13 +4544,14 @@ struct wpa_driver_ops {
        /**
         * stop_ap - Removes beacon from AP
         * @priv: Private driver interface data
+        * @link_id: Link ID of the specified link; -1 for non-MLD
         * Returns: 0 on success, -1 on failure (or if not supported)
         *
         * This optional function can be used to disable AP mode related
         * configuration. Unlike deinit_ap, it does not change to station
         * mode.
         */
-       int (*stop_ap)(void *priv);
+       int (*stop_ap)(void *priv, int link_id);
 
        /**
         * get_survey - Retrieve survey data
index aa5ed58b2ca077e2fc9debce954ad780ec67c0c7..c7fad43d5932c96d46ec625ffed4171eecc24d0d 100644 (file)
@@ -9570,17 +9570,30 @@ static int wpa_driver_nl80211_deinit_ap(void *priv)
 }
 
 
-static int wpa_driver_nl80211_stop_ap(void *priv)
+static int wpa_driver_nl80211_stop_ap(void *priv, int link_id)
 {
        struct i802_bss *bss = priv;
        struct wpa_driver_nl80211_data *drv = bss->drv;
+       unsigned int i;
 
        if (!is_ap_interface(drv->nlmode))
                return -1;
 
-       wpa_driver_nl80211_del_beacon_all(bss);
+       if (link_id == -1) {
+               wpa_driver_nl80211_del_beacon_all(bss);
+               return 0;
+       }
 
-       return 0;
+       for (i = 0; i < bss->n_links; ++i) {
+               struct i802_link *link = &bss->links[i];
+
+               if (link->link_id == link_id) {
+                       wpa_driver_nl80211_del_beacon(bss, link);
+                       return 0;
+               }
+       }
+
+       return -1;
 }