diff mbox series

ACS: channel selection based freqlist

Message ID 1589182969-3523-1-git-send-email-neojou@gmail.com
State Accepted
Headers show
Series ACS: channel selection based freqlist | expand

Commit Message

Neo Jou May 11, 2020, 7:42 a.m. UTC
From: neo_jou <neo_jou@realtek.com>

When doing ACS, check freqlist also if there is the config.

Signed-off-by: neojou <neojou@gmail.com>
---
 src/ap/acs.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Jouni Malinen May 16, 2020, 10:51 p.m. UTC | #1
On Mon, May 11, 2020 at 03:42:49PM +0800, neojou@gmail.com wrote:
> When doing ACS, check freqlist also if there is the config.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/ap/acs.c b/src/ap/acs.c
index 5c01610..6f074db 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -511,6 +511,14 @@  static int is_in_chanlist(struct hostapd_iface *iface,
 	return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan);
 }
 
+static int is_in_freqlist(struct hostapd_iface *iface,
+			  struct hostapd_channel_data *chan)
+{
+	if (!iface->conf->acs_freq_list.num)
+		return 1;
+
+	return freq_range_list_includes(&iface->conf->acs_freq_list, chan->freq);
+}
 
 static void acs_survey_mode_interference_factor(
 	struct hostapd_iface *iface, struct hostapd_hw_modes *mode)
@@ -527,6 +535,9 @@  static void acs_survey_mode_interference_factor(
 		if (!is_in_chanlist(iface, chan))
 			continue;
 
+		if (!is_in_freqlist(iface, chan))
+			continue;
+
 		wpa_printf(MSG_DEBUG, "ACS: Survey analysis for channel %d (%d MHz)",
 			   chan->chan, chan->freq);
 
@@ -651,6 +662,9 @@  acs_find_ideal_chan_mode(struct hostapd_iface *iface,
 		if (!is_in_chanlist(iface, chan))
 			continue;
 
+		if (!is_in_freqlist(iface, chan))
+			continue;
+
 		if (!chan_bw_allowed(chan, bw, 1, 1)) {
 			wpa_printf(MSG_DEBUG,
 				   "ACS: Channel %d: BW %u is not supported",
@@ -1013,6 +1027,9 @@  static int * acs_request_scan_add_freqs(struct hostapd_iface *iface,
 		if (!is_in_chanlist(iface, chan))
 			continue;
 
+		if (!is_in_freqlist(iface, chan))
+			continue;
+
 		*freq++ = chan->freq;
 	}