]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Added test for the proposed fix
authorDiego Fronza <diego@isc.org>
Thu, 10 Sep 2020 18:33:15 +0000 (15:33 -0300)
committerDiego Fronza <diego@isc.org>
Mon, 26 Oct 2020 13:45:27 +0000 (10:45 -0300)
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.

bin/tests/system/stub/clean.sh
bin/tests/system/stub/ns4/example.db [new file with mode: 0644]
bin/tests/system/stub/ns4/named.conf.in [new file with mode: 0644]
bin/tests/system/stub/ns5/named.conf.in [new file with mode: 0644]
bin/tests/system/stub/setup.sh
bin/tests/system/stub/tests.sh

index 728000401d35e257af6f32c2b5535f6141456297..3152710cc0ec806db8141980efac021d7e5d522a 100644 (file)
@@ -12,8 +12,9 @@
 #
 # 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 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 (file)
index 0000000..06f352b
--- /dev/null
@@ -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 (file)
index 0000000..88aae54
--- /dev/null
@@ -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 master;
+       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 (file)
index 0000000..5e5a1ac
--- /dev/null
@@ -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@; };
+};
index 4c12eaf5032244d4648d2b3121f77031c17be144..09c42d766fe7d7ee1ceac3624742a64b60ae7700 100644 (file)
@@ -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
index c2f6f2932c8c8318dbb7086a211a7b7af75bea80..266c7bf748c2040b834b6f3ec5701b68a5d2e57a 100644 (file)
@@ -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