xref: /minix3/external/bsd/bind/dist/bin/tests/system/legacy/tests.sh (revision 00b67f09dd46474d133c95011a48590a8e8f94c7)
1#!/bin/sh
2#
3# Copyright (C) 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
4#
5# Permission to use, copy, modify, and/or distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11# AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15# PERFORMANCE OF THIS SOFTWARE.
16
17# Id
18
19SYSTEMTESTTOP=..
20. $SYSTEMTESTTOP/conf.sh
21
22status=0
23n=0
24
25n=`expr $n + 1`
26echo "I:checking drop edns server setup ($n)"
27ret=0
28$DIG +edns @10.53.0.2 -p 5300 dropedns soa > dig.out.1.test$n
29grep "connection timed out; no servers could be reached" dig.out.1.test$n > /dev/null || ret=1
30$DIG +noedns @10.53.0.2 -p 5300 dropedns soa > dig.out.2.test$n || ret=1
31grep "status: NOERROR" dig.out.2.test$n > /dev/null || ret=1
32grep "EDNS: version:" dig.out.2.test$n > /dev/null && ret=1
33$DIG +noedns +tcp @10.53.0.2 -p 5300 dropedns soa > dig.out.3.test$n || ret=1
34grep "status: NOERROR" dig.out.3.test$n > /dev/null || ret=1
35grep "EDNS: version:" dig.out.3.test$n > /dev/null && ret=1
36$DIG +edns +tcp @10.53.0.2 -p 5300 dropedns soa > dig.out.4.test$n
37grep "connection timed out; no servers could be reached" dig.out.4.test$n > /dev/null || ret=1
38if [ $ret != 0 ]; then echo "I:failed"; fi
39status=`expr $status + $ret`
40
41n=`expr $n + 1`
42echo "I:checking recursive lookup to drop edns server succeeds ($n)"
43ret=0
44$DIG +tcp  @10.53.0.1 -p 5300 dropedns soa > dig.out.test$n || ret=1
45grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
46if [ $ret != 0 ]; then echo "I:failed"; fi
47status=`expr $status + $ret`
48
49n=`expr $n + 1`
50echo "I:checking drop edns + no tcp server setup ($n)"
51ret=0
52$DIG +edns @10.53.0.3 -p 5300 dropedns-notcp soa > dig.out.1.test$n
53grep "connection timed out; no servers could be reached" dig.out.1.test$n > /dev/null || ret=1
54$DIG +noedns +tcp  @10.53.0.3 -p 5300 dropedns-notcp soa > dig.out.2.test$n
55grep "connection timed out; no servers could be reached" dig.out.2.test$n > /dev/null
56$DIG +noedns @10.53.0.3 -p 5300 dropedns-notcp soa > dig.out.3.test$n || ret=1
57grep "status: NOERROR" dig.out.3.test$n > /dev/null || ret=1
58grep "EDNS: version:" dig.out.3.test$n > /dev/null && ret=1
59if [ $ret != 0 ]; then echo "I:failed"; fi
60status=`expr $status + $ret`
61
62n=`expr $n + 1`
63echo "I:checking recursive lookup to drop edns + no tcp server succeeds ($n)"
64ret=0
65$DIG +tcp  @10.53.0.1 -p 5300 dropedns-notcp soa > dig.out.test$n || ret=1
66grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
67if [ $ret != 0 ]; then echo "I:failed"; fi
68status=`expr $status + $ret`
69
70n=`expr $n + 1`
71echo "I:checking plain dns server setup ($n)"
72ret=0
73$DIG +edns @10.53.0.4 -p 5300 plain soa > dig.out.1.test$n || ret=1
74grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
75grep "EDNS: version:" dig.out.1.test$n > /dev/null && ret=1
76if [ $ret != 0 ]; then echo "I:failed"; fi
77status=`expr $status + $ret`
78
79n=`expr $n + 1`
80echo "I:checking recursive lookup to plain dns server succeeds ($n)"
81ret=0
82$DIG +tcp  @10.53.0.1 -p 5300 plain soa > dig.out.test$n || ret=1
83grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
84if [ $ret != 0 ]; then echo "I:failed"; fi
85status=`expr $status + $ret`
86
87n=`expr $n + 1`
88echo "I:checking plain dns + no tcp server setup ($n)"
89ret=0
90$DIG +edns @10.53.0.5 -p 5300 plain-notcp soa > dig.out.1.test$n || ret=1
91grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
92grep "EDNS: version:" dig.out.1.test$n > /dev/null && ret=1
93$DIG +edns +tcp @10.53.0.5 -p 5300 plain-notcp soa > dig.out.2.test$n
94grep "connection timed out; no servers could be reached" dig.out.2.test$n > /dev/null
95if [ $ret != 0 ]; then echo "I:failed"; fi
96status=`expr $status + $ret`
97
98n=`expr $n + 1`
99echo "I:checking recursive lookup to plain dns + no tcp server succeeds ($n)"
100ret=0
101$DIG +tcp  @10.53.0.1 -p 5300 plain-notcp soa > dig.out.test$n || ret=1
102grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
103if [ $ret != 0 ]; then echo "I:failed"; fi
104status=`expr $status + $ret`
105n=`expr $n + 1`
106
107echo "I:checking edns 512 server setup ($n)"
108ret=0
109$DIG +edns @10.53.0.6 -p 5300 edns512 soa > dig.out.1.test$n || ret=1
110grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
111$DIG +edns +tcp  @10.53.0.6 -p 5300 edns512 soa > dig.out.2.test$n || ret=1
112grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
113$DIG +edns @10.53.0.6 -p 5300 txt500.edns512 txt > dig.out.3.test$n
114grep "connection timed out; no servers could be reached" dig.out.3.test$n > /dev/null
115$DIG +edns +bufsize=512 +ignor @10.53.0.6 -p 5300 txt500.edns512 txt > dig.out.4.test$n
116grep "status: NOERROR" dig.out.4.test$n > /dev/null || ret=1
117if [ $ret != 0 ]; then echo "I:failed"; fi
118status=`expr $status + $ret`
119
120n=`expr $n + 1`
121echo "I:checking recursive lookup to edns 512 server succeeds ($n)"
122ret=0
123$DIG +tcp  @10.53.0.1 -p 5300 txt500.edns512 txt > dig.out.test$n || ret=1
124grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
125if [ $ret != 0 ]; then echo "I:failed"; fi
126status=`expr $status + $ret`
127
128n=`expr $n + 1`
129echo "I:checking edns 512 + no tcp server setup ($n)"
130ret=0
131$DIG +noedns @10.53.0.7 -p 5300 edns512-notcp soa > dig.out.1.test$n || ret=1
132grep "status: NOERROR" dig.out.1.test$n > /dev/null || ret=1
133$DIG +noedns +tcp  @10.53.0.7 -p 5300 edns512-notcp soa > dig.out.2.test$n
134grep "connection timed out; no servers could be reached" dig.out.2.test$n > /dev/null
135$DIG +edns @10.53.0.7 -p 5300 edns512-notcp soa > dig.out.3.test$n
136grep "connection timed out; no servers could be reached" dig.out.3.test$n > /dev/null
137$DIG +edns +bufsize=512 +ignor @10.53.0.7 -p 5300 edns512-notcp soa > dig.out.4.test$n
138grep "status: NOERROR" dig.out.4.test$n > /dev/null || ret=1
139if [ $ret != 0 ]; then echo "I:failed"; fi
140status=`expr $status + $ret`
141
142n=`expr $n + 1`
143echo "I:checking recursive lookup to edns 512 + no tcp server succeeds ($n)"
144ret=0
145$DIG +tcp  @10.53.0.1 -p 5300 edns512-notcp soa > dig.out.test$n || ret=1
146grep "status: NOERROR" dig.out.test$n > /dev/null || ret=1
147if [ $ret != 0 ]; then echo "I:failed"; fi
148status=`expr $status + $ret`
149
150if $SHELL ../testcrypto.sh > /dev/null 2>&1
151then
152    $PERL $SYSTEMTESTTOP/stop.pl . ns1
153
154    cp -f ns1/named2.conf ns1/named.conf
155
156    $PERL $SYSTEMTESTTOP/start.pl --noclean --restart . ns1
157
158    n=`expr $n + 1`
159    echo "I:checking recursive lookup to edns 512 + no tcp + trust anchor fails ($n)"
160    ret=0
161    $DIG +tcp  @10.53.0.1 -p 5300 edns512-notcp soa > dig.out.test$n
162    grep "status: SERVFAIL" dig.out.test$n > /dev/null ||
163        grep "connection timed out;" dig.out.test$n > /dev/null || ret=1
164    if [ $ret != 0 ]; then echo "I:failed"; fi
165    status=`expr $status + $ret`
166else
167    echo "I:skipping checking recursive lookup to edns 512 + no tcp + trust anchor fails as crypto not enabled"
168fi
169
170
171echo "I:exit status: $status"
172exit $status
173