diff options
author | Thomas Haller <thaller@redhat.com> | 2016-04-01 12:32:06 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-04-01 13:26:59 +0200 |
commit | ca3a1a5863e090ce46dbf3c31bc7a620926767c9 (patch) | |
tree | 7f0355c1bbfbf4f855661357cb4d7e83a4f2fa1a | |
parent | f6b0c92f8cbf93467b620d65c6b902a0d49ee1bf (diff) | |
download | NetworkManager-th/unmanaged-external-down-bgo763236.tar.gz |
fixup! manager: don't unmanage devices without L3 config on shutdownth/unmanaged-external-down-bgo763236
-rw-r--r-- | src/devices/nm-device.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device.h | 1 | ||||
-rw-r--r-- | src/nm-manager.c | 35 |
3 files changed, 19 insertions, 19 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index c7bfdfd4ae..619eda9bba 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3063,7 +3063,7 @@ nm_device_check_slave_connection_compatible (NMDevice *self, NMConnection *slave * * Returns: %TRUE if the device is capable of assuming connections, %FALSE if not */ -gboolean +static gboolean nm_device_can_assume_connections (NMDevice *self) { return !!NM_DEVICE_GET_CLASS (self)->update_connection; diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h index e21d5ed770..f5983c727c 100644 --- a/src/devices/nm-device.h +++ b/src/devices/nm-device.h @@ -404,7 +404,6 @@ gboolean nm_device_check_slave_connection_compatible (NMDevice *device, NMConnec gboolean nm_device_uses_assumed_connection (NMDevice *device); -gboolean nm_device_can_assume_connections (NMDevice *self); gboolean nm_device_can_assume_active_connection (NMDevice *device); gboolean nm_device_spec_match_list (NMDevice *device, const GSList *specs); diff --git a/src/nm-manager.c b/src/nm-manager.c index 5a737e67ef..4d31a9c535 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -842,26 +842,27 @@ remove_device (NMManager *self, nm_device_get_iface (device), allow_unmanage, nm_device_get_managed (device, FALSE)); if (allow_unmanage && nm_device_get_managed (device, FALSE)) { - gboolean unmanage = FALSE; + gboolean unmanage = TRUE; - /* Leave NM-activated connections, assumed connections, and devices - * without active connections alone when quitting so their configuration - * can be taken over when NM restarts. This ensures connectivity while - * NM is stopped. Devices which do not support connection assumption - * cannot be left up. - */ if (!quitting) { - /* Forced removal; device already gone */ - unmanage = TRUE; - } else if (!nm_device_can_assume_connections (device)) { - /* Devices that cannot assume any connection must be cleaned up */ - unmanage = TRUE; - } else if ( !nm_device_uses_assumed_connection (device) - && !nm_device_can_assume_active_connection (device)) { - /* NM-activated devices that cannot re-assume their active connection - * must be cleaned up. + /* the device is already gone. Unmanage it. */ + } else { + /* Leave certain devices alone when quitting so their configuration + * can be taken over when NM restarts. This ensures connectivity while + * NM is stopped. */ - unmanage = TRUE; + if (nm_device_uses_assumed_connection (device)) { + /* An assume connection must be left alone */ + unmanage = FALSE; + } else if (!nm_device_get_act_request (device)) { + /* a device without any active connection is either UNAVAILABLE or DISCONNECTED + * state. Since we don't know whether the device was upped by NetworkManager, + * we must leave it up on exit. */ + unmanage = FALSE; + } else if (!nm_platform_link_can_assume (NM_PLATFORM_GET, nm_device_get_ifindex (device))) { + /* The device has no layer 3 configuration. Leave it up. */ + unmanage = FALSE; + } } if (unmanage) { |