P2P: add conf param to prefer p2p multi channel

When p2p_multi_chan=1 is set in the wpa_supplicant.conf file, don't set
the P2P operating channel according to any existing shared frequency.

Normally we would force the operating channel to be the same as that of
other interfaces operating on the same phy. This param allow us to optimize
P2P user experience by allowing an arbitrary operating channel.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
android: wpa_s template: allow p2p multi channel operation (ANDROID)

Set the p2p_multi_chan parameter to 1 by default. It will have no effect
if the current driver doesn't support multi-channel. Otherwise it will
allow the P2P channel to be set while disregarding other connected
interfaces on the phy.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
nl80211: dummy DRIVER SETBAND handler

SETBAND command is handled in wpa_supplicant_driver_cmd API.
Add a dummy handler in driver_nl80211 for avoiding misleading log,
"Unsupported command: SETBAND ".

Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
android: wpa_s template: disassoc on low ack by default (ANDROID)

When operating as a GO, disassoc the peer station on aging/Tx failure

Signed-off-by: Arik Nemtsov <arik@wizery.com>
P2P: cancel action frame offchan wait after recv go neg conf

The missing call to scan_action_done keeps us offchan
on the listen channel for 250ms following sending go neg resp.
In case the oper channel is different from the listen channel
and we're GO a race could lead to start beaconing while offchan.
This causes the beacons to go out on the listen channel instead
of the oper channel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_s: fix bss selection on identical SSIDs with WEP+AES/TKIP

Configuring two identical SSIDs - one with WEP-SHARED
security and one with AES/TKIP breaks any authentication
attempt with WEP-SHARED SSID.

Reason for this behavior is that during BSS selection
from the priority group wrong BSS (with AES/TKIP) was
selected. Fix this by disallowing "non-WPA/WPA2" BSS
selection with defined rsn_ie/wpa_ie.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
P2P: speed up scans when connecting to persistent GO (UPSTREAM)

In the case of a persistent GO invoking a P2P group by invite
the P2P client starts scanning for the GO but it might still
not be up. If not found the next scan is scheduled for scan_interval
secs but this too long.
Speed up scans to find GO like it's being done in P2P provisioing.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Disable p2p on wlan0 (JB)

This prevents P2P IEs from being added to probes of scans on the
STA interface. These are not needed and prolong required channel
dwell time and Tx of probes.

This is somewhat of a hack but was a preferred approach on adding
framework changes to add p2p_disabled=1 to p2p_supplicant.conf and
not to wpa_supplicant.conf when both are created from the same template.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Avoid normal scans before sched scan if max_scan_ssids=1 (UPSTREAM)

In the case of max_scan_ssids=1 we may fallback to normal scan
if there's a single scan_ssid network. However the normal scan
can't add a wildcard SSID to the ssid list as it's limited to a single
entry. This delays getting broadcast scan results.
Always prefer to do a sched scan in such a case.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Allow concurrent normal scan and sched scan (UPSTREAM)

Some drivers support sched scan and normal scan. Enable this
by configuration of concurrent_sched_scan=1
This can speed up connection to scan_ssid=1 networks as
the sched scan doesn't get interrupted by a normal scan
for wildcard SSID.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
android: wpa_s template: enable concurrent_sched_scan (ANDROID)

Our solution supports this and it speeds up initial connection
to hidden networks.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Don't disable and select new network if SETBAND didn't change (ANDROID)

Current SETBAND would trigger network selection and as part of this
a scan attempt. This is not required in case SETBAND didn't change the
existing setting.

In Android which sends SETBAND immediately after WiFi startup this
would trigger needless scan attempts which would usually fail with -EBUSY
as another framework triggers scan was already going on.
The retry mechanism would then attempt further scans every 1 sec.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: cancel action frame offchan wait after recv go neg resp (UPSTREAM)

A wait of 200ms is configured after sending the go neg request.
The go neg process can end quickly within less than 200ms. If this wait
isn't canceled it can cause the beaconing of the GO to start while
mac80211 is still off channel on the listen channel and this may cause
beaconing on the wrong channel if oper channel is different from
the listen channel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: Fix broken rx action frame handling (INTERNAL-SQUASH)

The root cause of the duplication lies within the Rx path in mac80211
in Johannes` patch "mac80211: accept public action frames with mismatched BSSID".
When wpa_s works with a separate group interface this creates a duplicated Rx
on both the P2P dev interface and the GO interface.

Fix the issue by canceling the duplication in wpa_s and discarding
public action frames with unmatching bssid arriving on a dedicated GO interface

[Arik - for upstream we can't do this since it can break non-mac80211
drivers. Maybe set a flag in wiphy capabilities for when the kernel driver
does this?]

Signed-off-by: Eyal Shapira <eyal@wizery.com>
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>
nl80211: add support for DRIVER COUNTRY command

Add this for supporting country command coming as DRIVER command in Android.

Signed-off-by: Vishal Mahaveer <vishalm@ti.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>