hostapd: template function for auto-selection of channel (INTERNAL)

Don't fail when the configured AP channel is 0. Use it as a cue for
automatic channel selection. Move the code a bit up to avoid redundant
checks for channel validitly on the yet unselected channel.

Add an empty template function for auto-selecting a channel. At this point
a scan is initiated and its callback does nothing.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
hostapd: re-use auto-select scan result for 40Mhz pre-scan (INTERNAL)

We can use the scan done for selecting the channel for the mandatory
scan to be made for an 11a 40Mhz AP. Refactor some functions to be
able to use an existing scan_res structure.

Also make ieee80211n_check_scan() demand async completion, since the
interface is initialized by this function.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
hostapd: auto-select AP channel (INTERNAL)

Find all BSSes in scan results and find a channel in our HW mode where
the number of BSSes is minimal. Ignore channels disabled by our regulatory
domain.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
hostapd: auto-select secondary channel (INTERNAL)

Select a secondary channel according to regulatory class and ambient
noise constraints, as measured by the number of APs on the primary
channel.
If the user wants HT40 operation, try to select a secondary channel
where the level of noise is still minimal. If such one cannot be found,
we prefer to operate as an HT20 AP. The secondary channel selected also
has the minimum number of APs between all allowed secondary channels.

HT40 on 2.4Ghz is disallowed outright, since we can't fulfill all
regulatory constraints to operate in this mode.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Igal Chernobelsky <igalc@ti.com>
hostapd: add support for ACS whitelist and blacklist (INTERNAL)

Allow certain channels to be marked as forbidden for automatic channel
selection (ACS) via a blacklist. Also allow channels to be preferred
exclusively via a whitelist.

Both blacklist and whitelist can be configured via the hostapd.conf
file. Document these options in the sample hostapd.conf file given.

Signed-off-by: Arik Nemtsov <arik@wizery.com>

Conflicts:

	src/ap/ap_config.h