]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/fwd_ancil.tdir/fwd_ancil.test
Vendor import of Unbound 1.6.6.
[FreeBSD/FreeBSD.git] / testdata / fwd_ancil.tdir / fwd_ancil.test
1 # #-- fwd_ancil.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 . ../common.sh
9
10 if test `hostname`"" = "dicht.nlnetlabs.nl"; then
11         echo "In jail, no ::1, skip test"
12         exit 0
13 fi
14
15 if fgrep "disable interface-automatic" unbound.log; then
16         echo "skip test"
17         exit 0
18 fi
19
20 get_make
21 (cd $PRE; $MAKE streamtcp)
22
23 # detect platform support first
24 echo "> streamtcp -n -u -f 127.0.0.1 www.example.com. A IN"
25 $PRE/streamtcp -n -u -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile
26 sleep 2
27 echo "> check answer"
28 if ! grep "Please disable interface-automatic" unbound.log; then
29         echo "OK"
30 else
31         echo "No platform support for ancillary data"
32         echo "> cat logfiles"
33         cat fwd.log 
34         cat unbound.log
35         echo "Not OK - but ignore test"
36         exit 0
37 fi
38 rm outfile
39
40
41 # do the test
42 echo "> streamtcp -f 127.0.0.1 www.example.com. A IN"
43 $PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile
44 echo "> check answer"
45 if grep "10.20.30.40" outfile; then
46         echo "OK"
47 else
48         echo "> cat logfiles"
49         cat fwd.log 
50         cat unbound.log
51         echo "Not OK"
52         exit 1
53 fi
54 rm outfile
55
56 echo "> streamtcp -f ::1 www.example.com. A IN"
57 $PRE/streamtcp -f ::1@$UNBOUND_PORT www.example.com. A IN | tee outfile
58 echo "> check answer"
59 if grep "10.20.30.40" outfile; then
60         echo "OK"
61 else
62         echo "> cat logfiles"
63         cat fwd.log 
64         cat unbound.log
65         echo "Not OK"
66         exit 1
67 fi
68 rm outfile
69
70 echo "> streamtcp -u -f ::1 www.example.com. A IN"
71 $PRE/streamtcp -u -f ::1@$UNBOUND_PORT www.example.com. A IN | tee outfile
72 echo "> check answer"
73 if grep "10.20.30.40" outfile; then
74         echo "OK"
75 else
76         echo "> cat logfiles"
77         cat fwd.log 
78         cat unbound.log
79         echo "Not OK"
80         exit 1
81 fi
82 rm outfile
83
84 echo "> streamtcp -u -f 127.0.0.1 www.example.com. A IN"
85 $PRE/streamtcp -u -f 127.0.0.1@$UNBOUND_PORT www.example.com. A IN | tee outfile
86 echo "> check answer"
87 if grep "10.20.30.40" outfile; then
88         echo "OK"
89 else
90         echo "> cat logfiles"
91         cat fwd.log 
92         cat unbound.log
93         echo "Not OK"
94         exit 1
95 fi
96 rm outfile
97
98 echo "> cat logfiles"
99 cat fwd.log 
100 cat unbound.log
101 exit 0