]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dns-configuration: add in_addr_union field to DNSServer type
authorNick Rosbrook <enr0n@ubuntu.com>
Fri, 30 Jan 2026 19:34:28 +0000 (14:34 -0500)
committerNick Rosbrook <enr0n@ubuntu.com>
Tue, 3 Feb 2026 20:07:41 +0000 (15:07 -0500)
This makes it easier to use DNSServer with helpers from in-addr-util.h.

src/shared/dns-configuration.c
src/shared/dns-configuration.h

index 2e0ee8f0141bcb0635a932db059bbb84aa42e2c5..e148c2f8fd29b479a1f07f460c071387ace5a2a2 100644 (file)
@@ -58,6 +58,7 @@ static int dispatch_dns_server(const char *name, sd_json_variant *variant, sd_js
                 return json_log(variant, flags, SYNTHETIC_ERRNO(EINVAL),
                                 "Dispatched address size (%zu) is incompatible with the family (%s).",
                                 s->addr.iov_len, af_to_ipv4_ipv6(s->family));
+        memcpy_safe(&s->in_addr, s->addr.iov_base, s->addr.iov_len);
 
         *ret = TAKE_PTR(s);
 
index 93123f4467d5d32713a0c33785f166ab80788d99..af6e061780e132f3b3e4dd5f9f57efd6a0c240c7 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <sys/uio.h>
 
+#include "in-addr-util.h"
 #include "shared-forward.h"
 
 typedef struct DNSServer {
@@ -12,6 +13,7 @@ typedef struct DNSServer {
         int ifindex;
         char *server_name;
         bool accessible;
+        union in_addr_union in_addr;
 } DNSServer;
 
 DNSServer* dns_server_free(DNSServer *s);