summary refs log tree commit diff
path: root/libnm-core/nm-utils.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2016-10-01 00:33:49 +0200
committerMichael Biebl <biebl@debian.org>2016-10-01 00:33:49 +0200
commit270c4830551c9810ad4e83f9a1db2b1cb946208c (patch)
tree5df09188f7e43b70896efb7b6e942e0b130d75d3 /libnm-core/nm-utils.c
parent7514efc2f38c9ace4557d4e69d68e7d380389030 (diff)
New upstream version 1.4.2 upstream/1.4.2
Diffstat (limited to 'libnm-core/nm-utils.c')
-rw-r--r--libnm-core/nm-utils.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index a31a9190..df75d565 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -3425,7 +3425,22 @@ _nm_utils_hwaddr_cloned_data_synth (NMSetting *setting,
 	              "cloned-mac-address",
 	              &addr,
 	              NULL);
-	return addr ? g_variant_new_string (addr) : NULL;
+
+	/* Before introducing the extended "cloned-mac-address" (and its D-Bus
+	 * field "assigned-mac-address"), libnm's _nm_utils_hwaddr_to_dbus()
+	 * would drop invalid values as it was unable to serialize them.
+	 *
+	 * Now, we would like to send invalid values as "assigned-mac-address"
+	 * over D-Bus and let the server reject them.
+	 *
+	 * However, clients used to set the cloned-mac-address property
+	 * to "" and it just worked as the value was not serialized in
+	 * an ill form.
+	 *
+	 * To preserve that behavior, seralize "" as NULL.
+	 */
+
+	return addr && addr[0] ? g_variant_new_string (addr) : NULL;
 }
 
 gboolean
@@ -3443,7 +3458,7 @@ _nm_utils_hwaddr_cloned_data_set (NMSetting *setting,
 
 	g_object_set (setting,
 	              "cloned-mac-address",
-	              g_variant_get_string (value, NULL),
+	              nm_str_not_empty (g_variant_get_string (value, NULL)),
 	              NULL);
 	return TRUE;
 }