]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Allow to switch to usable DFS channels
authorSimon Wunderlich <sw@simonwunderlich.de>
Thu, 6 Feb 2014 18:30:39 +0000 (19:30 +0100)
committerJouni Malinen <j@w1.fi>
Tue, 11 Mar 2014 17:04:15 +0000 (19:04 +0200)
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-hostap: Simon Wunderlich <sw@simonwunderlich.de>

src/ap/dfs.c

index 71ddc807a1f188a0d3888a5bce5751b41932f352..e00da51b064d050479510b5777fab3664e682fb9 100644 (file)
@@ -748,9 +748,33 @@ 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",