]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check TTLs of mixed TTL ANY response with expired records
authorMark Andrews <marka@isc.org>
Tue, 25 Oct 2022 04:57:33 +0000 (15:57 +1100)
committerMark Andrews <marka@isc.org>
Wed, 7 Dec 2022 23:46:20 +0000 (10:46 +1100)
(cherry picked from commit e49f83499a4afc30847f85902726547ae7bbf4d4)

bin/tests/system/resolver/ns4/tld1.db
bin/tests/system/resolver/ns4/tld2.db
bin/tests/system/resolver/tests.sh

index 4bcfcf5f024da4e71c87ee5b6f9c4eca1dfb1309..03d79088feb2f8f1f1b23fd069a0e1f47d39793e 100644 (file)
@@ -30,3 +30,6 @@ edns-version.tld.     NS      ns.edns-version.tld.
 ns.edns-version.tld.   A       10.53.0.7
 cname                  CNAME   ns7
 ns7                    A       10.53.0.7
+mixedttl 10            A       10.0.0.1
+mixedttl 15            TXT     a TXT record
+mixedttl 20            AAAA    2001:db8::1
index 45dc6943a530b2d2426da9a48d1266d30f7885ff..c3a96d9f4fe90b370adff0f5f385043524ced8b1 100644 (file)
@@ -30,3 +30,6 @@ edns-version.tld.     NS      ns.edns-version.tld.
 ns.edns-version.tld.   A       10.53.0.7
 cname                  CNAME   ns7
 ns7                    A       10.53.0.7
+mixedttl 10            A       10.0.0.1
+mixedttl 15            TXT     a TXT record
+mixedttl 20            AAAA    2001:db8::1
index e928e49eaf6fe9bb92a0a0005abc5ef476f90e46..eec56a8aed59de91a692e1328f8ae17ddddd2533 100755 (executable)
@@ -904,5 +904,24 @@ grep "status: NOERROR" dig.out.ns9.${n} > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+n=$((n+1))
+echo_i "check expired TTLs with qtype * (${n})"
+ret=0
+dig_with_opts +tcp @10.53.0.5 mixedttl.tld any > dig.out.1.${n} || ret=1
+ttl1=$(awk '$1 == "mixedttl.tld." && $4 == "A" { print $2 + 1 }' dig.out.1.${n})
+# sleep TTL + 1 so that record has expired
+sleep "${ttl1:-0}"
+dig_with_opts +tcp @10.53.0.5 mixedttl.tld any > dig.out.2.${n} || ret=1
+# check preconditions
+grep "ANSWER: 3," dig.out.1.${n} > /dev/null || ret=1
+lines=$(awk '$1 == "mixedttl.tld." && $2 > 30 { print }' dig.out.1.${n} | wc -l)
+test ${lines:-1} -ne 0 && ret=1
+# check behaviour (there may be 1 answer on very slow machines)
+grep "ANSWER: [12]," dig.out.2.${n} > /dev/null || ret=1
+lines=$(awk '$1 == "mixedttl.tld." && $2 > 30 { print }' dig.out.2.${n} | wc -l)
+test ${lines:-1} -ne 0 && ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1