diff options
author | Andrew Zaborowski <andrew.zaborowski@intel.com> | 2018-10-10 02:17:47 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-10-11 16:07:15 +0200 |
commit | 2fff4e14b4c3b63f0b07d98a2d81f71666926196 (patch) | |
tree | 7788875e69d0c01f5b0f376a8313842cfded3c40 | |
parent | 979c632e1190aea04dae41b14c38033ab56a2285 (diff) | |
download | NetworkManager-2fff4e14b4c3b63f0b07d98a2d81f71666926196.tar.gz |
wifi/iwd: always update can_connect in state_changed
Ensure priv->can_connect is up to date on IWD state changed. If we
exited the function early priv->can_connect would sometimes be wrongly
TRUE and we'd start a new autoconnect too early after IP configuration
had failed for example.
-rw-r--r-- | src/devices/wifi/nm-device-iwd.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index 2e6ca1ce1e..50b2a8a3f2 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -2029,7 +2029,7 @@ state_changed (NMDeviceIwd *self, const char *new_state) NMDevice *device = NM_DEVICE (self); NMDeviceState dev_state = nm_device_get_state (device); gboolean iwd_connection = FALSE; - gboolean can_connect; + gboolean can_connect = priv->can_connect; _LOGI (LOGD_DEVICE | LOGD_WIFI, "new IWD device state is %s", new_state); @@ -2040,6 +2040,8 @@ state_changed (NMDeviceIwd *self, const char *new_state) /* Don't allow scanning while connecting, disconnecting or roaming */ set_can_scan (self, NM_IN_STRSET (new_state, "connected", "disconnected")); + priv->can_connect = FALSE; + if (NM_IN_STRSET (new_state, "connecting", "connected", "roaming")) { /* If we were connecting, do nothing, the confirmation of * a connection success is handled in the Device.Connect @@ -2081,10 +2083,10 @@ state_changed (NMDeviceIwd *self, const char *new_state) /* Don't allow new connection until iwd exits disconnecting and no * Connect callback is pending. */ - can_connect = NM_IN_STRSET (new_state, "disconnected"); - if (can_connect != priv->can_connect) { - priv->can_connect = can_connect; - nm_device_emit_recheck_auto_activate (device); + if (NM_IN_STRSET (new_state, "disconnected")) { + priv->can_connect = TRUE; + if (!can_connect) + nm_device_emit_recheck_auto_activate (device); } } |