aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-10-07 13:31:04 +0530
committerDeepthi Gowri <deepthi@codeaurora.org>2013-10-07 13:31:04 +0530
commit67cceb9a375efc9067d3561501490bb0b50b9a15 (patch)
treeddbacb1d7f555c5aa5c2d4d764ed158935f5fc32
parent05e3dd4de12248a8f859e9202d6aa5c7e640bf28 (diff)
downloadandroid_external_wpa_supplicant_8-67cceb9a375efc9067d3561501490bb0b50b9a15.tar.gz
android_external_wpa_supplicant_8-67cceb9a375efc9067d3561501490bb0b50b9a15.tar.bz2
android_external_wpa_supplicant_8-67cceb9a375efc9067d3561501490bb0b50b9a15.zip
P2P: Extend group formation timeout on GO to first data connection
Previously, GO considered the group to be fully formed at the completed of WPS provisioning step. This would leave the group running until idle timeout (which may not be enabled) or explicit removal if the client fails to connect for any reason. Since the client is expected to connect immediately after the WPS provisioning step, extend group formation timeout to cover that period until the first successfully completed data connection. This allows the GO to remove the group automatically if the client devices does not connect within P2P_MAX_INITIAL_CONN_WAIT_GO (10) seconds. Change-Id: Ia33cbf738490d89263c80a39d9044500a847b470 CRs-Fixed: 538026 Git-commit: 41f853235fe1d1fad1acecc0ee5dfe81c872c6b2 Git-repo: git://w1.fi/srv/git/hostap.git Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
-rw-r--r--wpa_supplicant/p2p_supplicant.c39
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h1
2 files changed, 36 insertions, 4 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index ab164f64..f6edc54a 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -663,8 +663,10 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
*/
if (wpa_s->global->p2p_group_formation)
wpa_s = wpa_s->global->p2p_group_formation;
- wpa_s->global->p2p_group_formation = NULL;
- wpa_s->p2p_in_provisioning = 0;
+ if (wpa_s->p2p_go_group_formation_completed) {
+ wpa_s->global->p2p_group_formation = NULL;
+ wpa_s->p2p_in_provisioning = 0;
+ }
if (!success) {
wpa_msg(wpa_s->parent, MSG_INFO,
@@ -4601,6 +4603,7 @@ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
eloop_cancel_timeout(wpas_p2p_group_formation_timeout, wpa_s->parent,
NULL);
+ wpa_s->p2p_go_group_formation_completed = 1;
if (ssid && ssid->mode == WPAS_MODE_INFRA) {
/*
* Use a separate timeout for initial data connection to
@@ -4608,9 +4611,28 @@ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
* something goes wrong in this step before the P2P group idle
* timeout mechanism is taken into use.
*/
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ "P2P: Re-start group formation timeout (%d seconds) as client for initial connection",
+ P2P_MAX_INITIAL_CONN_WAIT);
eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT, 0,
wpas_p2p_group_formation_timeout,
wpa_s->parent, NULL);
+ } else if (ssid) {
+ /*
+ * Use a separate timeout for initial data connection to
+ * complete to allow the group to be removed automatically if
+ * the client does not complete data connection successfully.
+ */
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ "P2P: Re-start group formation timeout (%d seconds) as GO for initial connection",
+ P2P_MAX_INITIAL_CONN_WAIT_GO);
+ eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT_GO, 0,
+ wpas_p2p_group_formation_timeout,
+ wpa_s->parent, NULL);
+ /*
+ * Complete group formation on first successful data connection
+ */
+ wpa_s->p2p_go_group_formation_completed = 0;
}
if (wpa_s->global->p2p)
p2p_wps_success_cb(wpa_s->global->p2p, peer_addr);
@@ -5838,9 +5860,18 @@ void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
* This can happen if WPS provisioning step is not terminated
* cleanly (e.g., P2P Client does not send WSC_Done). Since the
* peer was able to connect, there is no need to time out group
- * formation after this, though.
+ * formation after this, though. In addition, this is used with
+ * the initial connection wait on the GO as a separate formation
+ * timeout and as such, expected to be hit after the initial WPS
+ * provisioning step.
*/
- wpa_printf(MSG_DEBUG, "P2P: Workaround - cancelled P2P group formation timeout on data connection");
+ wpa_printf(MSG_DEBUG, "P2P: Canceled P2P group formation timeout on data connection");
+ }
+ if (!wpa_s->p2p_go_group_formation_completed) {
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Marking group formation completed on GO on first data connection");
+ wpa_s->p2p_go_group_formation_completed = 1;
+ wpa_s->global->p2p_group_formation = NULL;
+ wpa_s->p2p_in_provisioning = 0;
}
wpa_s->global->p2p_go_wait_client.sec = 0;
if (addr == NULL)
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index f583626d..f0e1ebe5 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -630,6 +630,7 @@ struct wpa_supplicant {
unsigned int p2p_pd_before_go_neg:1;
unsigned int p2p_go_ht40:1;
unsigned int user_initiated_pd:1;
+ unsigned int p2p_go_group_formation_completed:1;
int p2p_persistent_go_freq;
int p2p_persistent_id;
int p2p_go_intent;