Blame SOURCES/1003-sw-devices-managed-after-wake-rh1701585.patch

7b922c
From 98b1cf070bfa857a8a39b6499b39494bc4f4e54b Mon Sep 17 00:00:00 2001
7b922c
From: Beniamino Galvani <bgalvani@redhat.com>
7b922c
Date: Tue, 23 Apr 2019 16:39:17 +0200
7b922c
Subject: [PATCH 1/2] manager: clear unmanaged-sleeping flag on software
7b922c
 devices on resume
7b922c
7b922c
When networking is disabled at NM startup we unmanage all devices
7b922c
(including software ones) due to SLEEPING. After networking gets
7b922c
enabled again we must clear the unmanaged-sleeping flag on software
7b922c
devices.
7b922c
7b922c
(cherry picked from commit 656753b70888badc29ffca592f82fd8355894596)
7b922c
(cherry picked from commit bb555ff6b5959767ab663d610cdabb8baa280447)
7b922c
---
7b922c
 src/nm-manager.c | 8 ++++----
7b922c
 1 file changed, 4 insertions(+), 4 deletions(-)
7b922c
7b922c
diff --git a/src/nm-manager.c b/src/nm-manager.c
7b922c
index 40e068ac5..ed2fa3df4 100644
7b922c
--- a/src/nm-manager.c
7b922c
+++ b/src/nm-manager.c
7b922c
@@ -5923,10 +5923,10 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed)
7b922c
 		c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) {
7b922c
 			guint i;
7b922c
 
7b922c
-			if (nm_device_is_software (device)) {
7b922c
-				/* We do not manage/unmanage software devices but
7b922c
-				 * their dhcp leases could have gone stale so we need
7b922c
-				 * to renew them */
7b922c
+			if (   nm_device_is_software (device)
7b922c
+			    && !nm_device_get_unmanaged_flags (device, NM_UNMANAGED_SLEEPING)) {
7b922c
+				/* DHCP leases of software devices could have gone stale
7b922c
+				 * so we need to renew them. */
7b922c
 				nm_device_update_dynamic_ip_setup (device);
7b922c
 				continue;
7b922c
 			}
7b922c
-- 
7b922c
2.20.1
7b922c
7b922c
From 9b08f52f043cb5f3794f1432df157a16c222b21c Mon Sep 17 00:00:00 2001
7b922c
From: Beniamino Galvani <bgalvani@redhat.com>
7b922c
Date: Tue, 23 Apr 2019 15:30:53 +0200
7b922c
Subject: [PATCH 2/2] manager: unmanage software devices when networking gets
7b922c
 disabled
7b922c
7b922c
If a user disables networking, we consider that as an indication that
7b922c
also software devices must be disconnected. OTOH, we don't want to
7b922c
destroy them for external events as a system suspend.
7b922c
7b922c
(cherry picked from commit 32ee51eee002f5e6717b856fd0a095114a02cc96)
7b922c
(cherry picked from commit da8462df1a273cd6b31f885b866726a64ca14550)
7b922c
---
7b922c
 src/nm-manager.c | 12 +++++++++---
7b922c
 1 file changed, 9 insertions(+), 3 deletions(-)
7b922c
7b922c
diff --git a/src/nm-manager.c b/src/nm-manager.c
7b922c
index ed2fa3df4..c0cd15c0c 100644
7b922c
--- a/src/nm-manager.c
7b922c
+++ b/src/nm-manager.c
7b922c
@@ -5866,9 +5866,15 @@ do_sleep_wake (NMManager *self, gboolean sleeping_changed)
7b922c
 		 * suspend/resume?
7b922c
 		 */
7b922c
 		c_list_for_each_entry (device, &priv->devices_lst_head, devices_lst) {
7b922c
-			/* FIXME: shouldn't we be unmanaging software devices if !suspending? */
7b922c
-			if (nm_device_is_software (device))
7b922c
-				continue;
7b922c
+			if (nm_device_is_software (device)) {
7b922c
+				/* If a user disables networking we consider that as an
7b922c
+				 * indication that also software devices must be disconnected.
7b922c
+				 * But we don't want to destroy them for external events as
7b922c
+				 * a system suspend.
7b922c
+				 */
7b922c
+				if (suspending)
7b922c
+					continue;
7b922c
+			}
7b922c
 			/* Wake-on-LAN devices will be taken down post-suspend rather than pre- */
7b922c
 			if (   suspending
7b922c
 			    && device_is_wake_on_lan (priv->platform, device)) {
7b922c
-- 
7b922c
2.20.1
7b922c