From ccac7c61cfe2ec01f2cfd0762aa1415e4d73e1c0 Mon Sep 17 00:00:00 2001 From: Michal Kazior Date: Fri, 27 Jun 2014 14:19:28 +0200 Subject: [PATCH] hostapd: Make chan_switch command per-interface not per-BSS Currently hostapd data structures aren't ready for multi-channel BSSes, so make the command work now at least with single-channel multi-BSS channel switching. Signed-off-by: Michal Kazior --- hostapd/ctrl_iface.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 62652650d..9ce78292e 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -1252,16 +1252,28 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd) #endif /* CONFIG_TESTING_OPTIONS */ -static int hostapd_ctrl_iface_chan_switch(struct hostapd_data *hapd, char *pos) +static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, + char *pos) { #ifdef NEED_AP_MLME struct csa_settings settings; - int ret = hostapd_parse_csa_settings(pos, &settings); + int ret; + unsigned int i; + ret = hostapd_parse_csa_settings(pos, &settings); if (ret) return ret; - return hostapd_switch_channel(hapd, &settings); + for (i = 0; i < iface->num_bss; i++) { + ret = hostapd_switch_channel(iface->bss[i], &settings); + if (ret) { + /* FIX: What do we do if CSA fails in the middle of + * submitting multi-BSS CSA requests? */ + return ret; + } + } + + return 0; #else /* NEED_AP_MLME */ return -1; #endif /* NEED_AP_MLME */ @@ -1541,7 +1553,7 @@ static void hostapd_ctrl_iface_receive(int sock, void *eloop_ctx, reply_len = -1; #endif /* CONFIG_TESTING_OPTIONS */ } else if (os_strncmp(buf, "CHAN_SWITCH ", 12) == 0) { - if (hostapd_ctrl_iface_chan_switch(hapd, buf + 12)) + if (hostapd_ctrl_iface_chan_switch(hapd->iface, buf + 12)) reply_len = -1; } else if (os_strncmp(buf, "VENDOR ", 7) == 0) { reply_len = hostapd_ctrl_iface_vendor(hapd, buf + 7, reply,