P2P: Delay scan operation only when P2P is not in search state

With the radio work interface in place, station interface SCAN command
was not scheduled (i.e., it got continously delayed with "Delay station
mode scan while P2P operation is in progress") when a p2p_find was
operational. Fix this be delaying station mode scan only when a P2P
operation is in progress, but not in search state.

CRs-fixed: 749465
Git-commit: e7ce54023926addb6be4442bd1a87698c57e7524
Git-repo: git://w1.fi/srv/git/hostap.git
Change-Id : I0c897ce6902833554181d72ffd9142669ce7dc61
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>

Change-Id: If5a53c3bd6814df8454ac4cda99d24af045040fd
P2P: Stop driver listen in p2p_state_timeout()

When a P2P timeout occurs and p2p_state_timeout is executed, the
stop_listen function can be called besides setting in_listen to zero in
cases where the driver is still in ROC. That should not really happen in
normal cases, but it is possible for some drivers to extend the ROC
duration. If that happens, the next start_listen request may get
rejected with "P2P: Reject start_listen since p2p_listen_work already
exists".

Change-Id: Idb4cb33e98a3bbf3cc4929272ee0bc9ca6140ba6
Signed-off-by: Constantin Musca <constantin.musca@intel.com>
Git-commit a902d5a64b825a778992e26c0add98479e9c3b39
Git-repo: git://w1.fi/srv/git/hostap.git
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
P2P: Support GCMP as part of 60 GHz support

Change-Id: I8ea026a9fb474e6ad5ef20eee949b839ced6775e
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Git-commit: d77419d2348a9a08485dc00a09aa42dad21d6580
Git-repo: git://w1.fi/srv/git/hostap.git
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
P2P: Set p2p_scan_running based on driver scan request result

With the radio work interface, the actual request to start p2p_scan
operation is scheduled from a radio work and hence the initial return
value cannot provide the real result of the driver operation to trigger
a scan. Introduce a new notification API to indicate the scan trigger
status based on which the p2p_scan_running instance can be set using the
real return value from the driver operation.

CRs-Fixed: 748825
Git-Commit: b951a97454309a5078ee24a5796829a92f1df5f9
Git-repo : git://w1.fi/srv/git/hostap.git
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>

Change-Id: Id22add55a3ecba93a89eaadcae8bfbef953f8bac
P2P: Remove unreachable code in wpas_p2p_stop_find()

Commit 152cff6ba6d6ac206b93a2202eab57f0a36c26cb ('P2P: Remove
WPA_DRIVER_FLAGS_P2P_MGMT option') removed the only non-zero return from
wpas_p2p_stop_find_oper(), but did not remove the useless return value
or the return check in wpas_p2p_stop_find(). Clean these up by removing
unreachable code and useless return value.

Change-Id: I36bc270b154e25adef9256c07977515012eed6a8
CRs-fixed: 750852
Git-commit: 477b082cc4e9cb2025dba83bab6f9eed47eefc05
Git-repo: git://w1.fi/srv/git/hostap.git
Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
P2P: Do not consider the p2p_scan results after p2p_stop_find

If p2p_stop_find is issued after the p2p_scan request is triggered to
the host driver, the obtained scan results are also considered to update
the P2P peer entries. This is not always desired behavior, i.e., it can
be clearer if no P2P-DEVICE-FOUND events are generated based of that
final pending scan.

Change-Id: Ia3d19990dd58c79b2252de0e5e145d8d711beae8
CRs-fixed: 750852
Git-commit: 477b082cc4e9cb2025dba83bab6f9eed47eefc05
Git-repo: git://w1.fi/srv/git/hostap.git
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
WPS: Fix WPS-in-search check when STA_AUTOCONNECT is disabled

If "STA_AUTOCONNECT 0" has been used to disable automatic connection on
disconnection event and the driver indicates multiple disconnection
events for the disconnection from the current AP when WPS is started, it
could have been possible to hit a case where wpa_s->disconnected was set
to 1 during WPS processing and the following scan result processing
would stop the operation.

wpa_s->key_mgmt == WPA_KEY_MGMT_WPS check was trying to avoid to skip
autoconnect when WPS was in use, but that does not seem to work anymore.
Fix this by checking through wpas_wps_searching() as well to avoid
setting wpa_s->disconnect = 1 when there is an ongoing WPS operation.

Signed-off-by: Jouni Malinen <j@w1.fi>
Git-commit: 6e252b0db3cfbc345384feaeac7b7a934610448a
Git-repo : git://w1.fi/srv/git/hostap.git
CRs-fixed: 758089
Change-Id: I7ce7f68c47f611e8e3e819959b2d234f6e2e3d75
P2P: Do not change P2P state on GO Neg failure if it is P2P_SEARCH

Changing the P2P state to P2P_IDLE on GO Negotiation Failure would stop
the previously issued P2P_FIND operation without notifying the upper
layers. Leave the search operation running if in P2P_SEARCH state to
avoid unexpected behavior in case the upper layers issued a new P2P_FIND
while waiting for GO Negotiation to complete.

CRs-fixed: 759557
Git-commit: 9d11832090d6c8cc2f5d1586354d8c6b2e082703
Git-repo : git://w1.fi/srv/git/hostap.git
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Change-Id: I39421ce48c957d71f2f8e8bdf18e5fd544b3800c
MACsec: Fix policy configuration

macsec_validate variable was set incorrectly to FALSE(0) or TRUE(1)
instead of the enum validate_frames values (Disabled(0), Checked(1),
Strict(2). This ended up policy == SHOULD_SECURE to be mapped to
macsec_validate == Checked instead of Strict. This could have resulted
in unintended SecY forwarding of invalid packets rather than dropping
them.

Change-Id: I5959392657b3ae73a4b4bb1196c03127325dba4e
CRs-fixed: 748991
Git-commit: 43d859271894f83c5de6294685b5919889541bab
Git-repo: git://w1.fi/srv/git/hostap.git
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Do not re-open Android control sockets

On Android, the control socket being used may be the socket that is
created when wpa_supplicant is started as a /init.*.rc service. Such a
socket is maintained as a key-value pair in Android's environment.
Closing this control socket would leave wpa_supplicant in a bad state.
When wpa_supplicant re-opens the ctrl_iface socket, it will query the
Android's environment, and will be returned with the same socket
descriptor that has already been closed.

CRs-fixed: 755459
Git-commit: 3a7414b6a65403ca1b857aa8950a384adaec5f13
Git-repo : git://w1.fi/srv/git/hostap.git
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>

Change-Id: Ide6901d7fe7ed9fa0f62920365b5e1acf3208da9