]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check that received ZONEVERSION is logged
authorMark Andrews <marka@isc.org>
Mon, 17 Jun 2024 01:38:19 +0000 (11:38 +1000)
committerMark Andrews <marka@isc.org>
Mon, 24 Mar 2025 22:16:09 +0000 (22:16 +0000)
bin/tests/system/resolver/ans2/ans.pl
bin/tests/system/resolver/ns1/named.conf.in
bin/tests/system/resolver/ns5/named.conf.in
bin/tests/system/resolver/tests.sh

index 079a7d987940176c637447a4c97b35aade9f516f..8ec4b0a59b12fbec9b37545d65f1ec72c9225ebd 100644 (file)
@@ -20,6 +20,8 @@ use IO::Socket;
 use Net::DNS;
 use Net::DNS::Packet;
 
+print "Using Net::DNS $Net::DNS::VERSION\n";
+
 my $localport = int($ENV{'PORT'});
 if (!$localport) { $localport = 5300; }
 
@@ -170,6 +172,15 @@ for (;;) {
                        $packet->push("authority",
                                      new Net::DNS::RR($qname . " 300 SOA . . 0 0 0 0 0"));
                }
+       } elsif ($qname eq "zoneversion") {
+               $packet->push("authority", new Net::DNS::RR(". 300 SOA . . 0 0 0 0 0"));
+               if ($Net::DNS::VERSION >= 1.49) {
+                       $packet->edns->option('ZONEVERSION' => [0, 1, '01022304'] )
+               } elsif ($Net::DNS::VERSION >= 1.35) {
+                       $packet->edns->option('19' => {'BASE16' => '000101022304'} )
+               } else {
+                       $packet->edns->option('19' => pack 'H*', '000101022304')
+               }
        } else {
                # Data for the "bogus referrals" test
                $packet->push("authority", new Net::DNS::RR("below.www.example.com 300 NS ns.below.www.example.com"));
index 23356889cc781e2714ec613aa201565b1a2e1ca9..cb0cb13d1731dd046078aeea4ec094ddfab3ab33 100644 (file)
@@ -31,6 +31,7 @@ options {
        resolver-query-timeout 5000; # 5 seconds
        attach-cache "globalcache";
        max-recursion-queries 100;
+       request-zoneversion yes;
 };
 
 trust-anchors { };
index 32c5fa71113b71512e9032bb67054b154eee3757..21c5fe87357eabded1b358bef133e57eff023d18 100644 (file)
@@ -26,6 +26,15 @@ options {
        querylog yes;
        prefetch 4 10;
        responselog yes;
+       request-nsid yes;
+       request-zoneversion yes;
+};
+
+// Don't break tests which depend on ans10 by requesting
+// zoneversion or nsid
+server 10.53.0.10 {
+       request-nsid no;
+       request-zoneversion no;
 };
 
 include "trusted.conf";
index 01de8e7d7fd2bdb6d58c3c980cd5553c734962c5..894f7c5266809bdd6f6cc634d59a2b008ba30b46 100755 (executable)
@@ -901,6 +901,23 @@ test ${lines:-1} -ne 0 && ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+n=$((n + 1))
+echo_i "check that received ZONEVERSION is logged ($n)"
+ret=0
+pat="received ZONEVERSION serial 2010 from 10.53.0.4#[0-9]* for mixedttl.tld/TXT zone tld"
+grep "$pat" ns5/named.run >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
+n=$((n + 1))
+echo_i "check that received ZONEVERSION is logged non serial ($n)"
+ret=0
+dig_with_opts +tcp @10.53.0.1 zoneversion >dig.out.${n} || ret=1
+pat='received ZONEVERSION type 1 value 01022304 (\.\.#\.) from 10.53.0.2#[0-9]* for zoneversion/A zone \.'
+grep "$pat" ns1/named.run >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 n=$((n + 1))
 echo_i "check resolver behavior when FORMERR for EDNS options happens (${n})"
 ret=0