2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Implement new checks for the xfer system test

Check the max-transfer-time-in and max-transfer-idle-in options.
This commit is contained in:
Aram Sargsyan
2023-04-17 12:22:49 +00:00
committed by Ondřej Surý
parent dfaecfd752
commit 5324f047b2
10 changed files with 179 additions and 1 deletions

View File

@@ -38,3 +38,4 @@ rm -f ns6/*.db ns6/*.bk ns6/*.jnl
rm -f ns7/*.db ns7/*.bk ns7/*.jnl
rm -f ns8/large.db ns8/small.db
rm -f stats.*
rm -f wait_for_message.*

View File

@@ -0,0 +1,15 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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.
$TTL 3600
@ IN SOA . . 0 0 0 0 0
@ IN NS .
$GENERATE 1-5000 host$ TXT data-$

View File

@@ -0,0 +1,15 @@
; Copyright (C) Internet Systems Consortium, Inc. ("ISC")
;
; SPDX-License-Identifier: MPL-2.0
;
; 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.
$TTL 3600
@ IN SOA . . 0 0 0 0 0
@ IN NS .
$GENERATE 1-5000 host$ TXT data-$

View File

@@ -45,6 +45,16 @@ zone "edns-expire" {
file "edns-expire.db";
};
zone "axfr-max-transfer-time" {
type primary;
file "axfr-max-transfer-time.db";
};
zone "axfr-max-idle-time" {
type primary;
file "axfr-max-idle-time.db";
};
zone "axfr-too-big" {
type primary;
file "axfr-too-big.db";

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* 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.
*/
include "../../common/rndc.key";
controls {
inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion no;
notify yes;
};
zone "." {
type primary;
file "root.db";
};
zone "axfr-max-transfer-time" {
type primary;
file "axfr-max-transfer-time.db";
};

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* SPDX-License-Identifier: MPL-2.0
*
* 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.
*/
include "../../common/rndc.key";
controls {
inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; };
};
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
recursion no;
notify yes;
};
zone "." {
type primary;
file "root.db";
};
zone "axfr-max-idle-time" {
type primary;
file "axfr-max-idle-time.db";
};

View File

@@ -0,0 +1 @@
-D xfer-ns6 -X named.lock -m record -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152 -T transferinsecs

View File

@@ -29,6 +29,7 @@ options {
notify yes;
ixfr-from-differences primary;
check-integrity no;
tcp-idle-timeout 600;
};
zone "." {
@@ -54,6 +55,20 @@ zone "edns-expire" {
file "edns-expire.bk";
};
zone "axfr-max-transfer-time" {
type secondary;
max-transfer-time-in 1; # this is tested as seconds, when used with '-T transferinsecs'
primaries { 10.53.0.1; };
file "axfr-max-transfer-time.bk";
};
zone "axfr-max-idle-time" {
type secondary;
max-transfer-idle-in 50; # this is tested as seconds, when used with '-T transferinsecs'
primaries { 10.53.0.1; };
file "axfr-max-idle-time.bk";
};
zone "axfr-too-big" {
type secondary;
max-records 30;

View File

@@ -23,7 +23,7 @@ $SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 7 >ns7/primary2.db
cp -f ns4/root.db.in ns4/root.db
$PERL -e 'for ($i=0;$i<10000;$i++){ printf("x%u 0 in a 10.53.0.1\n", $i);}' >> ns4/root.db
copy_setports ns1/named.conf.in ns1/named.conf
copy_setports ns1/named1.conf.in ns1/named.conf
copy_setports ns2/named.conf.in ns2/named.conf
copy_setports ns3/named.conf.in ns3/named.conf
copy_setports ns6/named.conf.in ns6/named.conf

View File

@@ -15,6 +15,7 @@
DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}"
RNDCCMD="$RNDC -c ../common/rndc.conf -p ${CONTROLPORT} -s"
NS_PARAMS="-X named.lock -m record -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152"
status=0
n=0
@@ -580,5 +581,45 @@ grep "10.53.0.3#${EXTRAPORT1} (primary): query 'primary/SOA/IN' approved" ns6/na
if test $tmp != 0 ; then echo_i "failed"; fi
status=$((status+tmp))
wait_for_message() (
nextpartpeek ns6/named.run > wait_for_message.$n
grep -F "$1" wait_for_message.$n >/dev/null
)
nextpart ns6/named.run > /dev/null
n=$((n+1))
echo_i "test max-transfer-time-in with 1 second timeout ($n)"
stop_server ns1
copy_setports ns1/named2.conf.in ns1/named.conf
start_server --noclean --restart --port ${PORT} ns1 -- "-D xfer-ns1 $NS_PARAMS -T transferinsecs -T transferslowly"
sleep 1
$RNDCCMD 10.53.0.6 retransfer axfr-max-transfer-time 2>&1 | sed 's/^/ns6 /' | cat_i
tmp=0
retry_quiet 10 wait_for_message "maximum transfer time exceeded: timed out" || tmp=1
status=$((status+tmp))
nextpart ns6/named.run > /dev/null
n=$((n+1))
echo_i "test max-transfer-idle-in with 50 seconds timeout ($n)"
stop_server ns1
copy_setports ns1/named3.conf.in ns1/named.conf
start_server --noclean --restart --port ${PORT} ns1 -- "-D xfer-ns1 $NS_PARAMS -T transferinsecs -T transferstuck"
sleep 1
start=`date +%s`
$RNDCCMD 10.53.0.6 retransfer axfr-max-idle-time 2>&1 | sed 's/^/ns6 /' | cat_i
tmp=0
retry_quiet 60 wait_for_message "maximum idle time exceeded: timed out" || tmp=1
if [ $tmp -eq 0 ]; then
now=`date +%s`
diff=$((now - start))
# we expect a timeout in 50 seconds
test $diff -lt 50 && tmp=1
test $diff -ge 59 && tmp=1
if test $tmp != 0 ; then echo_i "unexpected diff value: ${diff}"; fi
fi
status=$((status+tmp))
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1