blacklist: Add expiration mechanism

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>
bgscan_learn: fix initial interval

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.
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.
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>
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>
add station before getting assoc resp tx completion

Add the station before sending the association
response (rather than after tx completion), in
order to handle EAPOL-Start before tx completion
race.

[Seems this is missing some cleanups - can't go upstream yet]

Signed-off-by: Eliad Peller <eliad@wizery.com>
save eapol for later use (EAPOL Start race)

[ Includes null check missing from the original patch - Arik ]

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Fix deauth with reason 7 due to multiple assoc_req received

Additional assoc_reqs received after an initial assoc_req (due to a timeout
in the STA) was already being handled caused the handle_assoc flow to
run again and in the process delete the station added to the driver
(in add_pre_assoc_sta). A race would occur where assoc_resp
was already sent to the STA (as part of the handling of the initial
assoc_req) and it sent a null data packet which arrived
while the station was deleted. This caused the packet to be classified
as a class 3 frame coming from an unknown STA and a deauth
would occur. Fix this by discarding additional assoc_req between
receiving the 1st assoc_req and getting a tx callback for the assoc_resp.

Signed-off-by: Eyal Shapira <eyal@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>
P2P: update scan results

(not sure this should go upstream)

update p2p scan results (and notify) if the
listen_freq or go_state were changed.

Signed-off-by: Eliad Peller <eliad@wizery.com>
P2P: Ignore PBC overlap in P2P provisioning

PBC overlap can be ignored as the P2P client knows
that it should connect to the P2P GO so no point of failing
the WPS session in case of overlap because some other
AP had WPS PBC on at the same time.
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>
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.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
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.
Disconnect if we can't roam following beacon loss

The driver reports the 1st beacon loss event but doesn't
disconnect until further consecutive beacon loss events are
received. That's being done in order to give the supplicant time
to roam seamlessly (i.e. without reporting DISCONNECTED to upper
layers). However, in case we can't find any roaming candidates
it's better to disconnect as soon as possible so any supplicant
client will be able to switch quickly to another communication
channel (e.g. mobile 3G). This change initiates up to two immediate
specific SSID scans on all channels following a beacon loss in order
to locate a roaming candidate. Two scans are performed in case
a roaming candidate was preivously blacklisted. That way, it'll be
explored if there's no other option.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: revert "P2P: Assume GO Negotiation failed if GO.."

Galaxy Nexus takes time to send the GO Neg Confirm (~200ms) and this
commit caused the GO Neg to fail because of this.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
driver_nl80211: Add support for DRIVER RXFILTER command

Add support for this Android specific feature using WoWLAN packet
pattern triggers.

Signed-off-by: Pontus Fuchs <pontus.fuchs@tactel.se>
driver_nl80211: rx filters - add support for longer patterns

- Add support for long patterns (longer than 8 bytes)
- Separate Rx filters static configuration from code
- Add DHCP and ARP Rx filters

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Assaf Azulay <assaf@ti.com>
driver_nl80211: Add and align rx filters IDs

Add more patterns (SSDP, ARP, DHCP) and align IDs to a common
vendor Android framework implementation.
Note that ARP pattern shouldn't be used as our FW
responds to ARPs by default without waking up the host.
It is added only for ID alignments purposes.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
driver_nl80211: Enable only unicast RXFILTER by default

In GB the framework always enabled RXFILTER for unicast
and bcast. This seems to be missing in ICS so enable
unicast by default as this is always required.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>