aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZefir Kurtisi <zefir.kurtisi@neratec.com>2016-03-07 11:47:01 (GMT)
committerJouni Malinen <j@w1.fi>2016-03-08 10:16:37 (GMT)
commit3bd58861ae120689652f6221e555e7a4d08a2b1c (patch)
treee41fcb26b2e6c41d299fe64e521ef1f4fe814ca1
parentcc1af6faed963a33809c6bcd4b590c44a64b0d96 (diff)
downloadhostap-3bd58861ae120689652f6221e555e7a4d08a2b1c.zip
hostap-3bd58861ae120689652f6221e555e7a4d08a2b1c.tar.gz
hostap-3bd58861ae120689652f6221e555e7a4d08a2b1c.tar.bz2
hostapd: Handle running out of DFS channels
In scenarios where only DFS channels are available (e.g., outdoor, special country codes), hostapd must be able to handle situations where all are unavailable. The two possibilities to get there are 1) while operating on the last available DFS channel a radar is detected 2) hostapd is started while all channels are unavailable In both cases, hostapd instead of terminating should better wait for the NOPs to pass and re-try operation after the CAC. This patch provides that feature by using the condition (iface->state == HAPD_IFACE_DFS && !iface->cac_started) as NOP mode signature to retry operation from within hostapd_dfs_nop_finished(). Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
-rw-r--r--src/ap/dfs.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index bda23f0..47adba7 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -704,7 +704,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
skip_radar);
if (!channel) {
wpa_printf(MSG_ERROR, "could not get valid channel");
- return -1;
+ hostapd_set_state(iface, HAPD_IFACE_DFS);
+ return 0;
}
iface->freq = channel->freq;
@@ -793,7 +794,6 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
if (!channel) {
wpa_printf(MSG_ERROR, "No valid channel available");
- hostapd_setup_interface_complete(iface, err);
return err;
}
@@ -858,8 +858,9 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
&vht_oper_centr_freq_seg1_idx,
skip_radar);
if (!channel) {
- /* FIXME: Wait for channel(s) to become available */
- hostapd_disable_iface(iface);
+ wpa_printf(MSG_INFO,
+ "%s: no DFS channels left, waiting for NOP to finish",
+ __func__);
return err;
}
@@ -982,6 +983,11 @@ int hostapd_dfs_nop_finished(struct hostapd_iface *iface, int freq,
/* TODO add correct implementation here */
set_dfs_state(iface, freq, ht_enabled, chan_offset, chan_width,
cf1, cf2, HOSTAPD_CHAN_DFS_USABLE);
+
+ /* Handle cases where all channels were initially unavailable */
+ if (iface->state == HAPD_IFACE_DFS && !iface->cac_started)
+ hostapd_handle_dfs(iface);
+
return 0;
}