The network needs to be set disconnected in the callback as the pointer
will be unconditionally cleared in the function. Even with a result of
zero the interface_state() cannot be relied on; it might not be called
by gsupplicant/wpa_supplicant in all cases.

Reported by Thomas Green.
---
 plugins/wifi.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index de176ed..58d8bb2 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2093,19 +2093,10 @@ static void disconnect_callback(int result, 
GSupplicantInterface *interface,
        }
 
        if (wifi->network) {
-               /*
-                * if result < 0 supplican return an error because
-                * the network is not current.
-                * we wont receive G_SUPPLICANT_STATE_DISCONNECTED since it
-                * failed, call connman_network_set_connected to report
-                * disconnect is completed.
-                */
-               if (result < 0)
-                       connman_network_set_connected(wifi->network, false);
+               connman_network_set_connected(wifi->network, false);
+               wifi->network = NULL;
        }
 
-       wifi->network = NULL;
-
        wifi->disconnecting = false;
 
        if (wifi->pending_network) {
-- 
2.1.4

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to