]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Report group removal reason PSK_FAILURE in timeout case
authorJouni Malinen <j@w1.fi>
Thu, 9 Oct 2014 22:31:57 +0000 (01:31 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 9 Oct 2014 22:31:57 +0000 (01:31 +0300)
It was possible for group formation timeout to be the trigger for
detecting the second PSK/4-way handshake failure. If that happened, the
special reason=PSK_FAILURE was not used in the P2P-GROUP-REMOVED event
even though P2P-PERSISTENT-PSK-FAIL did get reported. Fix this special
case by replacing the reason code with PSK_FAILURE if the PSK failure
timeout gets registed as part of the disconnection processing in the
formation timeout handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/p2p_supplicant.c

index 70a638293c3981a28b7543a9041212f2e002553b..d19efa25e74b0188bc92568f5c24674659791537 100644 (file)
@@ -467,8 +467,17 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
        if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid)
                wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);
 
-       if (os_strcmp(gtype, "client") == 0)
+       if (os_strcmp(gtype, "client") == 0) {
                wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+               if (eloop_is_timeout_registered(wpas_p2p_psk_failure_removal,
+                                               wpa_s, NULL)) {
+                       wpa_printf(MSG_DEBUG,
+                                  "P2P: PSK failure removal was scheduled, so use PSK failure as reason for group removal");
+                       removal_reason = P2P_GROUP_REMOVAL_PSK_FAILURE;
+                       eloop_cancel_timeout(wpas_p2p_psk_failure_removal,
+                                            wpa_s, NULL);
+               }
+       }
 
        if (wpa_s->cross_connect_in_use) {
                wpa_s->cross_connect_in_use = 0;