From 592f9ff6bc69cc849b885c190b9d003de488dc3b Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 14 Jul 2021 09:58:50 +1000 Subject: [PATCH 1/3] Test that 'zone-statistics full;' is properly processed --- bin/tests/system/conf.sh.common | 4 +- bin/tests/system/statistics/clean.sh | 1 + .../system/statistics/ns2/named2.conf.in | 48 +++++++++++++++++++ bin/tests/system/statistics/tests.sh | 37 ++++++++++++++ 4 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 bin/tests/system/statistics/ns2/named2.conf.in diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index bbc6ade2ea..f307da1eb6 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -577,7 +577,7 @@ _repeat() ( ) rndc_reload() { - echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'$1' /'`" + $RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reload $3 2>&1 | sed 's/^/'"I:$SYSTESTDIR:$1"' /' # reloading single zone is synchronous, if we're reloading whole server # we need to wait for reload to finish if [ -z "$3" ]; then @@ -589,7 +589,7 @@ rndc_reload() { } rndc_reconfig() { - echo_i "`$RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/'$1' /'`" + $RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/'"I:$SYSTESTDIR:$1"' /' for __try in 0 1 2 3 4 5 6 7 8 9; do $RNDC -c ../common/rndc.conf -s $2 -p ${CONTROLPORT} status | grep "reload/reconfig in progress" > /dev/null || break sleep 1 diff --git a/bin/tests/system/statistics/clean.sh b/bin/tests/system/statistics/clean.sh index 8a82a49d64..a99e3bab97 100644 --- a/bin/tests/system/statistics/clean.sh +++ b/bin/tests/system/statistics/clean.sh @@ -20,6 +20,7 @@ rm -f */named.memstats rm -f */named.run rm -f */ans.run rm -f */named.stats +rm -f */named.stats-stage* rm -f dig.out* rm -f curl.out.* rm -f ns*/named.lock diff --git a/bin/tests/system/statistics/ns2/named2.conf.in b/bin/tests/system/statistics/ns2/named2.conf.in new file mode 100644 index 0000000000..7fdf3037aa --- /dev/null +++ b/bin/tests/system/statistics/ns2/named2.conf.in @@ -0,0 +1,48 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, you can obtain one at https://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +options { + query-source address 10.53.0.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion yes; + notify yes; +}; + +statistics-channels { + inet 10.53.0.2 port @EXTRAPORT1@ allow { any; }; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.2 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; +}; + + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +zone "example" { + type primary; + file "example.db"; + allow-update { any; }; + zone-statistics full; +}; diff --git a/bin/tests/system/statistics/tests.sh b/bin/tests/system/statistics/tests.sh index 055bd88d4a..aed7bba1d2 100644 --- a/bin/tests/system/statistics/tests.sh +++ b/bin/tests/system/statistics/tests.sh @@ -238,5 +238,42 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=`expr $n + 1` +echo_i "Check that 'zone-statistics full;' is processed by 'rndc reconfig' ($n)" +ret=0 +# off by default +rm -f ns2/named.stats +$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /' +sleep 1 +cp ns2/named.stats ns2/named.stats-stage1-$n +sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage1-$n | grep -F '[example]' > /dev/null && ret=0 +# turn on +copy_setports ns2/named2.conf.in ns2/named.conf +rndc_reconfig ns2 10.53.0.2 +rm -f ns2/named.stats +$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /' +sleep 1 +cp ns2/named.stats ns2/named.stats-stage2-$n +sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage2-$n | grep -F '[example]' > /dev/null || ret=1 +# turn off +copy_setports ns2/named.conf.in ns2/named.conf +rndc_reconfig ns2 10.53.0.2 +rm -f ns2/named.stats +$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /' +sleep 1 +cp ns2/named.stats ns2/named.stats-stage3-$n +sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage3-$n | grep -F '[example]' > /dev/null && ret=0 +# turn on +copy_setports ns2/named2.conf.in ns2/named.conf +rndc_reconfig ns2 10.53.0.2 +rm -f ns2/named.stats +$RNDCCMD -s 10.53.0.2 stats 2>&1 | sed 's/^/I:ns2 /' +sleep 1 +cp ns2/named.stats ns2/named.stats-stage4-$n +sed -n '/Per Zone Query Statistics/,/^++/p' ns2/named.stats-stage4-$n | grep -F '[example]' > /dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` +n=`expr $n + 1` + + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 From 616896d735df796968e6ab827515c1134fc9a245 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 14 Jul 2021 09:59:47 +1000 Subject: [PATCH 2/3] zone->requeststats_on was not being set at the correct point --- lib/dns/zone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index f1cf499a23..c8d0f74d84 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -19715,8 +19715,8 @@ dns_zone_setrequeststats(dns_zone_t *zone, isc_stats_t *stats) { } else if (!zone->requeststats_on && stats != NULL) { if (zone->requeststats == NULL) { isc_stats_attach(stats, &zone->requeststats); - zone->requeststats_on = true; } + zone->requeststats_on = true; } UNLOCK_ZONE(zone); } From f2461afff745d26cd9a4a6dfff23cf47717dc376 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 14 Jul 2021 10:20:13 +1000 Subject: [PATCH 3/3] Add CHANGES for [GL #2820] --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index f3ee05567d..238d5993d1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5682. [bug] Not all changes to zone-statistics settings were + properly processed. [GL #2820] + 5681. [func] Relax the "zone_cdscheck" function to allow CDS and CDNSKEY records in the zone that do not match an existing DNSKEY record, so long as the algorithm