Oliver Smith | 3a9f267 | 2019-11-20 10:56:35 +0100 | [diff] [blame] | 1 | -- test_enc_dec_rfc_header -- |
| 2 | header in: |
| 3 | .id = 1337 |
| 4 | .qr = 0 |
| 5 | .opcode = 0 |
| 6 | .aa = 0 |
| 7 | .tc = 0 |
| 8 | .rd = 0 |
| 9 | .ra = 0 |
| 10 | .z = 0 |
| 11 | .rcode = 0 |
| 12 | .qdcount = 1 |
| 13 | .ancount = 0 |
| 14 | .nscount = 0 |
| 15 | .arcount = 0 |
| 16 | encoded: 05 39 00 00 00 01 00 00 00 00 00 00 |
| 17 | header out: |
| 18 | .id = 1337 |
| 19 | .qr = 0 |
| 20 | .opcode = 0 |
| 21 | .aa = 0 |
| 22 | .tc = 0 |
| 23 | .rd = 0 |
| 24 | .ra = 0 |
| 25 | .z = 0 |
| 26 | .rcode = 0 |
| 27 | .qdcount = 1 |
| 28 | .ancount = 0 |
| 29 | .nscount = 0 |
| 30 | .arcount = 0 |
| 31 | in (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00 |
| 32 | out (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00 |
| 33 | => OK |
| 34 | |
| 35 | header in: |
| 36 | .id = 42 |
| 37 | .qr = 1 |
| 38 | .opcode = 2 |
| 39 | .aa = 1 |
| 40 | .tc = 1 |
| 41 | .rd = 1 |
| 42 | .ra = 1 |
| 43 | .z = 2 |
| 44 | .rcode = 3 |
| 45 | .qdcount = 1234 |
| 46 | .ancount = 1111 |
| 47 | .nscount = 2222 |
| 48 | .arcount = 3333 |
| 49 | encoded: 00 2a 97 a3 04 d2 04 57 08 ae 0d 05 |
| 50 | header out: |
| 51 | .id = 42 |
| 52 | .qr = 1 |
| 53 | .opcode = 2 |
| 54 | .aa = 1 |
| 55 | .tc = 1 |
| 56 | .rd = 1 |
| 57 | .ra = 1 |
| 58 | .z = 2 |
| 59 | .rcode = 3 |
| 60 | .qdcount = 1234 |
| 61 | .ancount = 1111 |
| 62 | .nscount = 2222 |
| 63 | .arcount = 3333 |
| 64 | in (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d |
| 65 | out (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d |
| 66 | => OK |
| 67 | |
| 68 | -- test_enc_dec_rfc_header_einval -- |
| 69 | => OK |
| 70 | |
| 71 | -- test_enc_dec_rfc_question -- |
| 72 | question in: |
| 73 | .domain = hlr.1234567.imsi |
| 74 | .qtype = 255 |
| 75 | .qclass = 1 |
| 76 | encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 ff 00 01 |
| 77 | question out: |
| 78 | .domain = hlr.1234567.imsi |
| 79 | .qtype = 255 |
| 80 | .qclass = 1 |
| 81 | => OK |
| 82 | |
| 83 | question in: |
| 84 | .domain = hlr.1234567.imsi |
| 85 | .qtype = 1 |
| 86 | .qclass = 255 |
| 87 | encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 01 00 ff |
| 88 | question out: |
| 89 | .domain = hlr.1234567.imsi |
| 90 | .qtype = 1 |
| 91 | .qclass = 255 |
| 92 | => OK |
| 93 | |
| 94 | question in: |
| 95 | .domain = hlr.1234567.imsi |
| 96 | .qtype = 28 |
| 97 | .qclass = 255 |
| 98 | encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 1c 00 ff |
| 99 | question out: |
| 100 | .domain = hlr.1234567.imsi |
| 101 | .qtype = 28 |
| 102 | .qclass = 255 |
| 103 | => OK |
| 104 | |
| 105 | -- test_enc_dec_rfc_question_null -- |
| 106 | => OK |
| 107 | |
| 108 | -- test_enc_dec_rfc_record -- |
| 109 | question in: |
| 110 | .domain = hlr.1234567.imsi |
| 111 | .type = 1 |
| 112 | .class = 1 |
| 113 | .ttl = 1234 |
| 114 | .rdlength = 9 |
| 115 | .rdata = "10.42.2.1" |
| 116 | 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 |
| 117 | record_len: 37 |
| 118 | question out: |
| 119 | .domain = hlr.1234567.imsi |
| 120 | .type = 1 |
| 121 | .class = 1 |
| 122 | .ttl = 1234 |
| 123 | .rdlength = 9 |
| 124 | .rdata = "10.42.2.1" |
| 125 | => OK |
| 126 | |
| 127 | -- test_result_from_answer -- |
| 128 | --- |
| 129 | test: IPv4 |
| 130 | error: false |
| 131 | records: |
| 132 | - TXT age=3 |
| 133 | - A 42.42.42.42 |
| 134 | - TXT port=444 |
| 135 | exp: -> ipv4: 23.42.47.11:444 (age=3) (not-last) |
| 136 | res: -> ipv4: 23.42.47.11:444 (age=3) (not-last) |
| 137 | => OK |
| 138 | --- |
| 139 | test: IPv6 |
| 140 | error: false |
| 141 | records: |
| 142 | - TXT age=3 |
| 143 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 144 | - TXT port=666 |
| 145 | exp: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 146 | res: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 147 | => OK |
| 148 | --- |
| 149 | test: IPv4 + IPv6 |
| 150 | error: false |
| 151 | records: |
| 152 | - TXT age=3 |
| 153 | - A 42.42.42.42 |
| 154 | - TXT port=444 |
| 155 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 156 | - TXT port=666 |
| 157 | exp: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 158 | res: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 159 | => OK |
| 160 | --- |
| 161 | test: A twice |
| 162 | error: true |
| 163 | records: |
| 164 | - TXT age=3 |
| 165 | - A 42.42.42.42 |
| 166 | - TXT port=444 |
| 167 | - A 42.42.42.42 |
| 168 | DLGLOBAL ERROR 'A' record found twice in mDNS answer |
| 169 | => OK |
| 170 | --- |
| 171 | test: AAAA twice |
| 172 | error: true |
| 173 | records: |
| 174 | - TXT age=3 |
| 175 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 176 | - TXT port=444 |
| 177 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 178 | DLGLOBAL ERROR 'AAAA' record found twice in mDNS answer |
| 179 | => OK |
| 180 | --- |
| 181 | test: invalid TXT: no key/value pair |
| 182 | error: true |
| 183 | records: |
| 184 | - TXT age=3 |
| 185 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 186 | - TXT 12345 |
| 187 | DLGLOBAL ERROR failed to decode txt record |
| 188 | => OK |
| 189 | --- |
| 190 | test: age twice |
| 191 | error: true |
| 192 | records: |
| 193 | - TXT age=3 |
| 194 | - TXT age=3 |
| 195 | DLGLOBAL ERROR duplicate 'TXT' record for 'age' |
| 196 | => OK |
| 197 | --- |
| 198 | test: port as first record |
| 199 | error: true |
| 200 | records: |
| 201 | - TXT port=444 |
| 202 | DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record |
| 203 | => OK |
| 204 | --- |
| 205 | test: port without previous ip record |
| 206 | error: true |
| 207 | records: |
| 208 | - TXT age=3 |
| 209 | - TXT port=444 |
| 210 | DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record |
| 211 | => OK |
| 212 | --- |
| 213 | test: invalid TXT: invalid key |
| 214 | error: true |
| 215 | records: |
| 216 | - TXT age=3 |
| 217 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 218 | - TXT hello=world |
| 219 | DLGLOBAL ERROR unexpected key 'hello' in TXT record |
| 220 | => OK |
| 221 | --- |
| 222 | test: unexpected record type |
| 223 | error: true |
| 224 | records: |
| 225 | - TXT age=3 |
| 226 | - (invalid) |
| 227 | DLGLOBAL ERROR unexpected record type |
| 228 | => OK |
| 229 | --- |
| 230 | test: missing record: age |
| 231 | error: true |
| 232 | records: |
| 233 | - A 42.42.42.42 |
| 234 | - TXT port=444 |
| 235 | DLGLOBAL ERROR missing resource records in mDNS answer |
| 236 | => OK |
| 237 | --- |
| 238 | test: missing record: port for ipv4 |
| 239 | error: true |
| 240 | records: |
| 241 | - TXT age=3 |
| 242 | - A 42.42.42.42 |
| 243 | DLGLOBAL ERROR missing resource records in mDNS answer |
| 244 | => OK |
| 245 | --- |
| 246 | test: missing record: port for ipv4 #2 |
| 247 | error: true |
| 248 | records: |
| 249 | - TXT age=3 |
| 250 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 251 | - TXT port=666 |
| 252 | - A 42.42.42.42 |
| 253 | DLGLOBAL ERROR missing resource records in mDNS answer |
| 254 | => OK |