]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
add tests for 'delv +ns -4' and '-6'
authorEvan Hunt <each@isc.org>
Thu, 5 Jun 2025 21:10:21 +0000 (14:10 -0700)
committerEvan Hunt <each@isc.org>
Fri, 13 Jun 2025 04:03:25 +0000 (21:03 -0700)
check that `delv +ns` sends iterative queries over both address
families when -4 and -6 are not used, and suppresses queries
appropriately when they are.

(cherry picked from commit d29f1d171050580fde7e1ff3bc70f4c8157a4c1f)

bin/tests/system/digdelv/root.hint [new file with mode: 0644]
bin/tests/system/digdelv/tests.sh

diff --git a/bin/tests/system/digdelv/root.hint b/bin/tests/system/digdelv/root.hint
new file mode 100644 (file)
index 0000000..26bb7a6
--- /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 999999
+.                      IN      NS      a.root-servers.nil.
+a.root-servers.nil.    IN      A       10.53.0.1
+a.root-servers.nil.            AAAA    fd92:7065:b8e:ffff::1
index 85f99191b6834ac77ad702c7318e18d2c49bac7d..8bda1f8b4e5927c5473944182c2c9df98731b6d0 100644 (file)
@@ -1697,7 +1697,8 @@ if [ -x "$DELV" ]; then
 
   n=$((n + 1))
   echo_i "check NS output from delv +ns ($n)"
-  delv_with_opts -i +ns +nortrace +nostrace +nomtrace +novtrace +hint=../_common/root.hint ns example >delv.out.test$n || ret=1
+  ret=0
+  delv_with_opts -i +ns +nortrace +nostrace +nomtrace +novtrace +hint=root.hint ns example >delv.out.test$n || ret=1
   lines=$(awk '$1 == "example." && $4 == "NS" {print}' delv.out.test$n | wc -l)
   [ $lines -eq 2 ] || ret=1
   status=$((status + ret))
@@ -1705,7 +1706,7 @@ if [ -x "$DELV" ]; then
   n=$((n + 1))
   echo_i "checking delv +ns (no validation) ($n)"
   ret=0
-  delv_with_opts -i +ns +hint=../_common/root.hint a a.example >delv.out.test$n || ret=1
+  delv_with_opts -i +ns +hint=root.hint a a.example >delv.out.test$n || ret=1
   grep -q '; authoritative' delv.out.test$n || ret=1
   grep -q '_.example' delv.out.test$n && ret=1
   if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -1714,7 +1715,7 @@ if [ -x "$DELV" ]; then
   n=$((n + 1))
   echo_i "checking delv +ns +qmin (no validation) ($n)"
   ret=0
-  delv_with_opts -i +ns +qmin +hint=../_common/root.hint a a.example >delv.out.test$n || ret=1
+  delv_with_opts -i +ns +qmin +hint=root.hint a a.example >delv.out.test$n || ret=1
   grep -q '; authoritative' delv.out.test$n || ret=1
   if [ $ret -ne 0 ]; then echo_i "failed"; fi
   status=$((status + ret))
@@ -1722,7 +1723,7 @@ if [ -x "$DELV" ]; then
   n=$((n + 1))
   echo_i "checking delv +ns (with validation) ($n)"
   ret=0
-  delv_with_opts -a ns1/anchor.dnskey +root +ns +hint=../_common/root.hint a a.example >delv.out.test$n || ret=1
+  delv_with_opts -a ns1/anchor.dnskey +root +ns +hint=root.hint a a.example >delv.out.test$n || ret=1
   grep -q '; fully validated' delv.out.test$n || ret=1
   grep -q '_.example' delv.out.test$n && ret=1
   if [ $ret -ne 0 ]; then echo_i "failed"; fi
@@ -1731,11 +1732,40 @@ if [ -x "$DELV" ]; then
   n=$((n + 1))
   echo_i "checking delv +ns +qmin (with validation) ($n)"
   ret=0
-  delv_with_opts -a ns1/anchor.dnskey +root +ns +qmin +hint=../_common/root.hint a a.example >delv.out.test$n || ret=1
+  delv_with_opts -a ns1/anchor.dnskey +root +ns +qmin +hint=root.hint a a.example >delv.out.test$n || ret=1
   grep -q '; fully validated' delv.out.test$n || ret=1
   if [ $ret -ne 0 ]; then echo_i "failed"; fi
   status=$((status + ret))
 
+  if testsock6 fd92:7065:b8e:ffff::2 2>/dev/null; then
+    n=$((n + 1))
+    echo_i "checking delv +ns uses both address families ($n)"
+    ret=0
+    delv_with_opts -a ns1/anchor.dnskey +root +ns +hint=root.hint a a.example >delv.out.test$n || ret=1
+    grep -qF 'sending packet to 10.53' delv.out.test$n >/dev/null || ret=1
+    grep -qF 'sending packet to fd92:7065' delv.out.test$n >/dev/null || ret=1
+    if [ $ret -ne 0 ]; then echo_i "failed"; fi
+    status=$((status + ret))
+
+    n=$((n + 1))
+    echo_i "checking delv -4 +ns uses only IPv4 ($n)"
+    ret=0
+    delv_with_opts -a ns1/anchor.dnskey +root -4 +ns +hint=root.hint a a.example >delv.out.test$n || ret=1
+    grep -qF 'sending packet to 10.53' delv.out.test$n >/dev/null || ret=1
+    grep -qF 'sending packet to fd92:7065' delv.out.test$n >/dev/null && ret=1
+    if [ $ret -ne 0 ]; then echo_i "failed"; fi
+    status=$((status + ret))
+
+    n=$((n + 1))
+    echo_i "checking delv -6 +ns uses only IPv6 ($n)"
+    ret=0
+    delv_with_opts -a ns1/anchor.dnskey +root -6 +ns +hint=root.hint a a.example >delv.out.test$n || ret=1
+    grep -qF 'sending packet to 10.53' delv.out.test$n >/dev/null && ret=1
+    grep -qF 'sending packet to fd92:7065' delv.out.test$n >/dev/null || ret=1
+    if [ $ret -ne 0 ]; then echo_i "failed"; fi
+    status=$((status + ret))
+  fi
+
 else
   echo_i "$DELV is needed, so skipping these delv tests"
 fi