From 859cbc396fc0a814ab12796a208d43983136ac4f Mon Sep 17 00:00:00 2001 From: Chenming Huang Date: Wed, 6 Sep 2023 11:54:58 +0530 Subject: [PATCH] nl80211: Remove links when stopping AP MLD in hostapd There is an issue when starting a non-MLD AP on the same interface that previous operated as an AP MLD. When the previous AP MLD got stopped, links were not removed when using hostapd. Next non-MLD AP will fail to start because some nl80211 operations still require link id (e.g., set freq). Remove links when AP MLD is stop to avoid such issue. This was already done in the deinit_ap() handler when using wpa_supplicant, but hostapd needs to do same. Signed-off-by: Jouni Malinen --- src/drivers/driver_nl80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 5a4dac7b6..06d9d0aa5 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -193,6 +193,7 @@ static int nl80211_leave_ibss(struct wpa_driver_nl80211_data *drv, static int i802_set_iface_flags(struct i802_bss *bss, int up); static int nl80211_set_param(void *priv, const char *param); +static void nl80211_remove_links(struct i802_bss *bss); #ifdef CONFIG_MESH static int nl80211_put_mesh_config(struct nl_msg *msg, struct wpa_driver_mesh_bss_params *params); @@ -3185,8 +3186,10 @@ static void wpa_driver_nl80211_deinit(struct i802_bss *bss) nl80211_remove_monitor_interface(drv); - if (is_ap_interface(drv->nlmode)) + if (is_ap_interface(drv->nlmode)) { wpa_driver_nl80211_del_beacon_all(bss); + nl80211_remove_links(bss); + } if (drv->eapol_sock >= 0) { eloop_unregister_read_sock(drv->eapol_sock);