File 0001-Update-connectivity-value-on-device-removal.patch of Package NetworkManager.11070

From c8e9393a4e821673c273e5bf7a4393f17d29655b Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <alarrosa@suse.com>
Date: Thu, 21 Mar 2019 11:32:32 +0100
Subject: [PATCH] Update connectivity value on device removal

When a device is removed (like when the user unplugs a usb network
device) the device object is removed, so it doesn't emit a notify signal
for a change in its connectivity and so, device_connectivity_changed
is not called. This means that nobody updates the global connectivity
value which is potentially wrong if the device was the one providing
network connectivity.

Since device_connectivity_changed's first two parameters aren't actually
used and are there just for the signal to be able to be connected, I
moved the code from device_connectivity_changed to a new
update_connectivity_value function that just takes a NMManager
parameter and also call it from remove_device.

Fixes #141
---
 src/nm-manager.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index 0bf6a7510..f5608770e 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -269,6 +269,8 @@ static const GDBusSignalInfo signal_info_state_changed;
 
 /*****************************************************************************/
 
+static void update_connectivity_value (NMManager *self);
+
 static gboolean add_device (NMManager *self, NMDevice *device, GError **error);
 
 static NMActiveConnection *_new_active_connection (NMManager *self,
@@ -1348,6 +1350,8 @@ remove_device (NMManager *self,
 	g_signal_emit (self, signals[INTERNAL_DEVICE_REMOVED], 0, device);
 	_notify (self, PROP_ALL_DEVICES);
 
+	update_connectivity_value(self);
+
 	nm_exported_object_clear_and_unexport (&device);
 
 	check_if_startup_complete (self);
@@ -2424,6 +2428,12 @@ static void
 device_connectivity_changed (NMDevice *device,
                              GParamSpec *pspec,
                              NMManager *self)
+{
+	update_connectivity_value(self);
+}
+
+static void
+update_connectivity_value (NMManager *self)
 {
 	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
 	NMConnectivityState best_state = NM_CONNECTIVITY_UNKNOWN;
-- 
2.21.0