BIND 10 trac1213, updated. 19722a540a20a2dc5370df4d8f1f0bb326175001 [1213] Update comments in shell files
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Oct 10 10:37:55 UTC 2011
The branch, trac1213 has been updated
via 19722a540a20a2dc5370df4d8f1f0bb326175001 (commit)
via 8724a537b4f7d9d93bf06c2df860ea83f247461b (commit)
via f5b0e46b8cc66dc5aeef4df4d4e938ab0f4cd3da (commit)
from 5f5d0ee169a33ed2edf6d80ed1c7f557b993eaf5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 19722a540a20a2dc5370df4d8f1f0bb326175001
Author: Stephen Morris <stephen at isc.org>
Date: Mon Oct 10 11:33:21 2011 +0100
[1213] Update comments in shell files
commit 8724a537b4f7d9d93bf06c2df860ea83f247461b
Author: Stephen Morris <stephen at isc.org>
Date: Mon Oct 10 11:15:53 2011 +0100
[1213] Compare zones after update instead of just the SOA serial
commit f5b0e46b8cc66dc5aeef4df4d4e938ab0f4cd3da
Author: Stephen Morris <stephen at isc.org>
Date: Mon Oct 10 09:35:45 2011 +0100
[1213] Corrected documentation of fourth IXFR-in test
-----------------------------------------------------------------------
Summary of changes:
tests/system/ixfr/clean.sh | 3 +
tests/system/ixfr/common_tests.sh.in | 13 +--
tests/system/ixfr/db.example.n2.refresh.in | 2 +-
tests/system/ixfr/in-3/tests.sh | 4 +-
tests/system/ixfr/in-4/setup.sh.in | 8 +-
tests/system/ixfr/in-4/tests.sh | 15 +++-
tests/system/ixfr/ixfr_init.sh.in | 111 ++++++++++++++++++++++------
7 files changed, 113 insertions(+), 43 deletions(-)
-----------------------------------------------------------------------
diff --git a/tests/system/ixfr/clean.sh b/tests/system/ixfr/clean.sh
index 70cc4b2..aaa1a12 100644
--- a/tests/system/ixfr/clean.sh
+++ b/tests/system/ixfr/clean.sh
@@ -23,3 +23,6 @@ rm -f ns1/named.memstats
rm -f nsx2/bind10.run
rm -f nsx2/zone.sqlite3
+
+rm -f client.dig
+rm -f server.dig
diff --git a/tests/system/ixfr/common_tests.sh.in b/tests/system/ixfr/common_tests.sh.in
index c14d8d4..99f6a4d 100644
--- a/tests/system/ixfr/common_tests.sh.in
+++ b/tests/system/ixfr/common_tests.sh.in
@@ -20,7 +20,7 @@
#
# Preconditions:\n
# The BIND 9 nameserver (ns1, 10.53.0.1, acting as the IXFR server) is loaded
-# with the N-4 version of the zone. It may hold prior versions as well.
+# with the N-4 version of the zone. (It may hold prior versions as well.)
# Notifications are disabled.
#
# The BIND 10 nameserver (nsx2, 10.53.0.2, acting as the IXFR client) is loaded
@@ -30,8 +30,8 @@
# This script updates the IXFR server with the N-2 and N-0 versions of the zone.
# It then updates the BIND 10 configuration so that it looks for IXFRs from
# the IXFR server and causes the server to send the client a NOTIFY. After
-# waiting for the client to update from the server, it compares SOA serials,
-# reporting an error if they are different.
+# waiting for the client to update from the server, it compares ther zones of
+# the two system, reporting an error if they are different.
#
# Caller Actions:\n
# The caller can pre-load the BIND 10 IXFR client with whatever version of the
@@ -41,9 +41,6 @@
# After this test has finished, it is up to the caller to check the logs
# to see if they report the expected behavior.
#
-# \arg $1 If present (and set to "yes"), after updating the IXFR server,
-# ensure that NOTIFYs are enabled and send a NOTIFY to the slave.
-#
# \return 0 if the script executed successfully, non-zero otherwise
# Set up variables etc.
@@ -81,6 +78,6 @@ do_rndc $SERVER_NAME $SERVER_IP notify example
# Wait for the client to update itself.
wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
-# Has updated, get the latest serial of the client and server - they
+# Has updated, compare the client and server's versions of the zone s- they
# should be the same.
-compare_soa $SERVER_NAME $SERVER_IP $CLIENT_NAME $CLIENT_IP
+compare_zones $SERVER_NAME $SERVER_IP $CLIENT_NAME $CLIENT_IP
diff --git a/tests/system/ixfr/db.example.n2.refresh.in b/tests/system/ixfr/db.example.n2.refresh.in
index 6a999af..2c59416 100644
--- a/tests/system/ixfr/db.example.n2.refresh.in
+++ b/tests/system/ixfr/db.example.n2.refresh.in
@@ -15,7 +15,7 @@
$ORIGIN example.
$TTL 3600
-@ IN SOA ns1.example. hostmaster.example. 98 3600 900 7200 300
+@ IN SOA ns1.example. hostmaster.example. 98 30 2 7200 300
IN NS ns1.example.
IN NS ns2.example.
diff --git a/tests/system/ixfr/in-3/tests.sh b/tests/system/ixfr/in-3/tests.sh
index acb4739..b64b468 100644
--- a/tests/system/ixfr/in-3/tests.sh
+++ b/tests/system/ixfr/in-3/tests.sh
@@ -16,11 +16,11 @@
# PERFORMANCE OF THIS SOFTWARE.
# \file
-# This script performs the thrid IXFR-IN test. A BIND 9 nameserver (the
+# This script performs the third IXFR-IN test. A BIND 9 nameserver (the
# "server") contains a version of the zone (version N) and has IXFRs disabled.
# A BIND 10 nameserver (the "client") is loaded with version N-2 of the zone.
# A NOTIFY is sent to it, and it is expected that it will send an IXFR to the
-# server; the server should not respond to the request, so ther client should
+# server; the server should not respond to the request, so the client should
# then send an AXFR request and receive the latest copy of the zone.
. ../ixfr_init.sh
diff --git a/tests/system/ixfr/in-4/setup.sh.in b/tests/system/ixfr/in-4/setup.sh.in
index 47eab9c..4456ba3 100644
--- a/tests/system/ixfr/in-4/setup.sh.in
+++ b/tests/system/ixfr/in-4/setup.sh.in
@@ -20,10 +20,10 @@
sh clean.sh
-# Set up the initial version of the IXFR server - load the latest version of
-# the zone.
-cp $IXFR_TOP/named_noixfr.conf ns1/named.conf
-cp -f $IXFR_TOP/db.example.n0 ns1/db.example
+# Set up the initial version of the ixfr server - load the last-but-one version
+# of the zone.
+cp $IXFR_TOP/named_nonotify.conf ns1/named.conf
+cp -f $IXFR_TOP/db.example.n2.refresh ns1/db.example
# Set up the IXFR client - load a previous version of the zone with a short
# refresh time.
diff --git a/tests/system/ixfr/in-4/tests.sh b/tests/system/ixfr/in-4/tests.sh
index fd78990..09a5562 100644
--- a/tests/system/ixfr/in-4/tests.sh
+++ b/tests/system/ixfr/in-4/tests.sh
@@ -17,19 +17,26 @@
# \file
# This script performs the fourth IXFR-IN test. A BIND 9 nameserver (the
-# "server") contains a version of the zone (version N) and has IXFRs disabled.
+# "server") contains a version of the zone (version N) and has IXFRs enabled.
# A BIND 10 nameserver (the "client") is loaded with version N-2 of the zone
-# and a small refresh time. After this expires, the IXFR client should have
-# sent a request to the IXFR server.
+# and a small refresh time. After this expires, the IXFR client should send
+# an IXFR request to the IXFR server.
. ../ixfr_init.sh
status=$?
+# Ensure the server has the latest copy of the zone. The implicit assumption
+# here is that starting the two systems and reloading the IXFR server takes
+# less time than the SOA refresh time set in the "db.example.n2.refresh" zone
+# file.
+cp $IXFR_TOP/db.example.n0 ns1/db.example
+do_rndc $SERVER_NAME $SERVER_IP reload
+
# Store the SOA serial number of the BIND 10 client for later use.
old_client_serial=`$DIG_SOA @$CLIENT_IP | $AWK '{print $3}'`
echo "I:SOA serial of IXFR client $CLIENT_NAME is $old_client_serial"
-# Wait for the client to update itself. 20 seconds has been given as the
+# Wait for the client to update itself. 30 seconds has been given as the
# refresh interface and 2 seconds as the retry interval. The wait_for_update
# function will check for up to a minute looking for the new serial.
wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
diff --git a/tests/system/ixfr/ixfr_init.sh.in b/tests/system/ixfr/ixfr_init.sh.in
index 54f6c91..715b8af 100644
--- a/tests/system/ixfr/ixfr_init.sh.in
+++ b/tests/system/ixfr/ixfr_init.sh.in
@@ -15,9 +15,9 @@
# PERFORMANCE OF THIS SOFTWARE.
# \file
-# This file should be run by all IXFR tests before going anything else. It
-# includes the main configuration script that defines the various environment
-# variables, as well as defining useful shell subroutines.
+# This file should be run by all IXFR tests before doing anything else. It
+# includes the main configuration script to set the environment variables as
+# well as defining useful shell subroutines.
. @abs_top_builddir@/tests/system/conf.sh
@@ -26,7 +26,8 @@
# Short-hand for getting SOA - just supply address of the server
DIG_SOA="$DIG +norecurse +short -p $DNS_PORT example. SOA"
-# All IXFR tests use a BIND 9 server serving a BIND 10 client
+# All IXFR tests use a BIND 9 server serving a BIND 10 client. These have the
+# smae name and use the same address in all tests.
SERVER_NAME=ns1
SERVER_IP=10.53.0.1 # BIND 9
@@ -35,7 +36,7 @@ CLIENT_IP=10.53.0.2 # BIND 10
# \brief Check Arguments
#
-# All functions take the name of the server as the firsrt argument and its IP
+# Most functions take the name of nameserver as the first argument and its IP
# address as the second. This function is passed "$*" and just checks that
# both $1 and $2 are defined.
#
@@ -65,9 +66,12 @@ check_name_ip() {
# Controls the BIND 9 IXFR server. Called do_rndc (instead of rndc) to avoid
# confusion if rndc itself is in the search path.
#
-# $1 - Name of the server (ns1, nsx2 etc.)
-# $2 - IP address of the server
-# $* - Command to execute (which may be multiple tokens)
+# \arg $1 - Name of the server (ns1, nsx2 etc.)
+# \arg $2 - IP address of the server
+# \arg $* - Command to execute (which may be multiple tokens)
+#
+# \return 0 on success, 1 on failure (in which case an error message will
+# have been output).
do_rndc () {
# If the following checks fail, the code is wrong.
@@ -94,19 +98,18 @@ do_rndc () {
| sed "s/^/I:$name /"
}
-# wait_for_update
+# \brief Wait for update
#
# Given a serial number and a server, poll the nameserver until the SOA serial
# number is different from that given. The poll takes place every five seconds
# for a minute.
#
-# $1 - Name of the server
-# $2 - IP address of the server
-# $3 - Serial number to check against
+# \arg $1 - Name of the server
+# \arg $2 - IP address of the server
+# \arg $3 - Serial number to check against
#
-# Returns:
-# 0 - Serial number is different (requires another poll to obtain it)
-# 1 - Serial number has not changed
+# \return 0 if the serial number is different (requires another poll to obtain
+# it), 1 if the serial number has not changed after one minute.
wait_for_update() {
# If the following checks fail, the code is wrong.
@@ -115,7 +118,8 @@ wait_for_update() {
if [ $? -ne 0 ];
then
echo "R:FAIL wait_for_update - name or ip address of system not supplied"
- return 1
+ return 1t
+
fi
name=$1
@@ -124,7 +128,6 @@ wait_for_update() {
shift
serial=$1
- shift
if [ "$serial" = "" ];
then
echo "R:FAIL wait_for_update - serial number not supplied"
@@ -133,7 +136,8 @@ wait_for_update() {
# Now poll the server looking for the new serial number
- for i in 1 2 3 4 5 6 7 8 9 10 11 12
+ echo "I:waiting for SOA serial of $name to change from $serial"
+ for i in `seq 1 12`
do
if [ $i -gt 1 ];
then
@@ -153,15 +157,18 @@ wait_for_update() {
-# update_server_zone
+# \brief Update server zone
#
# Reloads the example. zone in the BIND 9 IXFR server and waits a maximum of
# one minute for it to be served.
#
-# $1 - Name of the server (ns1, nsx2 etc.)
-# $2 - IP address of the server
-# $3 - Zone file to load
-# $* - Command to execute (which may be multiple tokens)
+# \arg $1 - Name of the server (ns1, nsx2 etc.)
+# \arg $2 - IP address of the server
+# \arg $3 - Zone file to load
+# \arg $* - Command to execute (which may be multiple tokens)
+#
+# \return 0 on success, 1 on failure (for which an error message will have
+# been output).
update_server_zone() {
# If the following checks fail, the code is wrong.
@@ -194,7 +201,7 @@ update_server_zone() {
old_serial=`$DIG_SOA @$ip | $AWK '{print $3}'`
- echo "I:$name IXFR server loading $1"
+ echo "I:$name IXFR server loading $file"
cp $file $name/db.example
do_rndc $name $ip reload
if [ $? -ne 0 ];
@@ -263,3 +270,59 @@ compare_soa() {
return 0
}
+
+# \brief Compare client and server zones
+#
+# Checks the zones of two systems and reports if they are not identical.
+#
+# The check is simplistic. Each zone is listed via "dig", after which comment
+# lines, blank lines and spaces/tabs are removed, and the result sorted. The
+# output from each system is then compared. They should be identical.
+#
+# \arg $1 Name of the IXFR server
+# \arg $2 IP of the IXFR server
+# \arg $3 Name of the IXFR client
+# \arg $4 IP of the IXFR client
+#
+# \return 0 if the zones are the same, 1 if not.
+compare_zones() {
+
+ # If the following checks fail, the code is wrong.
+
+ check_name_ip $*
+ if [ $? -ne 0 ];
+ then
+ echo "R:FAIL compare_zones - name or ip address of server not supplied"
+ return 1
+ fi
+
+ server_name=$1
+ shift
+ server_ip=$1
+ shift
+
+ check_name_ip $*
+ if [ $? -ne 0 ];
+ then
+ echo "R:FAIL compare_zones - name or ip address of client not supplied"
+ return 1
+ fi
+
+ client_name=$1
+ shift
+ client_ip=$1
+ shift
+
+ $DIG @$client_ip example. axfr | grep -v '^;' | grep -v '^$' \
+ | sed -e 's/ //g' -e 's/\t//g' > client.dig
+ $DIG @$server_ip example. axfr | grep -v '^;' | grep -v '^$' \
+ | sed -e 's/ //g' -e 's/\t//g' > server.dig
+ diff client.dig server.dig
+ if [ $? -ne 0 ];
+ then
+ echo "R:FAIL client $client_name zone not same as server $server_name zone"
+ return 1
+ fi
+
+ return 0
+}
More information about the bind10-changes
mailing list