From 7b2ca5cf0dfaa53a219ebd940f074872db33b079 Mon Sep 17 00:00:00 2001 From: Sriram R Date: Fri, 14 Sep 2018 16:36:06 +0530 Subject: [PATCH] hostapd: Reset channel switch parameters on interface disable Previously, when an AP interface was disabled through a control interface DISABLE command during a channel switch window, the interface could not be reenabled due to beacon setup failure (which validates if CSA is in progress). Fix this by clearing channel switch parameters while disabling the hostapd interface. Signed-off-by: Sriram R --- src/ap/hostapd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 23d272075..117ee0836 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -2620,6 +2620,11 @@ int hostapd_disable_iface(struct hostapd_iface *hapd_iface) !!(hapd_iface->drv_flags & WPA_DRIVER_FLAGS_AP_TEARDOWN_SUPPORT); +#ifdef NEED_AP_MLME + for (j = 0; j < hapd_iface->num_bss; j++) + hostapd_cleanup_cs_params(hapd_iface->bss[j]); +#endif /* NEED_AP_MLME */ + /* same as hostapd_interface_deinit without deinitializing ctrl-iface */ for (j = 0; j < hapd_iface->num_bss; j++) { struct hostapd_data *hapd = hapd_iface->bss[j]; @@ -3428,7 +3433,6 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface, const struct hostapd_freq_params *freq_params) { int vht_seg0_idx = 0, vht_seg1_idx = 0, vht_bw = VHT_CHANWIDTH_USE_HT; - unsigned int i; wpa_printf(MSG_DEBUG, "Restarting all CSA-related BSSes"); @@ -3470,10 +3474,8 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface, /* * cs_params must not be cleared earlier because the freq_params * argument may actually point to one of these. + * These params will be cleared during interface disable below. */ - for (i = 0; i < iface->num_bss; i++) - hostapd_cleanup_cs_params(iface->bss[i]); - hostapd_disable_iface(iface); hostapd_enable_iface(iface); }