Patchwork [3/4] hostapd: DFS fix overlapped() function

login
register
mail settings
Submitter Janusz.Dziedzic@tieto.com
Date Oct. 24, 2013, 3:40 p.m.
Message ID <1382629228-8895-3-git-send-email-janusz.dziedzic@tieto.com>
Download mbox | patch
Permalink /patch/285953/
State Accepted
Commit 5eaf240af50a5a8a05da0348c19277146f4c2124
Headers show

Comments

Janusz.Dziedzic@tieto.com - Oct. 24, 2013, 3:40 p.m.
Fix dfs_are_channels_overlapped() function.
Check only DFS channels.
This fix a problem when works on non-DFS
channel and get radar event for the same
channel - without this patch we decide to
switch the channel.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
---
 src/ap/dfs.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 10e7e48..dffbea0 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -411,14 +411,15 @@  static int dfs_are_channels_overlapped(struct hostapd_data *hapd, int freq,
 	u8 radar_chan;
 	int res = 0;
 
-	if (hapd->iface->freq == freq)
-		res++;
-
 	/* Our configuration */
 	mode = hapd->iface->current_mode;
 	start_chan_idx = dfs_get_start_chan_idx(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 */
 	switch (chan_width) {
 	case CHAN_WIDTH_20_NOHT:
@@ -448,6 +449,8 @@  static int dfs_are_channels_overlapped(struct hostapd_data *hapd, int freq,
 
 	for (i = 0; i < n_chans; i++) {
 		chan = &mode->channels[start_chan_idx + i];
+		if (!(chan->flag & HOSTAPD_CHAN_RADAR))
+			continue;
 		for (j = 0; j < radar_n_chans; j++) {
 			wpa_printf(MSG_DEBUG, "checking our: %d, radar: %d",
 				   chan->chan, radar_chan + j * 4);