Check TTLs of mixed TTL ANY response with expired records

This commit is contained in:
Mark Andrews
2022-10-25 15:57:33 +11:00
parent 90249e4aa5
commit e49f83499a
3 changed files with 25 additions and 0 deletions

View 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

View 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

View File

@@ -860,5 +860,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