blob: 51e5afe63b7ea675c3b01103a21435a16e9a86c4 [file] [log] [blame]
Oliver Smith3a9f2672019-11-20 10:56:35 +01001-- test_enc_dec_rfc_qname --
2domain: "hlr.1234567.imsi"
3exp: "\3hlr\a1234567\4imsi"
4res: "\3hlr\a1234567\4imsi"
5=> OK
6
7qname: "\3hlr\a1234567\4imsi"
8exp: "hlr.1234567.imsi"
9res: "hlr.1234567.imsi"
10=> OK
11
12domain: "hlr..imsi"
13exp: NULL
14res: NULL
15=> OK
16
17domain: "hlr"
18exp: "\3hlr"
19res: "\3hlr"
20=> OK
21
22qname: "\3hlr"
23exp: "hlr"
24res: "hlr"
25=> OK
26
27domain: "hlr."
28exp: NULL
29res: NULL
30=> OK
31
32domain: ".hlr"
33exp: NULL
34res: NULL
35=> OK
36
37domain: ""
38exp: NULL
39res: NULL
40=> OK
41
42domain: "123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.12345"
43exp: "\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\512345"
44res: "\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\512345"
45=> OK
46
47qname: "\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\512345"
48exp: "123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.12345"
49res: "123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.12345"
50=> OK
51
52domain: "123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.12345toolong"
53exp: NULL
54res: NULL
55=> OK
56
57qname: "\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\t123456789\
58exp: NULL
59res: NULL
60=> OK
61
62qname: "\3hlr\a1234567\5imsi"
63exp: NULL
64res: NULL
65=> OK
66
67qname: "\2hlr\a1234567\4imsi"
68exp: NULL
69res: NULL
70=> OK
71
72qname: "\3hlr\3"
73exp: NULL
74res: NULL
75=> OK
76
77qname_max_len: 17
78qname: "\3hlr\a1234567\4imsi"
79exp: NULL
80res: NULL
81=> OK
82
83-- test_enc_dec_rfc_header --
84header in:
85.id = 1337
86.qr = 0
87.opcode = 0
88.aa = 0
89.tc = 0
90.rd = 0
91.ra = 0
92.z = 0
93.rcode = 0
94.qdcount = 1
95.ancount = 0
96.nscount = 0
97.arcount = 0
98encoded: 05 39 00 00 00 01 00 00 00 00 00 00
99header out:
100.id = 1337
101.qr = 0
102.opcode = 0
103.aa = 0
104.tc = 0
105.rd = 0
106.ra = 0
107.z = 0
108.rcode = 0
109.qdcount = 1
110.ancount = 0
111.nscount = 0
112.arcount = 0
113in (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00
114out (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00
115=> OK
116
117header in:
118.id = 42
119.qr = 1
120.opcode = 2
121.aa = 1
122.tc = 1
123.rd = 1
124.ra = 1
125.z = 2
126.rcode = 3
127.qdcount = 1234
128.ancount = 1111
129.nscount = 2222
130.arcount = 3333
131encoded: 00 2a 97 a3 04 d2 04 57 08 ae 0d 05
132header out:
133.id = 42
134.qr = 1
135.opcode = 2
136.aa = 1
137.tc = 1
138.rd = 1
139.ra = 1
140.z = 2
141.rcode = 3
142.qdcount = 1234
143.ancount = 1111
144.nscount = 2222
145.arcount = 3333
146in (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d
147out (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d
148=> OK
149
150-- test_enc_dec_rfc_header_einval --
151=> OK
152
153-- test_enc_dec_rfc_question --
154question in:
155.domain = hlr.1234567.imsi
156.qtype = 255
157.qclass = 1
158encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 ff 00 01
159question out:
160.domain = hlr.1234567.imsi
161.qtype = 255
162.qclass = 1
163=> OK
164
165question in:
166.domain = hlr.1234567.imsi
167.qtype = 1
168.qclass = 255
169encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 01 00 ff
170question out:
171.domain = hlr.1234567.imsi
172.qtype = 1
173.qclass = 255
174=> OK
175
176question in:
177.domain = hlr.1234567.imsi
178.qtype = 28
179.qclass = 255
180encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 1c 00 ff
181question out:
182.domain = hlr.1234567.imsi
183.qtype = 28
184.qclass = 255
185=> OK
186
187-- test_enc_dec_rfc_question_null --
188=> OK
189
190-- test_enc_dec_rfc_record --
191question in:
192.domain = hlr.1234567.imsi
193.type = 1
194.class = 1
195.ttl = 1234
196.rdlength = 9
197.rdata = "10.42.2.1"
198encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 01 00 01 00 00 04 d2 00 09 31 30 2e 34 32 2e 32 2e 31
199record_len: 37
200question out:
201.domain = hlr.1234567.imsi
202.type = 1
203.class = 1
204.ttl = 1234
205.rdlength = 9
206.rdata = "10.42.2.1"
207=> OK
208
209-- test_result_from_answer --
210---
211test: IPv4
212error: false
213records:
214- TXT age=3
215- A 42.42.42.42
216- TXT port=444
217exp: -> ipv4: 23.42.47.11:444 (age=3) (not-last)
218res: -> ipv4: 23.42.47.11:444 (age=3) (not-last)
219=> OK
220---
221test: IPv6
222error: false
223records:
224- TXT age=3
225- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
226- TXT port=666
227exp: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
228res: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
229=> OK
230---
231test: IPv4 + IPv6
232error: false
233records:
234- TXT age=3
235- A 42.42.42.42
236- TXT port=444
237- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
238- TXT port=666
239exp: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
240res: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
241=> OK
242---
243test: A twice
244error: true
245records:
246- TXT age=3
247- A 42.42.42.42
248- TXT port=444
249- A 42.42.42.42
250DLGLOBAL ERROR 'A' record found twice in mDNS answer
251=> OK
252---
253test: AAAA twice
254error: true
255records:
256- TXT age=3
257- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
258- TXT port=444
259- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
260DLGLOBAL ERROR 'AAAA' record found twice in mDNS answer
261=> OK
262---
263test: invalid TXT: no key/value pair
264error: true
265records:
266- TXT age=3
267- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
268- TXT 12345
269DLGLOBAL ERROR failed to decode txt record
270=> OK
271---
272test: age twice
273error: true
274records:
275- TXT age=3
276- TXT age=3
277DLGLOBAL ERROR duplicate 'TXT' record for 'age'
278=> OK
279---
280test: port as first record
281error: true
282records:
283- TXT port=444
284DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record
285=> OK
286---
287test: port without previous ip record
288error: true
289records:
290- TXT age=3
291- TXT port=444
292DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record
293=> OK
294---
295test: invalid TXT: invalid key
296error: true
297records:
298- TXT age=3
299- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
300- TXT hello=world
301DLGLOBAL ERROR unexpected key 'hello' in TXT record
302=> OK
303---
304test: unexpected record type
305error: true
306records:
307- TXT age=3
308- (invalid)
309DLGLOBAL ERROR unexpected record type
310=> OK
311---
312test: missing record: age
313error: true
314records:
315- A 42.42.42.42
316- TXT port=444
317DLGLOBAL ERROR missing resource records in mDNS answer
318=> OK
319---
320test: missing record: port for ipv4
321error: true
322records:
323- TXT age=3
324- A 42.42.42.42
325DLGLOBAL ERROR missing resource records in mDNS answer
326=> OK
327---
328test: missing record: port for ipv4 #2
329error: true
330records:
331- TXT age=3
332- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
333- TXT port=666
334- A 42.42.42.42
335DLGLOBAL ERROR missing resource records in mDNS answer
336=> OK