diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:37:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:37:14 +0000 |
commit | ea648e70a989cca190cd7403fe892fd2dcc290b4 (patch) | |
tree | e2b6b1c647da68b0d4d66082835e256eb30970e8 /bin/tests/system/zero | |
parent | Initial commit. (diff) | |
download | bind9-ea648e70a989cca190cd7403fe892fd2dcc290b4.tar.xz bind9-ea648e70a989cca190cd7403fe892fd2dcc290b4.zip |
Adding upstream version 1:9.11.5.P4+dfsg.upstream/1%9.11.5.P4+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | bin/tests/system/zero/ans5/ans.pl | 79 | ||||
-rw-r--r-- | bin/tests/system/zero/clean.sh | 17 | ||||
-rw-r--r-- | bin/tests/system/zero/ns1/named.conf.in | 27 | ||||
-rw-r--r-- | bin/tests/system/zero/ns1/root.db | 24 | ||||
-rw-r--r-- | bin/tests/system/zero/ns2/named.conf.in | 32 | ||||
-rw-r--r-- | bin/tests/system/zero/ns2/tld.db | 18 | ||||
-rw-r--r-- | bin/tests/system/zero/ns3/named.conf.in | 27 | ||||
-rw-r--r-- | bin/tests/system/zero/ns3/root.hint | 11 | ||||
-rw-r--r-- | bin/tests/system/zero/ns4/named.conf.in | 33 | ||||
-rw-r--r-- | bin/tests/system/zero/ns4/one.tld.db | 15 | ||||
-rw-r--r-- | bin/tests/system/zero/prereq.sh | 21 | ||||
-rw-r--r-- | bin/tests/system/zero/setup.sh | 20 | ||||
-rw-r--r-- | bin/tests/system/zero/tests.sh | 89 |
13 files changed, 413 insertions, 0 deletions
diff --git a/bin/tests/system/zero/ans5/ans.pl b/bin/tests/system/zero/ans5/ans.pl new file mode 100644 index 0000000..6f81e7c --- /dev/null +++ b/bin/tests/system/zero/ans5/ans.pl @@ -0,0 +1,79 @@ +#!/usr/bin/perl -w +# +# 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. + +# +# Don't respond if the "norespond" file exists; otherwise respond to +# any A or AAAA query. +# + +use IO::File; +use IO::Socket; +use Net::DNS; +use Net::DNS::Packet; + +my $localport = int($ENV{'PORT'}); +if (!$localport) { $localport = 5300; } + +my $sock = IO::Socket::INET->new(LocalAddr => "10.53.0.5", + LocalPort => $localport, Proto => "udp") or die "$!"; + +my $pidf = new IO::File "ans.pid", "w" or die "cannot open pid file: $!"; +print $pidf "$$\n" or die "cannot write pid file: $!"; +$pidf->close or die "cannot close pid file: $!"; +sub rmpid { unlink "ans.pid"; exit 1; }; + +$SIG{INT} = \&rmpid; +$SIG{TERM} = \&rmpid; + +my $octet = 0; + +for (;;) { + $sock->recv($buf, 512); + + print "**** request from " , $sock->peerhost, " port ", $sock->peerport, "\n"; + + my $packet; + + if ($Net::DNS::VERSION > 0.68) { + $packet = new Net::DNS::Packet(\$buf, 0); + $@ and die $@; + } else { + my $err; + ($packet, $err) = new Net::DNS::Packet(\$buf, 0); + $err and die $err; + } + + print "REQUEST:\n"; + $packet->print; + + $packet->header->qr(1); + + my @questions = $packet->question; + my $qname = $questions[0]->qname; + my $qtype = $questions[0]->qtype; + + $packet->header->aa(1); + if ($qtype eq "A") { + $packet->push("answer", + new Net::DNS::RR($qname . + " 0 A 192.0.2." . $octet)); + $octet = $octet + 1; + } elsif ($qtype eq "AAAA") { + $packet->push("answer", + new Net::DNS::RR($qname . + " 300 AAAA 2001:db8:beef::1")); + } + + $sock->send($packet->data); + print "RESPONSE:\n"; + $packet->print; + print "\n"; +} diff --git a/bin/tests/system/zero/clean.sh b/bin/tests/system/zero/clean.sh new file mode 100644 index 0000000..00fc10a --- /dev/null +++ b/bin/tests/system/zero/clean.sh @@ -0,0 +1,17 @@ +# 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. + +rm -f */named.conf +rm -f */named.run +rm -f */named.memstats +rm -f ns2/example.db +rm -f ns4/example.bk +rm -f dig.out* +rm -f query.list +rm -f ns*/named.lock diff --git a/bin/tests/system/zero/ns1/named.conf.in b/bin/tests/system/zero/ns1/named.conf.in new file mode 100644 index 0000000..9731fdf --- /dev/null +++ b/bin/tests/system/zero/ns1/named.conf.in @@ -0,0 +1,27 @@ +/* + * 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.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + acache-enable yes; +}; + +zone "." { + type master; + file "root.db"; +}; diff --git a/bin/tests/system/zero/ns1/root.db b/bin/tests/system/zero/ns1/root.db new file mode 100644 index 0000000..c20b5fc --- /dev/null +++ b/bin/tests/system/zero/ns1/root.db @@ -0,0 +1,24 @@ +; 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 +@ SOA ns1. hostmaster.warn.example. ( + 1 3600 1200 604800 3600 ) + NS ns1. +ns1. A 10.53.0.1 +; +example. NS ns2.example. +ns2.example. A 10.53.0.2 +example. NS ns4.example. +ns4.example. A 10.53.0.4 +increment. NS incrementns. +incrementns. A 10.53.0.5 +tld. NS ns2.tld. +ns2.tld. A 10.53.0.2 + diff --git a/bin/tests/system/zero/ns2/named.conf.in b/bin/tests/system/zero/ns2/named.conf.in new file mode 100644 index 0000000..b764a96 --- /dev/null +++ b/bin/tests/system/zero/ns2/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.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion no; + acache-enable yes; +}; + +zone "example" { + type master; + file "example.db"; +}; + +zone "tld" { + type master; + file "tld.db"; +}; diff --git a/bin/tests/system/zero/ns2/tld.db b/bin/tests/system/zero/ns2/tld.db new file mode 100644 index 0000000..11b5b13 --- /dev/null +++ b/bin/tests/system/zero/ns2/tld.db @@ -0,0 +1,18 @@ +; 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 1 +@ 300 SOA ns2.tld. hostmaster.ns2.tld. 0 1 1 1 1 +@ 300 NS ns2.tld. +ns2 300 A 10.53.0.2 +; +; The TTL of these delegation records needs to 1. +; +one 1 NS ns4.one.tld. +ns4.one 1 A 10.53.0.4 diff --git a/bin/tests/system/zero/ns3/named.conf.in b/bin/tests/system/zero/ns3/named.conf.in new file mode 100644 index 0000000..613af5d --- /dev/null +++ b/bin/tests/system/zero/ns3/named.conf.in @@ -0,0 +1,27 @@ +/* + * 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.3; + notify-source 10.53.0.3; + transfer-source 10.53.0.3; + port @PORT@; + pid-file "named.pid"; + listen-on { 10.53.0.3; }; + listen-on-v6 { none; }; + recursion yes; + acache-enable yes; +}; + +zone "." { + type hint; + file "root.hint"; +}; diff --git a/bin/tests/system/zero/ns3/root.hint b/bin/tests/system/zero/ns3/root.hint new file mode 100644 index 0000000..c1784c7 --- /dev/null +++ b/bin/tests/system/zero/ns3/root.hint @@ -0,0 +1,11 @@ +; 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. + +. NS ns1. +ns1. A 10.53.0.1 diff --git a/bin/tests/system/zero/ns4/named.conf.in b/bin/tests/system/zero/ns4/named.conf.in new file mode 100644 index 0000000..c88881e --- /dev/null +++ b/bin/tests/system/zero/ns4/named.conf.in @@ -0,0 +1,33 @@ +/* + * 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; + acache-enable yes; +}; + +zone "example" { + type slave; + masters { 10.53.0.2; }; + file "example.bk"; +}; + +zone "one.tld" { + type master; + file "one.tld.db"; +}; diff --git a/bin/tests/system/zero/ns4/one.tld.db b/bin/tests/system/zero/ns4/one.tld.db new file mode 100644 index 0000000..7706e44 --- /dev/null +++ b/bin/tests/system/zero/ns4/one.tld.db @@ -0,0 +1,15 @@ +; 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 1 +; The TTL of all these records needs to be 1. +@ 1 SOA ns4.one.tld. hostmaster.ns4.tld. 0 1 1 1 1 +@ 1 NS ns4.one.tld. +ns4 1 A 10.53.0.4 +www 1 A 10.53.0.4 diff --git a/bin/tests/system/zero/prereq.sh b/bin/tests/system/zero/prereq.sh new file mode 100644 index 0000000..de147a4 --- /dev/null +++ b/bin/tests/system/zero/prereq.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# 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. + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +if $PERL -e 'use Net::DNS;' 2>/dev/null +then + : +else + echo "I:This test requires the Net::DNS library." >&2 + exit 1 +fi diff --git a/bin/tests/system/zero/setup.sh b/bin/tests/system/zero/setup.sh new file mode 100644 index 0000000..27b8ba7 --- /dev/null +++ b/bin/tests/system/zero/setup.sh @@ -0,0 +1,20 @@ +# 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. + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +$SHELL clean.sh + +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 + +$SHELL ../genzone.sh 2 4 | sed -e 's/^$TTL 3600$/$TTL 0 ; force TTL to zero/' -e 's/86400.IN SOA/0 SOA/' > ns2/example.db diff --git a/bin/tests/system/zero/tests.sh b/bin/tests/system/zero/tests.sh new file mode 100644 index 0000000..73c277c --- /dev/null +++ b/bin/tests/system/zero/tests.sh @@ -0,0 +1,89 @@ +# 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. + +SYSTEMTESTTOP=.. +. $SYSTEMTESTTOP/conf.sh + +DIGOPTS="-p ${PORT}" + +status=0 +n=0 + +n=`expr $n + 1` +echo_i "check lookups against TTL=0 records ($n)" +i=0 +passes=10 +$DIG $DIGOPTS @10.53.0.2 axfr example | grep -v "^ds0" | +awk '$2 == "0" { print "-q", $1, $4; print "-q", "zzz"$1, $4;}' > query.list +while [ $i -lt $passes ] +do + ret=0 + $DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.1.test$n & + $DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.2.test$n & + $DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.3.test$n & + $DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.4.test$n & + $DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.5.test$n & + $DIG $DIGOPTS @10.53.0.3 -f query.list > dig.out$i.6.test$n & + wait + grep "status: SERVFAIL" dig.out$i.1.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.2.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.3.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.4.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.5.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.6.test$n && ret=1 + [ $ret = 1 ] && break + i=`expr $i + 1` + echo_i "successfully completed pass $i of $passes" +done +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check repeated recursive lookups of non recurring TTL=0 responses get new values ($n)" +count=`( +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +$DIG $DIGOPTS +short @10.53.0.3 foo.increment +) | sort -u | wc -l ` +if [ $count -ne 7 ] ; then echo_i "failed (count=$count)"; ret=1; fi +status=`expr $status + $ret` + +n=`expr $n + 1` +echo_i "check lookups against TTL=1 records ($n)" +i=0 +passes=10 +while [ $i -lt $passes ] +do + ret=0 + $DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.1.test$n + $DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.2.test$n + $DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.3.test$n + $DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.4.test$n + $DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.5.test$n + $DIG $DIGOPTS @10.53.0.3 www.one.tld > dig.out$i.6.test$n + grep "status: SERVFAIL" dig.out$i.1.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.2.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.3.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.4.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.5.test$n && ret=1 + grep "status: SERVFAIL" dig.out$i.6.test$n && ret=1 + [ $ret = 1 ] && break + i=`expr $i + 1` + echo_i "successfully completed pass $i of $passes" + $PERL -e 'select(undef, undef, undef, 0.3);' +done +if [ $ret != 0 ]; then echo_i "failed"; fi +status=`expr $status + $ret` + +echo_i "exit status: $status" +[ $status -eq 0 ] || exit 1 |