Use normal scan on first scan after init

Avoid using sched scan as the initial scan after wpa_s
init. This prevents a scenario on Android in which
the Android framework scan is preempted by a saved scan_ssid AP
being connected to due to immediate sched scan.
This delays receiving scan results.
android: Delay scan after startup to prevent race with framework (INTERNAL)

On Android, the immediate scan may cause the following race:

1. Framework starts wpa_s
2. wpa_s loads and initates a scan
3. A matching AP is found and successfully connected to
4. wpa_s reports CTRL-EVENT-CONNECTED but the framework
WiFi state machine didn't progress yet to the correct state
so this event is unexpected.
5. As a result the DHCP state machine isn't triggered.

The end result is successful assoc with the AP but no DHCP request
being sent. Avoid this by delaying the initial scan by scan_interval.
This doesn't delay getting scan results or connectibg to a rememebered AP
as the Android framework initiates a scan through the control interface
anyways after detecting that the supplicant started.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
sched scan: Make initial short interval scans more aggressive (INTERNAL)

In a very congested environment we've encountered an issue
where a remembered AP isn't detected in the first or second
scan necessarily. The current default of 10 seconds as the short
sched scan interval would therefore cause a long delay until
connecting to a remembered AP after powering on WiFi or disconnecting.
To fix this, reduce the default short interval to 5 secs and
have 10 intervals instead of 6 intervals of 10 seconds. The effect
on power consumption shouldn't be significant as the long interval
is the important factor affecting that.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
SME: Handle Netgear APs WEP shared quirks

Some Netgear APs like WNAP210 have a quirk behavior when
configured for WEP Shared. They send an auth response with algo
SHARED and status code NOT_SUPPORTED_AUTH_ALG (13) when being
sent a request made with auth algo OPEN.
Handle such APs by re-trying SHARED auth in this case.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Supply the connection scan results to bgscan after init

If bgscan is enabled, then bgscan is initiated after the
connection, with no bss scan result information.
Since a scan was performed prior to the connection, the
information exists and can be used to initialize the
bgscan's cache.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
bgscan_learn: scan all freq only if there are no candidates (INTERNAL)

change to patch 19958a54733009e7ef07dc10d98c8b04fa94b882

The original fix to bgscan_learn performs a scan on
all frequencies if bss candidates were not seen on other
channels.
This patch changes it so that if a candidate bss was
seen on the channel of the current AP do not scan
all frequencies.

Signed-off-by: Yoni Divinsky <yoni.divinsky@ti.com>
wpa_cli: p2p_connect to should receive 7 parameters

In wpa_cli the p2p_connect command should be able
to receive and send the ctrl_iface 7 parameters.
The fix is essential to pass p2p wifi certification.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>
nl80211: avoid using another interface for P2P GO (INTERNAL)

Relevant for wl6/7 only, we need to figure out the wl8 MR case.
We now declare iface combinations in wlcore due to cfg80211
enforcement of that. Since we declare support for concurrent
STA and P2P_GO, wpa_s would like to use another interface for
GO. However, since we don't really support P2P_GO so well in MR
but we do want to enable it in MR, prevent wpa_s from using P2P
concurrent mode.

This should be removed once we support P2P_GO properly in MR.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
driver_nl80211: report link speed in mbps

The "linkspeed" driver command incorrectly reported the rate in kbps up
until now.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Revert "wpa_supplicant: clear bssid state on deauth (EXP)"

This reverts commit 6cc7fdbfe58fe836916a4ed616a048c08f5a0777.

This commit introduced a bug (changing state to disconnected). Was
superseded by the upstream commit:

3025458 P2P: Do not use reassociation after getting disassociated

Signed-off-by: Arik Nemtsov <arik@wizery.com>
wpa_supplicant: delay scans only for android builds (INTERNAL)

commit e48cd17 ("android: Delay scan after startup to
prevent race with framework (INTERNAL)") is fixing some
bug wrt. android framework, but introduce pretty annoying
delay when working with native linux.

Surround the new functionality with ifdefs in order
to apply it only for android build.

Signed-off-by: Eliad Peller <eliad@wizery.com>
nl80211: add support for drop rx filters

Enable configuring rx filters which will be
dropped even if matching another rx filter. This
can be used for generating exception filters.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_s: make SETBAND take immediate effect

Make SETBAND disconnect from the current AP if it's not
in the correct band. Also expire APs which aren't in the correct
band so scan results will immediately reflect the band change.

[Eyal - ammended commit description]

Signed-off-by: Panduranga Mallireddy <panduranga_mallireddy@ti.com>
Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
update nl80211_copy.h (INTERNAL)

File taken from 18xx/internal, commit e35be06db924b71c.
Kernel 3.5rc7.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
ap: add missing WLAN_STA_ASSOC_REQ_OK flag cleanups

cleanup of WLAN_STA_ASSOC_REQ_OK flag is missing in some
places (e.g. when deauth a sta).

(This in turn caused problems when working as GO, as our
internal commit (a3e0a16 "Fix deauth with reason 7 due to
multiple assoc_req received") caused reassociations
(after WPS) to get dropped.

Signed-off-by: Eliad Peller <eliad@wizery.com>
SME: correctly check mode HT caps for enabling OBSS scan

Don't assume the 11g mode is always first in the list of mode (sometimes
it isn't). Traverse the array of modes and check the HT40 capability is
turned on for 11g.

Signed-hostap: Arik Nemtsov <arik@wizery.com>
Moving keystore to system/security

keystore used to be in frameworks/base/cmds/keystore, but this include
needs to be changed to support the move to system/security
Allow immediate scan request even if another scan was scheduled later

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Add state message sent after 'status' command

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Add network connection event for status

We need both supplicant state and network connection state
for proper sync up with framework