1#!/bin/sh 2# 3# Copyright (C) 2004, 2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") 4# Copyright (C) 2001 Internet Software Consortium. 5# 6# Permission to use, copy, modify, and/or distribute this software for any 7# purpose with or without fee is hereby granted, provided that the above 8# copyright notice and this permission notice appear in all copies. 9# 10# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 11# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 12# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 13# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 14# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 15# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16# PERFORMANCE OF THIS SOFTWARE. 17 18# $Id$ 19 20SYSTEMTESTTOP=.. 21. $SYSTEMTESTTOP/conf.sh 22 23status=0 24 25DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd" 26DIGCMD="$DIG $DIGOPTS @10.53.0.1 -p 5300" 27SENDCMD="$PERL ../send.pl 10.53.0.2 5301" 28RNDCCMD="$RNDC -s 10.53.0.1 -p 9953 -c ../common/rndc.conf" 29 30echo "I:testing initial AXFR" 31 32$SENDCMD <<EOF 33/SOA/ 34nil. 300 SOA ns.nil. root.nil. 1 300 300 604800 300 35/AXFR/ 36nil. 300 SOA ns.nil. root.nil. 1 300 300 604800 300 37/AXFR/ 38nil. 300 NS ns.nil. 39nil. 300 TXT "initial AXFR" 40a.nil. 60 A 10.0.0.61 41b.nil. 60 A 10.0.0.62 42/AXFR/ 43nil. 300 SOA ns.nil. root.nil. 1 300 300 604800 300 44EOF 45 46sleep 1 47 48# Initially, ns1 is not authoritative for anything (see setup.sh). 49# Now that ans is up and running with the right data, we make it 50# a slave for nil. 51 52cat <<EOF >>ns1/named.conf 53zone "nil" { 54 type slave; 55 file "myftp.db"; 56 masters { 10.53.0.2; }; 57}; 58EOF 59 60$RNDCCMD reload 61 62for i in 0 1 2 3 4 5 6 7 8 9 63do 64 $DIGCMD nil. SOA > dig.out 65 grep "SOA" dig.out > /dev/null && break 66 sleep 1 67done 68 69$DIGCMD nil. TXT | grep 'initial AXFR' >/dev/null || { 70 echo "I:failed" 71 status=1 72} 73 74echo "I:testing successful IXFR" 75 76# We change the IP address of a.nil., and the TXT record at the apex. 77# Then we do a SOA-only update. 78 79$SENDCMD <<EOF 80/SOA/ 81nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 82/IXFR/ 83nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 84nil. 300 SOA ns.nil. root.nil. 1 300 300 604800 300 85a.nil. 60 A 10.0.0.61 86nil. 300 TXT "initial AXFR" 87nil. 300 SOA ns.nil. root.nil. 2 300 300 604800 300 88nil. 300 TXT "successful IXFR" 89a.nil. 60 A 10.0.1.61 90nil. 300 SOA ns.nil. root.nil. 2 300 300 604800 300 91nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 92nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 93EOF 94 95sleep 1 96 97$RNDCCMD refresh nil 98 99sleep 2 100 101$DIGCMD nil. TXT | grep 'successful IXFR' >/dev/null || { 102 echo "I:failed" 103 status=1 104} 105 106echo "I:testing AXFR fallback after IXFR failure" 107 108# Provide a broken IXFR response and a working fallback AXFR response 109 110$SENDCMD <<EOF 111/SOA/ 112nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300 113/IXFR/ 114nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300 115nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 116nil. 300 TXT "delete-nonexistent-txt-record" 117nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300 118nil. 300 TXT "this-txt-record-would-be-added" 119nil. 300 SOA ns.nil. root.nil. 4 300 300 604800 300 120/AXFR/ 121nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 122/AXFR/ 123nil. 300 NS ns.nil. 124nil. 300 TXT "fallback AXFR" 125/AXFR/ 126nil. 300 SOA ns.nil. root.nil. 3 300 300 604800 300 127EOF 128 129sleep 1 130 131$RNDCCMD refresh nil 132 133sleep 2 134 135$DIGCMD nil. TXT | grep 'fallback AXFR' >/dev/null || { 136 echo "I:failed" 137 status=1 138} 139 140echo "I:exit status: $status" 141exit $status 142