]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add test for "Others" rrtype stat counter
authorMatthijs Mekking <matthijs@isc.org>
Wed, 15 Jan 2020 15:11:43 +0000 (16:11 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Tue, 4 Feb 2020 10:58:34 +0000 (11:58 +0100)
Add queries and checks for CAA RRtype in the serve-stale test.
Ensure that the "Others" rrtype stat counter is incremented and
decremented properly if the RRset becomes stale/ancient.

The low max-stale-ttl config option needs to be increased in order
to match the timing when things expire (aka become ancient).

bin/tests/system/serve-stale/ans2/ans.pl
bin/tests/system/serve-stale/ns1/named2.conf.in
bin/tests/system/serve-stale/tests.sh

index 3873847b8fded5973741f0d868116706b7627dfa..a87ebfe0991a523c4727bc1f8c9702b7c0049378 100644 (file)
@@ -47,6 +47,7 @@ my $A = "ns.example 300 IN A $localaddr";
 #
 my $TXT = "data.example 1 IN TXT \"A text record with a 1 second ttl\"";
 my $LONGTXT = "longttl.example 600 IN TXT \"A text record with a 600 second ttl\"";
+my $CAA = "othertype.example 1 IN CAA 0 issue \"ca1.example.net\"";
 my $negSOA = "example 1 IN SOA . . 0 0 0 0 300";
 
 sub reply_handler {
@@ -129,6 +130,15 @@ sub reply_handler {
        my $rr = new Net::DNS::RR($negSOA);
        push @auth, $rr;
        $rcode = "NXDOMAIN";
+    } elsif ($qname eq "othertype.example") {
+       if ($qtype eq "CAA") {
+           my $rr = new Net::DNS::RR($CAA);
+           push @ans, $rr;
+       } else {
+           my $rr = new Net::DNS::RR($negSOA);
+           push @auth, $rr;
+       }
+       $rcode = "NOERROR";
     } else {
         my $rr = new Net::DNS::RR($SOA);
        push @auth, $rr;
index 68d786029642d566a969d7c57426a49cd937d275..7ec265e63188270e0209536f623c54b4facc54ce 100644 (file)
@@ -27,7 +27,7 @@ options {
        listen-on { 10.53.0.1; };
        listen-on-v6 { none; };
        recursion yes;
-       max-stale-ttl 35;
+       max-stale-ttl 45;
        stale-answer-ttl 3;
        stale-answer-enable yes;
 };
index fc09c864efdd1f112a66286049c64f70a8270128..b0cfd93e9b24dd269bbff0bcb5da562139209493 100755 (executable)
@@ -30,6 +30,7 @@ n=0
 #$DIG -p ${PORT} @10.53.0.2 data.example TXT
 #$DIG -p ${PORT} @10.53.0.2 nodata.example TXT
 #$DIG -p ${PORT} @10.53.0.2 nxdomain.example TXT
+#$DIG -p ${PORT} @10.53.0.2 othertype.example CAA
 
 #
 # First test server with serve-stale options set.
@@ -54,6 +55,15 @@ grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "prime cache othertype.example ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "prime cache nodata.example ($n)"
 ret=0
@@ -82,6 +92,7 @@ cp ns1/named.stats ns1/named.stats.$n
 # Check first 10 lines of Cache DB statistics.  After prime queries, we expect
 # two active TXT one nxrrset TXT, and one NXDOMAIN.
 grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
+grep "1 Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "2 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 !TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
@@ -126,6 +137,16 @@ awk '/; answer/ { x=$0; getline; print x, $0}' ns1/named_dump.db.test$n |
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example ($n)"
 ret=0
@@ -158,6 +179,7 @@ cp ns1/named.stats ns1/named.stats.$n
 # stale NXDOMAIN.
 grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
 grep "1 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 #Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #!TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
@@ -189,6 +211,14 @@ status=`expr $status + $ret`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example (serve-stale off) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example (serve-stale off) ($n)"
 ret=0
@@ -230,6 +260,16 @@ grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example (serve-stale on) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example (serve-stale on) ($n)"
 ret=0
@@ -273,6 +313,14 @@ grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example (serve-stale no) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example (serve-stale no) ($n)"
 ret=0
@@ -314,6 +362,16 @@ grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example (serve-stale yes) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype\.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example (serve-stale yes) ($n)"
 ret=0
@@ -366,6 +424,16 @@ grep "data\.example\..*2.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example (serve-stale reset) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype.example\..*2.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example (serve-stale reset) ($n)"
 ret=0
@@ -425,7 +493,7 @@ n=`expr $n + 1`
 echo_i "check 'rndc serve-stale status' ($n)"
 ret=0
 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
-grep '_default: off (rndc) (stale-answer-ttl=3 max-stale-ttl=35)' rndc.out.test$n > /dev/null || ret=1
+grep '_default: off (rndc) (stale-answer-ttl=3 max-stale-ttl=45)' rndc.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
@@ -444,7 +512,7 @@ n=`expr $n + 1`
 echo_i "check 'rndc serve-stale status' ($n)"
 ret=0
 $RNDCCMD 10.53.0.1 serve-stale status > rndc.out.test$n 2>&1 || ret=1
-grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=35)' rndc.out.test$n > /dev/null || ret=1
+grep '_default: on (rndc) (stale-answer-ttl=3 max-stale-ttl=45)' rndc.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
@@ -477,6 +545,15 @@ grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "prime cache othertype.example (low max-stale-ttl) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "prime cache nodata.example (low max-stale-ttl) ($n)"
 ret=0
@@ -506,6 +583,7 @@ cp ns1/named.stats ns1/named.stats.$n
 # two active TXT RRsets, one nxrrset TXT, and one NXDOMAIN.
 grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
 grep "2 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 !TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 status=`expr $status + $ret`
@@ -532,6 +610,16 @@ grep "data\.example\..*3.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check stale othertype.example (low max-stale-ttl) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype\.example\..*3.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check stale nodata.example (low max-stale-ttl) ($n)"
 ret=0
@@ -565,8 +653,10 @@ cp ns1/named.stats ns1/named.stats.$n
 grep -A 10 "++ Cache DB RRsets ++" ns1/named.stats.$n > ns1/named.stats.$n.cachedb || ret=1
 grep "1 TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 #Others" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #!TXT" ns1/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #NXDOMAIN" ns1/named.stats.$n.cachedb > /dev/null || ret=1
+
 status=`expr $status + $ret`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 
@@ -581,6 +671,15 @@ grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check ancient othertype.example (low max-stale-ttl) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.1 othertype.example CAA > dig.out.test$n
+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check ancient nodata.example (low max-stale-ttl) ($n)"
 ret=0
@@ -632,6 +731,16 @@ grep "data\.example\..*1.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "prime cache othertype.example (max-stale-ttl default) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.3 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype\.example\..*1.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "prime cache nodata.example (max-stale-ttl default) ($n)"
 ret=0
@@ -663,6 +772,7 @@ cp ns3/named.stats ns3/named.stats.$n
 # two active TXT RRsets, one nxrrset TXT, and one NXDOMAIN.
 grep -A 10 "++ Cache DB RRsets ++" ns3/named.stats.$n > ns3/named.stats.$n.cachedb || ret=1
 grep "2 TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 Others" ns3/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 !TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 NXDOMAIN" ns3/named.stats.$n.cachedb > /dev/null || ret=1
 status=`expr $status + $ret`
@@ -696,6 +806,15 @@ grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check fail of othertype.example (max-stale-ttl default) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.3 othertype.example CAA > dig.out.test$n
+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check fail of nodata.example (max-stale-ttl default) ($n)"
 ret=0
@@ -727,8 +846,10 @@ cp ns3/named.stats ns3/named.stats.$n
 grep -A 10 "++ Cache DB RRsets ++" ns3/named.stats.$n > ns3/named.stats.$n.cachedb || ret=1
 grep "1 TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 #Others" ns3/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #!TXT" ns3/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #NXDOMAIN" ns3/named.stats.$n.cachedb > /dev/null || ret=1
+
 status=`expr $status + $ret`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 
@@ -757,6 +878,16 @@ grep "data\.example\..*1.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check othertype.example (max-stale-ttl default) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.3 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "example\..*1.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check nodata.example (max-stale-ttl default) ($n)"
 ret=0
@@ -810,6 +941,16 @@ grep "data\.example\..*1.*IN.*TXT.*A text record with a 1 second ttl" dig.out.te
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "prime cache othertype.example (serve-stale disabled) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.4 othertype.example CAA > dig.out.test$n
+grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 1," dig.out.test$n > /dev/null || ret=1
+grep "othertype\.example\..*1.*IN.*CAA.*0.*issue" dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "prime cache nodata.example (serve-stale disabled) ($n)"
 ret=0
@@ -841,6 +982,7 @@ cp ns4/named.stats ns4/named.stats.$n
 # two active TXT RRsets, one nxrrset TXT, and one NXDOMAIN.
 grep -A 10 "++ Cache DB RRsets ++" ns4/named.stats.$n > ns4/named.stats.$n.cachedb || ret=1
 grep "2 TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 Others" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 !TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 NXDOMAIN" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 status=`expr $status + $ret`
@@ -874,6 +1016,15 @@ grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
+n=`expr $n + 1`
+echo_i "check fail of othertype.example (serve-stale disabled) ($n)"
+ret=0
+$DIG -p ${PORT} @10.53.0.4 othertype.example CAA > dig.out.test$n
+grep "status: SERVFAIL" dig.out.test$n > /dev/null || ret=1
+grep "ANSWER: 0," dig.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
 n=`expr $n + 1`
 echo_i "check fail of nodata.example (serve-stale disabled) ($n)"
 ret=0
@@ -905,6 +1056,7 @@ cp ns4/named.stats ns4/named.stats.$n
 grep -A 10 "++ Cache DB RRsets ++" ns4/named.stats.$n > ns4/named.stats.$n.cachedb || ret=1
 grep "1 TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
+grep "1 #Others" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #!TXT" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 grep "1 #NXDOMAIN" ns4/named.stats.$n.cachedb > /dev/null || ret=1
 status=`expr $status + $ret`
@@ -960,6 +1112,7 @@ cp ns4/named.stats ns4/named.stats.$n
 # everything to be removed or scheduled to be removed.
 grep -A 10 "++ Cache DB RRsets ++" ns4/named.stats.$n > ns4/named.stats.$n.cachedb || ret=1
 grep "#TXT" ns4/named.stats.$n.cachedb > /dev/null && ret=1
+grep "#Others" ns4/named.stats.$n.cachedb > /dev/null && ret=1
 grep "#!TXT" ns4/named.stats.$n.cachedb > /dev/null && ret=1
 grep "#NXDOMAIN" ns4/named.stats.$n.cachedb > /dev/null && ret=1
 status=`expr $status + $ret`