ACS: Stop before scan if no channels in chanlist are available
When we set "channel=0" in hostapd.conf to enable ACS function, and set a wrong channel list, e.g., chanlist=222-999 on purpose, hostapd would still start ACS process to compute the ideal channel, even when there are no available channels with such configuration. Though there is no problem since hostapd fails to initialize interface, it spends time going through the scan and the debug log entries may make it more difficult to tell what was behind the failure. Thus, check if there are any available channels in acs_request_scan(), 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 already in hostapd_select_hw_mode(), instead of waiting for scan callback function to know if the setting is ok for ACS or not. This can save time and help to tell if the setting is correct at the initial function at the first. This will also allow the ENABLE control interface command to return FAIL when adding an interface dynamically. Signed-off-by: Neo Jou <neojou@gmail.com>
This commit is contained in:
parent
f32aa244ef
commit
d9286d0997
1 changed files with 6 additions and 0 deletions
|
@ -942,6 +942,12 @@ static int acs_request_scan(struct hostapd_iface *iface)
|
|||
}
|
||||
*freq = 0;
|
||||
|
||||
if (params.freqs == freq) {
|
||||
wpa_printf(MSG_ERROR, "ACS: No available channels found");
|
||||
os_free(params.freqs);
|
||||
return -1;
|
||||
}
|
||||
|
||||
iface->scan_cb = acs_scan_complete;
|
||||
|
||||
wpa_printf(MSG_DEBUG, "ACS: Scanning %d / %d",
|
||||
|
|
Loading…
Reference in a new issue