summary refs log tree commit diff
path: root/src/core/nm-dispatcher.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2025-02-12 13:46:50 +0100
committerMichael Biebl <biebl@debian.org>2025-02-12 13:46:50 +0100
commit8bdf070ff046f482f6eb5e2b15ebc216f5d1e3da (patch)
treef706478d189d54c6532e8863d4b0d5ff5575af60 /src/core/nm-dispatcher.c
parent818258cf34b83fbc754633295e1052d4752d7b15 (diff)
New upstream version 1.51.90 upstream/1.51.90
Diffstat (limited to 'src/core/nm-dispatcher.c')
-rw-r--r--src/core/nm-dispatcher.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/nm-dispatcher.c b/src/core/nm-dispatcher.c
index 4f442c68..16fb7e96 100644
--- a/src/core/nm-dispatcher.c
+++ b/src/core/nm-dispatcher.c
@@ -247,6 +247,20 @@ dump_ip_to_props(const NML3ConfigData *l3cd, int addr_family, GVariantBuilder *b
     }
     g_variant_builder_add(builder, "{sv}", "addresses", g_variant_builder_end(&int_builder));
 
+    /* We used to send name servers as a entry with key "nameservers" and binary
+     * value. That no longer works because name servers can be URIs. Send the
+     * value as an array of strings.
+     * To avoid problems when the NM and NM-dispatcher version don't match (right
+     * after an upgrade or downgrade), still send the old key in the old format,
+     * and introduce a new key for the new format. */
+    g_variant_builder_init(&int_builder, G_VARIANT_TYPE("as"));
+    strarr = nm_l3_config_data_get_nameservers(l3cd, addr_family, &n);
+    for (i = 0; i < n; i++)
+        g_variant_builder_add(&int_builder, "s", strarr[i]);
+    g_variant_builder_add(builder, "{sv}", "nameservers-full", g_variant_builder_end(&int_builder));
+
+    /* Old format for nameservers. This can be removed in the future when it's
+     * expected that both NM and NM-dispatcher support the new format.*/
     if (IS_IPv4)
         g_variant_builder_init(&int_builder, G_VARIANT_TYPE("au"));
     else
@@ -255,7 +269,7 @@ dump_ip_to_props(const NML3ConfigData *l3cd, int addr_family, GVariantBuilder *b
     for (i = 0; i < n; i++) {
         NMIPAddr a;
 
-        if (!nm_utils_dnsname_parse_assert(addr_family, strarr[i], NULL, &a, NULL))
+        if (!nm_dns_uri_parse_plain(addr_family, strarr[i], NULL, &a))
             continue;
 
         if (IS_IPv4)