Files
osmo-hlr/tests/mslookup/mdns_test.err
Oliver Smith 5decd49713 mslookup: use apn functions from libosmocore
Use the apn functions from libosmocore to encode and decode qnames to
avoid code duplication and to avoid unnecessary dynamic allocation.

The unit tests for encoding and decoding rfc_question / rfc_record are
still passing and have the same output.

Fixes: OS#5821
Change-Id: I09d3c617fd6eb4075084ee106d3f3c5803861d2f
2022-12-23 13:51:22 +01:00

255 lines
4.7 KiB
Plaintext

-- test_enc_dec_rfc_header --
header in:
.id = 1337
.qr = 0
.opcode = 0
.aa = 0
.tc = 0
.rd = 0
.ra = 0
.z = 0
.rcode = 0
.qdcount = 1
.ancount = 0
.nscount = 0
.arcount = 0
encoded: 05 39 00 00 00 01 00 00 00 00 00 00
header out:
.id = 1337
.qr = 0
.opcode = 0
.aa = 0
.tc = 0
.rd = 0
.ra = 0
.z = 0
.rcode = 0
.qdcount = 1
.ancount = 0
.nscount = 0
.arcount = 0
in (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00
out (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00
=> OK
header in:
.id = 42
.qr = 1
.opcode = 2
.aa = 1
.tc = 1
.rd = 1
.ra = 1
.z = 2
.rcode = 3
.qdcount = 1234
.ancount = 1111
.nscount = 2222
.arcount = 3333
encoded: 00 2a 97 a3 04 d2 04 57 08 ae 0d 05
header out:
.id = 42
.qr = 1
.opcode = 2
.aa = 1
.tc = 1
.rd = 1
.ra = 1
.z = 2
.rcode = 3
.qdcount = 1234
.ancount = 1111
.nscount = 2222
.arcount = 3333
in (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d
out (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d
=> OK
-- test_enc_dec_rfc_header_einval --
=> OK
-- test_enc_dec_rfc_question --
question in:
.domain = hlr.1234567.imsi
.qtype = 255
.qclass = 1
encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 ff 00 01
question out:
.domain = hlr.1234567.imsi
.qtype = 255
.qclass = 1
=> OK
question in:
.domain = hlr.1234567.imsi
.qtype = 1
.qclass = 255
encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 01 00 ff
question out:
.domain = hlr.1234567.imsi
.qtype = 1
.qclass = 255
=> OK
question in:
.domain = hlr.1234567.imsi
.qtype = 28
.qclass = 255
encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 1c 00 ff
question out:
.domain = hlr.1234567.imsi
.qtype = 28
.qclass = 255
=> OK
-- test_enc_dec_rfc_question_null --
=> OK
-- test_enc_dec_rfc_record --
question in:
.domain = hlr.1234567.imsi
.type = 1
.class = 1
.ttl = 1234
.rdlength = 9
.rdata = "10.42.2.1"
encoded: 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
record_len: 37
question out:
.domain = hlr.1234567.imsi
.type = 1
.class = 1
.ttl = 1234
.rdlength = 9
.rdata = "10.42.2.1"
=> OK
-- test_result_from_answer --
---
test: IPv4
error: false
records:
- TXT age=3
- A 42.42.42.42
- TXT port=444
exp: -> ipv4: 23.42.47.11:444 (age=3) (not-last)
res: -> ipv4: 23.42.47.11:444 (age=3) (not-last)
=> OK
---
test: IPv6
error: false
records:
- TXT age=3
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
- TXT port=666
exp: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
res: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
=> OK
---
test: IPv4 + IPv6
error: false
records:
- TXT age=3
- A 42.42.42.42
- TXT port=444
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
- TXT port=666
exp: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
res: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last)
=> OK
---
test: A twice
error: true
records:
- TXT age=3
- A 42.42.42.42
- TXT port=444
- A 42.42.42.42
DLGLOBAL ERROR 'A' record found twice in mDNS answer
=> OK
---
test: AAAA twice
error: true
records:
- TXT age=3
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
- TXT port=444
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
DLGLOBAL ERROR 'AAAA' record found twice in mDNS answer
=> OK
---
test: invalid TXT: no key/value pair
error: true
records:
- TXT age=3
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
- TXT 12345
DLGLOBAL ERROR failed to decode txt record
=> OK
---
test: age twice
error: true
records:
- TXT age=3
- TXT age=3
DLGLOBAL ERROR duplicate 'TXT' record for 'age'
=> OK
---
test: port as first record
error: true
records:
- TXT port=444
DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record
=> OK
---
test: port without previous ip record
error: true
records:
- TXT age=3
- TXT port=444
DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record
=> OK
---
test: invalid TXT: invalid key
error: true
records:
- TXT age=3
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
- TXT hello=world
DLGLOBAL ERROR unexpected key 'hello' in TXT record
=> OK
---
test: unexpected record type
error: true
records:
- TXT age=3
- (invalid)
DLGLOBAL ERROR unexpected record type
=> OK
---
test: missing record: age
error: true
records:
- A 42.42.42.42
- TXT port=444
DLGLOBAL ERROR missing resource records in mDNS answer
=> OK
---
test: missing record: port for ipv4
error: true
records:
- TXT age=3
- A 42.42.42.42
DLGLOBAL ERROR missing resource records in mDNS answer
=> OK
---
test: missing record: port for ipv4 #2
error: true
records:
- TXT age=3
- AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00
- TXT port=666
- A 42.42.42.42
DLGLOBAL ERROR missing resource records in mDNS answer
=> OK