AP MLD: Do not allow disabling first interface affiliated with an AP MLD

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>
This commit is contained in:
Chenming Huang 2023-12-20 14:09:18 +05:30 committed by Jouni Malinen
parent e3d16575c4
commit 7ba039ba11

View 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;