2000-05-19 18:01:27 +00:00
|
|
|
#!/bin/sh
|
2000-05-19 22:45:47 +00:00
|
|
|
#
|
2018-02-23 09:53:12 +01:00
|
|
|
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
2012-06-29 11:39:47 +10:00
|
|
|
#
|
2016-06-27 14:56:38 +10:00
|
|
|
# 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/.
|
2018-02-23 09:53:12 +01:00
|
|
|
#
|
|
|
|
# See the COPYRIGHT file distributed with this work for additional
|
|
|
|
# information regarding copyright ownership.
|
2004-03-05 05:14:21 +00:00
|
|
|
|
2000-06-05 19:36:44 +00:00
|
|
|
SYSTEMTESTTOP=..
|
|
|
|
. $SYSTEMTESTTOP/conf.sh
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}"
|
|
|
|
RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
|
|
|
|
|
2000-05-22 16:32:20 +00:00
|
|
|
status=0
|
2011-10-17 01:33:28 +00:00
|
|
|
n=0
|
2000-07-05 22:13:56 +00:00
|
|
|
|
2011-10-17 01:33:28 +00:00
|
|
|
#
|
|
|
|
# Wait up to 10 seconds for the servers to finish starting before testing.
|
|
|
|
#
|
2011-10-14 12:02:12 +00:00
|
|
|
for i in 1 2 3 4 5 6 7 8 9 10
|
|
|
|
do
|
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG +tcp -p ${PORT} example @10.53.0.2 soa > dig.out.ns2.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1
|
|
|
|
grep "flags:.* aa[ ;]" dig.out.ns2.test$n > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG +tcp -p ${PORT} example @10.53.0.3 soa > dig.out.ns3.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "status: NOERROR" dig.out.ns3.test$n > /dev/null || ret=1
|
|
|
|
grep "flags:.* aa[ ;]" dig.out.ns3.test$n > /dev/null || ret=1
|
2014-09-29 10:01:08 +10:00
|
|
|
nr=`grep 'x[0-9].*sending notify to' ns2/named.run | wc -l`
|
|
|
|
[ $nr -eq 20 ] || ret=1
|
2011-10-14 12:02:12 +00:00
|
|
|
[ $ret = 0 ] && break
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
2011-10-17 01:33:28 +00:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking initial status ($n)"
|
2011-10-17 01:33:28 +00:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.1" dig.out.ns2.test$n > /dev/null || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.1" dig.out.ns3.test$n > /dev/null || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-24 00:48:50 -08:00
|
|
|
digcomp dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2011-10-17 01:33:28 +00:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
2014-09-29 10:01:08 +10:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking startup notify rate limit ($n)"
|
2014-09-29 10:01:08 +10:00
|
|
|
ret=0
|
|
|
|
grep 'x[0-9].*sending notify to' ns2/named.run |
|
|
|
|
sed 's/.*:\([0-9][0-9]\)\..*/\1/' | uniq -c | awk '{print $1}' > log.out
|
|
|
|
# the notifies should span at least 4 seconds
|
|
|
|
wc -l log.out | awk '$1 < 4 { exit(1) }' || ret=1
|
|
|
|
# ... with no more than 5 in any one second
|
|
|
|
awk '$1 > 5 { exit(1) }' log.out || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2014-09-29 10:01:08 +10:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
2011-10-17 01:33:28 +00:00
|
|
|
sleep 1 # make sure filesystem time stamp is newer for reload.
|
2000-05-22 16:32:20 +00:00
|
|
|
rm -f ns2/example.db
|
2004-03-10 01:06:06 +00:00
|
|
|
cp -f ns2/example2.db ns2/example.db
|
2016-10-19 17:18:42 +02:00
|
|
|
if [ ! "$CYGWIN" ]; then
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "reloading with example2 using HUP and waiting up to 45 seconds"
|
2016-10-19 17:18:42 +02:00
|
|
|
$KILL -HUP `cat ns2/named.pid`
|
|
|
|
else
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "reloading with example2 using rndc and waiting up to 45 seconds"
|
|
|
|
$RNDCCMD 10.53.0.2 reload 2>&1 | sed 's/^/I:ns2 /'
|
2016-10-19 17:18:42 +02:00
|
|
|
fi
|
2016-02-02 09:46:43 +05:30
|
|
|
try=0
|
|
|
|
while test $try -lt 45
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null && break
|
|
|
|
try=`expr $try + 1`
|
|
|
|
done
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2013-06-08 09:49:03 +10:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking notify message was logged ($n)"
|
2013-06-08 09:49:03 +10:00
|
|
|
ret=0
|
|
|
|
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 2$' ns3/named.run > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2013-06-08 09:49:03 +10:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
2011-10-17 01:33:28 +00:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking example2 loaded ($n)"
|
2011-10-17 01:33:28 +00:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.2" dig.out.ns2.test$n > /dev/null || ret=1
|
2001-02-14 00:16:38 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2011-10-17 01:33:28 +00:00
|
|
|
status=`expr $ret + $status`
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2011-10-17 01:33:28 +00:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking example2 contents have been transferred after HUP reload ($n)"
|
2011-10-17 01:33:28 +00:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.2" dig.out.ns2.test$n > /dev/null || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.2" dig.out.ns3.test$n > /dev/null || ret=1
|
|
|
|
|
2018-02-24 00:48:50 -08:00
|
|
|
digcomp dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2011-10-17 01:33:28 +00:00
|
|
|
status=`expr $ret + $status`
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "stopping master and restarting with example4 then waiting up to 45 seconds"
|
2001-02-14 00:16:38 +00:00
|
|
|
$PERL $SYSTEMTESTTOP/stop.pl . ns2
|
2000-07-05 18:16:39 +00:00
|
|
|
|
2001-02-14 00:16:38 +00:00
|
|
|
rm -f ns2/example.db
|
2004-03-10 01:06:06 +00:00
|
|
|
cp -f ns2/example4.db ns2/example.db
|
2001-02-14 00:16:38 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} . ns2
|
2001-02-14 00:16:38 +00:00
|
|
|
|
2016-02-02 09:46:43 +05:30
|
|
|
try=0
|
|
|
|
while test $try -lt 45
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null && break
|
|
|
|
try=`expr $try + 1`
|
|
|
|
done
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2013-06-08 09:49:03 +10:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking notify message was logged ($n)"
|
2013-06-08 09:49:03 +10:00
|
|
|
ret=0
|
|
|
|
grep 'notify from 10.53.0.2#[0-9][0-9]*: serial 4$' ns3/named.run > /dev/null || ret=1
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2013-06-08 09:49:03 +10:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
2011-10-17 01:33:28 +00:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking example4 loaded ($n)"
|
2011-10-17 01:33:28 +00:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.4" dig.out.ns2.test$n > /dev/null || ret=1
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2011-10-17 01:33:28 +00:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking example4 contents have been transfered after restart ($n)"
|
2011-10-17 01:33:28 +00:00
|
|
|
ret=0
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.2 a > dig.out.ns2.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.4" dig.out.ns2.test$n > /dev/null || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS a.example. @10.53.0.3 a > dig.out.ns3.test$n || ret=1
|
2011-10-17 01:33:28 +00:00
|
|
|
grep "10.0.0.4" dig.out.ns3.test$n > /dev/null || ret=1
|
|
|
|
|
2018-02-24 00:48:50 -08:00
|
|
|
digcomp dig.out.ns2.test$n dig.out.ns3.test$n || ret=1
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2011-10-17 01:33:28 +00:00
|
|
|
status=`expr $ret + $status`
|
2000-05-19 18:01:27 +00:00
|
|
|
|
2014-11-24 11:25:06 +11:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking notify to alternate port with master inheritance ($n)"
|
2014-11-24 11:25:06 +11:00
|
|
|
$NSUPDATE << EOF
|
2018-02-20 15:43:27 -08:00
|
|
|
server 10.53.0.2 ${PORT}
|
2014-11-24 11:25:06 +11:00
|
|
|
zone x21
|
|
|
|
update add added.x21 0 in txt "test string"
|
|
|
|
send
|
|
|
|
EOF
|
|
|
|
for i in 1 2 3 4 5 6 7 8 9
|
|
|
|
do
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS added.x21. @10.53.0.4 txt -p $EXTRAPORT1 > dig.out.ns4.test$n || ret=1
|
2014-11-24 11:25:06 +11:00
|
|
|
grep "test string" dig.out.ns4.test$n > /dev/null && break
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
grep "test string" dig.out.ns4.test$n > /dev/null || ret=1
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2014-11-24 11:25:06 +11:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
2015-01-20 16:42:56 +11:00
|
|
|
n=`expr $n + 1`
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "checking notify to multiple views using tsig ($n)"
|
2015-01-20 16:42:56 +11:00
|
|
|
ret=0
|
|
|
|
$NSUPDATE << EOF
|
2018-02-20 15:43:27 -08:00
|
|
|
server 10.53.0.5 ${PORT}
|
2015-01-20 16:42:56 +11:00
|
|
|
zone x21
|
|
|
|
key a aaaaaaaaaaaaaaaaaaaa
|
|
|
|
update add added.x21 0 in txt "test string"
|
|
|
|
send
|
|
|
|
EOF
|
|
|
|
|
|
|
|
for i in 1 2 3 4 5 6 7 8 9
|
|
|
|
do
|
2018-02-20 15:43:27 -08:00
|
|
|
$DIG $DIGOPTS added.x21. -y b:bbbbbbbbbbbbbbbbbbbb @10.53.0.5 \
|
|
|
|
txt > dig.out.b.ns5.test$n || ret=1
|
|
|
|
$DIG $DIGOPTS added.x21. -y c:cccccccccccccccccccc @10.53.0.5 \
|
|
|
|
txt > dig.out.c.ns5.test$n || ret=1
|
2015-01-20 16:42:56 +11:00
|
|
|
grep "test string" dig.out.b.ns5.test$n > /dev/null &&
|
|
|
|
grep "test string" dig.out.c.ns5.test$n > /dev/null &&
|
|
|
|
break
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
grep "test string" dig.out.b.ns5.test$n > /dev/null || ret=1
|
|
|
|
grep "test string" dig.out.c.ns5.test$n > /dev/null || ret=1
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
[ $ret = 0 ] || echo_i "failed"
|
2015-01-20 16:42:56 +11:00
|
|
|
status=`expr $ret + $status`
|
|
|
|
|
2018-02-20 15:43:27 -08:00
|
|
|
echo_i "exit status: $status"
|
2016-06-14 13:48:39 +10:00
|
|
|
[ $status -eq 0 ] || exit 1
|