[PATCH] bridge: ignore bridge device that don't have any connections available.



---
 src/nm-manager.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index fbc9d23..c0ec0a6 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1719,7 +1719,7 @@ add_device (NMManager *self, NMDevice *device)
 	static guint32 devcount = 0;
 	const GSList *unmanaged_specs;
 	NMConnection *existing = NULL;
-	gboolean managed = FALSE, enabled = FALSE;
+	gboolean managed = FALSE, enabled = FALSE, inhibit_managed = FALSE;
 	RfKillType rtype;
 	NMDeviceType devtype;
 
@@ -1771,6 +1771,14 @@ add_device (NMManager *self, NMDevice *device)
 		g_signal_connect (device, NM_DEVICE_MODEM_ENABLE_CHANGED,
 		                  G_CALLBACK (manager_modem_enabled_changed),
 		                  self);
+	} else if (devtype == NM_DEVICE_TYPE_BRIDGE) {
+		GSList *connections = NULL;
+
+		connections = nm_settings_get_connections (priv->settings);
+		inhibit_managed = nm_device_connection_match_config (device, (const GSList *) connections) == NULL
+				 ? TRUE : FALSE;
+		nm_log_dbg (LOGD_HW, "MATT: should inhibit: %s", inhibit_managed ? "true" : "false");
+		g_slist_free (connections);
 	}
 
 	/* Update global rfkill state for this device type with the device's
@@ -1819,7 +1827,8 @@ add_device (NMManager *self, NMDevice *device)
 	/* Start the device if it's supposed to be managed */
 	unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings);
 	if (   !manager_sleeping (self)
-	    && !nm_device_spec_match_list (device, unmanaged_specs)) {
+	    && !nm_device_spec_match_list (device, unmanaged_specs)
+	    && !inhibit_managed) {
 		nm_device_set_managed (device,
 		                       TRUE,
 		                       existing ? NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED :
-- 
1.8.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]