]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Do not allow disabling first interface affiliated with an AP MLD
authorChenming Huang <quic_chenhuan@quicinc.com>
Wed, 20 Dec 2023 08:39:18 +0000 (14:09 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 2 Feb 2024 20:54:44 +0000 (22:54 +0200)
Disabling the first interface calls hapd_deinit(), which causes some
issues, e.g., failure when trying to disable other interfaces due to
NULL drv_priv.

So check that all other interfaces are already disabled before disable
the first interface.

Signed-off-by: Chenming Huang <quic_chenhuan@quicinc.com>
src/ap/hostapd.c

index 3201b57992ee5921c1c1dfff2bf37d02a610385a..cb464f67012b2e5bf9ecc00e93d0048ccd79ace4 100644 (file)
@@ -3198,6 +3198,31 @@ int hostapd_disable_iface(struct hostapd_iface *hapd_iface)
                return -1;
        }
 
+#ifdef CONFIG_IEEE80211BE
+       if (hapd_iface->bss[0]->conf->mld_ap &&
+           !hapd_iface->bss[0]->mld_first_bss) {
+               /* Do not allow mld_first_bss disabling before other BSSs */
+               for (j = 0; j < hapd_iface->interfaces->count; ++j) {
+                       struct hostapd_iface *h_iface =
+                               hapd_iface->interfaces->iface[j];
+                       struct hostapd_data *h_hapd = h_iface->bss[0];
+                       struct hostapd_bss_config *h_conf = h_hapd->conf;
+
+                       if (!h_conf->mld_ap ||
+                           h_conf->mld_id !=
+                           hapd_iface->bss[0]->conf->mld_id ||
+                           h_iface == hapd_iface)
+                               continue;
+
+                       if (h_iface->state != HAPD_IFACE_DISABLED) {
+                               wpa_printf(MSG_INFO,
+                                          "Do not allow disable mld_first_bss first");
+                               return -1;
+                       }
+               }
+       }
+#endif /* CONFIG_IEEE80211BE */
+
        wpa_msg(hapd_iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
        driver = hapd_iface->bss[0]->driver;
        drv_priv = hapd_iface->bss[0]->drv_priv;