hostapd: enable dynamic modification of acl policy

add APIs for dynamically changing the macaddr_acl
policy and mac addresses lists.
once changed, hostapd will deauth stations which
do not pass the new policy.

Signed-off-by: Nadim Zubidat <nadimz@ti.com>
Android: nl80211: add support for DRIVER COUNTRY command

Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
Android: fix driver command retval

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wpa_s: don't accumulate delayed sched scan requests (UPSTREAM)

Clear any previous pending timeouts before scheduling
a new delayed sched scan.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Do not sched scan if no enabled networks (UPSTREAM)

There is no point to sched scan when there are no enabled networks.
With some drivers initiating such an empty sched scan causes
returning of scan results with zero results. If this is repeated
it leads to clearing of wpa_s scan results.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Avoid changing state to WPA_SCANNING for sched scan (UPSTREAM)

This prevents manual scan requests from the control iface
in case of sched scan and normal scan can run concurrently.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Allow a new sched scan to replace an existing one (UPSTREAM)

Sched scan needs to be restarted in cases where the enabled
networks list changes. Make wpa_supplicant_req_sched_scan
cancel the previous scan in case there's an ongoing one and
start a new one with the updated networks list.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Cancel sched scan upon assoc event (UPSTREAM)

Looks like since scan is canceled so should any sched scan.
This should probably not occur as both are canceled upon
attempting to connect.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Change sched_scan logic for large number of configured networks (UPSTREAM)

One of the major motivations behind sched scan is offloading
periodic scanning to the device firmware so that the host can
suspend and only be woken up when a known network is close by.
When there are more than max_match_sets or max_sched_scan_ssids
networks in the configuration the current logic will attempt to sched
scan a maximal group up to a certain timeout and then switch to
the next group. The timeout also changes with a backoff.

There are a couple of problems with this approach:
	1. The host can suspend while we are sched scanning an arbitrary
	sub group of networks from all the configured networks. The
	device will keep searching only for these networks while suspended
	and other configured networks won't be scanned for.

	2. The current backoff mechanism won't handle well large
	number of networks

Instead of this we switch to a simpler logic whose principles are:
	1. We sched scan only a single group of networks which are determined
	according to those networks with the highest priority. This way
	when the host suspends we'll be scanning the highest priority networks.

	2. If there are more networks than sched scan can handle it will
	fallback to normal scan so we can still scan for the lower priority
	networks.

	3. As there's no need to switch groups there's no need for
	timeout and backoff.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Don't scan ssids that were sched scanned (UPSTREAM)

When having more than max_sched_scan_ssids ssids, scanning
of the remaining ssids (not included in the sched scan)
might take a while.

Reduce this time by avoiding scanning of ssids that
were already included in the scheduled scan.

Signed-off-by: Eliad Peller <eliad@wizery.com>
sched scan: read driver support for sched scan intervals (UPSTREAM)

Use the feature flag reported by NL80211 to know
if the driver supports short and long intervals in
the sched scan API. This is a prep patch for the
actual handling of this flag.
sched scan: add support for short and long intervals (UPSTREAM)

Configure sched scan to use short and long intervals
if the driver supports it

Signed-off-by: Eyal Shapira <eyal@wizery.com>
sched scan: Add config parameters for short and long intervals (UPSTREAM)

Part of support for short and long intervals
Add API and CLI command to control sched scan intervals (UPSTREAM)

Enable control over the sched scan intervals parameters
through a new wpa_s API (SCHED_SCAN_INTERVALS) and a
matching wpa_cli command.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_s: restart sched scan on channel list change

The channel list can be changed as a result of arriving
beacon hints during normal scan or as a result of local
Reg-Domain change, some passive channels can become
active and shall be reconfigured accordingly for the
scheduled scan.

This fixes the connection to hidden SSIDs on 5Ghz band
during default Reg-Domain 00 (world roaming).

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
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>
Distinguish between sched scan results and normal scan results (UPSTREAM)

This will be useful for future operations.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Avoid sched scan flood in case of mismatched security (UPSTREAM)

Current sched scan in the kernel is limited to SSID matching.
A rare corner case is when an AP with a matching SSID but unmatching
security to a saved profile is in the vicinity. In such a case
sched scan results will immediately be returned after initiating sched
scan however no match will be found due to the security mismatch.
This goes on in a tight loop which is bad as it will effectively
prevent the host from suspending and scan results will eventually
contain the single AP matched by the sched scan due to expiration
of other APs scanned in normal scans which are less frequent.

Avoid this by stopping sched scan after detecting sched scan results
were received but no matched network. Don't start another sched
scan immediately but wait for the next normal scan without any results
to restart it. This prevents the tight loop.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Do not delay p2p search in case of concurrent operations (INTERNAL)

In our case there's no real need for the 500ms delay.
Canceling it improves the peer detection speed and user experience.
If a STA is connected then the p2p find won't affect it except
for a possible throughput hit but we prefer a better that in order
to get a beter user experience during the find.
If a STA is attempting to connect or scanning the p2p find will
be restarted as it's resilient to failures in scan and listen phases.

Change-Id: I455ce99be9fa54521cf2cea96bd023e9f14b64eb
Signed-off-by: Eyal Shapira <eyal@wizery.com>
Android: p2p: various fixes

- Allow group idle timeout to run during WPS disconnect
- Perform single channel scan if we know the channel of the GO joined

Change-Id: I7e9e15b9c44804196bc98c01d51a71e24412b91d
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>