From a8a4eb14183bc38d808248f04097c39de966d9f2 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 15 Dec 2015 12:57:40 +0100 Subject: [PATCH] manager: don't create the virtual devices on all connection changes Only do so on user initiated changes. Fixes this: # ip link add br0 type bridge # ip addr add 2001:DB8::666/64 dev br0 # ip link set br0 up # A generated connection is assumed # ip link del br0 # The device and its address are removed. # The address removal triggers an update # of the connection's ipv6 settings, # which causes the NMDevice to reappear. # ip link add br0 type bridge # The new plink is associated with # the NMDevice, managed by NM --- src/nm-manager.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 18815947cf..43966822bb 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1109,9 +1109,9 @@ connection_added (NMSettings *settings, } static void -connection_changed (NMSettings *settings, - NMConnection *connection, - NMManager *manager) +connection_updated_by_user (NMSettings *settings, + NMConnection *connection, + NMManager *manager) { if (nm_connection_is_virtual (connection)) system_create_virtual_device (manager, connection); @@ -5037,12 +5037,10 @@ nm_manager_setup (const char *state_file, G_CALLBACK (system_hostname_changed_cb), self); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, G_CALLBACK (connection_added), self); - g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, - G_CALLBACK (connection_changed), self); + g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED_BY_USER, + G_CALLBACK (connection_updated_by_user), self); g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self); - g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED, - G_CALLBACK (connection_changed), self); priv->policy = nm_policy_new (self, priv->settings); g_signal_connect (priv->policy, "notify::" NM_POLICY_DEFAULT_IP4_DEVICE, @@ -5367,7 +5365,7 @@ dispose (GObject *object) g_signal_handlers_disconnect_by_func (priv->settings, system_unmanaged_devices_changed_cb, manager); g_signal_handlers_disconnect_by_func (priv->settings, system_hostname_changed_cb, manager); g_signal_handlers_disconnect_by_func (priv->settings, connection_added, manager); - g_signal_handlers_disconnect_by_func (priv->settings, connection_changed, manager); + g_signal_handlers_disconnect_by_func (priv->settings, connection_updated_by_user, manager); g_signal_handlers_disconnect_by_func (priv->settings, connection_removed, manager); g_clear_object (&priv->settings); }