P2P: Deauth p2p client just after dbus notify
authorEduardo Abinader <eduardo.abinader@openbossa.org>
Thu, 21 Aug 2014 03:30:24 +0000 (23:30 -0400)
committerJouni Malinen <j@w1.fi>
Sun, 7 Sep 2014 16:50:32 +0000 (19:50 +0300)
Currently to signal PropertiesChanged upon group client
removal (group property), wpa_supplicant dbus uses wpa_s
members like go_dev_addr and current_ssid, for instance.
Thus, deferring p2p client deauth to after dbus notify,
but keeping the same order as before, solves the issue,
as wpa_s is not yet completely deinitialized.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
wpa_supplicant/p2p_supplicant.c

index c77ae6a..5d63de3 100644 (file)
@@ -449,11 +449,16 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
                 (ssid && ssid->mode == WPAS_MODE_INFRA)) {
                wpa_s->reassociate = 0;
                wpa_s->disconnected = 1;
-               wpa_supplicant_deauthenticate(wpa_s,
-                                             WLAN_REASON_DEAUTH_LEAVING);
                gtype = "client";
        } else
                gtype = "GO";
+
+       if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid)
+               wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);
+
+       if (os_strcmp(gtype, "client") == 0)
+               wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+
        if (wpa_s->cross_connect_in_use) {
                wpa_s->cross_connect_in_use = 0;
                wpa_msg_global(wpa_s->parent, MSG_INFO,
@@ -511,9 +516,6 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
         */
        wpa_s->global->p2p_go_wait_client.sec = 0;
 
-       if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid)
-               wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);
-
        if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
                struct wpa_global *global;
                char *ifname;