From: Pasi Sjöholm <[email protected]>

It's possible from wpa_s to change the state from completed to scanning
without going through disconnected state if interface signals that the carrier
went off and on (IFF_LOWER_UP flag).

This will cause dead lock similar in c810464828d6764bea304de3e9b6b151aa05e313
if the wifi gets into associating state as the network->connected is still true
but wifi->connected is not.
---
 plugins/wifi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index d0d7917..90061f3 100755
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2309,6 +2309,7 @@ static void interface_state(GSupplicantInterface 
*interface)
        struct wifi_data *wifi;
        GSupplicantState state = g_supplicant_interface_get_state(interface);
        bool wps;
+       bool old_connected;
 
        wifi = g_supplicant_interface_get_data(interface);
 
@@ -2341,6 +2342,9 @@ static void interface_state(GSupplicantInterface 
*interface)
 
        switch (state) {
        case G_SUPPLICANT_STATE_SCANNING:
+               if (wifi->connected)
+                       connman_network_set_connected(network, false);
+
                break;
 
        case G_SUPPLICANT_STATE_AUTHENTICATING:
@@ -2413,6 +2417,7 @@ static void interface_state(GSupplicantInterface 
*interface)
                break;
        }
 
+       old_connected = wifi->connected;
        wifi->state = state;
 
        /* Saving wpa_s state policy:
@@ -2435,6 +2440,12 @@ static void interface_state(GSupplicantInterface 
*interface)
                else
                        wifi->connected = false;
                break;
+       case G_SUPPLICANT_STATE_SCANNING:
+               wifi->connected = false;
+
+               if (old_connected)
+                       start_autoscan(device);
+               break;
        case G_SUPPLICANT_STATE_COMPLETED:
                wifi->connected = true;
                break;
-- 
2.1.4

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

Reply via email to