From ea648e70a989cca190cd7403fe892fd2dcc290b4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 20:37:14 +0200 Subject: Adding upstream version 1:9.11.5.P4+dfsg. Signed-off-by: Daniel Baumann --- bin/tests/system/stress/clean.sh | 22 ++++++++ bin/tests/system/stress/ns1/named.conf | 29 ++++++++++ bin/tests/system/stress/ns2/named.conf | 31 +++++++++++ bin/tests/system/stress/ns3/named.conf | 48 +++++++++++++++++ bin/tests/system/stress/ns4/named.conf | 33 ++++++++++++ bin/tests/system/stress/prereq.sh | 21 ++++++++ bin/tests/system/stress/setup.pl | 83 ++++++++++++++++++++++++++++ bin/tests/system/stress/setup.sh | 16 ++++++ bin/tests/system/stress/tests.sh | 37 +++++++++++++ bin/tests/system/stress/update.pl | 99 ++++++++++++++++++++++++++++++++++ 10 files changed, 419 insertions(+) create mode 100644 bin/tests/system/stress/clean.sh create mode 100644 bin/tests/system/stress/ns1/named.conf create mode 100644 bin/tests/system/stress/ns2/named.conf create mode 100644 bin/tests/system/stress/ns3/named.conf create mode 100644 bin/tests/system/stress/ns4/named.conf create mode 100644 bin/tests/system/stress/prereq.sh create mode 100644 bin/tests/system/stress/setup.pl create mode 100644 bin/tests/system/stress/setup.sh create mode 100644 bin/tests/system/stress/tests.sh create mode 100644 bin/tests/system/stress/update.pl (limited to 'bin/tests/system/stress') diff --git a/bin/tests/system/stress/clean.sh b/bin/tests/system/stress/clean.sh new file mode 100644 index 0000000..3d13acd --- /dev/null +++ b/bin/tests/system/stress/clean.sh @@ -0,0 +1,22 @@ +#!/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. + +rm -f reload.pid + +rm -f ns?/zones.conf +rm -f ns?/zone*.bk + +rm -f ns1/delegations.db + +rm -f ns2/zone0*.db +rm -f ns2/zone0*.jnl +rm -f */named.memstats +rm -f ns*/named.lock diff --git a/bin/tests/system/stress/ns1/named.conf b/bin/tests/system/stress/ns1/named.conf new file mode 100644 index 0000000..59690e7 --- /dev/null +++ b/bin/tests/system/stress/ns1/named.conf @@ -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. + */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.1; + notify-source 10.53.0.1; + transfer-source 10.53.0.1; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.1; }; + listen-on-v6 { none; }; + recursion no; + notify yes; +}; + +zone "." { + type master; + file "root.db"; +}; diff --git a/bin/tests/system/stress/ns2/named.conf b/bin/tests/system/stress/ns2/named.conf new file mode 100644 index 0000000..c0fb05f --- /dev/null +++ b/bin/tests/system/stress/ns2/named.conf @@ -0,0 +1,31 @@ +/* + * 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. + */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.2; + notify-source 10.53.0.2; + transfer-source 10.53.0.2; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.2; }; + listen-on-v6 { none; }; + recursion no; + notify yes; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +include "zones.conf"; diff --git a/bin/tests/system/stress/ns3/named.conf b/bin/tests/system/stress/ns3/named.conf new file mode 100644 index 0000000..9b905a9 --- /dev/null +++ b/bin/tests/system/stress/ns3/named.conf @@ -0,0 +1,48 @@ +/* + * 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. + */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.3; + notify-source 10.53.0.3; + transfer-source 10.53.0.3; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.3; }; + listen-on-v6 { none; }; + recursion yes; + acache-enable yes; + notify yes; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.3 port 9953 allow { any; } keys { rndc_key; }; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +server 10.53.0.4 { + provide-ixfr no; +}; +server 10.53.0.2 { + request-ixfr no; +}; + +include "zones.conf"; diff --git a/bin/tests/system/stress/ns4/named.conf b/bin/tests/system/stress/ns4/named.conf new file mode 100644 index 0000000..405f618 --- /dev/null +++ b/bin/tests/system/stress/ns4/named.conf @@ -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. + */ + +controls { /* empty */ }; + +options { + query-source address 10.53.0.4; + notify-source 10.53.0.4; + transfer-source 10.53.0.4; + port 5300; + pid-file "named.pid"; + listen-on { 10.53.0.4; }; + listen-on-v6 { none; }; + recursion yes; + acache-enable yes; + notify yes; +}; + +zone "." { + type hint; + file "../../common/root.hint"; +}; + +include "zones.conf"; + diff --git a/bin/tests/system/stress/prereq.sh b/bin/tests/system/stress/prereq.sh new file mode 100644 index 0000000..de147a4 --- /dev/null +++ b/bin/tests/system/stress/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/stress/setup.pl b/bin/tests/system/stress/setup.pl new file mode 100644 index 0000000..40e3cea --- /dev/null +++ b/bin/tests/system/stress/setup.pl @@ -0,0 +1,83 @@ +#!/usr/bin/perl +# +# 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. + +# +# Set up test data for zone transfer quota tests. +# +use FileHandle; + +my $n_zones = 5; +my $n_names = 1000; + +make_zones(2, undef); +make_zones(3, "10.53.0.2"); +make_zones(4, "10.53.0.3"); + +my $rootdelegations = + new FileHandle("ns1/root.db", "w") or die; + +print $rootdelegations <close; + } + } +} diff --git a/bin/tests/system/stress/setup.sh b/bin/tests/system/stress/setup.sh new file mode 100644 index 0000000..b1798a4 --- /dev/null +++ b/bin/tests/system/stress/setup.sh @@ -0,0 +1,16 @@ +#!/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. + +# +# Set up test data for zone transfer quota tests. +# + +$PERL setup.pl diff --git a/bin/tests/system/stress/tests.sh b/bin/tests/system/stress/tests.sh new file mode 100644 index 0000000..53c3d20 --- /dev/null +++ b/bin/tests/system/stress/tests.sh @@ -0,0 +1,37 @@ +#!/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 + +status=0 + +( +$SHELL -c "while true + do $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 reload 2>&1 | + sed 's/^/I:ns3 /'; + sleep 1 + done" & echo $! >reload.pid +) & + +for i in 0 1 2 3 4 +do + $PERL update.pl -s 10.53.0.2 -p 5300 zone00000$i.example. & +done + +echo "I:waiting for background processes to finish" +wait + +echo "I:killing reload loop" +kill `cat reload.pid` + +echo "I:exit status: $status" +[ $status -eq 0 ] || exit 1 diff --git a/bin/tests/system/stress/update.pl b/bin/tests/system/stress/update.pl new file mode 100644 index 0000000..6bb8afc --- /dev/null +++ b/bin/tests/system/stress/update.pl @@ -0,0 +1,99 @@ +#!/usr/bin/perl +# +# 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. + +# +# Dynamic update test suite. +# +# Usage: +# +# perl update_test.pl [-s server] [-p port] zone +# +# The server defaults to 127.0.0.1. +# The port defaults to 53. +# +# The "Special NS rules" tests will only work correctly if the +# has no NS records to begin with, or alternatively has a +# single NS record pointing at the name "ns1" (relative to +# the zone name). +# +# Installation notes: +# +# This program uses the Net::DNS::Resolver module. +# You can install it by saying +# +# perl -MCPAN -e "install Net::DNS" +# + +use Getopt::Std; +use Net::DNS; +use Net::DNS::Update; +use Net::DNS::Resolver; + +$opt_s = "127.0.0.1"; +$opt_p = 53; + +getopt('s:p:'); + +$res = new Net::DNS::Resolver; +$res->nameservers($opt_s); +$res->port($opt_p); +$res->defnames(0); # Do not append default domain. + +@ARGV == 1 or die + "usage: perl update_test.pl [-s server] [-p port] zone\n"; + +$zone = shift @ARGV; + +my $failures = 0; + +sub assert { + my ($cond, $explanation) = @_; + if (!$cond) { + print "I:Test Failed: $explanation ***\n"; + $failures++ + } +} + +sub test { + my ($expected, @records) = @_; + + my $update = new Net::DNS::Update("$zone"); + + foreach $rec (@records) { + $update->push(@$rec); + } + + $reply = $res->send($update); + + # Did it work? + if (defined $reply) { + my $rcode = $reply->header->rcode; + assert($rcode eq $expected, "expected $expected, got $rcode"); + } else { + print "I:Update failed: ", $res->errorstring, "\n"; + } +} + +sub section { + my ($msg) = @_; + print "I:$msg\n"; +} + +for ($i = 0; $i < 1000; $i++) { + test("NOERROR", ["update", rr_add("dynamic-$i.$zone 300 TXT txt-$i" )]); +} + +if ($failures) { + print "I:$failures tests failed.\n"; +} else { + print "I:Update of $opt_s zone $zone successful.\n"; +} +exit $failures; -- cgit v1.2.3