]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: clear previous assignments of RefuseRecordTypes= on reload
authorMuhammad Nuzaihan Bin Kamal Luddin <muhammad@taqisystems.com>
Wed, 12 Feb 2025 05:40:04 +0000 (13:40 +0800)
committerLuca Boccassi <bluca@debian.org>
Fri, 14 Feb 2025 11:54:56 +0000 (11:54 +0000)
Follow-up for 81ae2237c1792943a1ec712ae2e630bcc592175b.

src/resolve/resolved-manager.c
test/units/TEST-75-RESOLVED.sh

index f86cc4267d2895c7e9fa6d0ecfa072715b140e33..a1588114471d509a7efa60b522233d64595576fc 100644 (file)
@@ -631,6 +631,7 @@ static void manager_set_defaults(Manager *m) {
         m->resolve_unicast_single_label = false;
         m->cache_from_localhost = false;
         m->stale_retention_usec = 0;
+        m->refuse_record_types = set_free(m->refuse_record_types);
 }
 
 static int manager_dispatch_reload_signal(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {
index facc39b47de05a65227e0c2cfaf133ad4600ac10..d7b535f1538785685f0cd4eb9a67a235b8cb29ed 100755 (executable)
@@ -1135,6 +1135,30 @@ testcase_14_refuse_record_types() {
 
     run resolvectl query localhost5 --type=A
     grep -qF "127.128.0.5" "$RUN_OUT"
+
+    {
+        echo "[Resolve]"
+        echo "RefuseRecordTypes=AAAA"
+    } >/run/systemd/resolved.conf.d/refuserecords.conf
+    systemctl reload systemd-resolved.service
+
+    run dig localhost -t SRV
+    grep -qF "status: NOERROR" "$RUN_OUT"
+
+    run dig localhost -t TXT
+    grep -qF "status: NOERROR" "$RUN_OUT"
+
+    run dig localhost -t AAAA
+    grep -qF "status: REFUSED" "$RUN_OUT"
+
+    (! run resolvectl query localhost5 --type=SRV)
+    grep -qF "does not have any RR of the requested type" "$RUN_OUT"
+
+    (! run resolvectl query localhost5 --type=TXT)
+    grep -qF "does not have any RR of the requested type" "$RUN_OUT"
+
+    (! run resolvectl query localhost5 --type=AAAA)
+    grep -qF "DNS query type refused." "$RUN_OUT"
 }
 
 # PRE-SETUP