Browse Source

[1213] Add third test - IXFR disabled on server, so try AXFR

Stephen Morris 13 years ago
parent
commit
48b8872569

+ 3 - 0
configure.ac

@@ -971,6 +971,8 @@ AC_OUTPUT([doc/version.ent
            tests/system/ixfr/in-1/nsx2/b10-config.db
            tests/system/ixfr/in-2/setup.sh
            tests/system/ixfr/in-2/nsx2/b10-config.db
+           tests/system/ixfr/in-3/setup.sh
+           tests/system/ixfr/in-3/nsx2/b10-config.db
           ], [
            chmod +x src/bin/cmdctl/run_b10-cmdctl.sh
            chmod +x src/bin/xfrin/run_b10-xfrin.sh
@@ -1004,6 +1006,7 @@ AC_OUTPUT([doc/version.ent
            chmod +x tests/system/ixfr/common_tests.sh
            chmod +x tests/system/ixfr/in-1/setup.sh
            chmod +x tests/system/ixfr/in-2/setup.sh
+           chmod +x tests/system/ixfr/in-3/setup.sh
           ])
 AC_OUTPUT
 

+ 15 - 36
tests/system/ixfr/common_tests.sh.in

@@ -40,20 +40,18 @@
 #
 # 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.
 . @abs_top_builddir@/tests/system/conf.sh
 . $IXFR_TOP/ixfr_init.sh
 
-SERVER_NAME=ns1
-SERVER_IP=10.53.0.1   # BIND 9
-
-CLIENT_NAME=nsx2
-CLIENT_IP=10.53.0.2   # BIND 10
-
 status=0
 
-
 # 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"
@@ -63,55 +61,36 @@ echo "I:SOA serial of IXFR client $CLIENT_NAME is $old_client_serial"
 # generate the differences between them.
 echo "I:updating IXFR-server $SERVER_NAME for ixfr-in tests"
 update_server_zone $SERVER_NAME $SERVER_IP $IXFR_TOP/largezone_n-2.db
-if [ $? != 0 ];
-then
-    status=1
-fi
+status=`expr $status + $?`
 
 # Wait a bit - it seems that if two updates are loaded in quick succession,
 # the second sometimes gets lost.
 sleep 5
 update_server_zone $SERVER_NAME $SERVER_IP $IXFR_TOP/largezone_n-0.db
-if [ $? != 0 ];
-then
-    status=1
-fi
+status=`expr $status + $?`
 
 # TODO: Need to alter configuration of BIND 10 server such that it accepts
 # NOTIFYs from and sends IXFR requests to the BIND 9 master.
 
-# Get the IXFR server to notify the slave server of the new zone.  Do this by
-# allowing notifies and then triggering a re-notification of the server.
+# If required, get the IXFR server to notify the slave server of the new zone.
+# Do this by allowing notifies and then triggering a re-notification of the
+# server.
 echo "I:notifying IXFR-client $CLIENT_NAME of presence of new version of zone"
 cp ns1/named_notify.conf ns1/named.conf
 
 do_rndc $SERVER_NAME $SERVER_IP reconfig
-if [ $? != 0 ];
-then
-    status=1
-fi
+status=`expr $status + $?`
 
 do_rndc $SERVER_NAME $SERVER_IP notify example
-if [ $? != 0 ];
-then
-    status=1
-fi
+status=`expr $status + $?`
 
 # Wait for the client to update itself.
 wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
-if [ $? != 0 ];
-then
-    status=1
-fi
+status=`expr $status + $?`
 
 # Has updated, get the latest serial of the client and server - they
 # should be the same.
-client_serial=`$DIG_SOA @$CLIENT_IP | $AWK '{print $3}'`
-server_serial=`$DIG_SOA @$SERVER_IP | $AWK '{print $3}'`
-if [ "$client_serial" != "$server_serial" ];
-then
-    echo "R:FAIL client serial $client_serial not same as server serial $server_serial after update"
-    status=1
-fi
+compare_soa $SERVER_NAME $SERVER_IP $CLIENT_NAME $CLIENT_IP
+status=`expr $status + $?`
 
 exit $status

+ 1 - 1
tests/system/ixfr/in-1/clean.sh

@@ -18,7 +18,7 @@
 # Clean up after zone transfer tests.
 
 rm -f ns1/named.conf
-rm -f ns1/largezone.db
+rm -f ns1/zone.db
 rm -f ns1/named.memstats
 
 rm -f nsx2/bind10.run

+ 1 - 0
tests/system/ixfr/in-1/ns1/named_nonotify.conf

@@ -30,6 +30,7 @@ options {
 	listen-on { 10.53.0.1; };
 	listen-on-v6 { none; };
 	recursion no;
+    ixfr-from-differences yes;
 	notify no;
 };
 

+ 1 - 0
tests/system/ixfr/in-1/ns1/named_notify.conf

@@ -30,6 +30,7 @@ options {
 	listen-on { 10.53.0.1; };
 	listen-on-v6 { none; };
 	recursion no;
+    ixfr-from-differences yes;
 	notify explicit;
     also-notify { 10.53.0.2; };
 };

+ 1 - 1
tests/system/ixfr/in-2/clean.sh

@@ -18,7 +18,7 @@
 # Clean up after zone transfer tests.
 
 rm -f ns1/named.conf
-rm -f ns1/largezone.db
+rm -f ns1/zone.db
 rm -f ns1/named.memstats
 
 rm -f nsx2/bind10.run

+ 1 - 0
tests/system/ixfr/in-2/ns1/named_nonotify.conf

@@ -30,6 +30,7 @@ options {
 	listen-on { 10.53.0.1; };
 	listen-on-v6 { none; };
 	recursion no;
+    ixfr-from-differences yes;
 	notify no;
 };
 

+ 2 - 1
tests/system/ixfr/in-2/ns1/named_notify.conf

@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-include ".../../../common/rndc.key";
+include "../../../common/rndc.key";
 
 controls {
         inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
@@ -30,6 +30,7 @@ options {
 	listen-on { 10.53.0.1; };
 	listen-on-v6 { none; };
 	recursion no;
+    ixfr-from-differences yes;
 	notify explicit;
     also-notify { 10.53.0.2; };
 };

+ 25 - 0
tests/system/ixfr/in-3/clean.sh

@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2004, 2007, 2011  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000, 2001  Internet Software Consortium.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# Clean up after zone transfer tests.
+
+rm -f ns1/named.conf
+rm -f ns1/zone.db
+rm -f ns1/named.memstats
+
+rm -f nsx2/bind10.run
+rm -f nsx2/zone.sqlite3

+ 41 - 0
tests/system/ixfr/in-3/ns1/named.conf

@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2004, 2007, 2011  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+include "../../../common/rndc.key";
+
+controls {
+        inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
+};
+
+options {
+	query-source address 10.53.0.1;
+	notify-source 10.53.0.1;
+	transfer-source 10.53.0.1;
+	port 53210;
+	pid-file "named.pid";
+	listen-on { 10.53.0.1; };
+	listen-on-v6 { none; };
+	recursion no;
+    ixfr-from-differences no;
+	notify explicit;
+    also-notify { 10.53.0.2; };
+};
+
+zone "example" {
+	type master;
+	file "zone.db";
+};

+ 6 - 0
tests/system/ixfr/in-3/nsx2/b10-config.db.in

@@ -0,0 +1,6 @@
+{"version": 2,
+ "Auth": {
+   "listen_on": [{"address": "10.53.0.2", "port": 53210}],
+   "database_file": "@abs_builddir@/zone.sqlite3"
+ }
+}

+ 31 - 0
tests/system/ixfr/in-3/setup.sh.in

@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Copyright (C) 2004, 2007, 2011  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2001, 2002  Internet Software Consortium.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+. @abs_top_builddir@/tests/system/conf.sh
+
+# Clean up from last time
+
+sh clean.sh
+
+# Set up the initial version of the IXFR server - load the latest version of
+# the zone.
+
+cp -f $IXFR_TOP/largezone_n-0.db ns1/zone.db
+
+# Set up the IXFR client - load a previous version of the zone.
+
+${B10_LOADZONE} -o . -d @builddir@/nsx2/zone.sqlite3 $IXFR_TOP/largezone_n-2.db

+ 61 - 0
tests/system/ixfr/in-3/tests.sh

@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright (C) 2004, 2005, 2007, 2011  Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2000, 2001  Internet Software Consortium.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+# \file
+# This script performs the thrid 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
+# then send an AXFR request and receive the latest copy of the zone.
+
+. ../ixfr_init.sh
+status=$?
+
+# 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"
+
+# TODO: Need to alter configuration of BIND 10 server such that it accepts
+# NOTIFYs from and sends IXFR requests to the BIND 9 master.
+
+# If required, get the IXFR server to notify the IXFR client of the new zone.
+# Do this by allowing notifies and then triggering a re-notification of the
+# server.
+echo "I:notifying IXFR-client $CLIENT_NAME of presence of new version of zone"
+cp ns1/named_notify.conf ns1/named.conf
+
+do_rndc $SERVER_NAME $SERVER_IP reconfig
+status=`expr $status + $?`
+
+do_rndc $SERVER_NAME $SERVER_IP notify example
+status=`expr $status + $?`
+
+# Wait for the client to update itself.
+wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
+status=`expr $status + $?`
+
+# Has updated, get the latest serial of the client and server - they
+# should be the same.
+compare_soa $SERVER_NAME $SERVER_IP $CLIENT_NAME $CLIENT_IP
+status=`expr $status + $?`
+
+# TODO: Check the BIND 10 log, looking for the IXFR messages that indicate that
+# it has initiated an IXFR and then an AXFR.
+
+echo "I:exit status: $status"
+exit $status

+ 57 - 0
tests/system/ixfr/ixfr_init.sh

@@ -26,6 +26,13 @@
 # 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
+SERVER_NAME=ns1
+SERVER_IP=10.53.0.1   # BIND 9
+
+CLIENT_NAME=nsx2
+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
@@ -206,3 +213,53 @@ update_server_zone() {
     echo "I:$name was at serial $old_serial, now at $new_serial"
     return 0
 }
+
+# \brief Compare client and server SOAs
+#
+# Checks the SOAs of two systems and reports if they are not equal.
+#
+# \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 systems have the same SOA, 1 if not.  In the latter case,
+#         an error will be output.
+compare_soa() {
+
+    # If the following checks fail, the code is wrong.
+
+    check_name_ip $*
+    if [ $? -ne 0 ];
+    then
+        echo "R:FAIL compare_soa - 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_soa - name or ip address of client not supplied"
+        return 1
+    fi
+
+    client_name=$1
+    shift
+    client_ip=$1
+    shift
+
+    client_serial=`$DIG_SOA @$client_ip | $AWK '{print $3}'`
+    server_serial=`$DIG_SOA @$server_ip | $AWK '{print $3}'`
+    if [ "$client_serial" != "$server_serial" ];
+    then
+        echo "R:FAIL client $client_name serial $client_serial not same as server $server_name serial $server_serial"
+        return 1
+    fi
+
+    return 0
+}