From 2b89da85b8cfe9bb862e8dd334855263c3522c00 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 31 Aug 2012 22:04:41 +0300 Subject: Fix disconnection event processing Commit 0d30cc240fa36905b034dc9676f9d8da0ac18e56 forced wpa_s->current_ssid and wpa_s->key_mgmt to be cleared in wpa_supplicant_mark_disassoc() which gets called from wpa_supplicant_event_disassoc(). This broke IEEE 802.1X authentication failure processing and P2P deauthentication notification (group termination). Fix this by splitting wpa_supplicant_event_disassoc() into two parts and make wpas_p2p_deauth_notif() indicate whether the interface was removed. If so, the last part of disassocition event processing is skipped. Since the wpa_supplicant_mark_disassoc() call is in the second part, the above mentioned issues are resolved. In addition, this cleans up the P2P group interface removal case by not trying to use fast reconnection mechanism just before the interface gets removed. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'wpa_supplicant/p2p_supplicant.c') diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index cfe0433..94a8658 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -374,7 +374,7 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s, if (wpa_s && ifname) wpa_drv_if_remove(wpa_s, type, ifname); os_free(ifname); - return 0; + return 1; } wpa_printf(MSG_DEBUG, "P2P: Remove temporary group network"); @@ -4709,14 +4709,15 @@ static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s) } -void wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, - u16 reason_code, const u8 *ie, size_t ie_len, - int locally_generated) +/* Returns 1 if the interface was removed */ +int wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, + u16 reason_code, const u8 *ie, size_t ie_len, + int locally_generated) { if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) - return; + return 0; if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) - return; + return 0; if (!locally_generated) p2p_deauth_notif(wpa_s->global->p2p, bssid, reason_code, ie, @@ -4728,9 +4729,13 @@ void wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, wpa_s->current_ssid->mode == WPAS_MODE_INFRA) { wpa_printf(MSG_DEBUG, "P2P: GO indicated that the P2P Group " "session is ending"); - wpas_p2p_group_delete(wpa_s, - P2P_GROUP_REMOVAL_GO_ENDING_SESSION); + if (wpas_p2p_group_delete(wpa_s, + P2P_GROUP_REMOVAL_GO_ENDING_SESSION) + > 0) + return 1; } + + return 0; } @@ -5165,7 +5170,8 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s) if (wpa_s == NULL) return -1; - return wpas_p2p_group_delete(wpa_s, P2P_GROUP_REMOVAL_REQUESTED); + return wpas_p2p_group_delete(wpa_s, P2P_GROUP_REMOVAL_REQUESTED) < 0 ? + -1 : 0; } -- cgit v1.1