diff options
author | Thomas Haller <thaller@redhat.com> | 2016-08-22 17:37:20 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-08-23 10:43:12 +0200 |
commit | d4e9b30320184f0f9e09da375bb6ec549d6ab337 (patch) | |
tree | 9f9a42332e11a9e59350bf196170bb2a81008d32 | |
parent | 4cb845558e501bddff5b359295f64ea2906be181 (diff) | |
download | NetworkManager-d4e9b30320184f0f9e09da375bb6ec549d6ab337.tar.gz |
device: fix queued activation failure due to link disconnected
When activating a connection, it may fail with nmcli reporting:
$ nmcli connection up id "Wired Connection 1"
Error: Connection activation failed: Active connection removed before it was initialized
This should be easily reproducible by having a connection "Wired Connection 1" with
cloned-mac-address set to random. When the connection is already active on a device,
re-activating with
$ nmcli connection up id "Wired Connection 1"
fails.
We first create a queued-activation and tear down the existing
connection:
device (enp0s25): state change: deactivating -> disconnected (reason 'new-activation')
Shortly after we see:
device[0x557d02cdb0c0] (enp0s25): set-hw-addr: setting MAC address to 'AA:BB:CC:DD:EE:FF' (reset, deactivate)...
device[0x557d02cdb0c0] (enp0s25): taking down device
later, we get:
device (enp0s25): link disconnected
device[0x557d02cdb0c0] (enp0s25): queued state change to unavailable due to carrier-changed (id 17290)
in the meantime, the queued activation request starts:
device (enp0s25): Activation: starting connection 'my-wired' (ca058ec5-8a47-4e1e-b38e-962b71c4699e)
but the device already transitions to unavailable
device[0x557d02cdb0c0] (enp0s25): running queued state change to unavailable (id 17290)
device (enp0s25): state change: disconnected -> unavailable (reason 'carrier-changed') [30 20 40]
which kills the new activation request:
active-connection[0x557d02c10e40]: set state deactivated (was unknown)
Just delay a carrier-lost handling if we have any queued activation
requests.
-rw-r--r-- | src/devices/nm-device.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 9d677e0a9d..4807a9ba15 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1726,7 +1726,8 @@ nm_device_set_carrier (NMDevice *self, gboolean carrier) nm_device_remove_pending_action (self, "carrier wait", TRUE); _carrier_wait_check_queued_act_request (self); } - } else if (state <= NM_DEVICE_STATE_DISCONNECTED) { + } else if ( state <= NM_DEVICE_STATE_DISCONNECTED + && !priv->queued_act_request) { _LOGI (LOGD_DEVICE, "link disconnected"); klass->carrier_changed (self, FALSE); } else { |