[PATCH 3/4] hostapd: allow to switch to usable DFS channels

Simon Wunderlich sw
Wed Feb 5 09:10:09 PST 2014


If channels are "available", change to "usable" DFS channels as a
fallback too. This requires CAC, but it is still better to do that
instead of stopping service completely.

Signed-off-by: Simon Wunderlich <sw at simonwunderlich.de>
---
 src/ap/dfs.c |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 6cb8915..5edf53a 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -724,9 +724,32 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 					skip_radar);
 
 	if (!channel) {
-		/* FIXME: Wait for channel(s) to become available */
+		/* if there is no channel to switch immediately to, check
+		 * if there is another channel where we can switch even if
+		 * it requires to perform a CAC first. */
+		skip_radar = 0;
+		channel = dfs_get_valid_channel(iface, &secondary_channel,
+						&vht_oper_centr_freq_seg0_idx,
+						&vht_oper_centr_freq_seg1_idx,
+						skip_radar);
+		if (!channel) {
+			/* FIXME: Wait for channel(s) to become available */
+			hostapd_disable_iface(iface);
+			return err;
+
+		}
+
+		iface->freq = channel->freq;
+		iface->conf->channel = channel->chan;
+		iface->conf->secondary_channel = secondary_channel;
+		iface->conf->vht_oper_centr_freq_seg0_idx =
+			vht_oper_centr_freq_seg0_idx;
+		iface->conf->vht_oper_centr_freq_seg1_idx =
+			vht_oper_centr_freq_seg1_idx;
+
 		hostapd_disable_iface(iface);
-		return err;
+		hostapd_enable_iface(iface);
+		return 0;
 	}
 
 	wpa_printf(MSG_DEBUG, "DFS will switch to a new channel %d",
-- 
1.7.10.4




More information about the Hostap mailing list