xref: /netbsd-src/external/bsd/unbound/dist/testdata/fwd_zero.tdir/fwd_zero.test (revision 8ecbf5f02b752fcb7debe1a8fab1dc82602bc760)
1# #-- fwd_zero.test --#
2# source the master var file when it's there
3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4# use .tpkg.var.test for in test variable passing
5[ -f .tpkg.var.test ] && source .tpkg.var.test
6
7PRE="../.."
8
9OPT="-i"
10if nc -h 2>&1 | grep -- "-w secs" >/dev/null; then
11        OPT="-w"
12fi
13
14# send query with qname but not qtype , qclass (malformed query)
15echo "> nc www.example.com. (malformed)"
16echo "b4380100000100000000000003777777076578616d706c6503636f6d00" | xxd -r -p | nc -un $OPT 2 127.0.0.1 $UNBOUND_PORT 2>/dev/null | xxd | tee outfile
17
18# now test that server is still up
19echo "> dig www.example.com."
20dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
21echo "> cat logfiles"
22cat fwd.log
23cat unbound.log
24echo "> check answer"
25if grep "10.20.30.40" outfile; then
26	echo "OK"
27else
28	echo "Not OK"
29	exit 1
30fi
31
32exit 0
33