etc/services - sync with NetBSD-8
[minix.git] / external / bsd / bind / dist / bin / tests / system / forward / tests.sh
blobf8632b7c7394f24ca988184eabe8bc9c1402dcc2
1 # Copyright (C) 2004, 2007, 2011-2014 Internet Systems Consortium, Inc. ("ISC")
2 # Copyright (C) 2000, 2001 Internet Software Consortium.
4 # Permission to use, copy, modify, and/or distribute this software for any
5 # purpose with or without fee is hereby granted, provided that the above
6 # copyright notice and this permission notice appear in all copies.
8 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 # PERFORMANCE OF THIS SOFTWARE.
16 # Id: tests.sh,v 1.9 2011/10/13 22:48:23 tbox Exp
18 SYSTEMTESTTOP=..
19 . $SYSTEMTESTTOP/conf.sh
21 root=10.53.0.1
22 hidden=10.53.0.2
23 f1=10.53.0.3
24 f2=10.53.0.4
26 status=0
28 echo "I:checking that a forward zone overrides global forwarders"
29 ret=0
30 $DIG +noadd +noauth txt.example1. txt @$hidden -p 5300 > dig.out.hidden || ret=1
31 $DIG +noadd +noauth txt.example1. txt @$f1 -p 5300 > dig.out.f1 || ret=1
32 $PERL ../digcomp.pl dig.out.hidden dig.out.f1 || ret=1
33 if [ $ret != 0 ]; then echo "I:failed"; fi
34 status=`expr $status + $ret`
36 echo "I:checking that a forward first zone no forwarders recurses"
37 ret=0
38 $DIG +noadd +noauth txt.example2. txt @$root -p 5300 > dig.out.root || ret=1
39 $DIG +noadd +noauth txt.example2. txt @$f1 -p 5300 > dig.out.f1 || ret=1
40 $PERL ../digcomp.pl dig.out.root dig.out.f1 || ret=1
41 if [ $ret != 0 ]; then echo "I:failed"; fi
42 status=`expr $status + $ret`
44 echo "I:checking that a forward only zone no forwarders fails"
45 ret=0
46 $DIG +noadd +noauth txt.example2. txt @$root -p 5300 > dig.out.root || ret=1
47 $DIG +noadd +noauth txt.example2. txt @$f1 -p 5300 > dig.out.f1 || ret=1
48 $PERL ../digcomp.pl dig.out.root dig.out.f1 || ret=1
49 if [ $ret != 0 ]; then echo "I:failed"; fi
50 status=`expr $status + $ret`
52 echo "I:checking that global forwarders work"
53 ret=0
54 $DIG +noadd +noauth txt.example4. txt @$hidden -p 5300 > dig.out.hidden || ret=1
55 $DIG +noadd +noauth txt.example4. txt @$f1 -p 5300 > dig.out.f1 || ret=1
56 $PERL ../digcomp.pl dig.out.hidden dig.out.f1 || ret=1
57 if [ $ret != 0 ]; then echo "I:failed"; fi
58 status=`expr $status + $ret`
60 echo "I:checking that a forward zone works"
61 ret=0
62 $DIG +noadd +noauth txt.example1. txt @$hidden -p 5300 > dig.out.hidden || ret=1
63 $DIG +noadd +noauth txt.example1. txt @$f2 -p 5300 > dig.out.f2 || ret=1
64 $PERL ../digcomp.pl dig.out.hidden dig.out.f2 || ret=1
65 if [ $ret != 0 ]; then echo "I:failed"; fi
66 status=`expr $status + $ret`
68 echo "I:checking that forwarding doesn't spontaneously happen"
69 ret=0
70 $DIG +noadd +noauth txt.example2. txt @$root -p 5300 > dig.out.root || ret=1
71 $DIG +noadd +noauth txt.example2. txt @$f2 -p 5300 > dig.out.f2 || ret=1
72 $PERL ../digcomp.pl dig.out.root dig.out.f2 || ret=1
73 if [ $ret != 0 ]; then echo "I:failed"; fi
74 status=`expr $status + $ret`
76 echo "I:checking that a forward zone with no specified policy works"
77 ret=0
78 $DIG +noadd +noauth txt.example3. txt @$hidden -p 5300 > dig.out.hidden || ret=1
79 $DIG +noadd +noauth txt.example3. txt @$f2 -p 5300 > dig.out.f2 || ret=1
80 $PERL ../digcomp.pl dig.out.hidden dig.out.f2 || ret=1
81 if [ $ret != 0 ]; then echo "I:failed"; fi
82 status=`expr $status + $ret`
84 echo "I:checking that a forward only doesn't recurse"
85 ret=0
86 $DIG txt.example5. txt @$f2 -p 5300 > dig.out.f2 || ret=1
87 grep "SERVFAIL" dig.out.f2 > /dev/null || ret=1
88 if [ $ret != 0 ]; then echo "I:failed"; fi
89 status=`expr $status + $ret`
91 echo "I:checking for negative caching of forwarder response"
92 # prime the cache, shutdown the forwarder then check that we can
93 # get the answer from the cache. restart forwarder.
94 ret=0
95 $DIG nonexist. txt @10.53.0.5 -p 5300 > dig.out.f2 || ret=1
96 grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
97 $PERL ../stop.pl . ns4 || ret=1
98 $DIG nonexist. txt @10.53.0.5 -p 5300 > dig.out.f2 || ret=1
99 grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
100 $PERL ../start.pl --restart --noclean . ns4 || ret=1
101 if [ $ret != 0 ]; then echo "I:failed"; fi
102 status=`expr $status + $ret`
104 echo "I:checking that forward only zone overrides empty zone"
105 ret=0
106 $DIG 1.0.10.in-addr.arpa TXT @10.53.0.4 -p 5300 > dig.out.f2
107 grep "status: NOERROR" dig.out.f2 > /dev/null || ret=1
108 $DIG 2.0.10.in-addr.arpa TXT @10.53.0.4 -p 5300 > dig.out.f2
109 grep "status: NXDOMAIN" dig.out.f2 > /dev/null || ret=1
110 if [ $ret != 0 ]; then echo "I:failed"; fi
111 status=`expr $status + $ret`
113 echo "I:checking that DS lookups for grafting forward zones are isolated"
114 ret=0
115 $DIG grafted A @10.53.0.4 -p 5300 > dig.out.q1
116 $DIG grafted DS @10.53.0.4 -p 5300 > dig.out.q2
117 $DIG grafted A @10.53.0.4 -p 5300 > dig.out.q3
118 $DIG grafted AAAA @10.53.0.4 -p 5300 > dig.out.q4
119 grep "status: NOERROR" dig.out.q1 > /dev/null || ret=1
120 grep "status: NXDOMAIN" dig.out.q2 > /dev/null || ret=1
121 grep "status: NOERROR" dig.out.q3 > /dev/null || ret=1
122 grep "status: NOERROR" dig.out.q4 > /dev/null || ret=1
123 if [ $ret != 0 ]; then echo "I:failed"; fi
124 status=`expr $status + $ret`
126 echo "I:exit status: $status"
127 exit $status