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>
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.

[Arik - reorder deauth event notification and make it is a deauth event
before touching its data]

Signed-off-by: Eyal Shapira <Eyal@wizery.com>
Signed-off-by: Arik Nemtsov <arik@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.
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>
add set/cancel_priority calls

implement set_priority/cancel_priority functions,
and call them in the appropriate places in the
STA connection flow.

Signed-off-by: Eliad Peller <eliad@wizery.com>
add set/cancel_priority to ap mode as well

ROC when the ap gets the first auth request, and CROC
after authorization (or after connection fails).

Signed-off-by: Eliad Peller <eliad@wizery.com>
Revert "P2P: Assume GO Negotiation failed if GO Neg Conf wait times out"

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

This reverts commit 579a80982ad07619373876c09cdd60e2afcba5b5.
Android: Add top level makefiles

These are from Android wpa_supplicant_8.git initial 0.8.X commit
8d520ff1dc2da35cdca849e982051b86468016d8.

Change-Id: I26aec5afbbd4f4a1f5fd900912545b6f5050de64
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Android: Add MODULE_LICENSE_BSD_LIKE

These are from Android wpa_supplicant_8.git initial 0.8.X commit
8d520ff1dc2da35cdca849e982051b86468016d8.

Change-Id: I26aec5afbbd4f4a1f5fd900912545b6f5050de64
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Android: Add src directory symlinks

These are from Android wpa_supplicant_8.git initial 0.8.X commit
8d520ff1dc2da35cdca849e982051b86468016d8.

Change-Id: I26aec5afbbd4f4a1f5fd900912545b6f5050de64
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Fix scan notification in case of canceling scan

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Set ap_scan to default in case of disassociation

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