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 <michal.kazior@tieto.com>
This commit is contained in:
Michal Kazior 2014-06-27 14:19:28 +02:00 committed by Jouni Malinen
parent 6782b6846b
commit ccac7c61cf

View File

@ -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,