summary refs log tree commit diff
path: root/src/nm-dispatcher
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/nm-dispatcher
parent818258cf34b83fbc754633295e1052d4752d7b15 (diff)
New upstream version 1.51.90 upstream/1.51.90
Diffstat (limited to 'src/nm-dispatcher')
-rw-r--r--src/nm-dispatcher/nm-dispatcher-utils.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/src/nm-dispatcher/nm-dispatcher-utils.c b/src/nm-dispatcher/nm-dispatcher-utils.c
index 6659936f..030506e9 100644
--- a/src/nm-dispatcher/nm-dispatcher-utils.c
+++ b/src/nm-dispatcher/nm-dispatcher-utils.c
@@ -264,22 +264,43 @@ construct_ip_items(GPtrArray *items, int addr_family, GVariant *ip_config, const
         g_variant_unref(val);
     }
 
-    val = g_variant_lookup_value(ip_config,
-                                 "nameservers",
-                                 addr_family == AF_INET ? G_VARIANT_TYPE("au")
-                                                        : G_VARIANT_TYPE("aay"));
+    /* For name servers, prefer the new key and fall back to the old one. */
+    val = g_variant_lookup_value(ip_config, "nameservers-full", G_VARIANT_TYPE("as"));
     if (val) {
-        gs_strfreev char **v = NULL;
+        nm_auto_unref_ptrarray GPtrArray *arr = NULL;
+        GVariantIter                      iter;
+        const char                       *str;
+
+        arr = g_ptr_array_new_full(g_variant_n_children(val) + 1, NULL);
+        g_variant_iter_init(&iter, val);
+        while (g_variant_iter_next(&iter, "&s", &str)) {
+            g_ptr_array_add(arr, (gpointer) str);
+        }
+        g_ptr_array_add(arr, NULL);
 
-        if (addr_family == AF_INET)
-            v = nm_utils_ip4_dns_from_variant(val);
-        else
-            v = nm_utils_ip6_dns_from_variant(val);
         _items_add_strv(items,
                         prefix,
                         addr_family == AF_INET ? "IP4_NAMESERVERS" : "IP6_NAMESERVERS",
-                        NM_CAST_STRV_CC(v));
+                        (const char *const *) arr->pdata);
         g_variant_unref(val);
+    } else {
+        val = g_variant_lookup_value(ip_config,
+                                     "nameservers",
+                                     addr_family == AF_INET ? G_VARIANT_TYPE("au")
+                                                            : G_VARIANT_TYPE("aay"));
+        if (val) {
+            gs_strfreev char **v = NULL;
+
+            if (addr_family == AF_INET)
+                v = nm_utils_ip4_dns_from_variant(val);
+            else
+                v = nm_utils_ip6_dns_from_variant(val);
+            _items_add_strv(items,
+                            prefix,
+                            addr_family == AF_INET ? "IP4_NAMESERVERS" : "IP6_NAMESERVERS",
+                            NM_CAST_STRV_CC(v));
+            g_variant_unref(val);
+        }
     }
 
     val = g_variant_lookup_value(ip_config, "domains", G_VARIANT_TYPE_STRING_ARRAY);