P2P: introduce force_go_bssid bool to avoid changing p2p join behavior
ag/20449626 along with ag/20449628 change the behavior for re-invocation
of auto GOs with the following mechanism:
1. Client device connects to GO and persists ssid block.
2. Now that ssid->bssid is used for connection to auto GO the same BSSID
is enforced.
3. GO spawns with a different BSSID from the original invocation, and
client device can no longer connect.
This should have no effect on Nearby behavior.
Bug: 233925359
Test: Nearby share still works
Test: Persistent connection is broken and works with this patch
Change-Id: I8cd9a8181a2f899e70a41586b131b906c94160ce
diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp
index 805ece2..ce945a4 100644
--- a/wpa_supplicant/aidl/p2p_iface.cpp
+++ b/wpa_supplicant/aidl/p2p_iface.cpp
@@ -194,7 +194,7 @@
if (wpas_p2p_group_add_persistent(
wpa_s, wpa_network, 0, 0, freq, 0, ht40, vht,
- CONF_OPER_CHWIDTH_USE_HT, he, 0, NULL, 0, 0, is6GhzAllowed(wpa_s), P2P_JOIN_LIMIT)) {
+ CONF_OPER_CHWIDTH_USE_HT, he, 0, NULL, 0, 0, is6GhzAllowed(wpa_s), P2P_JOIN_LIMIT, true)) {
ret = -1;
}
@@ -1574,7 +1574,7 @@
} else if (ssid->disabled == 2) {
if (wpas_p2p_group_add_persistent(
wpa_s, ssid, 0, 0, 0, 0, ht40, vht,
- CONF_OPER_CHWIDTH_USE_HT, he, edmg, NULL, 0, 0, is6GhzAllowed(wpa_s), 0)) {
+ CONF_OPER_CHWIDTH_USE_HT, he, edmg, NULL, 0, 0, is6GhzAllowed(wpa_s), 0, false)) {
return createStatus(SupplicantStatusCode::FAILURE_NETWORK_UNKNOWN);
} else {
return ndk::ScopedAStatus::ok();
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 314d741..7586feb 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -6879,7 +6879,7 @@
return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq,
vht_center_freq2, 0, ht40, vht,
vht_chwidth, he, edmg,
- NULL, 0, 0, allow_6ghz, 0);
+ NULL, 0, 0, allow_6ghz, 0, false);
}
diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
index 370aee2..9d1728c 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c
@@ -356,6 +356,7 @@
int persistent_group = 0;
int freq = 0;
int retry_limit = 0;
+ int force_go_bssid = 0;
char *iface = NULL;
unsigned int group_id = 0;
struct wpa_ssid *ssid;
@@ -382,6 +383,9 @@
retry_limit = entry.int32_value;
if (retry_limit <= 0)
goto inv_args_clear;
+ } else if (os_strcmp(entry.key, "force_go_bssid") == 0 &&
+ entry.type == DBUS_TYPE_BOOLEAN) {
+ force_go_bssid = entry.bool_value;
} else if (os_strcmp(entry.key, "persistent_group_object") ==
0 &&
entry.type == DBUS_TYPE_OBJECT_PATH)
@@ -432,7 +436,8 @@
if (wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq, 0, 0, 0,
0, 0, 0, 0, NULL, 0, 0,
- false, retry_limit)) {
+ false, retry_limit,
+ force_go_bssid)) {
reply = wpas_dbus_error_unknown_error(
message,
"Failed to reinvoke a persistent group");
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index ab1555e..a505e4f 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3309,7 +3309,8 @@
wpa_s->conf->p2p_go_he,
wpa_s->conf->p2p_go_edmg, NULL,
go ? P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : 0,
- 1, is_p2p_allow_6ghz(wpa_s->global->p2p), 0);
+ 1, is_p2p_allow_6ghz(wpa_s->global->p2p), 0,
+ false);
} else if (bssid) {
wpa_s->user_initiated_pd = 0;
wpa_msg_global(wpa_s, MSG_INFO,
@@ -3539,7 +3540,8 @@
ssid->mode == WPAS_MODE_P2P_GO ?
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE :
0, 1,
- is_p2p_allow_6ghz(wpa_s->global->p2p), 0);
+ is_p2p_allow_6ghz(wpa_s->global->p2p), 0,
+ false);
}
@@ -4619,7 +4621,7 @@
persistent_go->mode ==
WPAS_MODE_P2P_GO ?
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE :
- 0, 0, false, 0);
+ 0, 0, false, 0, false);
} else if (response_done) {
wpas_p2p_group_add(wpa_s, 1, freq,
0, 0, 0, 0, 0, 0, false);
@@ -4742,7 +4744,7 @@
NULL,
persistent_go->mode == WPAS_MODE_P2P_GO ?
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE : 0, 0,
- is_p2p_allow_6ghz(wpa_s->global->p2p), 0);
+ is_p2p_allow_6ghz(wpa_s->global->p2p), 0, false);
} else {
wpas_p2p_group_add(wpa_s, 1, freq, 0, 0, 0, 0, 0, 0,
is_p2p_allow_6ghz(wpa_s->global->p2p));
@@ -6971,7 +6973,8 @@
static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s,
struct wpa_ssid *params, int addr_allocated,
- int freq, int force_scan, int retry_limit)
+ int freq, int force_scan, int retry_limit,
+ bool force_go_bssid)
{
struct wpa_ssid *ssid;
int other_iface_found = 0;
@@ -7014,7 +7017,7 @@
if (params->passphrase)
ssid->passphrase = os_strdup(params->passphrase);
- if (params->bssid_set) {
+ if (force_go_bssid && params->bssid_set) {
ssid->bssid_set = 1;
os_memcpy(ssid->bssid, params->bssid, ETH_ALEN);
}
@@ -7065,7 +7068,8 @@
int edmg,
const struct p2p_channels *channels,
int connection_timeout, int force_scan,
- bool allow_6ghz, int retry_limit)
+ bool allow_6ghz, int retry_limit,
+ bool force_go_bssid)
{
struct p2p_go_neg_results params;
int go = 0, freq;
@@ -7134,7 +7138,8 @@
}
return wpas_start_p2p_client(wpa_s, ssid, addr_allocated, freq,
- force_scan, retry_limit);
+ force_scan, retry_limit,
+ force_go_bssid);
} else {
return -1;
}
diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h
index 949044a..c87e1bf 100644
--- a/wpa_supplicant/p2p_supplicant.h
+++ b/wpa_supplicant/p2p_supplicant.h
@@ -52,7 +52,8 @@
int max_oper_chwidth, int he, int edmg,
const struct p2p_channels *channels,
int connection_timeout, int force_scan,
- bool allow_6ghz, int retry_limit);
+ bool allow_6ghz, int retry_limit,
+ bool force_go_bssid);
struct p2p_group * wpas_p2p_group_init(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
enum wpas_p2p_prov_disc_use {