]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
AP MLD: Handle driver events for interface enable/disable
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Thu, 25 Apr 2024 10:15:20 +0000 (15:45 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 9 Aug 2024 06:42:59 +0000 (09:42 +0300)
When an interface is enabled, keys are reconfigured, if required, and
beaconing is started again. With MLO, this needs to be done for each of
the affiliated links. Before starting the beaconing, the link needs to
be added back first.

Similarly, when the interface is disabled, hostapd removes the keys and
set the BSS state to disabled. However, for an AP MLD interface, this
needs to be done for each of the affiliated link BSS.

Handle the interface enable/disable driver event for AP MLD.

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

index 1583be47e6243181640875ea871276f475be1621..9e9b46bb1ea6616dff4f53e2f1e3c38511456b57 100644 (file)
@@ -2464,6 +2464,56 @@ static void hostapd_iface_disable(struct hostapd_data *hapd)
 }
 
 
+#ifdef CONFIG_IEEE80211BE
+
+static void hostapd_mld_iface_enable(struct hostapd_data *hapd)
+{
+       struct hostapd_data *first_link, *link_bss;
+
+       first_link = hostapd_mld_is_first_bss(hapd) ? hapd :
+               hostapd_mld_get_first_bss(hapd);
+
+       /* Links have been removed. Re-add all links and enable them, but
+        * enable the first link BSS before doing that. */
+       if (hostapd_drv_link_add(first_link, first_link->mld_link_id,
+                                first_link->own_addr)) {
+               wpa_printf(MSG_ERROR, "MLD: Failed to re-add link %d in MLD %s",
+                          first_link->mld_link_id, first_link->conf->iface);
+               return;
+       }
+
+       hostapd_iface_enable(first_link);
+
+       /* Add other affiliated links */
+       for_each_mld_link(link_bss, first_link) {
+               if (link_bss == first_link)
+                       continue;
+
+               if (hostapd_drv_link_add(link_bss, link_bss->mld_link_id,
+                                        link_bss->own_addr)) {
+                       wpa_printf(MSG_ERROR,
+                                  "MLD: Failed to re-add link %d in MLD %s",
+                                  link_bss->mld_link_id,
+                                  link_bss->conf->iface);
+                       continue;
+               }
+
+               hostapd_iface_enable(link_bss);
+       }
+}
+
+
+static void hostapd_mld_iface_disable(struct hostapd_data *hapd)
+{
+       struct hostapd_data *link_bss;
+
+       for_each_mld_link(link_bss, hapd)
+               hostapd_iface_disable(link_bss);
+}
+
+#endif /* CONFIG_IEEE80211BE */
+
+
 void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                          union wpa_event_data *data)
 {
@@ -2741,9 +2791,21 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                break;
 #endif /* NEED_AP_MLME */
        case EVENT_INTERFACE_ENABLED:
+#ifdef CONFIG_IEEE80211BE
+               if (hapd->conf->mld_ap) {
+                       hostapd_mld_iface_enable(hapd);
+                       break;
+               }
+#endif /* CONFIG_IEEE80211BE */
                hostapd_iface_enable(hapd);
                break;
        case EVENT_INTERFACE_DISABLED:
+#ifdef CONFIG_IEEE80211BE
+               if (hapd->conf->mld_ap) {
+                       hostapd_mld_iface_disable(hapd);
+                       break;
+               }
+#endif /* CONFIG_IEEE80211BE */
                hostapd_iface_disable(hapd);
                break;
 #ifdef CONFIG_ACS