Patchwork [RFC,2/3] hostapd: Make chan_switch per-iface not per-bss

login
register
mail settings
Submitter Michal Kazior
Date March 18, 2014, 1:55 p.m.
Message ID <1395150910-20595-3-git-send-email-michal.kazior@tieto.com>
Download mbox | patch
Permalink /patch/331433/
State Superseded
Headers show

Comments

Michal Kazior - March 18, 2014, 1:55 p.m.
Submit CSA request for each BSS that is related to the current
interface.

It doesn't make much sense to allow hostapd to perform a real per-BSS
switch beacuse the control frequency is shared among BSSes. Even if
hardware would be capable of performing the switch it would break
hostapd.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 hostapd/ctrl_iface.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

Patch

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index dbdc8c6..4056c7c 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1236,16 +1236,26 @@  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 i, ret;
 
+	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) {
+			/* FIXME: 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 */
@@ -1468,7 +1478,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 {
 		os_memcpy(reply, "UNKNOWN COMMAND\n", 16);