DFS: Handle radar event when CAC actived correctly

When we have CAC active and receive a radar event, we should ignore
CAC_ABORT event and handle channel switch in the radar event handler.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
Janusz Dziedzic 2013-10-26 16:36:00 +03:00 committed by Jouni Malinen
parent 5eaf240af5
commit 2e946249b1
3 changed files with 17 additions and 23 deletions

View file

@ -724,6 +724,7 @@ int hostapd_start_dfs_cac(struct hostapd_data *hapd, int mode, int freq,
int center_segment0, int center_segment1) int center_segment0, int center_segment1)
{ {
struct hostapd_freq_params data; struct hostapd_freq_params data;
int res;
if (!hapd->driver || !hapd->driver->start_dfs_cac) if (!hapd->driver || !hapd->driver->start_dfs_cac)
return 0; return 0;
@ -740,7 +741,11 @@ int hostapd_start_dfs_cac(struct hostapd_data *hapd, int mode, int freq,
center_segment1)) center_segment1))
return -1; return -1;
return hapd->driver->start_dfs_cac(hapd->drv_priv, &data); res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data);
if (!res)
hapd->cac_started = 1;
return res;
} }

View file

@ -546,29 +546,13 @@ int hostapd_dfs_complete_cac(struct hostapd_data *hapd, int success, int freq,
int ht_enabled, int chan_offset, int chan_width, int ht_enabled, int chan_offset, int chan_width,
int cf1, int cf2) int cf1, int cf2)
{ {
struct hostapd_channel_data *channel;
int err = 1;
if (success) { if (success) {
/* Complete iface/ap configuration */ /* Complete iface/ap configuration */
set_dfs_state(hapd, freq, ht_enabled, chan_offset, set_dfs_state(hapd, freq, ht_enabled, chan_offset,
chan_width, cf1, cf2, chan_width, cf1, cf2,
HOSTAPD_CHAN_DFS_AVAILABLE); HOSTAPD_CHAN_DFS_AVAILABLE);
hapd->cac_started = 0;
hostapd_setup_interface_complete(hapd->iface, 0); hostapd_setup_interface_complete(hapd->iface, 0);
} else {
/* Switch to new channel */
set_dfs_state(hapd, freq, ht_enabled, chan_offset,
chan_width, cf1, cf2,
HOSTAPD_CHAN_DFS_UNAVAILABLE);
channel = dfs_get_valid_channel(hapd);
if (channel) {
hapd->iconf->channel = channel->chan;
hapd->iface->freq = channel->freq;
err = 0;
} else
wpa_printf(MSG_ERROR, "No valid channel available");
hostapd_setup_interface_complete(hapd->iface, err);
} }
return 0; return 0;
@ -588,7 +572,13 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_data *hapd)
err = 0; err = 0;
} }
hapd->driver->stop_ap(hapd->drv_priv); if (!hapd->cac_started) {
wpa_printf(MSG_DEBUG, "DFS radar detected");
hapd->driver->stop_ap(hapd->drv_priv);
} else {
wpa_printf(MSG_DEBUG, "DFS radar detected during CAC");
hapd->cac_started = 0;
}
hostapd_setup_interface_complete(hapd->iface, err); hostapd_setup_interface_complete(hapd->iface, err);
return 0; return 0;
@ -614,10 +604,6 @@ int hostapd_dfs_radar_detected(struct hostapd_data *hapd, int freq,
if (!res) if (!res)
return 0; return 0;
/* we are working on non-DFS channel - skip event */
if (res == 0)
return 0;
/* radar detected while operating, switch the channel. */ /* radar detected while operating, switch the channel. */
res = hostapd_dfs_start_channel_switch(hapd); res = hostapd_dfs_start_channel_switch(hapd);

View file

@ -152,6 +152,9 @@ struct hostapd_data {
int parameter_set_count; int parameter_set_count;
/* DFS specific parameters */
int cac_started;
/* Time Advertisement */ /* Time Advertisement */
u8 time_update_counter; u8 time_update_counter;
struct wpabuf *time_adv; struct wpabuf *time_adv;