aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-01-15 15:57:03 -0800
committerXin Li <delphij@google.com>2020-01-15 15:57:03 -0800
commitd7ca43dfed24237d19067e91ad3b9e7b34db9018 (patch)
treecfed94e5a8ccebad79e84632e58c0da35abedd8d
parenta515753b18f9b054b54588acab651f5dd6c6c9e2 (diff)
parent6178d7ecd8fd406d0775dcd5d9eb790f578122d1 (diff)
downloadwpa_supplicant_8-d7ca43dfed24237d19067e91ad3b9e7b34db9018.tar.gz
DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp-without-vendor (6129114) into stage-aosp-masterandroid10-sidebranch
Bug: 146167222 Change-Id: Ieab88e4a33ce3fa6fb442c52f4765350f78dbda7
-rw-r--r--wpa_supplicant/hidl/1.2/p2p_iface.cpp19
-rw-r--r--wpa_supplicant/hidl/1.2/sta_network.cpp5
-rw-r--r--wpa_supplicant/wpa_supplicant.c1
-rw-r--r--wpa_supplicant/wps_supplicant.c10
-rw-r--r--wpa_supplicant/wps_supplicant.h5
5 files changed, 33 insertions, 7 deletions
diff --git a/wpa_supplicant/hidl/1.2/p2p_iface.cpp b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
index ada7ee6e..fd9ce0dc 100644
--- a/wpa_supplicant/hidl/1.2/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
@@ -225,6 +225,12 @@ int joinScanReq(
size_t ielen;
unsigned int bands;
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
+ wpa_printf(MSG_ERROR,
+ "P2P: P2P interface is gone, cancel join scan");
+ return -ENXIO;
+ }
+
os_memset(&params, 0, sizeof(params));
if (ssid.size() > 0) {
params.ssids[0].ssid = ssid.data();
@@ -1628,6 +1634,10 @@ SupplicantStatus P2pIface::addGroup_1_2Internal(
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
+ return {SupplicantStatusCode::FAILURE_IFACE_DISABLED, ""};
+ }
+
if (!isSsidValid(ssid)) {
return {SupplicantStatusCode::FAILURE_ARGS_INVALID, "SSID is invalid."};
}
@@ -1637,10 +1647,6 @@ SupplicantStatus P2pIface::addGroup_1_2Internal(
}
if (!joinExistingGroup) {
- if (wpa_s->global->p2p == NULL) {
- return {SupplicantStatusCode::FAILURE_IFACE_DISABLED, ""};
- }
-
struct p2p_data *p2p = wpa_s->global->p2p;
os_memcpy(p2p->ssid, ssid.data(), ssid.size());
p2p->ssid_len = ssid.size();
@@ -1685,6 +1691,9 @@ SupplicantStatus P2pIface::addGroup_1_2Internal(
pending_join_scan_callback =
[wpa_s, ssid, freq]() {
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
+ return;
+ }
int ret = joinScanReq(wpa_s, ssid, freq);
// for BUSY case, the scan might be occupied by WiFi.
// Do not give up immediately, but try again later.
@@ -1701,7 +1710,7 @@ SupplicantStatus P2pIface::addGroup_1_2Internal(
};
pending_scan_res_join_callback = [wpa_s, ssid, passphrase, peer_address, this]() {
- if (wpa_s->global->p2p_disabled) {
+ if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
return;
}
diff --git a/wpa_supplicant/hidl/1.2/sta_network.cpp b/wpa_supplicant/hidl/1.2/sta_network.cpp
index 9f4e9d2f..57622f83 100644
--- a/wpa_supplicant/hidl/1.2/sta_network.cpp
+++ b/wpa_supplicant/hidl/1.2/sta_network.cpp
@@ -1011,8 +1011,9 @@ SupplicantStatus StaNetwork::setWepTxKeyIdxInternal(uint32_t key_idx)
SupplicantStatus StaNetwork::setRequirePmfInternal(bool enable)
{
struct wpa_ssid *wpa_ssid = retrieveNetworkPtr();
- wpa_ssid->ieee80211w =
- enable ? MGMT_FRAME_PROTECTION_REQUIRED : NO_MGMT_FRAME_PROTECTION;
+ if (enable) {
+ wpa_ssid->ieee80211w = MGMT_FRAME_PROTECTION_REQUIRED;
+ }
resetInternalStateAfterParamsUpdate();
return {SupplicantStatusCode::SUCCESS, ""};
}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index be8efb4c..5d4adf4f 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -4333,6 +4333,7 @@ int wpa_supplicant_update_mac_addr(struct wpa_supplicant *wpa_s)
}
wpa_sm_set_own_addr(wpa_s->wpa, wpa_s->own_addr);
+ wpas_wps_update_mac_addr(wpa_s);
return 0;
}
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 2950763b..5da81545 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -2235,6 +2235,16 @@ void wpas_wps_update_config(struct wpa_supplicant *wpa_s)
}
+void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s)
+{
+ struct wps_context *wps;
+
+ wps = wpa_s->wps;
+ if (wps)
+ os_memcpy(wps->dev.mac_addr, wpa_s->own_addr, ETH_ALEN);
+}
+
+
#ifdef CONFIG_WPS_NFC
#ifdef CONFIG_WPS_ER
diff --git a/wpa_supplicant/wps_supplicant.h b/wpa_supplicant/wps_supplicant.h
index 3a99f2c5..41b92980 100644
--- a/wpa_supplicant/wps_supplicant.h
+++ b/wpa_supplicant/wps_supplicant.h
@@ -62,6 +62,7 @@ struct wpabuf * wpas_wps_er_nfc_config_token(struct wpa_supplicant *wpa_s,
int ndef, const char *uuid);
int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s);
void wpas_wps_update_config(struct wpa_supplicant *wpa_s);
+void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s);
struct wpabuf * wpas_wps_network_config_token(struct wpa_supplicant *wpa_s,
int ndef, struct wpa_ssid * ssid);
struct wpabuf * wpas_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
@@ -156,6 +157,10 @@ wpas_wps_reenable_networks_pending(struct wpa_supplicant *wpa_s)
return 0;
}
+static inline void wpas_wps_update_mac_addr(struct wpa_supplicant *wpa_s)
+{
+}
+
#endif /* CONFIG_WPS */
#endif /* WPS_SUPPLICANT_H */