]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/local_nosnoop.tdir/local_nosnoop.test
Vendor import of Unbound 1.9.0.
[FreeBSD/FreeBSD.git] / testdata / local_nosnoop.tdir / local_nosnoop.test
1 # #-- local_nosnoop.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 # do the test
9 #
10 # www.example.com is available through recursion.
11 # foo.example.com is available through local-data (and recursion...).
12 #
13 # so, with 'allow' the cache snoop stops working:
14 #       dig +norec for www does not work any more.
15 #
16 echo "> dig www.example.com. +RD"
17 dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
18 echo "> cat logfiles"
19 cat fwd.log 
20 cat unbound.log
21 echo "> check answer"
22 if grep "10.20.30.40" outfile; then
23         echo "OK"
24 else
25         echo "Not OK"
26         exit 1
27 fi
28
29 echo "> dig www.example.com. +norec"
30 dig @localhost +norec -p $UNBOUND_PORT www.example.com. | tee outfile
31 echo "> cat logfiles"
32 cat fwd.log 
33 cat unbound.log
34 echo "> check answer"
35 if grep "REFUSED" outfile; then
36         echo "OK rcode"
37 else
38         echo "Not OK rcode"
39         exit 1
40 fi
41
42 if grep "10.20.30.40" outfile; then
43         echo "Not OK"
44         exit 1
45 else
46         echo "OK"
47 fi
48
49 echo "> dig foo.example.com. +RD"
50 dig @localhost -p $UNBOUND_PORT foo.example.com. | tee outfile
51 echo "> cat logfiles"
52 cat fwd.log 
53 cat unbound.log
54 echo "> check answer"
55 if grep "1.1.1.1" outfile; then
56         echo "OK"
57 else
58         echo "Not OK"
59         exit 1
60 fi
61
62 echo "> dig foo.example.com. +norec"
63 dig @localhost +norec -p $UNBOUND_PORT foo.example.com. | tee outfile
64 echo "> cat logfiles"
65 cat fwd.log 
66 cat unbound.log
67 echo "> check answer"
68 if grep "1.1.1.1" outfile; then
69         echo "OK"
70 else
71         echo "Not OK"
72         exit 1
73 fi
74
75 exit 0