]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: persist DNSOverTLS configuration in state file
authormsizanoen1 <msizanoen@qtmlabs.xyz>
Tue, 27 Sep 2022 14:48:48 +0000 (21:48 +0700)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 Sep 2022 23:09:06 +0000 (08:09 +0900)
Currently, NetworkManager will set DNSOverTLS according to its
`connection.dnsovertls` configuration only once during connection,
instead of every single restart of systemd-resolved, causing resolved to
lose the configuration on restart.

Fix this by persisting DNSOverTLS in the runtime state file, which will
also make it more consistent with other interface-specific settings.

src/resolve/resolved-link.c

index 35b31a5317ed2e947fd151647625f65da35757d6..9ab55eb82e39fcc9bc1d28d3393ed9d57a00f99e 100644 (file)
@@ -1204,6 +1204,10 @@ int link_save_user(Link *l) {
         if (v)
                 fprintf(f, "DNSSEC=%s\n", v);
 
+        v = dns_over_tls_mode_to_string(l->dns_over_tls_mode);
+        if (v)
+                fprintf(f, "DNSOVERTLS=%s\n", v);
+
         if (l->default_route >= 0)
                 fprintf(f, "DEFAULT_ROUTE=%s\n", yes_no(l->default_route));
 
@@ -1281,6 +1285,7 @@ int link_load_user(Link *l) {
                 *llmnr = NULL,
                 *mdns = NULL,
                 *dnssec = NULL,
+                *dns_over_tls = NULL,
                 *servers = NULL,
                 *domains = NULL,
                 *ntas = NULL,
@@ -1305,6 +1310,7 @@ int link_load_user(Link *l) {
                            "LLMNR", &llmnr,
                            "MDNS", &mdns,
                            "DNSSEC", &dnssec,
+                           "DNSOVERTLS", &dns_over_tls,
                            "SERVERS", &servers,
                            "DOMAINS", &domains,
                            "NTAS", &ntas,
@@ -1332,6 +1338,9 @@ int link_load_user(Link *l) {
         /* If we can't recognize the DNSSEC setting, then set it to invalid, so that the daemon default is used. */
         l->dnssec_mode = dnssec_mode_from_string(dnssec);
 
+        /* Same for DNSOverTLS */
+        l->dns_over_tls_mode = dns_over_tls_mode_from_string(dns_over_tls);
+
         for (p = servers;;) {
                 _cleanup_free_ char *word = NULL;