Merge "P2P: get cached scan results on iface creation to avoid scan"
diff --git a/hostapd/aidl/hostapd.cpp b/hostapd/aidl/hostapd.cpp
index 91a0a7e..f2200d6 100644
--- a/hostapd/aidl/hostapd.cpp
+++ b/hostapd/aidl/hostapd.cpp
@@ -547,17 +547,18 @@
iface_params.hwModeParams.enable80211AC ? 2 : 0);
break;
default:
- if (!is_2Ghz_band_only && !is_60Ghz_used
- && iface_params.hwModeParams.enable80211AC) {
- ht_cap_vht_oper_he_oper_chwidth_as_string =
+ if (!is_2Ghz_band_only && !is_60Ghz_used) {
+ if (iface_params.hwModeParams.enable80211AC) {
+ ht_cap_vht_oper_he_oper_chwidth_as_string =
"ht_capab=[HT40+]\n"
"vht_oper_chwidth=1\n";
- }
+ }
#ifdef CONFIG_IEEE80211AX
- if (iface_params.hwModeParams.enable80211AX && !is_60Ghz_used) {
- ht_cap_vht_oper_he_oper_chwidth_as_string += "he_oper_chwidth=1";
- }
+ if (iface_params.hwModeParams.enable80211AX) {
+ ht_cap_vht_oper_he_oper_chwidth_as_string += "he_oper_chwidth=1";
+ }
#endif
+ }
break;
}
diff --git a/src/ap/acs.c b/src/ap/acs.c
index 7708bc2..57fc6da 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -994,6 +994,14 @@
if (iface->conf->ieee80211ac || iface->conf->ieee80211ax)
acs_adjust_center_freq(iface);
+ err = hostapd_select_hw_mode(iface);
+ if (err) {
+ wpa_printf(MSG_ERROR, "ACS: Could not (err: %d) select hw_mode for freq=%d channel=%d",
+ err, iface->freq, iface->conf->channel);
+ err = -1;
+ goto fail;
+ }
+
err = 0;
fail:
/*
diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c
index 8ee2033..db46d95 100644
--- a/src/eap_peer/eap.c
+++ b/src/eap_peer/eap.c
@@ -2850,8 +2850,9 @@
}
/* Look for the realm of the anonymous identity. */
- realm = strnchr(config->anonymous_identity,
- config->anonymous_identity_len, '@');
+ identity = config->anonymous_identity;
+ identity_len = config->anonymous_identity_len;
+ realm = strnchr(identity, identity_len, '@');
if (NULL != realm) {
wpa_printf(MSG_DEBUG, "Get the realm from anonymous identity.");
*len = identity_len - (realm - identity);
@@ -2859,8 +2860,9 @@
}
/* Look for the realm of the real identity. */
- realm = strnchr(config->imsi_identity,
- config->imsi_identity_len, '@');
+ identity = config->imsi_identity;
+ identity_len = config->imsi_identity_len;
+ realm = strnchr(identity, identity_len, '@');
if (NULL != realm) {
wpa_printf(MSG_DEBUG, "Get the realm from IMSI identity.");
*len = identity_len - (realm - identity);
diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp
index d2276eb..1fd015b 100644
--- a/wpa_supplicant/aidl/p2p_iface.cpp
+++ b/wpa_supplicant/aidl/p2p_iface.cpp
@@ -468,7 +468,7 @@
if (wpas_p2p_group_add_persistent(
wpa_s, wpa_network, 0, 0, 0, 0, ht40, vht,
- CHANWIDTH_USE_HT, he, 0, NULL, 0, 0, is6GhzAllowed(wpa_s))) {
+ CONF_OPER_CHWIDTH_USE_HT, he, 0, NULL, 0, 0, is6GhzAllowed(wpa_s))) {
ret = -1;
}
@@ -1303,13 +1303,14 @@
int he = wpa_s->conf->p2p_go_he;
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ int edmg = wpa_s->conf->p2p_go_edmg;
const char* pin =
pre_selected_pin.length() > 0 ? pre_selected_pin.data() : nullptr;
bool auto_join = !join_existing_group;
int new_pin = wpas_p2p_connect(
wpa_s, peer_address.data(), pin, wps_method, persistent, auto_join,
join_existing_group, false, go_intent_signed, 0, 0, -1, false, ht40,
- vht, CHANWIDTH_USE_HT, he, 0, nullptr, 0, is6GhzAllowed(wpa_s));
+ vht, CONF_OPER_CHWIDTH_USE_HT, he, edmg, nullptr, 0, is6GhzAllowed(wpa_s));
if (new_pin < 0) {
return {"", createStatus(SupplicantStatusCode::FAILURE_UNKNOWN)};
}
@@ -1409,6 +1410,7 @@
int he = wpa_s->conf->p2p_go_he;
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ int edmg = wpa_s->conf->p2p_go_edmg;
struct wpa_ssid* ssid =
wpa_config_get_network(wpa_s->conf, persistent_network_id);
if (ssid == NULL || ssid->disabled != 2) {
@@ -1416,7 +1418,7 @@
}
if (wpas_p2p_invite(
wpa_s, peer_address.data(), ssid, NULL, 0, 0, ht40, vht,
- CHANWIDTH_USE_HT, 0, he, 0, is6GhzAllowed(wpa_s))) {
+ CONF_OPER_CHWIDTH_USE_HT, 0, he, edmg, is6GhzAllowed(wpa_s))) {
return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
}
return ndk::ScopedAStatus::ok();
@@ -1853,12 +1855,13 @@
int he = wpa_s->conf->p2p_go_he;
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ int edmg = wpa_s->conf->p2p_go_edmg;
struct wpa_ssid* ssid =
wpa_config_get_network(wpa_s->conf, persistent_network_id);
if (ssid == NULL) {
if (wpas_p2p_group_add(
wpa_s, persistent, 0, 0, ht40, vht,
- CHANWIDTH_USE_HT, he, 0, is6GhzAllowed(wpa_s))) {
+ CONF_OPER_CHWIDTH_USE_HT, he, edmg, is6GhzAllowed(wpa_s))) {
return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
} else {
return ndk::ScopedAStatus::ok();
@@ -1866,7 +1869,7 @@
} else if (ssid->disabled == 2) {
if (wpas_p2p_group_add_persistent(
wpa_s, ssid, 0, 0, 0, 0, ht40, vht,
- CHANWIDTH_USE_HT, he, 0, NULL, 0, 0, is6GhzAllowed(wpa_s))) {
+ CONF_OPER_CHWIDTH_USE_HT, he, edmg, NULL, 0, 0, is6GhzAllowed(wpa_s))) {
return createStatus(SupplicantStatusCode::FAILURE_NETWORK_UNKNOWN);
} else {
return ndk::ScopedAStatus::ok();
@@ -1884,6 +1887,7 @@
int he = wpa_s->conf->p2p_go_he;
int vht = wpa_s->conf->p2p_go_vht;
int ht40 = wpa_s->conf->p2p_go_ht40 || vht;
+ int edmg = wpa_s->conf->p2p_go_edmg;
if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) {
return createStatus(SupplicantStatusCode::FAILURE_IFACE_DISABLED);
@@ -1911,7 +1915,7 @@
if (wpas_p2p_group_add(
wpa_s, persistent, freq, 0, ht40, vht,
- CHANWIDTH_USE_HT, he, 0, is6GhzAllowed(wpa_s))) {
+ CONF_OPER_CHWIDTH_USE_HT, he, edmg, is6GhzAllowed(wpa_s))) {
return createStatus(SupplicantStatusCode::FAILURE_UNKNOWN);
}
return ndk::ScopedAStatus::ok();
diff --git a/wpa_supplicant/aidl/sta_network.cpp b/wpa_supplicant/aidl/sta_network.cpp
index fe4a760..61c71a1 100644
--- a/wpa_supplicant/aidl/sta_network.cpp
+++ b/wpa_supplicant/aidl/sta_network.cpp
@@ -2142,6 +2142,7 @@
return ndk::ScopedAStatus::ok();
}
+ new_entry->external = true;
wpa_sm_pmksa_cache_add_entry(wpa_s->wpa, new_entry);
return ndk::ScopedAStatus::ok();
@@ -2160,6 +2161,7 @@
if (key_mgmt_mask & WPA_KEY_MGMT_OWE) {
// Do not allow to connect to Open network when OWE is selected
wpa_ssid->owe_only = 1;
+ wpa_ssid->owe_ptk_workaround = 1;
}
wpa_ssid->key_mgmt = key_mgmt_mask;
wpa_printf(MSG_MSGDUMP, "key_mgmt: 0x%x", wpa_ssid->key_mgmt);
@@ -2488,6 +2490,26 @@
key_mgmt_mask |= WPA_KEY_MGMT_FT_SAE;
}
#endif
+#ifdef CONFIG_FILS
+ if ((key_mgmt_mask & WPA_KEY_MGMT_FILS_SHA256) &&
+ (capa.key_mgmt_iftype[WPA_IF_STATION] &
+ WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA256)) {
+ key_mgmt_mask |= WPA_KEY_MGMT_FT_FILS_SHA256;
+ }
+
+ if ((key_mgmt_mask & WPA_KEY_MGMT_FILS_SHA384) &&
+ (capa.key_mgmt_iftype[WPA_IF_STATION] &
+ WPA_DRIVER_CAPA_KEY_MGMT_FT_FILS_SHA384)) {
+ key_mgmt_mask |= WPA_KEY_MGMT_FT_FILS_SHA384;
+ }
+#endif
+#ifdef CONFIG_SUITEB192
+ if ((key_mgmt_mask & WPA_KEY_MGMT_IEEE8021X_SUITE_B_192) &&
+ (capa.key_mgmt_iftype[WPA_IF_STATION] &
+ WPA_DRIVER_CAPA_KEY_MGMT_FT_802_1X_SHA384)) {
+ key_mgmt_mask |= WPA_KEY_MGMT_FT_IEEE8021X_SHA384;
+ }
+#endif
#endif
}
@@ -2512,6 +2534,20 @@
key_mgmt_mask &= ~WPA_KEY_MGMT_FT_SAE;
}
#endif
+#ifdef CONFIG_FILS
+ if (key_mgmt_mask & WPA_KEY_MGMT_FILS_SHA256) {
+ key_mgmt_mask &= ~WPA_KEY_MGMT_FT_FILS_SHA256;
+ }
+
+ if (key_mgmt_mask & WPA_KEY_MGMT_FILS_SHA384) {
+ key_mgmt_mask &= ~WPA_KEY_MGMT_FT_FILS_SHA384;
+ }
+#endif
+#ifdef CONFIG_SUITEB192
+ if (key_mgmt_mask & WPA_KEY_MGMT_IEEE8021X_SUITE_B_192) {
+ key_mgmt_mask &= ~WPA_KEY_MGMT_FT_IEEE8021X_SHA384;
+ }
+#endif
#endif
}
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 0261362..bee4fe7 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -414,7 +414,9 @@
}
}
- if (conf->secondary_channel) {
+ if (wpa_s->p2p_go_no_pri_sec_switch) {
+ conf->no_pri_sec_switch = 1;
+ } else if (conf->secondary_channel) {
struct wpa_supplicant *iface;
for (iface = wpa_s->global->ifaces; iface; iface = iface->next)
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index a8cab8d..ce20970 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -6909,6 +6909,7 @@
bool allow_6ghz)
{
struct p2p_go_neg_results params;
+ int selected_freq = 0;
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return -1;
@@ -6923,12 +6924,12 @@
wpas_p2p_stop_find_oper(wpa_s);
if (!wpa_s->p2p_go_do_acs) {
- freq = wpas_p2p_select_go_freq(wpa_s, freq);
- if (freq < 0)
+ selected_freq = wpas_p2p_select_go_freq(wpa_s, freq);
+ if (selected_freq < 0)
return -1;
}
- if (wpas_p2p_init_go_params(wpa_s, ¶ms, freq, vht_center_freq2,
+ if (wpas_p2p_init_go_params(wpa_s, ¶ms, selected_freq, vht_center_freq2,
ht40, vht, max_oper_chwidth, he, edmg,
NULL))
return -1;
@@ -6939,6 +6940,8 @@
wpa_s = wpas_p2p_get_group_iface(wpa_s, 0, 1);
if (wpa_s == NULL)
return -1;
+ if (freq > 0)
+ wpa_s->p2p_go_no_pri_sec_switch = 1;
wpas_start_wps_go(wpa_s, ¶ms, 0);
return 0;
@@ -7080,6 +7083,7 @@
freq = wpas_p2p_select_go_freq(wpa_s, force_freq);
if (freq < 0)
return -1;
+ wpa_s->p2p_go_no_pri_sec_switch = 1;
} else {
freq = wpas_p2p_select_go_freq(wpa_s, neg_freq);
if (freq < 0 ||
@@ -9697,9 +9701,6 @@
if (!wpa_s->conf->p2p_optimize_listen_chan)
return;
- if (!wpa_s->current_ssid || wpa_s->wpa_state != WPA_COMPLETED)
- return;
-
curr_chan = p2p_get_listen_channel(wpa_s->global->p2p);
for (i = 0, cand = 0; i < num; i++) {
ieee80211_freq_to_chan(freqs[i].freq, &chan);
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 78efba0..c63f3b2 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1908,7 +1908,9 @@
#ifdef CONFIG_DRIVER_NL80211_BRCM
if ((wpa_s->key_mgmt & WPA_KEY_MGMT_CROSS_AKM_ROAM) &&
- IS_CROSS_AKM_ROAM_KEY_MGMT(ssid->key_mgmt)) {
+ IS_CROSS_AKM_ROAM_KEY_MGMT(ssid->key_mgmt) &&
+ (wpa_s->group_cipher == WPA_CIPHER_CCMP) &&
+ (wpa_s->pairwise_cipher == WPA_CIPHER_CCMP)) {
wpa_s->key_mgmt = WPA_KEY_MGMT_SAE | WPA_KEY_MGMT_PSK;
wpa_dbg(wpa_s, MSG_INFO,
"WPA: Updating to KEY_MGMT SAE+PSK for seamless roaming");
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 231c7ab..047e88d 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1161,6 +1161,7 @@
unsigned int user_initiated_pd:1;
unsigned int p2p_go_group_formation_completed:1;
unsigned int group_formation_reported:1;
+ unsigned int p2p_go_no_pri_sec_switch:1;
unsigned int waiting_presence_resp;
int p2p_first_connection_timeout;
unsigned int p2p_nfc_tag_enabled:1;
diff --git a/wpa_supplicant/wpa_supplicant_template.conf b/wpa_supplicant/wpa_supplicant_template.conf
index 7a558f3..a1846b1 100644
--- a/wpa_supplicant/wpa_supplicant_template.conf
+++ b/wpa_supplicant/wpa_supplicant_template.conf
@@ -7,3 +7,4 @@
p2p_add_cli_chan=1
oce=1
sae_pwe=2
+p2p_optimize_listen_chan=1