summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-dns.c
diff options
context:
space:
mode:
authorRonan Pigott <ronan@rjp.ie>2024-01-16 08:04:41 +0100
committerRonan Pigott <ronan@rjp.ie>2024-10-21 18:10:19 +0200
commit3fd6708cde0fa4283e2335aca288a40a49406f3c (patch)
tree2f5f397a9b3f99e326044f0696ccd2d8c8589fac /src/network/networkd-dns.c
parentnetwork: Add serialization for DoT resolvers (diff)
downloadsystemd-3fd6708cde0fa4283e2335aca288a40a49406f3c.tar.xz
systemd-3fd6708cde0fa4283e2335aca288a40a49406f3c.zip
network: Serialize DNR servers
Implement serialization/deserialization for DNR servers. This re-uses the string format in place for user configuration of DoT servers, and as a consequence non-DoT servers are discarded when recording the link configuration, for correctness. This also enables sd-resolved to use these servers as it would other DNS servers.
Diffstat (limited to 'src/network/networkd-dns.c')
-rw-r--r--src/network/networkd-dns.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/network/networkd-dns.c b/src/network/networkd-dns.c
index 74a371b6d7..fb2b282bc8 100644
--- a/src/network/networkd-dns.c
+++ b/src/network/networkd-dns.c
@@ -94,6 +94,31 @@ bool link_get_use_dns(Link *link, NetworkConfigSource proto) {
return true;
}
+bool link_get_use_dnr(Link *link, NetworkConfigSource proto) {
+ int n;
+
+ assert(link);
+
+ if (!link->network)
+ return false;
+
+ switch (proto) {
+ case NETWORK_CONFIG_SOURCE_DHCP4:
+ n = link->network->dhcp_use_dnr;
+ break;
+ default:
+ assert_not_reached();
+ }
+
+ /* If set explicitly, use that */
+ if (n >= 0)
+ return n;
+
+ /* Otherwise, default to the same as the UseDNS setting. After all,
+ * this is just another way for the server to tell us about DNS configuration. */
+ return link_get_use_dns(link, proto);
+}
+
int config_parse_domains(
const char *unit,
const char *filename,