From eab2b50dc83e1d14dcb573dfc9b10fc6a9cb1cdd Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 14 Sep 2013 10:39:50 -0700 Subject: [PATCH] P2P: Cancel group formation timeout on client connection It was possiblle for the group formation timeout to be left running even after the P2P Client connected to the group if the WPS provisioning step was not completed cleanly (e.g., due to WSC_Done not getting received from the client). There is no need to remove the group in such case due to the initial group formation timeout, so work around this by removing that timeout on data connection. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 9338ad5b0..882c1d581 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -5945,6 +5945,16 @@ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s, void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s, const u8 *addr) { + if (eloop_cancel_timeout(wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL) > 0) { + /* + * 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. + */ + wpa_printf(MSG_DEBUG, "P2P: Workaround - cancelled P2P group formation timeout on data connection"); + } wpa_s->global->p2p_go_wait_client.sec = 0; if (addr == NULL) return;