P2P: allow persistent group join retry limit to be configured via D-Bus
Bug: 233925359
Test: Configured limit to 3, connection failed after 3 scan attempts
Change-Id: Ie85c75282b9d1933e2cbd7a78969eca1520c5c81
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 0bfb962..0d59b79 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -996,6 +996,7 @@
}
wpa_s->p2p_in_invitation = 0;
+ wpa_s->p2p_retry_limit = 0;
eloop_cancel_timeout(wpas_p2p_move_go, wpa_s, NULL);
eloop_cancel_timeout(wpas_p2p_reconsider_moving_go, wpa_s, NULL);
@@ -1390,6 +1391,7 @@
wpa_s->p2p_in_provisioning = 0;
}
wpa_s->p2p_in_invitation = 0;
+ wpa_s->p2p_retry_limit = 0;
wpa_s->group_formation_reported = 1;
if (!success) {
@@ -2407,6 +2409,21 @@
}
+bool wpas_p2p_retry_limit_exceeded(struct wpa_supplicant *wpa_s)
+{
+ if (!wpa_s->p2p_in_invitation || !wpa_s->p2p_retry_limit ||
+ wpa_s->p2p_in_invitation <= wpa_s->p2p_retry_limit) {
+ return false;
+ }
+ wpa_printf(MSG_DEBUG, "P2P: Group join retry limit exceeded");
+ eloop_cancel_timeout(wpas_p2p_group_formation_timeout,
+ wpa_s->p2pdev, NULL);
+ eloop_register_timeout(0, 0, wpas_p2p_group_formation_timeout,
+ wpa_s->p2pdev, NULL);
+ return true;
+}
+
+
static void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
{
struct wpa_supplicant *wpa_s = ctx;
@@ -3292,7 +3309,7 @@
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));
+ 1, is_p2p_allow_6ghz(wpa_s->global->p2p), 0);
} else if (bssid) {
wpa_s->user_initiated_pd = 0;
wpa_msg_global(wpa_s, MSG_INFO,
@@ -3522,7 +3539,7 @@
ssid->mode == WPAS_MODE_P2P_GO ?
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE :
0, 1,
- is_p2p_allow_6ghz(wpa_s->global->p2p));
+ is_p2p_allow_6ghz(wpa_s->global->p2p), 0);
}
@@ -4602,7 +4619,7 @@
persistent_go->mode ==
WPAS_MODE_P2P_GO ?
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE :
- 0, 0, false);
+ 0, 0, false, 0);
} else if (response_done) {
wpas_p2p_group_add(wpa_s, 1, freq,
0, 0, 0, 0, 0, 0, false);
@@ -4725,7 +4742,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));
+ is_p2p_allow_6ghz(wpa_s->global->p2p), 0);
} else {
wpas_p2p_group_add(wpa_s, 1, freq, 0, 0, 0, 0, 0, 0,
is_p2p_allow_6ghz(wpa_s->global->p2p));
@@ -6954,7 +6971,7 @@
static int wpas_start_p2p_client(struct wpa_supplicant *wpa_s,
struct wpa_ssid *params, int addr_allocated,
- int freq, int force_scan)
+ int freq, int force_scan, int retry_limit)
{
struct wpa_ssid *ssid;
int other_iface_found = 0;
@@ -6999,6 +7016,7 @@
wpa_s->show_group_started = 1;
wpa_s->p2p_in_invitation = 1;
+ wpa_s->p2p_retry_limit = retry_limit;
wpa_s->p2p_invite_go_freq = freq;
wpa_s->p2p_go_group_formation_completed = 0;
wpa_s->global->p2p_group_formation = wpa_s;
@@ -7042,7 +7060,7 @@
int edmg,
const struct p2p_channels *channels,
int connection_timeout, int force_scan,
- bool allow_6ghz)
+ bool allow_6ghz, int retry_limit)
{
struct p2p_go_neg_results params;
int go = 0, freq;
@@ -7111,7 +7129,7 @@
}
return wpas_start_p2p_client(wpa_s, ssid, addr_allocated, freq,
- force_scan);
+ force_scan, retry_limit);
} else {
return -1;
}
@@ -7867,6 +7885,7 @@
wpa_s->global->p2p_group_formation = NULL;
wpa_s->p2p_in_provisioning = 0;
wpa_s->p2p_in_invitation = 0;
+ wpa_s->p2p_retry_limit = 0;
}
os_memset(go_dev_addr, 0, ETH_ALEN);
@@ -8696,6 +8715,7 @@
wpa_s->global->p2p_group_formation = NULL;
wpa_s->p2p_in_provisioning = 0;
wpa_s->p2p_in_invitation = 0;
+ wpa_s->p2p_retry_limit = 0;
}
wpa_s->global->p2p_go_wait_client.sec = 0;
if (addr == NULL)