WPS: Select only correct AP following provisioning (UPSTREAM)

If there are other saved enabled networks a scan following
a successful WPS provisioing may connect to one of those
instead of the AP with which the provisioning was just done.
Avoid that by allowing only selection of a scan result with
a matching bssid to the WPS AP. This will be limited to a number
of scans following WPS provisioing using the same counter
wpa_s->after_wps used to optimize scan frequency post provisioning.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_s/hostapd: add description to version string

Signed-off-by: Ido Reis <idor@ti.com>
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
wpa_s: new override_p2p_go_intent conf parameter (INTERNAL)

If override_p2p_go_intent is set in the p2p/wpa_supplicant.conf
use it instead of the p2p_go_intent value passed from the frame
work.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
P2P: accept provision discovery with bcast group ID

Some bogus devices send provision discovery requests with
bcast group id, which is invalid. However, we currently
must accept these requests, as these devices are part of
the certification testbeds.

Signed-off-by: Eliad Peller <eliad@wizery.com>
P2P: wait on GO negotiation confirm

This commit reverts:
792c887 P2P: Send GO Negotiation Confirm without wait

Some drivers rely on the wait period for sending packets on the
off-channel. If the wait value is small there's a race condition where
the driver ROC might complete before the packet was sent out.

This doesn't impede other drivers, as the wait is cancelled when a
Tx-completion arrives from the remote peer.

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