]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - testdata/ipset.tdir/ipset.test
unbound: Vendor import 1.19.0
[FreeBSD/FreeBSD.git] / testdata / ipset.tdir / ipset.test
1 # #-- ipset.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 . ../common.sh
8 PRE="../.."
9
10 # Make all the queries. They need to succeed by the way.
11 echo "> dig www.example.net."
12 dig @127.0.0.1 -p $UNBOUND_PORT www.example.net. | tee outfile
13 echo "> check answer"
14 if grep "1.1.1.1" outfile; then
15         echo "OK"
16 else
17         echo "> cat logfiles"
18         cat fwd.log
19         cat unbound.log
20         echo "Not OK"
21         exit 1
22 fi
23 echo "> check ipset"
24 if grep "ipset: add 1.1.1.1 to atotallymadeupnamefor4 for www.example.net." unbound.log; then
25         echo "ipset OK"
26 else
27         echo "> cat logfiles"
28         cat fwd.log
29         cat unbound.log
30         echo "Not OK"
31         exit 1
32 fi
33
34 echo "> dig www.example.net. AAAA"
35 dig @127.0.0.1 -p $UNBOUND_PORT www.example.net. AAAA | tee outfile
36 echo "> check answer"
37 if grep "::1" outfile; then
38         echo "OK"
39 else
40         echo "> cat logfiles"
41         cat fwd.log
42         cat unbound.log
43         echo "Not OK"
44         exit 1
45 fi
46 echo "> check ipset"
47 if grep "ipset: add ::1 to atotallymadeupnamefor6 for www.example.net." unbound.log; then
48         echo "ipset OK"
49 else
50         echo "> cat logfiles"
51         cat fwd.log
52         cat unbound.log
53         echo "Not OK"
54         exit 1
55 fi
56
57 echo "> dig cname.example.net."
58 dig @127.0.0.1 -p $UNBOUND_PORT cname.example.net. | tee outfile
59 echo "> check answer"
60 if grep "2.2.2.2" outfile; then
61         echo "OK"
62 else
63         echo "> cat logfiles"
64         cat fwd.log
65         cat unbound.log
66         echo "Not OK"
67         exit 1
68 fi
69 echo "> check ipset"
70 if grep "ipset: add 2.2.2.2 to atotallymadeupnamefor4 for target.example.net." unbound.log; then
71         echo "ipset OK"
72 else
73         echo "> cat logfiles"
74         cat fwd.log
75         cat unbound.log
76         echo "Not OK"
77         exit 1
78 fi
79
80 echo "> dig cname.example.net. AAAA"
81 dig @127.0.0.1 -p $UNBOUND_PORT cname.example.net. AAAA | tee outfile
82 echo "> check answer"
83 if grep "::2" outfile; then
84         echo "OK"
85 else
86         echo "> cat logfiles"
87         cat fwd.log
88         cat unbound.log
89         echo "Not OK"
90         exit 1
91 fi
92 echo "> check ipset"
93 if grep "ipset: add ::2 to atotallymadeupnamefor6 for target.example.net." unbound.log; then
94         echo "ipset OK"
95 else
96         echo "> cat logfiles"
97         cat fwd.log
98         cat unbound.log
99         echo "Not OK"
100         exit 1
101 fi
102
103 echo "> dig outsidecname.example.net."
104 dig @127.0.0.1 -p $UNBOUND_PORT outsidecname.example.net. | tee outfile
105 echo "> check answer"
106 if grep "3.3.3.3" outfile; then
107         echo "OK"
108 else
109         echo "> cat logfiles"
110         cat fwd.log
111         cat unbound.log
112         echo "Not OK"
113         exit 1
114 fi
115 echo "> check ipset"
116 if grep "ipset: add 3.3.3.3 to atotallymadeupnamefor4 for target.example.com." unbound.log; then
117         echo "ipset OK"
118 else
119         echo "> cat logfiles"
120         cat fwd.log
121         cat unbound.log
122         echo "Not OK"
123         exit 1
124 fi
125
126 echo "> dig outsidecname.example.net. AAAA"
127 dig @127.0.0.1 -p $UNBOUND_PORT outsidecname.example.net. AAAA | tee outfile
128 echo "> check answer"
129 if grep "::3" outfile; then
130         echo "OK"
131 else
132         echo "> cat logfiles"
133         cat fwd.log
134         cat unbound.log
135         echo "Not OK"
136         exit 1
137 fi
138 echo "> check ipset"
139 if grep "ipset: add ::3 to atotallymadeupnamefor6 for target.example.com." unbound.log; then
140         echo "ipset OK"
141 else
142         echo "> cat logfiles"
143         cat fwd.log
144         cat unbound.log
145         echo "Not OK"
146         exit 1
147 fi
148
149 echo "> dig lookslikeexample.net. AAAA"
150 dig @127.0.0.1 -p $UNBOUND_PORT lookslikeexample.net. AAAA | tee outfile
151 echo "> check answer"
152 if grep "::4" outfile; then
153         echo "OK"
154 else
155         echo "> cat logfiles"
156         cat fwd.log
157         cat unbound.log
158         echo "Not OK"
159         exit 1
160 fi
161 echo "> check ipset"
162 if grep "ipset: add ::4 to atotallymadeupnamefor6 for lookslikeexample.net." unbound.log; then
163         echo "> cat logfiles"
164         cat fwd.log
165         cat unbound.log
166         echo "Not OK"
167         exit 1
168 else
169         echo "ipset OK"
170 fi
171
172 echo "> cat logfiles"
173 cat tap.log
174 cat tap.errlog
175 cat fwd.log
176 echo "> OK"
177 exit 0