]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check "records but is not served by" warnings
authorMark Andrews <marka@isc.org>
Tue, 17 Oct 2023 04:28:22 +0000 (15:28 +1100)
committerMark Andrews <marka@isc.org>
Wed, 11 Dec 2024 21:32:21 +0000 (21:32 +0000)
This checks that "zone has A records but is not served by IPv4
servers" and "zone has AAAA records but is not served by IPv6
servers" are emitted when they should be and not when they shouldn't
be.

bin/tests/system/checkzone/tests.sh
bin/tests/system/checkzone/zones/warn.no-a.server.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/warn.no-a.server.glue.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/warn.no-aaaa.server.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db [new file with mode: 0644]

index aa26c8fb43ae4d18ac5490ae687998204bfb8de4..fb6bcab82af2eca82a4e6ec977673c84efe4d4ac 100644 (file)
@@ -218,5 +218,41 @@ echo $lines
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+echo_i "Checking for 'zone has A records but is not served by IPv4 servers' warning ($n)"
+ret=0
+$CHECKZONE example zones/warn.no-a.server.db >test.out1.$n 2>&1 || ret=1
+grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null || ret=1
+grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null && ret=1
+n=$((n + 1))
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
+echo_i "Checking for 'zone has AAAA records but is not served by IPv6 servers' warning ($n)"
+ret=0
+$CHECKZONE example zones/warn.no-aaaa.server.db >test.out1.$n 2>&1 || ret=1
+grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null || ret=1
+grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null && ret=1
+n=$((n + 1))
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
+echo_i "Checking for 'zone has A records but is not served by IPv4 servers' warning for glue ($n)"
+ret=0
+$CHECKZONE example zones/warn.no-a.server.glue.db >test.out1.$n 2>&1 || ret=1
+grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null || ret=1
+grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null && ret=1
+n=$((n + 1))
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
+echo_i "Checking for 'zone has AAAA records but is not served by IPv6 servers' warning for glue ($n)"
+ret=0
+$CHECKZONE example zones/warn.no-aaaa.server.glue.db >test.out1.$n 2>&1 || ret=1
+grep "zone has AAAA records but is not served by IPv6 servers" test.out1.$n >/dev/null || ret=1
+grep "zone has A records but is not served by IPv4 servers" test.out1.$n >/dev/null && ret=1
+n=$((n + 1))
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1
diff --git a/bin/tests/system/checkzone/zones/warn.no-a.server.db b/bin/tests/system/checkzone/zones/warn.no-a.server.db
new file mode 100644 (file)
index 0000000..a27c247
--- /dev/null
@@ -0,0 +1,22 @@
+; 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.
+
+@              30      IN      SOA     ns1 hostmaster 2017052201 3600 600 604800 30
+@              7200    IN      NS      ns1
+@              7200    IN      NS      ns2
+@              7200    IN      NS      ns3
+@              7200    IN      NS      ns4
+ns1            3600    IN      AAAA    fd92:7065:b8e:ffff::1
+ns2            3600    IN      AAAA    fd92:7065:b8e:ffff::2
+ns3            3600    IN      AAAA    fd92:7065:b8e:ffff::4
+ns4            3600    IN      AAAA    fd92:7065:b8e:ffff::4
+dualstack      300     IN      AAAA    2001:db8::1
+dualstack      300     IN      A       10.53.0.5
diff --git a/bin/tests/system/checkzone/zones/warn.no-a.server.glue.db b/bin/tests/system/checkzone/zones/warn.no-a.server.glue.db
new file mode 100644 (file)
index 0000000..0bbfdde
--- /dev/null
@@ -0,0 +1,23 @@
+; 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.
+
+@              30      IN      SOA     ns1 hostmaster 2017052201 3600 600 604800 30
+@              7200    IN      NS      ns1
+@              7200    IN      NS      ns2
+@              7200    IN      NS      ns3
+@              7200    IN      NS      ns4
+ns1            3600    IN      AAAA    fd92:7065:b8e:ffff::1
+ns2            3600    IN      AAAA    fd92:7065:b8e:ffff::2
+ns3            3600    IN      AAAA    fd92:7065:b8e:ffff::4
+ns4            3600    IN      AAAA    fd92:7065:b8e:ffff::4
+child          3600    IN      NS      ns1.child
+ns1.child      300     IN      AAAA    2001:db8::1
+ns1.child      300     IN      A       10.53.0.5
diff --git a/bin/tests/system/checkzone/zones/warn.no-aaaa.server.db b/bin/tests/system/checkzone/zones/warn.no-aaaa.server.db
new file mode 100644 (file)
index 0000000..afb52d3
--- /dev/null
@@ -0,0 +1,22 @@
+; 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.
+
+@              30      IN      SOA     ns1 hostmaster 2017052201 3600 600 604800 30
+@              7200    IN      NS      ns1
+@              7200    IN      NS      ns2
+@              7200    IN      NS      ns3
+@              7200    IN      NS      ns4
+ns1            3600    IN      A       10.53.0.1
+ns2            3600    IN      A       10.53.0.2
+ns3            3600    IN      A       10.53.0.4
+ns4            3600    IN      A       10.53.0.4
+dualstack      300     IN      AAAA    2001:db8::1
+dualstack      300     IN      A       10.53.0.5
diff --git a/bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db b/bin/tests/system/checkzone/zones/warn.no-aaaa.server.glue.db
new file mode 100644 (file)
index 0000000..165a114
--- /dev/null
@@ -0,0 +1,23 @@
+; 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.
+
+@              30      IN      SOA     ns1 hostmaster 2017052201 3600 600 604800 30
+@              7200    IN      NS      ns1
+@              7200    IN      NS      ns2
+@              7200    IN      NS      ns3
+@              7200    IN      NS      ns4
+ns1            3600    IN      A       10.53.0.1
+ns2            3600    IN      A       10.53.0.2
+ns3            3600    IN      A       10.53.0.4
+ns4            3600    IN      A       10.53.0.4
+child          3600    IN      NS      ns1.child
+ns1.child      300     IN      AAAA    2001:db8::1
+ns1.child      300     IN      A       10.53.0.5