]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Clean up group formation on network block removal
authorJouni Malinen <j@w1.fi>
Sat, 10 Dec 2011 10:56:42 +0000 (12:56 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 10 Dec 2011 10:56:42 +0000 (12:56 +0200)
If a P2P group network block is removed for any reason (e.g., wps_cancel
command) while the interface is in group formation, remove the group
formation timeout and indicate failure immediately. Previously, this
type of operations could end up leaving the timeout running and result
in somewhat unexpected group formation failure events later.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpa_supplicant/notify.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/p2p_supplicant.h

index cf8234654ff497c89051e3e4d420a1c53bfb7a25..196ae8f5c893adbb30912217b8e464881bf1ca19 100644 (file)
@@ -252,6 +252,9 @@ void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
                wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
        if (wpa_s->global->p2p_group_formation != wpa_s)
                wpas_dbus_unregister_network(wpa_s, ssid->id);
+#ifdef CONFIG_P2P
+       wpas_p2p_network_removed(wpa_s, ssid);
+#endif /* CONFIG_P2P */
 }
 
 
index 4ce04321aaf3451474fad19b677fbe23b5aeae3e..c2095ea6a47fec184c2ff6073c4f417a914c209e 100644 (file)
@@ -4215,3 +4215,17 @@ int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s)
 
        return p2p_in_progress(wpa_s->global->p2p);
 }
+
+
+void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s,
+                             struct wpa_ssid *ssid)
+
+{
+       if (wpa_s->p2p_in_provisioning && ssid->p2p_group &&
+           eloop_cancel_timeout(wpas_p2p_group_formation_timeout,
+                                wpa_s->parent, NULL) > 0) {
+               wpa_printf(MSG_DEBUG, "P2P: Canceled group formation due to "
+                          "P2P group network getting removed");
+               wpas_p2p_group_formation_timeout(wpa_s->parent, NULL);
+       }
+}
index 6afc4bb060d4b38ff900233213cdbf953810ad51..91400a620e6d0bf9c1cd1f0b85908998d1555467 100644 (file)
@@ -129,5 +129,7 @@ int wpas_p2p_disconnect(struct wpa_supplicant *wpa_s);
 void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s,
                         struct wps_event_fail *fail);
 int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s);
+void wpas_p2p_network_removed(struct wpa_supplicant *wpa_s,
+                             struct wpa_ssid *ssid);
 
 #endif /* P2P_SUPPLICANT_H */