diff options
| author | Beniamino Galvani <bgalvani@redhat.com> | 2019-11-26 10:58:49 +0100 |
|---|---|---|
| committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-05 11:31:24 +0100 |
| commit | 1170205fd2c295f2b57ff2cdcdf04139fcf5470d (patch) | |
| tree | a56a087f3a1cce92ed8ab550f925b7b7df58427e | |
| parent | ea4e95ec33a284fa03ed360b0101a02dcd22294d (diff) | |
| download | NetworkManager-bg/assume-failed-rh1737774.tar.gz | |
device: don't transition assumed devices to FAILED before ACTIVATEDbg/assume-failed-rh1737774
If the activation of an assumed device fails, we first set the device
state to FAILED and then to ACTIVATED. In the FAILED state, the active
connection transitions to DEACTIVATED and clears its device pointer;
hence we end up with an inconsistent state which causes assertion
failures in other parts of the code (for example, get_best_ip_config()
assumes that the device of the best active connection is not NULL).
Don't first transition to FAILED and then to ACTIVATED, just set the
latter.
https://bugzilla.redhat.com/show_bug.cgi?id=1737774
| -rw-r--r-- | src/devices/nm-device.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index c4e7b80c69..c50aa42ac7 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -15476,6 +15476,13 @@ _set_state_full (NMDevice *self, old_state = priv->state; + if ( state == NM_DEVICE_STATE_FAILED + && nm_device_sys_iface_state_is_external_or_assume (self)) { + /* Avoid tearing down assumed connection, assume it's connected */ + state = NM_DEVICE_STATE_ACTIVATED; + reason = NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED; + } + /* Do nothing if state isn't changing, but as a special case allow * re-setting UNAVAILABLE if the device is missing firmware so that we * can retry device initialization. @@ -15727,14 +15734,6 @@ _set_state_full (NMDevice *self, */ _cancel_activation (self); - if (nm_device_sys_iface_state_is_external_or_assume (self)) { - /* Avoid tearing down assumed connection, assume it's connected */ - nm_device_queue_state (self, - NM_DEVICE_STATE_ACTIVATED, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); - break; - } - sett_conn = nm_device_get_settings_connection (self); _LOGW (LOGD_DEVICE | LOGD_WIFI, "Activation: failed for connection '%s'", |
