]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move ctrl_iface deinit into the end of interface deinit
authorDmitry Shmidt <dimitrysh@google.com>
Sun, 29 Jan 2012 18:21:07 +0000 (20:21 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Jan 2012 18:21:07 +0000 (20:21 +0200)
This allows TERMINATING ctrl_iface event to be sent at the end of the
deinit sequence to avoid race conditions with new operations that this
event may trigger while wpa_supplicant would still be running through
the deinitialization path.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
wpa_supplicant/wpa_supplicant.c

index 6d622b82bb6c8ad290e93d1a2adde41e92632246..b686c529bda430e576473a1ff8421c0bbf7b7ea2 100644 (file)
@@ -400,16 +400,10 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
                wpa_s->l2_br = NULL;
        }
 
-       if (wpa_s->ctrl_iface) {
-               wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
-               wpa_s->ctrl_iface = NULL;
-       }
        if (wpa_s->conf != NULL) {
                struct wpa_ssid *ssid;
                for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
                        wpas_notify_network_removed(wpa_s, ssid);
-               wpa_config_free(wpa_s->conf);
-               wpa_s->conf = NULL;
        }
 
        os_free(wpa_s->confname);
@@ -2419,6 +2413,19 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
 
        if (notify)
                wpas_notify_iface_removed(wpa_s);
+
+       if (terminate)
+               wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
+
+       if (wpa_s->ctrl_iface) {
+               wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
+               wpa_s->ctrl_iface = NULL;
+       }
+
+       if (wpa_s->conf != NULL) {
+               wpa_config_free(wpa_s->conf);
+               wpa_s->conf = NULL;
+       }
 }