123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #!/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 is used in a couple of IXFR tests.
- #
- # 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.
- # Notifications are disabled.
- #
- # The BIND 10 nameserver (nsx2, 10.53.0.2, acting as the IXFR client) is loaded
- # with an earlier (unspecified) version of the zone.
- #
- # Actions:\n
- # 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.
- #
- # Caller Actions:\n
- # The caller can pre-load the BIND 10 IXFR client with whatever version of the
- # zone it requires. It can also load the BIND 9 IXFR server with zones earlier
- # than N-4.
- #
- # After this test has finished, it is up to the caller to check the logs
- # to see if they report the expected behavior.
- # 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"
- # Load the BIND 9 system (the IXFR server) with the "n - 2" and "n" version of
- # the zones. With ixfr-from-differences set to "yes", the nameserver should
- # 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
- # 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
- # 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.
- 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
- do_rndc $SERVER_NAME $SERVER_IP notify example
- if [ $? != 0 ];
- then
- status=1
- fi
- # Wait for the client to update itself.
- wait_for_update $CLIENT_NAME $CLIENT_IP $old_client_serial
- if [ $? != 0 ];
- then
- status=1
- fi
- # 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
- exit $status
|