summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2015-03-03 09:23:50 -0600
committerDan Williams <dcbw@redhat.com>2015-03-03 09:26:38 -0600
commit2022a5adf154c88a28f8ef7e3b3ef957bb132071 (patch)
treea3943b6ce09f62dd12bf0b6319e7f7d4ac10e0e9
parentb48a4ec63516ff957d175db1afaaef6d8aa07aeb (diff)
downloadNetworkManager-2022a5adf154c88a28f8ef7e3b3ef957bb132071.tar.gz
device: move to UNAVAILABLE state when deactivating if device is not available
If the device assumed a connection but some of the resources for that connection (eg, carrier) are no longer available, the device will not be deactivated after "device: don't disconnect assumed connections" to ensure NM does not clean up something it shouldn't touch. But if the user manually deactivates the device, ensure that if it is no longer available, it's not moved to DISCONNECTED state when it really should be moved to UNAVAILABLE. If the device becomes available again during the DEACTIVATING state processing, then when it finally hits UNAVAILABLE it will be moved again to DISCONNECTED automatically. Reproducer: - add ethernet interface to an externally managed bridge - plug cable into ethernet interface - remove cable - remove interface from the bridge; it stays in 'activated' state - nmcli dev disconnect <ethernet> - device moves to 'disconnected' state even though there is no carrier
-rw-r--r--src/devices/nm-device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 5b284e9a23..997284878a 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6909,7 +6909,10 @@ _set_state_full (NMDevice *device,
nm_act_request_get_connection (req),
device);
} else {
- priv->dispatcher.post_state = NM_DEVICE_STATE_DISCONNECTED;
+ if (nm_device_is_available (device))
+ priv->dispatcher.post_state = NM_DEVICE_STATE_DISCONNECTED;
+ else
+ priv->dispatcher.post_state = NM_DEVICE_STATE_UNAVAILABLE;
priv->dispatcher.post_state_reason = reason;
if (!nm_dispatcher_call (DISPATCHER_ACTION_PRE_DOWN,
nm_act_request_get_connection (req),