tests.sh 31.3 KB
Newer Older
1
2
#!/bin/sh
#
3
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
Evan Hunt's avatar
Evan Hunt committed
4
#
5
6
7
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
10
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
Evan Hunt's avatar
Evan Hunt committed
11

12
13
# shellcheck source=conf.sh
. "$SYSTEMTESTTOP/conf.sh"
Evan Hunt's avatar
Evan Hunt committed
14

15
16
set -e

Evan Hunt's avatar
Evan Hunt committed
17
18
status=0
n=0
19

20
sendcmd() {
21
    "$PERL" "$SYSTEMTESTTOP/send.pl" "${1}" "$EXTRAPORT1"
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
}

dig_with_opts() {
    "$DIG" -p "$PORT" "$@"
}

mdig_with_opts() {
    "$MDIG" -p "$PORT" "$@"
}

# using delv insecure mode as not testing dnssec here
delv_with_opts() {
    "$DELV" -i -p "$PORT" "$@"
}

KEYID="$(cat ns2/keyid)"
KEYDATA="$(< ns2/keydata sed -e 's/\+/[+]/g')"
NOSPLIT="$(< ns2/keydata sed -e 's/\+/[+]/g' -e 's/ //g')"

if [ -x "$DIG" ] ; then
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
43
  echo_i "checking dig short form works ($n)"
44
  ret=0
45
46
47
48
  dig_with_opts @10.53.0.3 +short a a.example > dig.out.test$n || ret=1
  test "$(wc -l < dig.out.test$n)" -eq 1 || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
49

50
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
51
  echo_i "checking dig split width works ($n)"
52
  ret=0
53
  dig_with_opts @10.53.0.3 +split=4 -t sshfp foo.example > dig.out.test$n || ret=1
54
  grep " 9ABC DEF6 7890 " < dig.out.test$n > /dev/null || ret=1
55
56
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
57

58
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
59
  echo_i "checking dig +unknownformat works ($n)"
60
  ret=0
61
  dig_with_opts @10.53.0.3 +unknownformat a a.example > dig.out.test$n || ret=1
62
  grep "CLASS1[ 	][ 	]*TYPE1[ 	][ 	]*\\\\# 4 0A000001" < dig.out.test$n > /dev/null || ret=1
63
64
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
65

66
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
67
  echo_i "checking dig with reverse lookup works ($n)"
68
  ret=0
69
  dig_with_opts @10.53.0.3 -x 127.0.0.1 > dig.out.test$n 2>&1 || ret=1
70
  # doesn't matter if has answer
71
72
73
  grep -i "127\\.in-addr\\.arpa\\." < dig.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
74

75
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
76
  echo_i "checking dig over TCP works ($n)"
77
  ret=0
78
  dig_with_opts +tcp @10.53.0.3 a a.example > dig.out.test$n || ret=1
79
  grep "10\\.0\\.0\\.1$" < dig.out.test$n > /dev/null || ret=1
80
81
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
82

83
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
84
  echo_i "checking dig +multi +norrcomments works for dnskey (when default is rrcomments)($n)"
Evan Hunt's avatar
Evan Hunt committed
85
  ret=0
86
87
88
89
  dig_with_opts +tcp @10.53.0.3 +multi +norrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null && ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
90

91
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
92
  echo_i "checking dig +multi +norrcomments works for soa (when default is rrcomments)($n)"
Evan Hunt's avatar
Evan Hunt committed
93
  ret=0
94
95
96
97
  dig_with_opts +tcp @10.53.0.3 +multi +norrcomments SOA example > dig.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null && ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
98

99
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
100
  echo_i "checking dig +rrcomments works for DNSKEY($n)"
Evan Hunt's avatar
Evan Hunt committed
101
  ret=0
102
103
104
105
  dig_with_opts +tcp @10.53.0.3 +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
106

107
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
108
  echo_i "checking dig +short +rrcomments works for DNSKEY ($n)"
Evan Hunt's avatar
Evan Hunt committed
109
  ret=0
110
111
112
113
  dig_with_opts +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < dig.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
114

115
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
116
  echo_i "checking dig +short +nosplit works($n)"
117
  ret=0
118
119
120
121
  dig_with_opts +tcp @10.53.0.3 +short +nosplit DNSKEY dnskey.example > dig.out.test$n || ret=1
  grep "$NOSPLIT" < dig.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
122

123
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
124
  echo_i "checking dig +short +rrcomments works($n)"
125
  ret=0
126
  dig_with_opts +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
127
  grep -q "$KEYDATA  ; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID\$" < dig.out.test$n || ret=1
128
129
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
130

131
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
132
  echo_i "checking dig multi flag is local($n)"
133
  ret=0
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
  dig_with_opts +tcp @10.53.0.3 -t DNSKEY dnskey.example +nomulti dnskey.example +nomulti > dig.out.nn.$n || ret=1
  dig_with_opts +tcp @10.53.0.3 -t DNSKEY dnskey.example +multi dnskey.example +nomulti > dig.out.mn.$n || ret=1
  dig_with_opts +tcp @10.53.0.3 -t DNSKEY dnskey.example +nomulti dnskey.example +multi > dig.out.nm.$n || ret=1
  dig_with_opts +tcp @10.53.0.3 -t DNSKEY dnskey.example +multi dnskey.example +multi > dig.out.mm.$n || ret=1
  lcnn=$(wc -l < dig.out.nn.$n)
  lcmn=$(wc -l < dig.out.mn.$n)
  lcnm=$(wc -l < dig.out.nm.$n)
  lcmm=$(wc -l < dig.out.mm.$n)
  test "$lcmm" -ge "$lcnm" || ret=1
  test "$lcmm" -ge "$lcmn" || ret=1
  test "$lcnm" -ge "$lcnn" || ret=1
  test "$lcmn" -ge "$lcnn" || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))

  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
150
  echo_i "checking dig +noheader-only works ($n)"
151
  ret=0
152
  dig_with_opts +tcp @10.53.0.3 +noheader-only A example > dig.out.test$n || ret=1
153
  grep "Got answer:" < dig.out.test$n > /dev/null || ret=1
154
155
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
156

157
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
158
  echo_i "checking dig +short +rrcomments works($n)"
159
  ret=0
160
  dig_with_opts +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > dig.out.test$n || ret=1
161
  grep -q "$KEYDATA  ; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID\$" < dig.out.test$n || ret=1
162
163
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
164

165
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
166
  echo_i "checking dig +header-only works ($n)"
167
  ret=0
168
  dig_with_opts +tcp @10.53.0.3 +header-only example > dig.out.test$n || ret=1
169
170
  grep "^;; flags: qr rd; QUERY: 0, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
  grep "^;; QUESTION SECTION:" < dig.out.test$n > /dev/null && ret=1
171
172
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
173

174
  n=$((n+1))
175
176
  echo_i "checking dig +raflag works ($n)"
  ret=0
177
  dig_with_opts +tcp @10.53.0.3 +raflag +qr example > dig.out.test$n || ret=1
178
179
  grep "^;; flags: rd ra ad; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
  grep "^;; flags: qr rd ra; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
180
181
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
182

183
  n=$((n+1))
184
185
  echo_i "checking dig +tcflag works ($n)"
  ret=0
186
  dig_with_opts +tcp @10.53.0.3 +tcflag +qr example > dig.out.test$n || ret=1
187
188
  grep "^;; flags: tc rd ad; QUERY: 1, ANSWER: 0" < dig.out.test$n > /dev/null || ret=1
  grep "^;; flags: qr rd ra; QUERY: 1, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
189
190
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
191

192
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
193
  echo_i "checking dig +header-only works (with class and type set) ($n)"
194
  ret=0
195
  dig_with_opts +tcp @10.53.0.3 +header-only -c IN -t A example > dig.out.test$n || ret=1
196
197
  grep "^;; flags: qr rd; QUERY: 0, ANSWER: 0," < dig.out.test$n > /dev/null || ret=1
  grep "^;; QUESTION SECTION:" < dig.out.test$n > /dev/null && ret=1
198
199
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
200

201
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
202
  echo_i "checking dig +zflag works, and that BIND properly ignores it ($n)"
203
  ret=0
204
  dig_with_opts +tcp @10.53.0.3 +zflag +qr A example > dig.out.test$n || ret=1
205
206
  sed -n '/Sending:/,/Got answer:/p' dig.out.test$n | grep "^;; flags: rd ad; MBZ: 0x4;" > /dev/null || ret=1
  sed -n '/Got answer:/,/AUTHORITY SECTION:/p' dig.out.test$n | grep "^;; flags: qr rd ra; QUERY: 1" > /dev/null || ret=1
207
208
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
209

210
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
211
  echo_i "checking dig +qr +ednsopt=08 does not cause an INSIST failure ($n)"
212
  ret=0
213
  dig_with_opts @10.53.0.3 +ednsopt=08 +qr a a.example > dig.out.test$n || ret=1
214
215
  grep "INSIST" < dig.out.test$n > /dev/null && ret=1
  grep "FORMERR" < dig.out.test$n > /dev/null || ret=1
216
217
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
218

Evan Hunt's avatar
Evan Hunt committed
219
  echo_i "checking dig +ttlunits works ($n)"
220
  ret=0
221
  dig_with_opts +tcp @10.53.0.2 +ttlunits A weeks.example > dig.out.test$n || ret=1
222
  grep "^weeks.example.		3w" < dig.out.test$n > /dev/null || ret=1
223
  dig_with_opts +tcp @10.53.0.2 +ttlunits A days.example > dig.out.test$n || ret=1
224
  grep "^days.example.		3d" < dig.out.test$n > /dev/null || ret=1
225
  dig_with_opts +tcp @10.53.0.2 +ttlunits A hours.example > dig.out.test$n || ret=1
226
  grep "^hours.example.		3h" < dig.out.test$n > /dev/null || ret=1
227
  dig_with_opts +tcp @10.53.0.2 +ttlunits A minutes.example > dig.out.test$n || ret=1
228
  grep "^minutes.example.	45m" < dig.out.test$n > /dev/null || ret=1
229
  dig_with_opts +tcp @10.53.0.2 +ttlunits A seconds.example > dig.out.test$n || ret=1
230
  grep "^seconds.example.	45s" < dig.out.test$n > /dev/null || ret=1
231
232
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
233

234
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
235
  echo_i "checking dig respects precedence of options with +ttlunits ($n)"
236
  ret=0
237
  dig_with_opts +tcp @10.53.0.2 +ttlunits +nottlid A weeks.example > dig.out.test$n || ret=1
238
  grep "^weeks.example.		IN" < dig.out.test$n > /dev/null || ret=1
239
  dig_with_opts +tcp @10.53.0.2 +nottlid +ttlunits A weeks.example > dig.out.test$n || ret=1
240
  grep "^weeks.example.		3w" < dig.out.test$n > /dev/null || ret=1
241
  dig_with_opts +tcp @10.53.0.2 +nottlid +nottlunits A weeks.example > dig.out.test$n || ret=1
242
  grep "^weeks.example.		1814400" < dig.out.test$n > /dev/null || ret=1
243
244
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
245

246
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
247
  echo_i "checking dig preserves origin on TCP retries ($n)"
248
249
  ret=0
  # Ask ans4 to still accept TCP connections, but not respond to queries
250
  echo "//" | sendcmd 10.53.0.4
251
252
  dig_with_opts -d +tcp @10.53.0.4 +retry=1 +time=1 +domain=bar foo > dig.out.test$n 2>&1 && ret=1
  test "$(grep -c "trying origin bar" dig.out.test$n)" -eq 2 || ret=1
253
  grep "using root origin" < dig.out.test$n > /dev/null && ret=1
254
255
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
256

257
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
258
  echo_i "checking dig -6 -4 ($n)"
259
  ret=0
260
  dig_with_opts +tcp @10.53.0.2 -4 -6 A a.example > dig.out.test$n 2>&1 && ret=1
261
  grep "only one of -4 and -6 allowed" < dig.out.test$n > /dev/null || ret=1
262
263
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
264

265
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
266
  echo_i "checking dig @IPv6addr -4 A a.example ($n)"
267
  if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null
268
269
  then
    ret=0
270
    dig_with_opts +tcp @fd92:7065:b8e:ffff::2 -4 A a.example > dig.out.test$n 2>&1 && ret=1
271
    grep "address family not supported" < dig.out.test$n > /dev/null || ret=1
272
273
    if [ $ret -ne 0 ]; then echo_i "failed"; fi
    status=$((status+ret))
274
  else
Evan Hunt's avatar
Evan Hunt committed
275
    echo_i "IPv6 unavailable; skipping"
276
  fi
Evan Hunt's avatar
Evan Hunt committed
277

278
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
279
  echo_i "checking dig @IPv4addr -6 +mapped A a.example ($n)"
280
  if "$TESTSOCK6" fd92:7065:b8e:ffff::2 2>/dev/null && [ "$(uname -s)" != "OpenBSD" ]
281
282
283
  then
    ret=0
    ret=0
284
285
286
287
    dig_with_opts +tcp @10.53.0.2 -6 +mapped A a.example > dig.out.test$n 2>&1 || ret=1
    grep "SERVER: ::ffff:10.53.0.2#$PORT" < dig.out.test$n > /dev/null || ret=1
    if [ $ret -ne 0 ]; then echo_i "failed"; fi
    status=$((status+ret))
288
  else
Evan Hunt's avatar
Evan Hunt committed
289
    echo_i "IPv6 or IPv4-to-IPv6 mapping unavailable; skipping"
290
  fi
291

292
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
293
  echo_i "checking dig +tcp @IPv4addr -6 +nomapped A a.example ($n)"
294
  if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null
295
296
297
  then
    ret=0
    ret=0
298
299
300
301
    dig_with_opts +tcp @10.53.0.2 -6 +nomapped A a.example > dig.out.test$n 2>&1 || ret=1
    grep "SERVER: ::ffff:10.53.0.2#$PORT" < dig.out.test$n > /dev/null && ret=1
    if [ $ret -ne 0 ]; then echo_i "failed"; fi
    status=$((status+ret))
302
  else
Evan Hunt's avatar
Evan Hunt committed
303
    echo_i "IPv6 unavailable; skipping"
304
  fi
305
  n=$((n+1))
306

Evan Hunt's avatar
Evan Hunt committed
307
  echo_i "checking dig +notcp @IPv4addr -6 +nomapped A a.example ($n)"
308
  if $TESTSOCK6 fd92:7065:b8e:ffff::2 2>/dev/null
309
310
311
  then
    ret=0
    ret=0
312
313
314
315
    dig_with_opts +notcp @10.53.0.2 -6 +nomapped A a.example > dig.out.test$n 2>&1 || ret=1
    grep "SERVER: ::ffff:10.53.0.2#$PORT" < dig.out.test$n > /dev/null && ret=1
    if [ $ret -ne 0 ]; then echo_i "failed"; fi
    status=$((status+ret))
316
  else
Evan Hunt's avatar
Evan Hunt committed
317
    echo_i "IPv6 unavailable; skipping"
318
  fi
Evan Hunt's avatar
Evan Hunt committed
319

320
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
321
  echo_i "checking dig +subnet ($n)"
322
  ret=0
323
  dig_with_opts +tcp @10.53.0.2 +subnet=127.0.0.1 A a.example > dig.out.test$n 2>&1 || ret=1
324
  grep "CLIENT-SUBNET: 127.0.0.1/32/0" < dig.out.test$n > /dev/null || ret=1
325
326
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
327

328
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
329
  echo_i "checking dig +subnet +subnet ($n)"
330
  ret=0
331
  dig_with_opts +tcp @10.53.0.2 +subnet=127.0.0.0 +subnet=127.0.0.1 A a.example > dig.out.test$n 2>&1 || ret=1
332
  grep "CLIENT-SUBNET: 127.0.0.1/32/0" < dig.out.test$n > /dev/null || ret=1
333
334
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
335

336
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
337
  echo_i "checking dig +subnet with various prefix lengths ($n)"
338
339
  ret=0
  for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24; do
340
      dig_with_opts +tcp @10.53.0.2 +subnet=255.255.255.255/$i A a.example > dig.out.$i.test$n 2>&1 || ret=1
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
      case $i in
      1|9|17) octet=128 ;;
      2|10|18) octet=192 ;;
      3|11|19) octet=224 ;;
      4|12|20) octet=240 ;;
      5|13|21) octet=248 ;;
      6|14|22) octet=252 ;;
      7|15|23) octet=254 ;;
      8|16|24) octet=255 ;;
      esac
      case $i in
      1|2|3|4|5|6|7|8) addr="${octet}.0.0.0";;
      9|10|11|12|13|14|15|16) addr="255.${octet}.0.0";;
      17|18|19|20|21|22|23|24) addr="255.255.${octet}.0" ;;
      esac
356
357
      grep "FORMERR" < dig.out.$i.test$n > /dev/null && ret=1
      grep "CLIENT-SUBNET: $addr/$i/0" < dig.out.$i.test$n > /dev/null || ret=1
358
  done
359
360
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
361

362
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
363
  echo_i "checking dig +subnet=0/0 ($n)"
364
  ret=0
365
  dig_with_opts +tcp @10.53.0.2 +subnet=0/0 A a.example > dig.out.test$n 2>&1 || ret=1
366
367
368
  grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
  grep "CLIENT-SUBNET: 0.0.0.0/0/0" < dig.out.test$n > /dev/null || ret=1
  grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
369
370
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
371

372
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
373
  echo_i "checking dig +subnet=0 ($n)"
374
  ret=0
375
  dig_with_opts +tcp @10.53.0.2 +subnet=0 A a.example > dig.out.test$n 2>&1 || ret=1
376
377
378
  grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
  grep "CLIENT-SUBNET: 0.0.0.0/0/0" < dig.out.test$n > /dev/null || ret=1
  grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
379
380
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
381

382
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
383
  echo_i "checking dig +subnet=::/0 ($n)"
384
  ret=0
385
  dig_with_opts +tcp @10.53.0.2 +subnet=::/0 A a.example > dig.out.test$n 2>&1 || ret=1
386
387
388
  grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
  grep "CLIENT-SUBNET: ::/0/0" < dig.out.test$n > /dev/null || ret=1
  grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
389
390
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
391

392
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
393
  echo_i "checking dig +ednsopt=8:00000000 (family=0, source=0, scope=0) ($n)"
394
  ret=0
395
  dig_with_opts +tcp @10.53.0.2 +ednsopt=8:00000000 A a.example > dig.out.test$n 2>&1 || ret=1
396
  grep "status: NOERROR" < dig.out.test$n > /dev/null || ret=1
397
  grep "CLIENT-SUBNET: 0/0/0" < dig.out.test$n > /dev/null || ret=1
398
  grep "10.0.0.1" < dig.out.test$n > /dev/null || ret=1
399
400
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
401

402
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
403
  echo_i "checking dig +ednsopt=8:00030000 (family=3, source=0, scope=0) ($n)"
404
  ret=0
405
  dig_with_opts +qr +tcp @10.53.0.2 +ednsopt=8:00030000 A a.example > dig.out.test$n 2>&1 || ret=1
406
407
  grep "status: FORMERR" < dig.out.test$n > /dev/null || ret=1
  grep "CLIENT-SUBNET: 00 03 00 00" < dig.out.test$n > /dev/null || ret=1
408
409
410
  test "$(grep -c "CLIENT-SUBNET: 00 03 00 00" dig.out.test$n)" -eq 1 || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
411

412
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
413
  echo_i "checking dig +subnet with prefix lengths between byte boundaries ($n)"
414
415
  ret=0
  for p in 9 10 11 12 13 14 15; do
416
    dig_with_opts +tcp @10.53.0.2 +subnet=10.53/$p A a.example > dig.out.test.$p.$n 2>&1 || ret=1
417
418
419
    grep "FORMERR" < dig.out.test.$p.$n > /dev/null && ret=1
    grep "CLIENT-SUBNET.*/$p/0" < dig.out.test.$p.$n > /dev/null || ret=1
  done
420
421
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
422

423
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
424
  echo_i "checking dig +sp works as an abbreviated form of split ($n)"
425
  ret=0
426
  dig_with_opts @10.53.0.3 +sp=4 -t sshfp foo.example > dig.out.test$n || ret=1
427
  grep " 9ABC DEF6 7890 " < dig.out.test$n > /dev/null || ret=1
428
429
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
430

431
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
432
  echo_i "checking dig -c works ($n)"
433
  ret=0
434
  dig_with_opts @10.53.0.3 -c CHAOS -t txt version.bind > dig.out.test$n || ret=1
435
  grep "version.bind.		0	CH	TXT" < dig.out.test$n > /dev/null || ret=1
436
437
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
438

439
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
440
  echo_i "checking dig +dscp ($n)"
441
  ret=0
442
443
444
  dig_with_opts @10.53.0.3 +dscp=32 a a.example > /dev/null 2>&1 || ret=1
  dig_with_opts @10.53.0.3 +dscp=-1 a a.example > /dev/null 2>&1 && ret=1
  dig_with_opts @10.53.0.3 +dscp=64 a a.example > /dev/null 2>&1 && ret=1
445
446
  #TODO add a check to make sure dig is actually setting the dscp on the query
  #we might have to add better logging to named for this
447
448
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
449

450
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
451
  echo_i "checking dig +ednsopt with option number ($n)"
452
  ret=0
453
  dig_with_opts @10.53.0.3 +ednsopt=3 a.example > dig.out.test$n 2>&1 || ret=1
454
  grep 'NSID: .* ("ns3")' dig.out.test$n > /dev/null || ret=1
455
456
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
457

458
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
459
  echo_i "checking dig +ednsopt with option name ($n)"
460
  ret=0
461
  dig_with_opts @10.53.0.3 +ednsopt=nsid a.example > dig.out.test$n 2>&1 || ret=1
462
  grep 'NSID: .* ("ns3")' dig.out.test$n > /dev/null || ret=1
463
464
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
465

466
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
467
  echo_i "checking that dig warns about .local queries ($n)"
468
  ret=0
469
  dig_with_opts @10.53.0.3 local soa > dig.out.test$n 2>&1 || ret=1
470
  grep ";; WARNING: .local is reserved for Multicast DNS" dig.out.test$n > /dev/null || ret=1
471
472
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
473

474
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
475
  echo_i "check that dig processes +ednsopt=key-tag and FORMERR is returned ($n)"
476
  dig_with_opts @10.53.0.3 +ednsopt=key-tag a.example +qr > dig.out.test$n 2>&1 || ret=1
477
  grep "; KEY-TAG$" dig.out.test$n > /dev/null || ret=1
478
  grep "status: FORMERR" dig.out.test$n > /dev/null || ret=1
479
480
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
481

482
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
483
  echo_i "check that dig processes +ednsopt=key-tag:<value-list> ($n)"
484
  dig_with_opts @10.53.0.3 +ednsopt=key-tag:00010002 a.example +qr > dig.out.test$n 2>&1 || ret=1
485
  grep "; KEY-TAG: 1, 2$" dig.out.test$n > /dev/null || ret=1
486
  grep "status: FORMERR" dig.out.test$n > /dev/null && ret=1
487
488
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
489

490
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
491
  echo_i "check that dig processes +ednsopt=key-tag:<malformed-value-list> and FORMERR is returned ($n)"
492
  ret=0
493
  dig_with_opts @10.53.0.3 +ednsopt=key-tag:0001000201 a.example +qr > dig.out.test$n 2>&1 || ret=1
494
495
  grep "; KEY-TAG: 00 01 00 02 01" dig.out.test$n > /dev/null || ret=1
  grep "status: FORMERR" dig.out.test$n > /dev/null || ret=1
496
497
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
498

499
  n=$((n+1))
500
501
  echo_i "check that dig handles malformed option '+ednsopt=:' gracefully ($n)"
  ret=0
502
  dig_with_opts @10.53.0.3 +ednsopt=: a.example > dig.out.test$n 2>&1 && ret=1
503
  grep "ednsopt no code point specified" dig.out.test$n > /dev/null || ret=1
504
505
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
506

507
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
508
  echo_i "check that dig gracefully handles bad escape in domain name ($n)"
509
  ret=0
510
511
  digstatus=0
  dig_with_opts @10.53.0.3 '\0.' > dig.out.test$n 2>&1 || digstatus=$?
512
513
514
515
  echo digstatus=$digstatus >> dig.out.test$n
  test $digstatus -eq 10 || ret=1
  grep REQUIRE dig.out.test$n > /dev/null && ret=1
  grep "is not a legal name (bad escape)" dig.out.test$n > /dev/null || ret=1
516
517
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
518

519
  n=$((n+1))
Mark Andrews's avatar
Mark Andrews committed
520
521
  echo_i "check that dig -q -m works ($n)"
  ret=0
522
  dig_with_opts @10.53.0.3 -q -m > dig.out.test$n 2>&1
523
  grep '^;-m\..*IN.*A$' dig.out.test$n > /dev/null || ret=1
Mark Andrews's avatar
Mark Andrews committed
524
  grep "Dump of all outstanding memory allocations" dig.out.test$n > /dev/null && ret=1
525
526
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586

  n=$((n+1))
  echo_i "checking exit code for a retry upon TCP EOF (immediate -> immediate) ($n)"
  ret=0
  echo "no_response no_response" | sendcmd 10.53.0.5
  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1
  # Sanity check: ensure ans5 behaves as expected.
  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))

  n=$((n+1))
  echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> partial AXFR) ($n)"
  ret=0
  echo "partial_axfr partial_axfr" | sendcmd 10.53.0.5
  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1
  # Sanity check: ensure ans5 behaves as expected.
  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))

  n=$((n+1))
  echo_i "checking exit code for a retry upon TCP EOF (immediate -> partial AXFR) ($n)"
  ret=0
  echo "no_response partial_axfr" | sendcmd 10.53.0.5
  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1
  # Sanity check: ensure ans5 behaves as expected.
  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))

  n=$((n+1))
  echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> immediate) ($n)"
  ret=0
  echo "partial_axfr no_response" | sendcmd 10.53.0.5
  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 && ret=1
  # Sanity check: ensure ans5 behaves as expected.
  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 2 ] || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))

  n=$((n+1))
  echo_i "checking exit code for a retry upon TCP EOF (immediate -> complete AXFR) ($n)"
  ret=0
  echo "no_response complete_axfr" | sendcmd 10.53.0.5
  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 || ret=1
  # Sanity check: ensure ans5 behaves as expected.
  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))

  n=$((n+1))
  echo_i "checking exit code for a retry upon TCP EOF (partial AXFR -> complete AXFR) ($n)"
  ret=0
  echo "partial_axfr complete_axfr" | sendcmd 10.53.0.5
  dig_with_opts @10.53.0.5 example AXFR +tries=1 > dig.out.test$n 2>&1 || ret=1
  # Sanity check: ensure ans5 behaves as expected.
  [ `grep "communications error.*end of file" dig.out.test$n | wc -l` -eq 1 ] || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
587
else
Evan Hunt's avatar
Evan Hunt committed
588
  echo_i "$DIG is needed, so skipping these dig tests"
589
590
fi

591
592
if [ -x "$MDIG" ] ; then
  n=$((n+1))
Mark Andrews's avatar
Mark Andrews committed
593
594
  echo_i "check that mdig handles malformed option '+ednsopt=:' gracefully ($n)"
  ret=0
595
  mdig_with_opts @10.53.0.3 +ednsopt=: a.example > dig.out.test$n 2>&1 && ret=1
Mark Andrews's avatar
Mark Andrews committed
596
  grep "ednsopt no code point specified" dig.out.test$n > /dev/null || ret=1
597
598
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Mark Andrews's avatar
Mark Andrews committed
599
600
601
602
else
  echo_i "$MDIG is needed, so skipping these mdig tests"
fi

603
604
if [ -x "$DELV" ] ; then
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
605
  echo_i "checking delv short form works ($n)"
Evan Hunt's avatar
Evan Hunt committed
606
  ret=0
607
608
609
610
  delv_with_opts @10.53.0.3 +short a a.example > delv.out.test$n || ret=1
  test "$(wc -l < delv.out.test$n)" -eq 1 || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
611

612
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
613
  echo_i "checking delv split width works ($n)"
Evan Hunt's avatar
Evan Hunt committed
614
  ret=0
615
  delv_with_opts @10.53.0.3 +split=4 -t sshfp foo.example > delv.out.test$n || ret=1
Evan Hunt's avatar
Evan Hunt committed
616
  grep " 9ABC DEF6 7890 " < delv.out.test$n > /dev/null || ret=1
617
618
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
619

620
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
621
  echo_i "checking delv +unknownformat works ($n)"
622
  ret=0
623
  delv_with_opts @10.53.0.3 +unknownformat a a.example > delv.out.test$n || ret=1
624
  grep "CLASS1[ 	][ 	]*TYPE1[ 	][ 	]*\\\\# 4 0A000001" < delv.out.test$n > /dev/null || ret=1
625
626
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
627

628
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
629
  echo_i "checking delv -4 -6 ($n)"
630
  ret=0
631
  delv_with_opts @10.53.0.3 -4 -6 A a.example > delv.out.test$n 2>&1 && ret=1
632
  grep "only one of -4 and -6 allowed" < delv.out.test$n > /dev/null || ret=1
633
634
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
635

636
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
637
  echo_i "checking delv with IPv6 on IPv4 does not work ($n)"
638
  if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null
Evan Hunt's avatar
Evan Hunt committed
639
640
641
  then
    ret=0
    # following should fail because @IPv4 overrides earlier @IPv6 above
642
643
    # and -6 forces IPv6 so this should fail, with a message
    # "Use of IPv4 disabled by -6"
644
    delv_with_opts @fd92:7065:b8e:ffff::3 @10.53.0.3 -6 -t txt foo.example > delv.out.test$n 2>&1 && ret=1
Evan Hunt's avatar
Evan Hunt committed
645
646
    # it should have no results but error output
    grep "testing" < delv.out.test$n > /dev/null && ret=1
647
    grep "Use of IPv4 disabled by -6" delv.out.test$n > /dev/null || ret=1
648
649
    if [ $ret -ne 0 ]; then echo_i "failed"; fi
    status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
650
  else
Evan Hunt's avatar
Evan Hunt committed
651
    echo_i "IPv6 unavailable; skipping"
Evan Hunt's avatar
Evan Hunt committed
652
653
  fi

654
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
655
  echo_i "checking delv with IPv4 on IPv6 does not work ($n)"
656
657
658
659
660
661
  if $TESTSOCK6 fd92:7065:b8e:ffff::3 2>/dev/null
  then
    ret=0
    # following should fail because @IPv6 overrides earlier @IPv4 above
    # and -4 forces IPv4 so this should fail, with a message
    # "Use of IPv6 disabled by -4"
662
    delv_with_opts @10.53.0.3 @fd92:7065:b8e:ffff::3 -4 -t txt foo.example > delv.out.test$n 2>&1 && ret=1
663
664
665
    # it should have no results but error output
    grep "testing" delv.out.test$n > /dev/null && ret=1
    grep "Use of IPv6 disabled by -4" delv.out.test$n > /dev/null || ret=1
666
667
    if [ $ret -ne 0 ]; then echo_i "failed"; fi
    status=$((status+ret))
668
  else
Evan Hunt's avatar
Evan Hunt committed
669
    echo_i "IPv6 unavailable; skipping"
670
671
  fi

672
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
673
  echo_i "checking delv with reverse lookup works ($n)"
Evan Hunt's avatar
Evan Hunt committed
674
  ret=0
675
  delv_with_opts @10.53.0.3 -x 127.0.0.1 > delv.out.test$n 2>&1 || ret=1
Evan Hunt's avatar
Evan Hunt committed
676
  # doesn't matter if has answer
677
678
679
  grep -i "127\\.in-addr\\.arpa\\." < delv.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
680

681
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
682
  echo_i "checking delv over TCP works ($n)"
Evan Hunt's avatar
Evan Hunt committed
683
  ret=0
684
  delv_with_opts +tcp @10.53.0.3 a a.example > delv.out.test$n || ret=1
685
  grep "10\\.0\\.0\\.1$" < delv.out.test$n > /dev/null || ret=1
686
687
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
688

689
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
690
  echo_i "checking delv +multi +norrcomments works for dnskey (when default is rrcomments)($n)"
Evan Hunt's avatar
Evan Hunt committed
691
  ret=0
692
693
694
695
  delv_with_opts +tcp @10.53.0.3 +multi +norrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n > /dev/null && ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
696

697
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
698
  echo_i "checking delv +multi +norrcomments works for soa (when default is rrcomments)($n)"
Evan Hunt's avatar
Evan Hunt committed
699
  ret=0
700
701
702
703
  delv_with_opts +tcp @10.53.0.3 +multi +norrcomments SOA example > delv.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n > /dev/null && ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
704

705
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
706
  echo_i "checking delv +rrcomments works for DNSKEY($n)"
Evan Hunt's avatar
Evan Hunt committed
707
  ret=0
708
709
710
711
  delv_with_opts +tcp @10.53.0.3 +rrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
712

713
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
714
  echo_i "checking delv +short +rrcomments works for DNSKEY ($n)"
Evan Hunt's avatar
Evan Hunt committed
715
  ret=0
716
717
718
719
  delv_with_opts +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1
  grep "; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n > /dev/null || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
Evan Hunt's avatar
Evan Hunt committed
720

721
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
722
  echo_i "checking delv +short +rrcomments works ($n)"
723
  ret=0
724
725
726
727
  delv_with_opts +tcp @10.53.0.3 +short +rrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1
  grep -q "$KEYDATA  ; ZSK; alg = $DEFAULT_ALGORITHM ; key id = $KEYID" < delv.out.test$n || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
728

729
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
730
  echo_i "checking delv +short +nosplit works ($n)"
731
  ret=0
732
733
734
735
736
737
  delv_with_opts +tcp @10.53.0.3 +short +nosplit DNSKEY dnskey.example > delv.out.test$n || ret=1
  grep -q "$NOSPLIT" < delv.out.test$n || ret=1
  test "$(wc -l < delv.out.test$n)" -eq 1 || ret=1
  test "$(awk '{print NF}' < delv.out.test$n)" -eq 14 || ret=1
  if [ $ret -ne 0 ]; then echo_i "failed"; fi
  status=$((status+ret))
738

739
  n=$((n+1))
Evan Hunt's avatar
Evan Hunt committed
740
  echo_i "checking delv +short +nosplit +norrcomments works ($n)"
741
  ret=0
742
  delv_with_opts +tcp @10.53.0.3 +short +nosplit +norrcomments DNSKEY dnskey.example > delv.out.test$n || ret=1
743
  grep -q "$NOSPLIT\$" < delv.out.test$n || ret=1
Ondřej Surý's avatar