DFS: Fix overlapped() function to check only DFS channels

This fixes a problem when operating on non-DFS channel and receiving a
radar event for that channel. Previously, we would have decided to
switch channels.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
Janusz Dziedzic 2013-10-26 16:30:42 +03:00 committed by Jouni Malinen
parent 345276a6b5
commit 5eaf240af5

View file

@ -417,14 +417,15 @@ static int dfs_are_channels_overlapped(struct hostapd_data *hapd, int freq,
u8 radar_chan; u8 radar_chan;
int res = 0; int res = 0;
if (hapd->iface->freq == freq)
res++;
/* Our configuration */ /* Our configuration */
mode = hapd->iface->current_mode; mode = hapd->iface->current_mode;
start_chan_idx = dfs_get_start_chan_idx(hapd); start_chan_idx = dfs_get_start_chan_idx(hapd);
n_chans = dfs_get_used_n_chans(hapd); n_chans = dfs_get_used_n_chans(hapd);
/* Check we are on DFS channel(s) */
if (!dfs_check_chans_radar(hapd, start_chan_idx, n_chans))
return 0;
/* Reported via radar event */ /* Reported via radar event */
switch (chan_width) { switch (chan_width) {
case CHAN_WIDTH_20_NOHT: case CHAN_WIDTH_20_NOHT:
@ -454,6 +455,8 @@ static int dfs_are_channels_overlapped(struct hostapd_data *hapd, int freq,
for (i = 0; i < n_chans; i++) { for (i = 0; i < n_chans; i++) {
chan = &mode->channels[start_chan_idx + i]; chan = &mode->channels[start_chan_idx + i];
if (!(chan->flag & HOSTAPD_CHAN_RADAR))
continue;
for (j = 0; j < radar_n_chans; j++) { for (j = 0; j < radar_n_chans; j++) {
wpa_printf(MSG_DEBUG, "checking our: %d, radar: %d", wpa_printf(MSG_DEBUG, "checking our: %d, radar: %d",
chan->chan, radar_chan + j * 4); chan->chan, radar_chan + j * 4);