From: Diego Fronza Date: Thu, 10 Sep 2020 18:33:15 +0000 (-0300) Subject: Added test for the proposed fix X-Git-Tag: v9.16.9~33^2~2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=69e6bea8350f31f2da056e68c408c56715a197ce;p=thirdparty%2Fbind9.git Added test for the proposed fix This test is very simple, two nameserver instances are created: - ns4: master, with 'minimal-responses yes', authoritative for example. zone - ns5: slave, stub zone The first thing verified is the transfer of zone data from master to slave, which should be saved in ns5/example.db. After that, a query is issued to ns5 asking for target.example. TXT, a record present in the master database with the "test" string as content. If that query works, it means stub zone successfully request nameserver addresses from master, ns4.example. A/AAAA The presence of both A/AAAA records for ns4 is also verified in the stub zone local file, ns5/example.db. --- diff --git a/bin/tests/system/stub/clean.sh b/bin/tests/system/stub/clean.sh index 7081eaa5094..56ef8e24350 100644 --- a/bin/tests/system/stub/clean.sh +++ b/bin/tests/system/stub/clean.sh @@ -12,9 +12,10 @@ # # Clean up after stub tests. # -rm -f dig.out.ns3 ns3/child.example.st +rm -f dig.out.ns[35] ns3/child.example.st rm -f */named.memstats rm -f */named.conf rm -f */named.run rm -f ns*/named.lock rm -f ns*/managed-keys.bind* +rm -f ns5/example.db diff --git a/bin/tests/system/stub/ns4/example.db b/bin/tests/system/stub/ns4/example.db new file mode 100644 index 00000000000..06f352b2526 --- /dev/null +++ b/bin/tests/system/stub/ns4/example.db @@ -0,0 +1,21 @@ +; 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 http://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + +$TTL 300 ; 5 minutes +@ IN SOA ns4.example. hostmaster.example. ( + 2000042795 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) +@ IN NS ns4 +ns4 IN A 10.53.0.4 + IN AAAA fd92:7065:b8e:ffff::4 +target IN TXT "test" diff --git a/bin/tests/system/stub/ns4/named.conf.in b/bin/tests/system/stub/ns4/named.conf.in new file mode 100644 index 00000000000..5c44380e2c8 --- /dev/null +++ b/bin/tests/system/stub/ns4/named.conf.in @@ -0,0 +1,29 @@ +/* + * 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 http://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.4; + notify-source 10.53.0.4; + transfer-source 10.53.0.4; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.4; }; + listen-on-v6 { none; }; + recursion no; + notify yes; + minimal-responses yes; + dnssec-validation no; +}; + +zone "example" { + type primary; + file "example.db"; +}; diff --git a/bin/tests/system/stub/ns5/named.conf.in b/bin/tests/system/stub/ns5/named.conf.in new file mode 100644 index 00000000000..5e5a1ac40a7 --- /dev/null +++ b/bin/tests/system/stub/ns5/named.conf.in @@ -0,0 +1,32 @@ +/* + * 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 http://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.5; + notify-source 10.53.0.5; + transfer-source 10.53.0.5; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.5; }; + listen-on-v6 { none; }; + dnssec-validation no; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +zone "example" { + type stub; + file "example.db"; + masters { 10.53.0.4 port @PORT@; }; +}; diff --git a/bin/tests/system/stub/setup.sh b/bin/tests/system/stub/setup.sh index 4c12eaf5032..09c42d766fe 100644 --- a/bin/tests/system/stub/setup.sh +++ b/bin/tests/system/stub/setup.sh @@ -15,3 +15,5 @@ SYSTEMTESTTOP=.. copy_setports ns1/named.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 ns4/named.conf.in ns4/named.conf +copy_setports ns5/named.conf.in ns5/named.conf diff --git a/bin/tests/system/stub/tests.sh b/bin/tests/system/stub/tests.sh index c2f6f2932c8..266c7bf748c 100644 --- a/bin/tests/system/stub/tests.sh +++ b/bin/tests/system/stub/tests.sh @@ -60,5 +60,26 @@ digcomp knowngood.dig.out.rec dig.out.ns3 || ret=1 } done +echo_i "check that glue record is correctly transferred from master when minimal-responses is on" +ret=0 +# First ensure that zone data was transfered. +for i in 1 2 3 4 5 6 7; do + [ -f ns5/example.db ] && break + sleep 1 +done + +if [ -f ns5/example.db ]; then + # If NS glue wasn't transferred, this query would fail. + $DIG $DIGOPTS +nodnssec @10.53.0.5 target.example. txt > dig.out.ns5 || ret=1 + grep 'target\.example.*TXT.*"test"' dig.out.ns5 > /dev/null || ret=1 + # Ensure both ipv4 and ipv6 glue records were transferred. + grep -E 'ns4[[:space:]]+A[[:space:]]+10.53.0.4' ns5/example.db > /dev/null || ret=1 + grep -E 'AAAA[[:space:]]+fd92:7065:b8e:ffff::4' ns5/example.db > /dev/null || ret=1 + [ $ret = 0 ] || { status=1; echo_i "failed"; } +else + status=1 + echo_i "failed: stub zone transfer failed ns4(master) <---> ns5/example.db" +fi + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1