sched scan: read driver support for sched scan intervals

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 config parameters for short and long intervals

Part of support for short and long intervals
sched scan: add support for short and long intervals

Configure sched scan to use short and long intervals
if the driver supports it
nl80211: Handle ROAMING_SUPPORT event

Some drivers may notify us that roaming support changed.
This is passed on to wpa_s in order to take that into
account regarding bgscan and roaming.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_s: Disable bgscan and roaming when driver support is limited

Some drivers are limited in certain conditions (e.g. wl12xx
on multi role with a single channel) and would like wpa_s
to disable bgscan and roaming attempts in these situations.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Android: hostapd: enable N rates in build config

Signed-off-by: Ido Reis <idor@ti.com>
Android: wpa_s: changes to default build config

Enable roaming and bgscan

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Ido Reis <idor@ti.com>
wpa_s: add API to disable or enable roaming

If bgscan is configured then it will be disabled and enabled
as well as roaming. This allows wpa_s users to disable roaming
and bgscan when they wish (e.g. device screen is turned off/on)
To disable send "SET roaming_disabled 1" and to enable replace with 0.
config: enable NL80211

Just enable it in both hostapd and wpa_s.

Signed-off-by: Luciano Coelho <coelho@ti.com>
Add API and CLI command to control sched scan intervals

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>
Fix initial interval of bgscan_learn

In case the initial signal level of the associated BSS
was above the given threshold , bgscan_learn module would
begin using the short_interval but never switch to the
long_interval as there would be no signal change event.
Make the init code poll for the current signal level and
set scan_interval accordingly.
This logic exists in bgscan_simple but was missing in
bgscan_learn.
Add blacklist expiration

With the current implementation, once a BSS was added
to the blacklist, it can't go out. Add a simple timeout
(2 minutes) to allow blacklist expiration.

TODO: the timeout should probably be set more dynamically,
or at least make it configurable...

Signed-off-by: Eliad Peller <eliad@wizery.com>
initiate roaming on beacon_loss

Add wpa_s->roaming to indicate (forced) roaming request.
set it on beacon_loss event.
(no need to disconnect if there is no available ap, as
the driver will send disassoc after some time)

Signed-off-by: Eliad Peller <eliad@wizery.com>
bgscan_learn: Scan all channels in certain scenarios

The current scanning of learned frequencies and only a single
new frequency every interval may result in a very long time until
a specific channel where a BSS candidate operates would be scanned
(especially if working on both 2.4 and 5Ghz). To better handle
this scan all frequencies when signal is low and we haven't learned
more than 1 channel.
Roam back to the origin AP when assoc/auth times out

When roaming, avoid going to DISCONNECTED in case assoc or auth
times out with the new AP. Instead attempt to reconnect
back to old AP.
Ignore a deauth from a different BSS than the current one

This fixes an issue with roaming where the previous
BSS would send a DEAUTH during the roaming and this
would caused the supplicant to disconnect.
Prevent roaming to a different ESS while connected

While connected to a certain ESS prevent roaming to a different
ESS AP even if its signal is better. This prevents an undesired
switch between networks in this example scenario:
2 network profiles configured Net1 and Net2. We're already associated
to an AP on the ESS Net1 and while walking with the device we get close
to an AP from ESS Net2. Before this change a decision to switch to
Net2 was made.
nl80211_driver: add private commands to use dropbcast

Add DRIVER DROPBCAST {GET,ENABLE,DISABLE} commands to show the current
setting, enable and disable the feature of dropping all broadcast
packets while in suspend mode.

Signed-off-by: Luciano Coelho <coelho@ti.com>
P2P: ignore neg_req with previously used dialog_token

The p2p spec is a bit broken. if for some reason we
get duplicate negotiation request, the supplicant
will generate 2 different responses (different SSIDs)
with the same dialog token. The remote peer will
confirm one of them, but it will probably be the
wrong one (the first he received)...

Workaround it but ignoring negotiation requests with
the last used dialog_token.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Execute p2p_find instead of p2p_listen

In order for the Android UI to update its
peers list, p2p_find should be used but the Android
WiFi Direct UI uses p2p_listen for some reason.
So workaround it by starting a p2p_find instead.