]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Make chan_switch command per-interface not per-BSS
authorMichal Kazior <michal.kazior@tieto.com>
Fri, 27 Jun 2014 12:19:28 +0000 (14:19 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Jun 2014 08:06:44 +0000 (11:06 +0300)
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>
hostapd/ctrl_iface.c

index 62652650dfd05e2cd74de6b9af85989a84bb7a5f..9ce78292e0df79f94358e7a90ac962ff04d4f87a 100644 (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,