]> git.ipfire.org Git - thirdparty/hostap.git/commit
ACS: Stop before scan if no channels in chanlist are available
authorNeo Jou <neojou@gmail.com>
Wed, 18 Sep 2019 07:39:50 +0000 (15:39 +0800)
committerJouni Malinen <j@w1.fi>
Thu, 19 Sep 2019 09:09:47 +0000 (12:09 +0300)
commitd9286d099797186eb30870323da529c0284197bd
tree1c558c6f4eb2f86aca8fd03a1c04e3255d5305ec
parentf32aa244efe66dd102397a9521be1a7b07f4b6a7
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>
src/ap/acs.c