]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test rndc retransfer -force
authorAram Sargsyan <aram@isc.org>
Tue, 11 Jun 2024 12:26:08 +0000 (12:26 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 1 Aug 2024 11:01:14 +0000 (11:01 +0000)
Use a big zone and the slow transfer mode. Initiate a retransfer, wait
several seconds, then initiate a retransfer using a '-force' argument,
which should cancel the previous transfer and start a new one.

bin/tests/system/xfer/ns1/axfr-rndc-retransfer-force.db [new file with mode: 0644]
bin/tests/system/xfer/ns1/named1.conf.in
bin/tests/system/xfer/ns1/named2.conf.in
bin/tests/system/xfer/ns6/named.conf.in
bin/tests/system/xfer/tests.sh

diff --git a/bin/tests/system/xfer/ns1/axfr-rndc-retransfer-force.db b/bin/tests/system/xfer/ns1/axfr-rndc-retransfer-force.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-$
index 1f010ff8886955b803ed9e2828e9bc31c37dada2..d3f597dfda054f3e80c5dc0818a0d6ab6d7ae274 100644 (file)
@@ -47,6 +47,7 @@ zone "edns-expire" {
        file "edns-expire.db";
 };
 
+
 zone "axfr-max-transfer-time" {
        type primary;
        file "axfr-max-transfer-time.db";
@@ -57,6 +58,11 @@ zone "axfr-max-idle-time" {
        file "axfr-max-idle-time.db";
 };
 
+zone "axfr-rndc-retransfer-force" {
+       type primary;
+       file "axfr-rndc-retransfer-force.db";
+};
+
 zone "axfr-too-big" {
        type primary;
        file "axfr-too-big.db";
index 3803b49056f7f062ee8ee1840daf216905426a2a..3c7f2fae2091fb8ddb03ea55e00b9147f0aaaa1d 100644 (file)
@@ -40,3 +40,8 @@ zone "axfr-max-transfer-time" {
        type primary;
        file "axfr-max-transfer-time.db";
 };
+
+zone "axfr-rndc-retransfer-force" {
+       type primary;
+       file "axfr-rndc-retransfer-force.db";
+};
index 8fd14bd7b1ec3ea70be82f0b6b2e90db1f0ecc7d..e98fc3b58862aef2059438ff7e91a634ad0c32a8 100644 (file)
@@ -71,6 +71,12 @@ zone "axfr-max-idle-time" {
        file "axfr-max-idle-time.bk";
 };
 
+zone "axfr-rndc-retransfer-force" {
+       type secondary;
+       primaries { 10.53.0.1; };
+       file "axfr-rndc-retransfer-force.bk";
+};
+
 zone "axfr-too-big" {
        type secondary;
        max-records 30;
index 950268def411b81948524f6cc67fa9da84a85aaa..feeb3a679f329d4897677a5d3ab5ebae230f8a9f 100755 (executable)
@@ -646,27 +646,50 @@ wait_for_message() (
   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)"
+# Restart ns1 with -T transferslowly
 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
+
+nextpart ns6/named.run >/dev/null
+
+n=$((n + 1))
+echo_i "test rndc retransfer -force ($n)"
 tmp=0
-retry_quiet 10 wait_for_message "maximum transfer time exceeded: timed out" || tmp=1
+$RNDCCMD 10.53.0.6 retransfer axfr-rndc-retransfer-force 2>&1 | sed 's/^/ns6 /' | cat_i
+# Wait for at least one message
+msg="'axfr-rndc-retransfer-force/IN' from 10.53.0.1#${PORT}: received"
+retry_quiet 5 wait_for_message "$msg" || tmp=1
+# Issue a retransfer-force command which should cancel the ongoing transfer and start a new one
+$RNDCCMD 10.53.0.6 retransfer -force axfr-rndc-retransfer-force 2>&1 | sed 's/^/ns6 /' | cat_i
+msg="'axfr-rndc-retransfer-force/IN' from 10.53.0.1#${PORT}: Transfer status: operation canceled"
+retry_quiet 5 wait_for_message "$msg" || tmp=1
+# Wait for the new transfer to complete successfully
+msg="'axfr-rndc-retransfer-force/IN' from 10.53.0.1#${PORT}: Transfer status: success"
+retry_quiet 30 wait_for_message "$msg" || tmp=1
+if test $tmp != 0; then echo_i "failed"; fi
 status=$((status + tmp))
 
 nextpart ns6/named.run >/dev/null
 
 n=$((n + 1))
-echo_i "test max-transfer-idle-in with 50 seconds timeout ($n)"
+echo_i "test max-transfer-time-in with 1 second timeout ($n)"
+$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))
+
+# Restart ns1 with -T transferstuck
 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
+
+nextpart ns6/named.run >/dev/null
+
+n=$((n + 1))
+echo_i "test max-transfer-idle-in with 50 seconds timeout ($n)"
 start=$(date +%s)
 $RNDCCMD 10.53.0.6 retransfer axfr-max-idle-time 2>&1 | sed 's/^/ns6 /' | cat_i
 tmp=0