diff --git a/SOURCES/0022-no-unmanage-on-quit-rh1371126.patch b/SOURCES/0022-no-unmanage-on-quit-rh1371126.patch new file mode 100644 index 0000000..4d4a1e6 --- /dev/null +++ b/SOURCES/0022-no-unmanage-on-quit-rh1371126.patch @@ -0,0 +1,138 @@ +From 126ff818cfdce4c390ad3f553dba7fcc71462d3d Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Tue, 11 Oct 2016 14:42:35 +0200 +Subject: [PATCH 1/1] core: don't unmanage devices on shutdown + +... except Wi-Fi and devices that cannot assume connections at all. + +https://bugzilla.redhat.com/show_bug.cgi?id=1371126 +https://bugzilla.redhat.com/show_bug.cgi?id=1378418 +(cherry picked from commit d298b7c96d939b6c5cb7eddd7824e4f0cd695294) +(cherry picked from commit b14fe3ce0802c708b25982899d787bbbf15eebff) +--- + src/devices/nm-device.c | 100 ++++++++++-------------------------------------- + 1 file changed, 20 insertions(+), 80 deletions(-) + +diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c +index 2e01897..aabbd53 100644 +--- a/src/devices/nm-device.c ++++ b/src/devices/nm-device.c +@@ -3492,95 +3492,35 @@ nm_device_can_assume_connections (NMDevice *self) + return !!NM_DEVICE_GET_CLASS (self)->update_connection; + } + +-/** +- * nm_device_can_assume_active_connection: +- * @self: #NMDevice instance +- * +- * This is a convenience function to determine whether the device's active +- * connection can be assumed if NetworkManager restarts. This method returns +- * %TRUE if and only if the device can assume connections, and the device has +- * an active connection, and that active connection can be assumed. +- * +- * Returns: %TRUE if the device's active connection can be assumed, or %FALSE +- * if there is no active connection or the active connection cannot be +- * assumed. +- */ + static gboolean +-nm_device_can_assume_active_connection (NMDevice *self) ++unmanaged_on_quit (NMDevice *self) + { +- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); + NMConnection *connection; +- const char *method; +- const char *assumable_ip6_methods[] = { +- NM_SETTING_IP6_CONFIG_METHOD_IGNORE, +- NM_SETTING_IP6_CONFIG_METHOD_AUTO, +- NM_SETTING_IP6_CONFIG_METHOD_DHCP, +- NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL, +- NM_SETTING_IP6_CONFIG_METHOD_MANUAL, +- NULL +- }; +- const char *assumable_ip4_methods[] = { +- NM_SETTING_IP4_CONFIG_METHOD_DISABLED, +- NM_SETTING_IP6_CONFIG_METHOD_AUTO, +- NM_SETTING_IP6_CONFIG_METHOD_MANUAL, +- NULL +- }; + ++ /* NMDeviceWifi overwrites this function to always unmanage wifi devices. ++ * ++ * For all other types, if the device type can assume connections, we leave ++ * it up on quit. ++ * ++ * Originally, we would only keep devices up that can be assumed afterwards. ++ * However, that meant we unmanged layer-2 only devices. So, this was step ++ * by step refined to unmanage less (commit 25aaaab3, rh#1311988, rh#1333983). ++ * But there are more scenarios where we also want to keep the device up ++ * (rh#1378418, rh#1371126). */ + if (!nm_device_can_assume_connections (self)) +- return FALSE; ++ return TRUE; + ++ /* the only exception are IPv4 shared connections. We unmanage them on quit. */ + connection = nm_device_get_applied_connection (self); +- if (!connection) +- return FALSE; +- +- /* Can't assume connections that aren't yet configured +- * FIXME: what about bridges/bonds waiting for slaves? +- */ +- if (priv->state < NM_DEVICE_STATE_IP_CONFIG) +- return FALSE; +- if (priv->ip4_state != IP_DONE && priv->ip6_state != IP_DONE) +- return FALSE; +- +- method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG); +- if (!g_strv_contains (assumable_ip6_methods, method)) +- return FALSE; +- +- method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG); +- if (!g_strv_contains (assumable_ip4_methods, method)) +- return FALSE; +- +- return TRUE; +-} +- +-static gboolean +-unmanaged_on_quit (NMDevice *self) +-{ +- /* Leave certain devices alone when quitting so their configuration +- * can be taken over when NM restarts. This ensures connectivity while +- * NM is stopped. +- */ +- if (nm_device_uses_assumed_connection (self)) { +- /* An assume connection must be left alone */ +- return FALSE; +- } +- +- if (!nm_device_get_act_request (self)) { +- /* 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. +- */ +- return FALSE; +- } +- +- if (!nm_platform_link_can_assume (NM_PLATFORM_GET, nm_device_get_ifindex (self))) { +- /* The device has no layer 3 configuration. Leave it up. */ +- return FALSE; ++ if (connection) { ++ if (NM_IN_STRSET (nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG), ++ NM_SETTING_IP4_CONFIG_METHOD_SHARED)) { ++ /* shared connections are to be unmangaed. */ ++ return TRUE; ++ } + } + +- if (nm_device_can_assume_active_connection (self)) +- return FALSE; +- +- return TRUE; ++ return FALSE; + } + + gboolean +-- +2.7.4 + diff --git a/SPECS/NetworkManager.spec b/SPECS/NetworkManager.spec index 9c4b889..118ef3d 100644 --- a/SPECS/NetworkManager.spec +++ b/SPECS/NetworkManager.spec @@ -12,7 +12,7 @@ %global rpm_version 1.4.0 %global real_version 1.4.0 -%global release_version 12 +%global release_version 13 %global epoch_version 1 %global obsoletes_nmver 1:0.9.9.95-1 @@ -125,6 +125,7 @@ Patch18: 0018-device-fix-reapply-crash-rh1376784.patch Patch19: 0019-cli-fix-autocompletion-rh1375933.patch Patch20: 0020-fix-assume-bond-and-infiniband-rh1375558.patch Patch21: 0021-assume-devices-with-slaves-rh1333983.patch +Patch22: 0022-no-unmanage-on-quit-rh1371126.patch Requires(post): systemd Requires(preun): systemd @@ -394,6 +395,7 @@ by nm-connection-editor and nm-applet in a non-graphical environment. %patch19 -p1 %patch20 -p1 %patch21 -p1 +%patch22 -p1 %build %if %{with regen_docs} @@ -699,6 +701,9 @@ fi %endif %changelog +* Wed Nov 2 2016 Thomas Haller - 1:1.4.0-13 +- core: don't unmanage devices on shutdown (rh#1371126) + * Mon Sep 26 2016 Lubomir Rintel - 1:1.4.0-12 - device: consider a device with slaves configured (rh#1333983)