]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: reallocate DNS scope when DNSSEC and/or DNS-over-TLS settings are changed
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 8 May 2022 05:50:39 +0000 (14:50 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 10 May 2022 07:44:45 +0000 (09:44 +0200)
Fixes #23227.

src/resolve/resolved-link-bus.c
src/resolve/resolved-link.c

index 881b65bb2630b7ab528ac648d12acaedf5fccd97..2361f448e8e542a200d74f6aee5e21ab9e6c03c4 100644 (file)
@@ -640,6 +640,7 @@ int bus_link_method_set_dns_over_tls(sd_bus_message *message, void *userdata, sd
 
         if (l->dns_over_tls_mode != mode) {
                 link_set_dns_over_tls_mode(l, mode);
+                link_allocate_scopes(l);
 
                 (void) link_save_user(l);
 
@@ -688,6 +689,7 @@ int bus_link_method_set_dnssec(sd_bus_message *message, void *userdata, sd_bus_e
 
         if (l->dnssec_mode != mode) {
                 link_set_dnssec_mode(l, mode);
+                link_allocate_scopes(l);
 
                 (void) link_save_user(l);
 
index 8027eb6f91ff515d1ce31838b7c1b561f2b1a75a..cd960e25b1d5a3ca0e8040d3614418e5d3eaa4cb 100644 (file)
@@ -390,6 +390,7 @@ void link_set_dns_over_tls_mode(Link *l, DnsOverTlsMode mode) {
 #endif
 
         l->dns_over_tls_mode = mode;
+        l->unicast_scope = dns_scope_free(l->unicast_scope);
 }
 
 static int link_update_dns_over_tls_mode(Link *l) {
@@ -430,17 +431,8 @@ void link_set_dnssec_mode(Link *l, DnssecMode mode) {
         if (l->dnssec_mode == mode)
                 return;
 
-        if ((l->dnssec_mode == _DNSSEC_MODE_INVALID) ||
-            (l->dnssec_mode == DNSSEC_NO && mode != DNSSEC_NO) ||
-            (l->dnssec_mode == DNSSEC_ALLOW_DOWNGRADE && mode == DNSSEC_YES)) {
-
-                /* When switching from non-DNSSEC mode to DNSSEC mode, flush the cache. Also when switching from the
-                 * allow-downgrade mode to full DNSSEC mode, flush it too. */
-                if (l->unicast_scope)
-                        dns_cache_flush(&l->unicast_scope->cache);
-        }
-
         l->dnssec_mode = mode;
+        l->unicast_scope = dns_scope_free(l->unicast_scope);
 }
 
 static int link_update_dnssec_mode(Link *l) {