Indicate disconnection event on interface disabled
authorJouni Malinen <j@w1.fi>
Sat, 26 Apr 2014 13:42:45 +0000 (16:42 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 28 Apr 2014 13:54:09 +0000 (16:54 +0300)
It is possible for the disconnection event from the driver to not get
delivered when interface is disabled. To maintain consistent ctrl_iface
event behavior, indicate CTRL-EVENT-DISCONNECTED in such a case if we
were in connected state.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/events.c

index cad0938..e2577bf 100644 (file)
@@ -3362,6 +3362,14 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                }
 #endif /* CONFIG_P2P */
 
+               if (wpa_s->wpa_state >= WPA_AUTHENTICATING) {
+                       /*
+                        * Indicate disconnection to keep ctrl_iface events
+                        * consistent.
+                        */
+                       wpa_supplicant_event_disassoc(
+                               wpa_s, WLAN_REASON_DEAUTH_LEAVING, 1);
+               }
                wpa_supplicant_mark_disassoc(wpa_s);
                radio_remove_works(wpa_s, NULL, 0);