Blame SOURCES/rh1031794-no-touch-loopback.patch

2186fd
From 46a7760ead2841d0a8ad5468bae8042b44af7aa2 Mon Sep 17 00:00:00 2001
2186fd
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
2186fd
Date: Wed, 20 Nov 2013 18:05:01 +0100
2186fd
Subject: [PATCH 1/2] core: do not generate a connection for loopback interface
2186fd
 (rh #1032594)
2186fd
2186fd
Else loopback is managed, and could be easily disconnected, which causes various
2186fd
issues with applications. So do not manage it for now, to be on the safer side.
2186fd
2186fd
https://bugzilla.redhat.com/show_bug.cgi?id=1032594
2186fd
---
2186fd
 src/nm-manager.c | 19 ++++++++++---------
2186fd
 1 file changed, 10 insertions(+), 9 deletions(-)
2186fd
2186fd
diff --git a/src/nm-manager.c b/src/nm-manager.c
2186fd
index bf03084..adb8d72 100644
2186fd
--- a/src/nm-manager.c
2186fd
+++ b/src/nm-manager.c
2186fd
@@ -147,15 +147,15 @@ static void bluez_manager_bdaddr_added_cb (NMBluezManager *bluez_mgr,
2186fd
                                            NMManager *manager);
2186fd
 
2186fd
 static void bluez_manager_bdaddr_removed_cb (NMBluezManager *bluez_mgr,
2186fd
                                              const char *bdaddr,
2186fd
                                              const char *object_path,
2186fd
                                              gpointer user_data);
2186fd
 
2186fd
-static void add_device (NMManager *self, NMDevice *device, gboolean nm_created);
2186fd
+static void add_device (NMManager *self, NMDevice *device, gboolean generate_con);
2186fd
 static void remove_device (NMManager *self, NMDevice *device, gboolean quitting);
2186fd
 
2186fd
 static void hostname_provider_init (NMHostnameProvider *provider_class);
2186fd
 
2186fd
 static NMActiveConnection *_new_active_connection (NMManager *self,
2186fd
                                                    NMConnection *connection,
2186fd
                                                    const char *specific_object,
2186fd
@@ -577,15 +577,15 @@ modem_added (NMModemManager *modem_manager,
2186fd
 		nm_log_info (LOGD_MB, "ignoring modem '%s' (no associated Bluetooth device)", modem_iface);
2186fd
 		return;
2186fd
 	}
2186fd
 
2186fd
 	/* Make the new modem device */
2186fd
 	device = nm_device_modem_new (modem, driver);
2186fd
 	if (device)
2186fd
-		add_device (self, device, TRUE);
2186fd
+		add_device (self, device, FALSE);
2186fd
 }
2186fd
 
2186fd
 static void
2186fd
 set_state (NMManager *manager, NMState state)
2186fd
 {
2186fd
 	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
2186fd
 	const char *state_str;
2186fd
@@ -1184,15 +1184,15 @@ system_create_virtual_device (NMManager *self, NMConnection *connection)
2186fd
 		device = nm_device_vlan_new_for_connection (connection, parent);
2186fd
 	} else if (nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)) {
2186fd
 		device = nm_device_infiniband_new_partition (connection, parent);
2186fd
 	}
2186fd
 
2186fd
 	if (device) {
2186fd
 		nm_device_set_is_nm_owned (device, TRUE);
2186fd
-		add_device (self, device, TRUE);
2186fd
+		add_device (self, device, FALSE);
2186fd
 	}
2186fd
 
2186fd
 	g_signal_handlers_unblock_by_func (nm_platform_get (), G_CALLBACK (platform_link_added_cb), self);
2186fd
 
2186fd
 out:
2186fd
 	g_free (iface);
2186fd
 	return device;
2186fd
@@ -1765,15 +1765,15 @@ get_existing_connection (NMManager *manager, NMDevice *device)
2186fd
 	}
2186fd
 	g_object_unref (connection);
2186fd
 
2186fd
 	return added ? NM_CONNECTION (added) : NULL;
2186fd
 }
2186fd
 
2186fd
 static void
2186fd
-add_device (NMManager *self, NMDevice *device, gboolean nm_created)
2186fd
+add_device (NMManager *self, NMDevice *device, gboolean generate_con)
2186fd
 {
2186fd
 	NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
2186fd
 	const char *iface, *driver, *type_desc;
2186fd
 	char *path;
2186fd
 	static guint32 devcount = 0;
2186fd
 	const GSList *unmanaged_specs;
2186fd
 	NMConnection *connection = NULL;
2186fd
@@ -1858,16 +1858,17 @@ add_device (NMManager *self, NMDevice *device, gboolean nm_created)
2186fd
 
2186fd
 	path = g_strdup_printf ("/org/freedesktop/NetworkManager/Devices/%d", devcount++);
2186fd
 	nm_device_set_path (device, path);
2186fd
 	nm_dbus_manager_register_object (priv->dbus_mgr, path, device);
2186fd
 	nm_log_info (LOGD_CORE, "(%s): exported as %s", iface, path);
2186fd
 	g_free (path);
2186fd
 
2186fd
-	/* Don't bother generating a connection for devices NM just created */
2186fd
-	if (!nm_created)
2186fd
+	/* Don't generate a connection e.g. for devices NM just created, or
2186fd
+	 * for the loopback */
2186fd
+	if (generate_con)
2186fd
 		connection = get_existing_connection (self, device);
2186fd
 
2186fd
 	/* Start the device if it's supposed to be managed */
2186fd
 	unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings);
2186fd
 	if (   !manager_sleeping (self)
2186fd
 	    && !nm_device_spec_match_list (device, unmanaged_specs)) {
2186fd
 		nm_device_set_manager_managed (device,
2186fd
@@ -1959,15 +1960,15 @@ bluez_manager_bdaddr_added_cb (NMBluezManager *bluez_mgr,
2186fd
 		nm_log_info (LOGD_HW, "BT device %s (%s) added (%s%s%s)",
2186fd
 		             name,
2186fd
 		             bdaddr,
2186fd
 		             has_dun ? "DUN" : "",
2186fd
 		             has_dun && has_nap ? " " : "",
2186fd
 		             has_nap ? "NAP" : "");
2186fd
 
2186fd
-		add_device (manager, device, TRUE);
2186fd
+		add_device (manager, device, FALSE);
2186fd
 	}
2186fd
 }
2186fd
 
2186fd
 static void
2186fd
 bluez_manager_bdaddr_removed_cb (NMBluezManager *bluez_mgr,
2186fd
                                  const char *bdaddr,
2186fd
                                  const char *object_path,
2186fd
@@ -2259,15 +2260,15 @@ platform_link_added_cb (NMPlatform *platform,
2186fd
 		default:
2186fd
 			device = nm_device_generic_new (plink);
2186fd
 			break;
2186fd
 		}
2186fd
 	}
2186fd
 
2186fd
 	if (device)
2186fd
-		add_device (self, device, FALSE);
2186fd
+		add_device (self, device, plink->type != NM_LINK_TYPE_LOOPBACK);
2186fd
 }
2186fd
 
2186fd
 static void
2186fd
 platform_link_removed_cb (NMPlatform *platform,
2186fd
                           int ifindex,
2186fd
                           NMPlatformLink *plink,
2186fd
                           NMPlatformReason reason,
2186fd
@@ -2296,15 +2297,15 @@ atm_device_added_cb (NMAtmManager *atm_mgr,
2186fd
 
2186fd
 	device = find_device_by_iface (self, iface);
2186fd
 	if (device)
2186fd
 		return;
2186fd
 
2186fd
 	device = nm_device_adsl_new (sysfs_path, iface, driver);
2186fd
 	if (device)
2186fd
-		add_device (self, device, FALSE);
2186fd
+		add_device (self, device, TRUE);
2186fd
 }
2186fd
 
2186fd
 static void
2186fd
 atm_device_removed_cb (NMAtmManager *manager,
2186fd
                        const char *iface,
2186fd
                        gpointer user_data)
2186fd
 {
2186fd
-- 
2186fd
1.8.3.1
2186fd