summary refs log tree commit diff
path: root/src/devices/nm-device-ethernet.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-05-11 17:08:25 +0200
committerMichael Biebl <biebl@debian.org>2016-05-11 17:08:25 +0200
commit73e152af6e3fb4f5848bfb8394484026ff119003 (patch)
treed5a8b37778d3a95c51511451b38b6a329b94cb41 /src/devices/nm-device-ethernet.c
parent78c3b8801ecf4975e5da1af3b10ae20dd2d876de (diff)
Imported Upstream version 1.2.2 upstream/1.2.2
Diffstat (limited to 'src/devices/nm-device-ethernet.c')
-rw-r--r--src/devices/nm-device-ethernet.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c
index 6225ae7b..d27f7dca 100644
--- a/src/devices/nm-device-ethernet.c
+++ b/src/devices/nm-device-ethernet.c
@@ -194,16 +194,21 @@ _update_s390_subchannels (NMDeviceEthernet *self)
 		} else if (   !strcmp (item, "layer2")
 		           || !strcmp (item, "portname")
 		           || !strcmp (item, "portno")) {
-			char *path, *value;
+			gs_free char *path = NULL, *value = NULL;
+
 			path = g_strdup_printf ("%s/%s", parent_path, item);
 			value = nm_platform_sysctl_get (NM_PLATFORM_GET, path);
-			if (value && *value)
-				g_hash_table_insert (priv->s390_options, g_strdup (item), g_strdup (value));
-			else
+
+			if (   !strcmp (item, "portname")
+			    && !g_strcmp0 (value, "no portname required")) {
+				/* Do nothing */
+			} else if (value && *value) {
+				g_hash_table_insert (priv->s390_options, g_strdup (item), value);
+				value = NULL;
+			} else
 				_LOGW (LOGD_DEVICE | LOGD_HW, "error reading %s", path);
-			g_free (path);
-			g_free (value);
 		}
+
 		if (error) {
 			_LOGW (LOGD_DEVICE | LOGD_HW, "%s", error->message);
 			g_clear_error (&error);
@@ -1433,7 +1438,9 @@ new_default_connection (NMDevice *self)
 	const GSList *connections;
 	NMSetting *setting;
 	const char *hw_address;
-	char *defname, *uuid;
+	gs_free char *defname = NULL;
+	gs_free char *uuid = NULL;
+	gs_free char *machine_id = NULL;
 
 	if (nm_config_get_no_auto_default_for_device (nm_config_get (), self))
 		return NULL;
@@ -1448,7 +1455,19 @@ new_default_connection (NMDevice *self)
 
 	connections = nm_connection_provider_get_connections (nm_connection_provider_get ());
 	defname = nm_device_ethernet_utils_get_default_wired_name (connections);
-	uuid = nm_utils_uuid_generate ();
+	if (!defname)
+		return NULL;
+
+	machine_id = nm_utils_machine_id_read ();
+
+	/* Create a stable UUID. The UUID is also the Network_ID for stable-privacy addr-gen-mode,
+	 * thus when it changes we will also generate different IPv6 addresses. */
+	uuid = _nm_utils_uuid_generate_from_strings ("default-wired",
+	                                             machine_id ?: "",
+	                                             defname,
+	                                             hw_address,
+	                                             NULL);
+
 	g_object_set (setting,
 	              NM_SETTING_CONNECTION_ID, defname,
 	              NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
@@ -1457,8 +1476,6 @@ new_default_connection (NMDevice *self)
 	              NM_SETTING_CONNECTION_UUID, uuid,
 	              NM_SETTING_CONNECTION_TIMESTAMP, (guint64) time (NULL),
 	              NULL);
-	g_free (uuid);
-	g_free (defname);
 
 	/* Lock the connection to the device */
 	setting = nm_setting_wired_new ();