summaryrefslogtreecommitdiffstats
path: root/bin/tests/system/reclimit
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 23:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 23:51:28 +0000
commit3a8f8bef7340cf47837e9bb89b7a24d3844005ec (patch)
treebe267b16d2782cfdbd4781cbde4cc712308faf6f /bin/tests/system/reclimit
parentAdding upstream version 1:9.16.44. (diff)
downloadbind9-upstream.tar.xz
bind9-upstream.zip
Adding upstream version 1:9.16.48.upstream/1%9.16.48upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/tests/system/reclimit')
-rw-r--r--bin/tests/system/reclimit/ans7/ans.pl16
-rw-r--r--bin/tests/system/reclimit/prereq.sh29
-rw-r--r--bin/tests/system/reclimit/tests.sh239
3 files changed, 154 insertions, 130 deletions
diff --git a/bin/tests/system/reclimit/ans7/ans.pl b/bin/tests/system/reclimit/ans7/ans.pl
index 41a44a6..52110f1 100644
--- a/bin/tests/system/reclimit/ans7/ans.pl
+++ b/bin/tests/system/reclimit/ans7/ans.pl
@@ -22,9 +22,14 @@ 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; };
+sub term { };
$SIG{INT} = \&rmpid;
-$SIG{TERM} = \&rmpid;
+if ($Net::DNS::VERSION >= 1.42) {
+ $SIG{TERM} = \&term;
+} else {
+ $SIG{TERM} = \&rmpid;
+}
my $count = 0;
@@ -73,4 +78,11 @@ my $ns = Net::DNS::Nameserver->new(
Verbose => $verbose,
);
-$ns->main_loop;
+if ($Net::DNS::VERSION >= 1.42) {
+ $ns->start_server();
+ select(undef, undef, undef, undef);
+ $ns->stop_server();
+ unlink "ans.pid";
+} else {
+ $ns->main_loop;
+}
diff --git a/bin/tests/system/reclimit/prereq.sh b/bin/tests/system/reclimit/prereq.sh
index 8c587c3..68108c0 100644
--- a/bin/tests/system/reclimit/prereq.sh
+++ b/bin/tests/system/reclimit/prereq.sh
@@ -14,24 +14,21 @@
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
-if $PERL -e 'use Net::DNS;' 2>/dev/null
-then
- if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION <= 0.78);' 2>/dev/null
- then
- :
- else
- echo_i "Net::DNS versions up to 0.78 have a bug that causes this test to fail: please update." >&2
- exit 1
- fi
-else
- echo_i "This test requires the Net::DNS library." >&2
+if $PERL -e 'use Net::DNS;' 2>/dev/null; then
+ if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION <= 0.78);' 2>/dev/null; then
+ :
+ else
+ echo_i "Net::DNS versions up to 0.78 have a bug that causes this test to fail: please update." >&2
exit 1
+ fi
+else
+ echo_i "This test requires the Net::DNS library." >&2
+ exit 1
fi
-if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null
-then
- :
+if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null; then
+ :
else
- echo_i "This test requires the Net::DNS::Nameserver library." >&2
- exit 1
+ echo_i "This test requires the Net::DNS::Nameserver library." >&2
+ exit 1
fi
diff --git a/bin/tests/system/reclimit/tests.sh b/bin/tests/system/reclimit/tests.sh
index 7fe8ee9..a203445 100644
--- a/bin/tests/system/reclimit/tests.sh
+++ b/bin/tests/system/reclimit/tests.sh
@@ -20,17 +20,17 @@ status=0
n=0
ns3_reset() {
- copy_setports $1 ns3/named.conf
- $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/I:ns3 /'
- $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} flush | sed 's/^/I:ns3 /'
+ copy_setports $1 ns3/named.conf
+ $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} reconfig 2>&1 | sed 's/^/I:ns3 /'
+ $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p ${CONTROLPORT} flush | sed 's/^/I:ns3 /'
}
ns3_sends_aaaa_queries() {
- if grep "started AAAA fetch" ns3/named.run >/dev/null; then
- return 0
- else
- return 1
- fi
+ if grep "started AAAA fetch" ns3/named.run >/dev/null; then
+ return 0
+ else
+ return 1
+ fi
}
# Check whether the number of queries ans2 received from ns3 (this value is
@@ -39,172 +39,187 @@ ns3_sends_aaaa_queries() {
# - if ns3 sends AAAA queries, the query count should equal $2,
# - if ns3 does not send AAAA queries, the query count should equal $3.
check_query_count() {
- count1=`sed 's/[^0-9]//g;' $1`
- count2=`sed 's/[^0-9]//g;' $2`
- count=`expr $count1 + $count2`
- #echo_i "count1=$count1 count2=$count2 count=$count"
- expected_count_with_aaaa=$3
- expected_count_without_aaaa=$4
-
- if ns3_sends_aaaa_queries; then
- expected_count=$expected_count_with_aaaa
- else
- expected_count=$expected_count_without_aaaa
- fi
-
- if [ $count -ne $expected_count ]; then
- echo_i "count $count (actual) != $expected_count (expected)"
- ret=1
- fi
+ count1=$(sed 's/[^0-9]//g;' $1)
+ count2=$(sed 's/[^0-9]//g;' $2)
+ count=$(expr $count1 + $count2)
+ #echo_i "count1=$count1 count2=$count2 count=$count"
+ expected_count_with_aaaa=$3
+ expected_count_without_aaaa=$4
+
+ if ns3_sends_aaaa_queries; then
+ expected_count=$expected_count_with_aaaa
+ else
+ expected_count=$expected_count_without_aaaa
+ fi
+
+ if [ $count -ne $expected_count ]; then
+ echo_i "count $count (actual) != $expected_count (expected)"
+ ret=1
+ fi
}
echo_i "set max-recursion-depth=12"
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt excessive-depth lookup ($n)"
ret=0
-echo "1000" > ans2/ans.limit
-echo "1000" > ans4/ans.limit
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.4 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect1.example.org > dig.out.1.test$n || ret=1
-grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-$DIG $DIGOPTS +short @10.53.0.4 count txt > dig.out.4.test$n || ret=1
+echo "1000" >ans2/ans.limit
+echo "1000" >ans4/ans.limit
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.4 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect1.example.org >dig.out.1.test$n || ret=1
+grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+$DIG $DIGOPTS +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1
check_query_count dig.out.2.test$n dig.out.4.test$n 27 14
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt permissible lookup ($n)"
ret=0
-echo "12" > ans2/ans.limit
-echo "12" > ans4/ans.limit
+echo "12" >ans2/ans.limit
+echo "12" >ans4/ans.limit
ns3_reset ns3/named1.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.4 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect2.example.org > dig.out.1.test$n || ret=1
-grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-$DIG $DIGOPTS +short @10.53.0.4 count txt > dig.out.4.test$n || ret=1
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.4 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect2.example.org >dig.out.1.test$n || ret=1
+grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+$DIG $DIGOPTS +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1
check_query_count dig.out.2.test$n dig.out.4.test$n 50 26
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
echo_i "set max-recursion-depth=5"
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt excessive-depth lookup ($n)"
ret=0
-echo "12" > ans2/ans.limit
+echo "12" >ans2/ans.limit
ns3_reset ns3/named2.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.4 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect3.example.org > dig.out.1.test$n || ret=1
-grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-$DIG $DIGOPTS +short @10.53.0.4 count txt > dig.out.4.test$n || ret=1
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.4 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect3.example.org >dig.out.1.test$n || ret=1
+grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+$DIG $DIGOPTS +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1
check_query_count dig.out.2.test$n dig.out.4.test$n 13 7
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt permissible lookup ($n)"
ret=0
-echo "5" > ans2/ans.limit
-echo "5" > ans4/ans.limit
+echo "5" >ans2/ans.limit
+echo "5" >ans4/ans.limit
ns3_reset ns3/named2.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.4 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect4.example.org > dig.out.1.test$n || ret=1
-grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-$DIG $DIGOPTS +short @10.53.0.4 count txt > dig.out.4.test$n || ret=1
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.4 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect4.example.org >dig.out.1.test$n || ret=1
+grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+$DIG $DIGOPTS +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1
check_query_count dig.out.2.test$n dig.out.4.test$n 22 12
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
echo_i "set max-recursion-depth=100, max-recursion-queries=50"
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt excessive-queries lookup ($n)"
ret=0
-echo "13" > ans2/ans.limit
-echo "13" > ans4/ans.limit
+echo "13" >ans2/ans.limit
+echo "13" >ans4/ans.limit
ns3_reset ns3/named3.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.4 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect5.example.org > dig.out.1.test$n || ret=1
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.4 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect5.example.org >dig.out.1.test$n || ret=1
if ns3_sends_aaaa_queries; then
- grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
+ grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1
fi
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-$DIG $DIGOPTS +short @10.53.0.4 count txt > dig.out.4.test$n || ret=1
-eval count=`cat dig.out.2.test$n`
-[ $count -le 50 ] || { ret=1; echo_i "count ($count) !<= 50"; }
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+$DIG $DIGOPTS +short @10.53.0.4 count txt >dig.out.4.test$n || ret=1
+eval count=$(cat dig.out.2.test$n)
+[ $count -le 50 ] || {
+ ret=1
+ echo_i "count ($count) !<= 50"
+}
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt permissible lookup ($n)"
ret=0
-echo "12" > ans2/ans.limit
+echo "12" >ans2/ans.limit
ns3_reset ns3/named3.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect6.example.org > dig.out.1.test$n || ret=1
-grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-eval count=`cat dig.out.2.test$n`
-[ $count -le 50 ] || { ret=1; echo_i "count ($count) !<= 50"; }
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect6.example.org >dig.out.1.test$n || ret=1
+grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+eval count=$(cat dig.out.2.test$n)
+[ $count -le 50 ] || {
+ ret=1
+ echo_i "count ($count) !<= 50"
+}
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
echo_i "set max-recursion-depth=100, max-recursion-queries=40"
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt excessive-queries lookup ($n)"
ret=0
-echo "11" > ans2/ans.limit
+echo "11" >ans2/ans.limit
ns3_reset ns3/named4.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect7.example.org > dig.out.1.test$n || ret=1
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect7.example.org >dig.out.1.test$n || ret=1
if ns3_sends_aaaa_queries; then
- grep "status: SERVFAIL" dig.out.1.test$n > /dev/null || ret=1
+ grep "status: SERVFAIL" dig.out.1.test$n >/dev/null || ret=1
fi
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-eval count=`cat dig.out.2.test$n`
-[ $count -le 40 ] || { ret=1; echo_i "count ($count) !<= 40"; }
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+eval count=$(cat dig.out.2.test$n)
+[ $count -le 40 ] || {
+ ret=1
+ echo_i "count ($count) !<= 40"
+}
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempt permissible lookup ($n)"
ret=0
-echo "9" > ans2/ans.limit
+echo "9" >ans2/ans.limit
ns3_reset ns3/named4.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS @10.53.0.3 indirect8.example.org > dig.out.1.test$n || ret=1
-grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-eval count=`cat dig.out.2.test$n`
-[ $count -le 40 ] || { ret=1; echo_i "count ($count) !<= 40"; }
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS @10.53.0.3 indirect8.example.org >dig.out.1.test$n || ret=1
+grep "status: NOERROR" dig.out.1.test$n >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+eval count=$(cat dig.out.2.test$n)
+[ $count -le 40 ] || {
+ ret=1
+ echo_i "count ($count) !<= 40"
+}
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
-n=`expr $n + 1`
+n=$(expr $n + 1)
echo_i "attempting NS explosion ($n)"
ret=0
ns3_reset ns3/named4.conf.in
-$DIG $DIGOPTS @10.53.0.2 reset > /dev/null || ret=1
-$DIG $DIGOPTS +short @10.53.0.3 ns1.1.example.net > dig.out.1.test$n || ret=1
-$DIG $DIGOPTS +short @10.53.0.2 count txt > dig.out.2.test$n || ret=1
-eval count=`cat dig.out.2.test$n`
+$DIG $DIGOPTS @10.53.0.2 reset >/dev/null || ret=1
+$DIG $DIGOPTS +short @10.53.0.3 ns1.1.example.net >dig.out.1.test$n || ret=1
+$DIG $DIGOPTS +short @10.53.0.2 count txt >dig.out.2.test$n || ret=1
+eval count=$(cat dig.out.2.test$n)
[ $count -lt 50 ] || ret=1
-$DIG $DIGOPTS +short @10.53.0.7 count txt > dig.out.3.test$n || ret=1
-eval count=`cat dig.out.3.test$n`
-[ $count -lt 50 ] || { ret=1; echo_i "count ($count) !<= 50"; }
+$DIG $DIGOPTS +short @10.53.0.7 count txt >dig.out.3.test$n || ret=1
+eval count=$(cat dig.out.3.test$n)
+[ $count -lt 50 ] || {
+ ret=1
+ echo_i "count ($count) !<= 50"
+}
if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
+status=$(expr $status + $ret)
#grep "duplicate query" ns3/named.run
echo_i "exit status: $status"