summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clients/tui/nmt-mac-entry.c3
-rw-r--r--libnm-core/nm-utils.c19
2 files changed, 19 insertions, 3 deletions
diff --git a/clients/tui/nmt-mac-entry.c b/clients/tui/nmt-mac-entry.c
index da7f55fac1..5650f946de 100644
--- a/clients/tui/nmt-mac-entry.c
+++ b/clients/tui/nmt-mac-entry.c
@@ -201,7 +201,8 @@ nmt_mac_entry_get_property (GObject *object,
g_value_set_int (value, priv->mac_length);
break;
case PROP_MAC_ADDRESS:
- g_value_set_string (value, nmt_newt_entry_get_text (NMT_NEWT_ENTRY (object)));
+ g_value_set_string (value,
+ nm_strdup_not_empty (nmt_newt_entry_get_text (NMT_NEWT_ENTRY (object))));
break;
case PROP_ENTRY_TYPE:
g_value_set_int (value, priv->entry_type);
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index a31a91906f..5c2c1299b1 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 and _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_strdup_not_empty (g_variant_get_string (value, NULL)),
NULL);
return TRUE;
}