diff --git a/bin/tests/system/ixfr/clean.sh b/bin/tests/system/ixfr/clean.sh index 1117710c49..537f97fd64 100644 --- a/bin/tests/system/ixfr/clean.sh +++ b/bin/tests/system/ixfr/clean.sh @@ -11,12 +11,12 @@ rm -f stats.* rm -f ns1/*.db ns1/*.jnl -rm -f ns3/*.jnl ns3/mytest.db ns3/subtest.db +rm -f ns3/*.jnl ns3/mytest*.db ns3/subtest*.db rm -f ns4/*.jnl ns4/*.db rm -f ns5/*.jnl ns5/*.db rm -f */named.memstats rm -f */named.conf -rm -f */named.run +rm -f */named.run */named.run.prev rm -f */ans.run rm -f dig.out.test* dig.out1.test* dig.out2.test* dig.out3.test* rm -f ns3/large.db diff --git a/bin/tests/system/ixfr/ixfr-stats.good b/bin/tests/system/ixfr/ixfr-stats.good index dd62e121d6..3d0d2dde32 100644 --- a/bin/tests/system/ixfr/ixfr-stats.good +++ b/bin/tests/system/ixfr/ixfr-stats.good @@ -1,3 +1,3 @@ messages=1 -records=6 -bytes=219 +records=5 +bytes=204 diff --git a/bin/tests/system/ixfr/ns1/.gitignore b/bin/tests/system/ixfr/ns1/.gitignore deleted file mode 100644 index 58e5c9282d..0000000000 --- a/bin/tests/system/ixfr/ns1/.gitignore +++ /dev/null @@ -1 +0,0 @@ -named.conf diff --git a/bin/tests/system/ixfr/ns1/named.conf.in b/bin/tests/system/ixfr/ns1/named.conf.in new file mode 100644 index 0000000000..854d04dedb --- /dev/null +++ b/bin/tests/system/ixfr/ns1/named.conf.in @@ -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. + */ + +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; + notify yes; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-sha256; +}; + +controls { + inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; +}; diff --git a/bin/tests/system/ixfr/ns1/startme b/bin/tests/system/ixfr/ns1/startme deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/bin/tests/system/ixfr/ns3/mytest0.db b/bin/tests/system/ixfr/ns3/mytest0.db deleted file mode 100644 index 644086fb85..0000000000 --- a/bin/tests/system/ixfr/ns3/mytest0.db +++ /dev/null @@ -1,26 +0,0 @@ -; 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. - -$ORIGIN test. -$TTL 15 -test. 15 IN SOA ns1.test. hostmaster.test. ( - 1 ; serial - 3H ; refresh - 15 ; retry - 1w ; expire - 3h ; minimum - ) - IN NS ns1.test. - IN NS ns2.test. - IN NS ns5.test. -ns1 IN A 10.53.0.3 -ns2 IN A 10.53.0.4 -ns5 IN A 10.53.0.5 -host1 IN A 192.168.10.3 -host2 IN A 192.168.10.4 diff --git a/bin/tests/system/ixfr/ns3/mytest1.db b/bin/tests/system/ixfr/ns3/mytest1.db deleted file mode 100644 index ddc7e05d24..0000000000 --- a/bin/tests/system/ixfr/ns3/mytest1.db +++ /dev/null @@ -1,26 +0,0 @@ -; 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. - -$ORIGIN test. -$TTL 15 -test. 15 IN SOA ns1.test. hostmaster.test. ( - 2 ; serial - 3H ; refresh - 15 ; retry - 1w ; expire - 3h ; minimum - ) - IN NS ns1.test. - IN NS ns2.test. - IN NS ns5.test. -ns1 IN A 10.53.0.3 -ns2 IN A 10.53.0.4 -ns5 IN A 10.53.0.5 -host1 IN A 192.168.10.13 -host2 IN A 192.168.10.4 diff --git a/bin/tests/system/ixfr/ns3/mytest2.db b/bin/tests/system/ixfr/ns3/mytest2.db deleted file mode 100644 index 080f3358b1..0000000000 --- a/bin/tests/system/ixfr/ns3/mytest2.db +++ /dev/null @@ -1,26 +0,0 @@ -; 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. - -$ORIGIN test. -$TTL 15 -test. 15 IN SOA ns1.test. hostmaster.test. ( - 4 ; serial - 3H ; refresh - 15 ; retry - 1w ; expire - 3h ; minimum - ) - IN NS ns1.test. - IN NS ns2.test. - IN NS ns5.test. -ns1 IN A 10.53.0.3 -ns2 IN A 10.53.0.4 -ns5 IN A 10.53.0.5 -host1 IN A 192.168.10.13 -host2 IN A 192.168.10.14 diff --git a/bin/tests/system/ixfr/ns3/named.conf.in b/bin/tests/system/ixfr/ns3/named.conf.in index 4ffb872b8f..fe1f7567f6 100644 --- a/bin/tests/system/ixfr/ns3/named.conf.in +++ b/bin/tests/system/ixfr/ns3/named.conf.in @@ -37,6 +37,7 @@ view "primary" { zone "test" IN { type master; file "mytest.db"; + max-ixfr-ratio 75%; }; zone "sub.test" IN { type master; diff --git a/bin/tests/system/ixfr/ns3/subtest0.db b/bin/tests/system/ixfr/ns3/subtest0.db deleted file mode 100644 index 7dc1ed79e6..0000000000 --- a/bin/tests/system/ixfr/ns3/subtest0.db +++ /dev/null @@ -1,22 +0,0 @@ -; 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. - -$ORIGIN sub.test. -$TTL 15 -sub.test. 15 IN SOA ns1.test. hostmaster.test. ( - 1 ; serial - 3H ; refresh - 15 ; retry - 1w ; expire - 3h ; minimum - ) - IN NS ns1.test. - IN NS ns2.test. -host3 IN A 192.168.10.23 -host4 IN A 192.168.10.24 diff --git a/bin/tests/system/ixfr/ns3/subtest1.db b/bin/tests/system/ixfr/ns3/subtest1.db deleted file mode 100644 index 5af027a4c7..0000000000 --- a/bin/tests/system/ixfr/ns3/subtest1.db +++ /dev/null @@ -1,22 +0,0 @@ -; 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. - -$ORIGIN sub.test. -$TTL 15 -sub.test. 15 IN SOA ns1.test. hostmaster.test. ( - 3 ; serial - 3H ; refresh - 15 ; retry - 1w ; expire - 3h ; minimum - ) - IN NS ns1.test. - IN NS ns2.test. -host3 IN A 192.168.10.123 -host4 IN A 192.168.10.24 diff --git a/bin/tests/system/ixfr/setup.sh b/bin/tests/system/ixfr/setup.sh index 963d54c50c..8c8c5fccc7 100644 --- a/bin/tests/system/ixfr/setup.sh +++ b/bin/tests/system/ixfr/setup.sh @@ -12,35 +12,56 @@ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh -cat <ns1/named.conf -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; - notify yes; -}; - -key rndc_key { - secret "1234abcd8765"; - algorithm hmac-sha256; -}; - -controls { - inet 10.53.0.1 port ${CONTROLPORT} allow { any; } keys { rndc_key; }; -}; -EOF +$SHELL clean.sh +copy_setports ns1/named.conf.in ns1/named.conf copy_setports ns3/named.conf.in ns3/named.conf copy_setports ns4/named.conf.in ns4/named.conf copy_setports ns5/named.conf.in ns5/named.conf -# Setup initial db files for ns3 -cp ns3/mytest0.db ns3/mytest.db -cp ns3/subtest0.db ns3/subtest.db +# Set up db files for zone "test" - this is a series of four +# versions of the zone, the second and third having small changes +# and the fourth having a large one. + +testdb () { + cat << EOF +\$ORIGIN $1 +\$TTL 15 +@ 15 IN SOA ns1.test. hostmaster.test. ( + $2 ; serial + 3H ; refresh + 15 ; retry + 1w ; expire + 3h ; minimum + ) + IN NS ns1.test. + IN NS ns2.test. + IN NS ns5.test. +ns1 IN A 10.53.0.3 +ns2 IN A 10.53.0.4 +ns5 IN A 10.53.0.5 +EOF + + i=0 + while [ $i -lt $3 ]; do + echo "host$i IN A 192.0.2.$i" + i=$((i+1)) + done +} + +testdb test. 1 60 > ns3/mytest.db +testdb test. 2 61 > ns3/mytest1.db +testdb test. 3 62 > ns3/mytest2.db +testdb test. 4 0 > ns3/mytest3.db + +# Set up similar db files for sub.test, which will have IXFR disabled +testdb sub.test. 1 60 > ns3/subtest.db +testdb sub.test. 3 61 > ns3/subtest1.db + +# Set up a large zone +i=0 $SHELL ../genzone.sh 3 > ns3/large.db -awk 'END { for (i = 0; i < 10000; i++) printf("record%d 10 IN TXT this is record %d\n", i, i) }' < /dev/null >> ns3/large.db +while [ $i -lt 10000 ]; do + echo "record$i 10 IN TXT this is record %i" >> ns3/large.db + i=$((i+1)) +done diff --git a/bin/tests/system/ixfr/tests.sh b/bin/tests/system/ixfr/tests.sh index c07251d4d0..6d1fe1f2d1 100644 --- a/bin/tests/system/ixfr/tests.sh +++ b/bin/tests/system/ixfr/tests.sh @@ -18,6 +18,12 @@ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh +wait_for_serial() ( + $DIG $DIGOPTS "@$1" "$2" SOA > "$4" + serial=$(awk '$4 == "SOA" { print $7 }' "$4") + [ "$3" -eq "${serial:--1}" ] +) + status=0 n=0 @@ -27,6 +33,7 @@ RNDCCMD="$RNDC -p ${CONTROLPORT} -c ../common/rndc.conf -s" n=$((n+1)) echo_i "testing initial AXFR ($n)" +ret=0 $SENDCMD < dig.out.test$n - grep "SOA" dig.out.test$n > /dev/null && break - sleep 1 -done +retry_quiet 10 wait_for_serial 10.53.0.1 nil. 1 dig.out.test$n || ret=1 -$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'initial AXFR' >/dev/null || { - echo_i "failed" - status=1 -} +$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'initial AXFR' >/dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) n=$((n+1)) echo_i "testing successful IXFR ($n)" +ret=0 # We change the IP address of a.nil., and the TXT record at the apex. # Then we do a SOA-only update. @@ -94,17 +96,17 @@ EOF sleep 1 -$RNDCCMD 10.53.0.1 refresh nil +$RNDCCMD 10.53.0.1 refresh nil | sed 's/^/ns1 /' | cat_i sleep 2 -$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'successful IXFR' >/dev/null || { - echo_i "failed" - status=1 -} +$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'successful IXFR' >/dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) n=$((n+1)) echo_i "testing AXFR fallback after IXFR failure ($n)" +ret=0 # Provide a broken IXFR response and a working fallback AXFR response @@ -129,14 +131,13 @@ EOF sleep 1 -$RNDCCMD 10.53.0.1 refresh nil +$RNDCCMD 10.53.0.1 refresh nil | sed 's/^/ns1 /' | cat_i sleep 2 -$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'fallback AXFR' >/dev/null || { - echo_i "failed" - status=1 -} +$DIG $DIGOPTS @10.53.0.1 nil. TXT | grep 'fallback AXFR' >/dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) n=$((n+1)) echo_i "testing ixfr-from-differences option ($n)" @@ -146,150 +147,84 @@ if [ $? -ne 0 ] then echo_i "named-checkzone returned failure on ns3/mytest.db" fi -# modify the master -#echo_i "digging against master: " -#$DIG $DIGOPTS @10.53.0.3 a host1.test. -#echo_i "digging against slave: " -#$DIG $DIGOPTS @10.53.0.4 a host1.test. -# wait for slave to be stable -for i in 0 1 2 3 4 5 6 7 8 9 -do - $DIG $DIGOPTS +tcp @10.53.0.4 SOA test > dig.out.test$n - grep -i "hostmaster\.test\..1" dig.out.test$n > /dev/null && break - sleep 1 -done +retry_quiet 10 wait_for_serial 10.53.0.4 test. 1 dig.out.test$n || ret=1 + +nextpart ns4/named.run > /dev/null # modify the master cp ns3/mytest1.db ns3/mytest.db $RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i -#wait for master to reload load -for i in 0 1 2 3 4 5 6 7 8 9 -do - $DIG $DIGOPTS +tcp @10.53.0.3 SOA test > dig.out.test$n - grep -i "hostmaster\.test\..2" dig.out.test$n > /dev/null && break - sleep 1 -done +# wait for master to reload +retry_quiet 10 wait_for_serial 10.53.0.3 test. 2 dig.out.test$n || ret=1 -#wait for slave to transfer zone -for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -do - $DIG $DIGOPTS +tcp @10.53.0.4 SOA test > dig.out.test$n - grep -i "hostmaster\.test\..2" dig.out.test$n > /dev/null && break - - # re-notify if we've been waiting a long time - if [ $i -ge 5 ]; then - $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i - fi - sleep 1 -done - -# slave should have gotten notify and updated - -for i in 0 1 2 3 4 5 6 7 8 9 -do - INCR=`grep "test/IN/primary" ns4/named.run|grep "got incremental"|wc -l` - [ $INCR -eq 1 ] && break - sleep 1 -done -if [ $INCR -ne 1 ] -then - echo_i "failed to get incremental response" - status=1 +# wait for slave to reload +tret=0 +retry_quiet 5 wait_for_serial 10.53.0.4 test. 2 dig.out.test$n || tret=1 +if [ $tret -eq 1 ]; then + # re-noitfy after 5 seconds, then wait another 10 + $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i + retry_quiet 10 wait_for_serial 10.53.0.4 test. 2 dig.out.test$n || ret=1 fi +wait_for_log 10 'got incremental' ns4/named.run || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + n=$((n+1)) -echo_i "testing request-ixfr option in view vs zone ($n)" +echo_i "testing 'request-ixfr no' option inheritance from view ($n)" +ret=0 # There's a view with 2 zones. In the view, "request-ixfr yes" # but in the zone "sub.test", request-ixfr no" # we want to make sure that a change to sub.test results in AXFR, while # changes to test. result in IXFR -echo_ic "this result should be AXFR" cp ns3/subtest1.db ns3/subtest.db # change to sub.test zone, should be AXFR +nextpart ns4/named.run > /dev/null $RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i -#wait for master to reload zone -for i in 0 1 2 3 4 5 6 7 8 9 -do - $DIG $DIGOPTS +tcp @10.53.0.3 SOA sub.test > dig.out.test$n - grep -i "hostmaster\.test\..3" dig.out.test$n > /dev/null && break - sleep 1 -done +# wait for master to reload +retry_quiet 10 wait_for_serial 10.53.0.3 sub.test. 3 dig.out.test$n || ret=1 -#wait for slave to transfer zone -for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -do - $DIG $DIGOPTS +tcp @10.53.0.4 SOA sub.test > dig.out.test$n - grep -i "hostmaster\.test\..3" dig.out.test$n > /dev/null && break - - # re-notify if we've been waiting a long time - if [ $i -ge 5 ]; then - $RNDCCMD 10.53.0.3 notify sub.test | set 's/^/ns3 /' | cat_i - fi - sleep 1 -done - -echo_ic "this result should be AXFR" -for i in 0 1 2 3 4 5 6 7 8 9 -do - NONINCR=`grep 'sub\.test/IN/primary' ns4/named.run|grep "got nonincremental" | wc -l` - [ $NONINCR -eq 2 ] && break - sleep 1 -done -if [ $NONINCR -ne 2 ] -then - echo_ic "failed to get nonincremental response in 2nd AXFR test" - - echo_i "failed" - status=1 -else - echo_ic "success: AXFR it was" +# wait for slave to reload +tret=0 +retry_quiet 5 wait_for_serial 10.53.0.4 sub.test. 3 dig.out.test$n || tret=1 +if [ $tret -eq 1 ]; then + # re-noitfy after 5 seconds, then wait another 10 + $RNDCCMD 10.53.0.3 notify sub.test | set 's/^/ns3 /' | cat_i + retry_quiet 10 wait_for_serial 10.53.0.4 sub.test. 3 dig.out.test$n || ret=1 fi -echo_ic "this result should be IXFR" -cp ns3/mytest2.db ns3/mytest.db # change to test zone, should be IXFR -$RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i - -# wait for master to reload zone -for i in 0 1 2 3 4 5 6 7 8 9 -do - $DIG +tcp -p 5300 @10.53.0.3 SOA test > dig.out.test$n - grep -i "hostmaster\.test\..4" dig.out.test$n > /dev/null && break - sleep 1 -done - -# wait for slave to transfer zone -for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -do - $DIG $DIGOPTS +tcp @10.53.0.4 SOA test > dig.out.test$n - grep -i "hostmaster\.test\..4" dig.out.test$n > /dev/null && break - - # re-notify if we've been waiting a long time - if [ $i -ge 5 ]; then - $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i - fi - sleep 1 -done - -for i in 0 1 2 3 4 5 6 7 8 9 -do - INCR=`grep "test/IN/primary" ns4/named.run|grep "got incremental"|wc -l` - [ $INCR -eq 2 ] && break - sleep 1 -done -if [ $INCR -ne 2 ] -then - echo_ic "failed to get incremental response in 2nd IXFR test" - - echo_i "failed" - status=1 -else - echo_ic "success: IXFR it was" -fi +wait_for_log 10 'got nonincremental response' ns4/named.run || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) n=$((n+1)) +echo_i "testing 'request-ixfr yes' option inheritance from view ($n)" +ret=0 +cp ns3/mytest2.db ns3/mytest.db # change to test zone, should be IXFR +nextpart ns4/named.run > /dev/null +$RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i + +# wait for master to reload +retry_quiet 10 wait_for_serial 10.53.0.3 test. 3 dig.out.test$n || ret=1 + +# wait for slave to reload +tret=0 +retry_quiet 5 wait_for_serial 10.53.0.4 test. 3 dig.out.test$n || tret=1 +if [ $tret -eq 1 ]; then + # re-noitfy after 5 seconds, then wait another 10 + $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i + retry_quiet 10 wait_for_serial 10.53.0.4 test. 3 dig.out.test$n || ret=1 +fi + +wait_for_log 10 'got incremental response' ns4/named.run || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + +n=$((n+1)) +ret=0 echo_i "testing DiG's handling of a multi message AXFR style IXFR response ($n)" ( (sleep 10 && kill $$) 2>/dev/null & @@ -298,9 +233,11 @@ $DIG -p ${PORT} ixfr=0 large @10.53.0.3 > dig.out.test$n kill $sub ) lines=`grep hostmaster.large dig.out.test$n | wc -l` -test ${lines:-0} -eq 2 || { echo_i "failed"; status=1; } +test ${lines:-0} -eq 2 || ret=1 messages=`sed -n 's/^;;.*messages \([0-9]*\),.*/\1/p' dig.out.test$n` -test ${messages:-0} -gt 1 || { echo_i "failed"; status=1; } +test ${messages:-0} -gt 1 || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) n=$((n+1)) echo_i "test 'dig +notcp ixfr=' vs 'dig ixfr= +notcp' vs 'dig ixfr=' ($n)" @@ -310,28 +247,23 @@ $DIG $DIGOPTS +notcp ixfr=1 test @10.53.0.4 > dig.out1.test$n || ret=1 $DIG $DIGOPTS ixfr=1 +notcp test @10.53.0.4 > dig.out2.test$n || ret=1 digcomp dig.out1.test$n dig.out2.test$n || ret=1 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out1.test$n || ret=1 -awk '$4 == "SOA" { if ($7 == 4) exit(0); else exit(1);}' dig.out1.test$n || ret=1 +awk '$4 == "SOA" { if ($7 == 3) exit(0); else exit(1);}' dig.out1.test$n || ret=1 # Should be incremental transfer. $DIG $DIGOPTS ixfr=1 test @10.53.0.4 > dig.out3.test$n || ret=1 awk '$4 == "SOA" { soacnt++} END { if (soacnt == 6) exit(0); else exit(1);}' dig.out3.test$n || ret=1 -if [ ${ret} != 0 ]; then - echo_i "failed" - status=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + +# make sure ns5 has transfered the zone +# wait for slave to reload +tret=0 +retry_quiet 5 wait_for_serial 10.53.0.5 test. 4 dig.out.test$n || tret=1 +if [ $tret -eq 1 ]; then + # re-noitfy after 5 seconds, then wait another 10 + $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i + retry_quiet 10 wait_for_serial 10.53.0.5 test. 3 dig.out.test$n || ret=1 fi -# wait for slave to transfer zone -for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -do - $DIG $DIGOPTS +tcp @10.53.0.5 SOA test > dig.out.test$n - grep -i "hostmaster\.test\..4" dig.out.test$n > /dev/null && break - - # re-notify if we've been waiting a long time - if [ $i -ge 5 ]; then - $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i - fi - sleep 1 -done - n=$((n+1)) echo_i "test 'provide-ixfr no;' ($n)" ret=0 @@ -341,42 +273,59 @@ $DIG $DIGOPTS ixfr=1 test @10.53.0.5 > dig.out1.test$n || ret=1 $DIG $DIGOPTS ixfr=1 +notcp test @10.53.0.5 > dig.out2.test$n || ret=1 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 2) exit(0); else exit(1);}' dig.out1.test$n || ret=1 awk '$4 == "SOA" { soacnt++} END {if (soacnt == 1) exit(0); else exit(1);}' dig.out2.test$n || ret=1 -if [ ${ret} != 0 ]; then - echo_i "failed" - status=1 -fi +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) n=$((n+1)) echo_i "checking whether dig calculates IXFR statistics correctly ($n)" ret=0 $DIG $DIGOPTS +noedns +stat -b 10.53.0.4 @10.53.0.4 test. ixfr=2 > dig.out1.test$n get_dig_xfer_stats dig.out1.test$n > stats.dig -diff ixfr-stats.good stats.dig || ret=1 +diff ixfr-stats.good stats.dig > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) # Note: in the next two tests, we use ns4 logs for checking both incoming and # outgoing transfer statistics as ns4 is both a secondary server (for ns3) and a # primary server (for dig queries from the previous test) for "test". + +_wait_for_stats () { + get_named_xfer_stats ns4/named.run "$1" test "$2" > "$3" + diff ixfr-stats.good "$3" > /dev/null || return 1 + return 0 +} + n=$((n+1)) echo_i "checking whether named calculates incoming IXFR statistics correctly ($n)" ret=0 -get_named_xfer_stats ns4/named.run 10.53.0.3 test "Transfer completed" > stats.incoming -diff ixfr-stats.good stats.incoming || ret=1 +retry_quiet 10 _wait_for_stats 10.53.0.3 "Transfer completed" stats.incoming if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) n=$((n+1)) echo_i "checking whether named calculates outgoing IXFR statistics correctly ($n)" -ret=1 -for i in 0 1 2 3 4 5 6 7 8 9; do - get_named_xfer_stats ns4/named.run 10.53.0.4 test "IXFR ended" > stats.outgoing - if diff ixfr-stats.good stats.outgoing > /dev/null; then - ret=0 - break - fi - sleep 1 -done +retry_quiet 10 _wait_for_stats 10.53.0.4 "IXFR ended" stats.outgoing +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status+ret)) + +n=$((n+1)) +ret=0 +echo_i "testing fallback to AXFR when max-ixfr-ratio is exceeded ($n)" +nextpart ns4/named.run > /dev/null + +cp ns3/mytest3.db ns3/mytest.db # change to test zone, too big for IXFR +$RNDCCMD 10.53.0.3 reload | sed 's/^/ns3 /' | cat_i + +# wait for slave to reload +tret=0 +retry_quiet 5 wait_for_serial 10.53.0.4 test. 4 dig.out.test$n || tret=1 +if [ $tret -eq 1 ]; then + # re-noitfy after 5 seconds, then wait another 10 + $RNDCCMD 10.53.0.3 notify test | set 's/^/ns3 /' | cat_i + retry_quiet 10 wait_for_serial 10.53.0.4 test. 4 dig.out.test$n || ret=1 +fi + +wait_for_log 10 'got nonincremental response' ns4/named.run || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) diff --git a/util/copyrights b/util/copyrights index 690a3055c9..f5f9b4c02c 100644 --- a/util/copyrights +++ b/util/copyrights @@ -688,7 +688,6 @@ ./bin/tests/system/ixfr/ans2/startme X 2011,2018,2019,2020 ./bin/tests/system/ixfr/clean.sh SH 2001,2004,2007,2011,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/ixfr/ixfr-stats.good X 2019,2020 -./bin/tests/system/ixfr/ns1/startme X 2012,2013,2018,2019,2020 ./bin/tests/system/ixfr/prereq.sh SH 2001,2004,2007,2012,2014,2016,2018,2019,2020 ./bin/tests/system/ixfr/setup.sh SH 2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020 ./bin/tests/system/ixfr/tests.sh SH 2001,2004,2007,2011,2012,2014,2016,2018,2019,2020