]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Implement new checks for the xfer system test
authorAram Sargsyan <aram@isc.org>
Mon, 17 Apr 2023 12:22:49 +0000 (12:22 +0000)
committerOndřej Surý <ondrej@isc.org>
Fri, 21 Apr 2023 10:53:02 +0000 (12:53 +0200)
Check the max-transfer-time-in and max-transfer-idle-in options.

bin/tests/system/xfer/clean.sh
bin/tests/system/xfer/ns1/axfr-max-idle-time.db [new file with mode: 0644]
bin/tests/system/xfer/ns1/axfr-max-transfer-time.db [new file with mode: 0644]
bin/tests/system/xfer/ns1/named1.conf.in [moved from bin/tests/system/xfer/ns1/named.conf.in with 88% similarity]
bin/tests/system/xfer/ns1/named2.conf.in [new file with mode: 0644]
bin/tests/system/xfer/ns1/named3.conf.in [new file with mode: 0644]
bin/tests/system/xfer/ns6/named.args [new file with mode: 0644]
bin/tests/system/xfer/ns6/named.conf.in
bin/tests/system/xfer/setup.sh
bin/tests/system/xfer/tests.sh

index bf5016e8f91315a788b4cbd590881c7bbcad3fcf..effdda8a924ce076398f6b003e41f353287ad4e8 100644 (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.*
diff --git a/bin/tests/system/xfer/ns1/axfr-max-idle-time.db b/bin/tests/system/xfer/ns1/axfr-max-idle-time.db
new file mode 100644 (file)
index 0000000..252925f
--- /dev/null
@@ -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-$
diff --git a/bin/tests/system/xfer/ns1/axfr-max-transfer-time.db b/bin/tests/system/xfer/ns1/axfr-max-transfer-time.db
new file mode 100644 (file)
index 0000000..252925f
--- /dev/null
@@ -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-$
similarity index 88%
rename from bin/tests/system/xfer/ns1/named.conf.in
rename to bin/tests/system/xfer/ns1/named1.conf.in
index 26bca1943e0cd1b1c6fce31b3d37cad8b7763cbc..6777f5bb8d7701f77b31e01572771af6b7e29b81 100644 (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";
diff --git a/bin/tests/system/xfer/ns1/named2.conf.in b/bin/tests/system/xfer/ns1/named2.conf.in
new file mode 100644 (file)
index 0000000..434743d
--- /dev/null
@@ -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";
+};
diff --git a/bin/tests/system/xfer/ns1/named3.conf.in b/bin/tests/system/xfer/ns1/named3.conf.in
new file mode 100644 (file)
index 0000000..4f6344c
--- /dev/null
@@ -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";
+};
diff --git a/bin/tests/system/xfer/ns6/named.args b/bin/tests/system/xfer/ns6/named.args
new file mode 100644 (file)
index 0000000..2be062b
--- /dev/null
@@ -0,0 +1 @@
+-D xfer-ns6 -X named.lock -m record -c named.conf -d 99 -g -U 4 -T maxcachesize=2097152 -T transferinsecs
index 636400cfcedb07aa10755fd5de8048d0f9a30ff6..d5b87108964610ca902d317f69cc138e0fac0f9c 100644 (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;
index 092d798799a8cbf06b09e4127ad95e59ae030949..ff64d8fbddcc5a6012b213c577669be1152e00ee 100644 (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
index 25cb9857d6721bc5b824f96d5b043e2272e15c43..5891de70ba3a4fdac1fd5c78b1c0dd49548518a5 100755 (executable)
@@ -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