[PATCH] ACS: to improve the checking of available ACS channel list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Neo Jou <neojou@xxxxxxxxx>

When we set "channel=0" in hostapd.conf to enable ACS function,
and set the wrong channel list, e.g. chanlist=222-999 on purpose,
hostapd will still start ACS process to compute ideal channel,
even there is no available channel in this setting.

Though there is no problem since hostapd fails to initialize
interface, it spends time and may cause some problem to tell if
the setting is correct at the first.

Thus would like to suggest the following patch, we can check if
there is any available channels in the function acs_request_scan()
at the first, and return -1 if no available channel, then it will
fail at acs_init(), without doing ACS computation. It will show
the following in the log:
    Could not select hw_mode and channel. (-3)
    wlan0: interface state UNINITIALIZED->DISABLED

Then we can know the setting is incorrect at the first at
hostapd_select_hw_mode(), instead of waiting for scan callback
function to know if the setting is ok for ACS or not. It can save
time and help to tell if the setting is correct at the initial
function at the first.

Signed-off-by: Neo Jou <neojou@xxxxxxxxx>
---
 src/ap/acs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/ap/acs.c b/src/ap/acs.c
index 11178a1..e1e196d 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -942,6 +942,10 @@ static int acs_request_scan(struct hostapd_iface *iface)
 	}
 	*freq = 0;
 
+	if (params.freqs == freq) { /* No available channel */
+		return -1;
+	}
+
 	iface->scan_cb = acs_scan_complete;
 
 	wpa_printf(MSG_DEBUG, "ACS: Scanning %d / %d",
-- 
2.7.4


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux