Hello!

I have a bridge that was created before the start of NM and it
shouldn't be managed by NM. But NM ignores unmanaged specs from a
plugin: device_has_config() always returns TRUE for bridges, so default
connection is generated and NM tries to manage the bridge.
Attached patch fixes this, although I'm not sure that's the right way.

-- 
WBR, Mikhail Efremov
>From d34100c8527b2ab3bd3d8cdcd488d3116e3c3e0b Mon Sep 17 00:00:00 2001
From: Mikhail Efremov <s...@altlinux.org>
Date: Mon, 31 Mar 2014 20:29:05 +0400
Subject: [PATCH] Don't generate a connection for unmanaged devices.

---
 src/nm-manager.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index 48ce061..5a39103 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1751,6 +1751,7 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con)
 	char *path;
 	static guint32 devcount = 0;
 	const GSList *unmanaged_specs;
+	gboolean unmanaged = FALSE;
 	NMConnection *connection = NULL;
 	gboolean enabled = FALSE;
 	RfKillType rtype;
@@ -1847,15 +1848,17 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con)
 	nm_log_info (LOGD_CORE, "(%s): exported as %s", iface, path);
 	g_free (path);
 
+	unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings);
+	unmanaged = nm_device_spec_match_list (device, unmanaged_specs);
+
 	/* Don't generate a connection e.g. for devices NM just created, or
 	 * for the loopback */
-	if (generate_con)
+	if (generate_con && !unmanaged)
 		connection = get_existing_connection (self, 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)) {
+	    && !unmanaged) {
 		nm_device_set_manager_managed (device,
 		                               TRUE,
 		                               connection ? NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED :
-- 
1.8.5.5

_______________________________________________
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to