P2P: Remove P2P groups on process termination
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 25 Sep 2013 22:38:30 +0000 (01:38 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 25 Sep 2013 22:38:30 +0000 (01:38 +0300)
Killing the wpa_supplicant process or using TERMINATE ctrl_iface command
resulted in the process existing without cleaning up possibly added
dynamic P2P group interfaces. Clean this up by stopping each P2P group
before stopping eloop.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/wpa_supplicant.c

index 334ccc9..eab1c39 100644 (file)
@@ -716,6 +716,11 @@ void wpa_supplicant_terminate_proc(struct wpa_global *global)
 #ifdef CONFIG_WPS
        struct wpa_supplicant *wpa_s = global->ifaces;
        while (wpa_s) {
+#ifdef CONFIG_P2P
+               if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE ||
+                   (wpa_s->current_ssid && wpa_s->current_ssid->p2p_group))
+                       wpas_p2p_disconnect(wpa_s);
+#endif /* CONFIG_P2P */
                if (wpas_wps_terminate_pending(wpa_s) == 1)
                        pending = 1;
                wpa_s = wpa_s->next;