Merge branch '2820-rndc-reconfig-does-not-act-on-change-to-zone-statistics' into 'main'

Resolve "rndc reconfig does not act on change to zone-statistics"

Closes #2820

See merge request isc-projects/bind9!5271
This commit is contained in:
Mark Andrews 2021-07-16 04:09:53 +00:00
commit ddacc7e1b2
6 changed files with 92 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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;
};

View file

@ -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

View file

@ -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);
}