From: Mark Andrews Date: Thu, 28 Oct 2021 22:41:31 +0000 (+1100) Subject: Check synth-from-dnssec XML counters X-Git-Tag: v9.17.21~5^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dcea1531de14fcd61c2172c35b8b84fa8136fc1;p=thirdparty%2Fbind9.git Check synth-from-dnssec XML counters --- diff --git a/bin/tests/system/synthfromdnssec/clean.sh b/bin/tests/system/synthfromdnssec/clean.sh index b02e421536e..9d247e78bf3 100644 --- a/bin/tests/system/synthfromdnssec/clean.sh +++ b/bin/tests/system/synthfromdnssec/clean.sh @@ -39,3 +39,4 @@ rm -f ./wild.out ./insecure.wild.out rm -f ./wildcname.out ./insecure.wildcname.out rm -f ./minimal.nxdomain.out rm -f ./black.out +rm -f ./xml.out* diff --git a/bin/tests/system/synthfromdnssec/ns1/named.conf.in b/bin/tests/system/synthfromdnssec/ns1/named.conf.in index 192979965fa..7f157df3ff5 100644 --- a/bin/tests/system/synthfromdnssec/ns1/named.conf.in +++ b/bin/tests/system/synthfromdnssec/ns1/named.conf.in @@ -33,6 +33,10 @@ controls { inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; +statistics-channels { + inet 10.53.0.1 port @EXTRAPORT1@ allow { any; }; +}; + zone "." { type primary; file "root.db.signed"; diff --git a/bin/tests/system/synthfromdnssec/ns2/named.conf.in b/bin/tests/system/synthfromdnssec/ns2/named.conf.in index ffb32b9ae18..201ab7735e2 100644 --- a/bin/tests/system/synthfromdnssec/ns2/named.conf.in +++ b/bin/tests/system/synthfromdnssec/ns2/named.conf.in @@ -33,6 +33,10 @@ controls { inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; +statistics-channels { + inet 10.53.0.2 port @EXTRAPORT1@ allow { any; }; +}; + zone "." { type hint; file "root.hints"; diff --git a/bin/tests/system/synthfromdnssec/ns3/named.conf.in b/bin/tests/system/synthfromdnssec/ns3/named.conf.in index fcc44a2d8a5..1fa6f3f27a7 100644 --- a/bin/tests/system/synthfromdnssec/ns3/named.conf.in +++ b/bin/tests/system/synthfromdnssec/ns3/named.conf.in @@ -33,6 +33,10 @@ controls { inet 10.53.0.3 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; +statistics-channels { + inet 10.53.0.3 port @EXTRAPORT1@ allow { any; }; +}; + zone "." { type hint; file "root.hints"; diff --git a/bin/tests/system/synthfromdnssec/ns4/named.conf.in b/bin/tests/system/synthfromdnssec/ns4/named.conf.in index 32e4845c355..06fc825f5ad 100644 --- a/bin/tests/system/synthfromdnssec/ns4/named.conf.in +++ b/bin/tests/system/synthfromdnssec/ns4/named.conf.in @@ -34,6 +34,10 @@ controls { inet 10.53.0.4 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; +statistics-channels { + inet 10.53.0.4 port @EXTRAPORT1@ allow { any; }; +}; + zone "." { type hint; file "root.hints"; diff --git a/bin/tests/system/synthfromdnssec/ns5/named.conf.in b/bin/tests/system/synthfromdnssec/ns5/named.conf.in index 0dc554aa0e4..85672b47807 100644 --- a/bin/tests/system/synthfromdnssec/ns5/named.conf.in +++ b/bin/tests/system/synthfromdnssec/ns5/named.conf.in @@ -34,6 +34,10 @@ controls { inet 10.53.0.5 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; +statistics-channels { + inet 10.53.0.5 port @EXTRAPORT1@ allow { any; }; +}; + zone "." { type hint; file "root.hints"; diff --git a/bin/tests/system/synthfromdnssec/ns6/named.conf.in b/bin/tests/system/synthfromdnssec/ns6/named.conf.in index 0b2c712a003..76cb5f64d68 100644 --- a/bin/tests/system/synthfromdnssec/ns6/named.conf.in +++ b/bin/tests/system/synthfromdnssec/ns6/named.conf.in @@ -34,6 +34,10 @@ controls { inet 10.53.0.6 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; +statistics-channels { + inet 10.53.0.6 port @EXTRAPORT1@ allow { any; }; +}; + zone "." { type hint; file "root.hints"; diff --git a/bin/tests/system/synthfromdnssec/tests.sh b/bin/tests/system/synthfromdnssec/tests.sh index 51db3e97ed2..a7cd51266d9 100644 --- a/bin/tests/system/synthfromdnssec/tests.sh +++ b/bin/tests/system/synthfromdnssec/tests.sh @@ -424,6 +424,71 @@ do if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) done + + if ${FEATURETEST} --have-libxml2 && [ -x "${CURL}" ] ; then + echo_i "getting XML statisistcs for (synth-from-dnssec ${description};) ($n)" + ret=0 + xml=xml.out$n + ${CURL} http://10.53.0.${ns}:${EXTRAPORT1}/xml/v3/server > $xml 2>/dev/null || ret=1 + n=$((n+1)) + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status+ret)) + + echo_i "check XML for 'CoveringNSEC' with (synth-from-dnssec ${description};) ($n)" + ret=0 + counter=$(sed -n 's;.*.*\([0-9]*\).*0<" | wc -l) + if [ ${synth} = yes ] + then + test $zero = 0 || ret=1 + else + test $zero = 1 || ret=1 + fi + n=$((n+1)) + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status+ret)) + + echo_i "check XML for 'CacheNSECNodes' with (synth-from-dnssec ${description};) ($n)" + ret=0 + counter=$(sed -n 's;.*.*\([0-9]*\).*0<" | wc -l) + if [ ${ad} = yes ] + then + test $zero = 0 || ret=1 + else + test $zero = 1 || ret=1 + fi + n=$((n+1)) + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status+ret)) + + for synthesized in SynthNXDOMAIN SynthNODATA SynthWILDCARD + do + case $synthesized in + SynthNXDOMAIN) count=1;; + SynthNODATA) count=2;; + SynthWILDCARD) count=2;; + esac + + echo_i "check XML for '$synthesized}' with (synth-from-dnssec ${description};) ($n)" + ret=0 + if [ ${synth} = yes ] + then + grep ''$count'' $xml > /dev/null || ret=1 + else + grep ''0'' $xml > /dev/null || ret=1 + fi + n=$((n+1)) + if [ $ret != 0 ]; then echo_i "failed"; fi + status=$((status+ret)) + done + else + echo_i "Skipping XML statistics checks" + fi done echo_i "check redirect response (+dnssec) (synth-from-dnssec ;) ($n)"