]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/fwd_bogus.tdir/fwd_bogus.test
Vendor import of Unbound 1.6.6.
[FreeBSD/FreeBSD.git] / testdata / fwd_bogus.tdir / fwd_bogus.test
1 # #-- fwd_bogus.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
7 PRE="../.."
8
9 # do the test
10 echo "> dig www.example.com."
11 dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
12 echo "> cat logfiles"
13 cat fwd.log 
14 cat unbound.log
15 echo "> check answer"
16 # servfail.
17 if grep "SERVFAIL" outfile; then
18         echo "OK"
19 else
20         echo "Not OK"
21         exit 1
22 fi
23
24 # now check the cache.
25 $PRE/unbound-control -c ub.conf dump_cache > cachedump
26 if test $? -ne 0; then
27         echo "unbound-control failed"
28         cat cachedump
29         exit 1
30 else
31         echo "unbound-control ok"
32 fi
33
34 # bad cache entry looks like this
35 # msg www.example.com. IN A 32896 1 1252576696 1 1 0 0
36 cat cachedump
37
38 ttl=`grep "msg www.example.com" cachedump | awk '{print $7}'`
39 echo TTL $ttl
40 # must be smaller than bogus ttl of 60.
41 if test $ttl -gt 61; then
42         echo "failed: TTL too big!"
43         exit 1
44 else
45         echo "TTL OK"
46 fi
47
48 exit 0