Oliver Smith | 3a9f267 | 2019-11-20 10:56:35 +0100 | [diff] [blame^] | 1 | -- test_enc_dec_rfc_qname -- |
| 2 | domain: "hlr.1234567.imsi" |
| 3 | exp: "\3hlr\a1234567\4imsi" |
| 4 | res: "\3hlr\a1234567\4imsi" |
| 5 | => OK |
| 6 | |
| 7 | qname: "\3hlr\a1234567\4imsi" |
| 8 | exp: "hlr.1234567.imsi" |
| 9 | res: "hlr.1234567.imsi" |
| 10 | => OK |
| 11 | |
| 12 | domain: "hlr..imsi" |
| 13 | exp: NULL |
| 14 | res: NULL |
| 15 | => OK |
| 16 | |
| 17 | domain: "hlr" |
| 18 | exp: "\3hlr" |
| 19 | res: "\3hlr" |
| 20 | => OK |
| 21 | |
| 22 | qname: "\3hlr" |
| 23 | exp: "hlr" |
| 24 | res: "hlr" |
| 25 | => OK |
| 26 | |
| 27 | domain: "hlr." |
| 28 | exp: NULL |
| 29 | res: NULL |
| 30 | => OK |
| 31 | |
| 32 | domain: ".hlr" |
| 33 | exp: NULL |
| 34 | res: NULL |
| 35 | => OK |
| 36 | |
| 37 | domain: "" |
| 38 | exp: NULL |
| 39 | res: NULL |
| 40 | => OK |
| 41 | |
| 42 | domain: "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" |
| 43 | exp: "\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" |
| 44 | res: "\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 | |
| 47 | qname: "\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" |
| 48 | exp: "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" |
| 49 | res: "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 | |
| 52 | domain: "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" |
| 53 | exp: NULL |
| 54 | res: NULL |
| 55 | => OK |
| 56 | |
| 57 | qname: "\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\ |
| 58 | exp: NULL |
| 59 | res: NULL |
| 60 | => OK |
| 61 | |
| 62 | qname: "\3hlr\a1234567\5imsi" |
| 63 | exp: NULL |
| 64 | res: NULL |
| 65 | => OK |
| 66 | |
| 67 | qname: "\2hlr\a1234567\4imsi" |
| 68 | exp: NULL |
| 69 | res: NULL |
| 70 | => OK |
| 71 | |
| 72 | qname: "\3hlr\3" |
| 73 | exp: NULL |
| 74 | res: NULL |
| 75 | => OK |
| 76 | |
| 77 | qname_max_len: 17 |
| 78 | qname: "\3hlr\a1234567\4imsi" |
| 79 | exp: NULL |
| 80 | res: NULL |
| 81 | => OK |
| 82 | |
| 83 | -- test_enc_dec_rfc_header -- |
| 84 | header 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 |
| 98 | encoded: 05 39 00 00 00 01 00 00 00 00 00 00 |
| 99 | header 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 |
| 113 | in (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00 |
| 114 | out (hexdump): 39 05 00 00 01 00 00 00 00 00 00 00 |
| 115 | => OK |
| 116 | |
| 117 | header 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 |
| 131 | encoded: 00 2a 97 a3 04 d2 04 57 08 ae 0d 05 |
| 132 | header 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 |
| 146 | in (hexdump): 2a 00 97 a3 d2 04 57 04 ae 08 05 0d |
| 147 | out (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 -- |
| 154 | question in: |
| 155 | .domain = hlr.1234567.imsi |
| 156 | .qtype = 255 |
| 157 | .qclass = 1 |
| 158 | encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 ff 00 01 |
| 159 | question out: |
| 160 | .domain = hlr.1234567.imsi |
| 161 | .qtype = 255 |
| 162 | .qclass = 1 |
| 163 | => OK |
| 164 | |
| 165 | question in: |
| 166 | .domain = hlr.1234567.imsi |
| 167 | .qtype = 1 |
| 168 | .qclass = 255 |
| 169 | encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 01 00 ff |
| 170 | question out: |
| 171 | .domain = hlr.1234567.imsi |
| 172 | .qtype = 1 |
| 173 | .qclass = 255 |
| 174 | => OK |
| 175 | |
| 176 | question in: |
| 177 | .domain = hlr.1234567.imsi |
| 178 | .qtype = 28 |
| 179 | .qclass = 255 |
| 180 | encoded: 03 68 6c 72 07 31 32 33 34 35 36 37 04 69 6d 73 69 00 00 1c 00 ff |
| 181 | question 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 -- |
| 191 | question in: |
| 192 | .domain = hlr.1234567.imsi |
| 193 | .type = 1 |
| 194 | .class = 1 |
| 195 | .ttl = 1234 |
| 196 | .rdlength = 9 |
| 197 | .rdata = "10.42.2.1" |
| 198 | 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 |
| 199 | record_len: 37 |
| 200 | question 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 | --- |
| 211 | test: IPv4 |
| 212 | error: false |
| 213 | records: |
| 214 | - TXT age=3 |
| 215 | - A 42.42.42.42 |
| 216 | - TXT port=444 |
| 217 | exp: -> ipv4: 23.42.47.11:444 (age=3) (not-last) |
| 218 | res: -> ipv4: 23.42.47.11:444 (age=3) (not-last) |
| 219 | => OK |
| 220 | --- |
| 221 | test: IPv6 |
| 222 | error: false |
| 223 | records: |
| 224 | - TXT age=3 |
| 225 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 226 | - TXT port=666 |
| 227 | exp: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 228 | res: -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 229 | => OK |
| 230 | --- |
| 231 | test: IPv4 + IPv6 |
| 232 | error: false |
| 233 | records: |
| 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 |
| 239 | exp: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 240 | res: -> ipv4: 23.42.47.11:444 -> ipv6: [1122:3344:5566:7788:99aa:bbcc:ddee:ff00]:666 (age=3) (not-last) |
| 241 | => OK |
| 242 | --- |
| 243 | test: A twice |
| 244 | error: true |
| 245 | records: |
| 246 | - TXT age=3 |
| 247 | - A 42.42.42.42 |
| 248 | - TXT port=444 |
| 249 | - A 42.42.42.42 |
| 250 | DLGLOBAL ERROR 'A' record found twice in mDNS answer |
| 251 | => OK |
| 252 | --- |
| 253 | test: AAAA twice |
| 254 | error: true |
| 255 | records: |
| 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 |
| 260 | DLGLOBAL ERROR 'AAAA' record found twice in mDNS answer |
| 261 | => OK |
| 262 | --- |
| 263 | test: invalid TXT: no key/value pair |
| 264 | error: true |
| 265 | records: |
| 266 | - TXT age=3 |
| 267 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 268 | - TXT 12345 |
| 269 | DLGLOBAL ERROR failed to decode txt record |
| 270 | => OK |
| 271 | --- |
| 272 | test: age twice |
| 273 | error: true |
| 274 | records: |
| 275 | - TXT age=3 |
| 276 | - TXT age=3 |
| 277 | DLGLOBAL ERROR duplicate 'TXT' record for 'age' |
| 278 | => OK |
| 279 | --- |
| 280 | test: port as first record |
| 281 | error: true |
| 282 | records: |
| 283 | - TXT port=444 |
| 284 | DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record |
| 285 | => OK |
| 286 | --- |
| 287 | test: port without previous ip record |
| 288 | error: true |
| 289 | records: |
| 290 | - TXT age=3 |
| 291 | - TXT port=444 |
| 292 | DLGLOBAL ERROR 'TXT' record for 'port' without previous 'A' or 'AAAA' record |
| 293 | => OK |
| 294 | --- |
| 295 | test: invalid TXT: invalid key |
| 296 | error: true |
| 297 | records: |
| 298 | - TXT age=3 |
| 299 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 300 | - TXT hello=world |
| 301 | DLGLOBAL ERROR unexpected key 'hello' in TXT record |
| 302 | => OK |
| 303 | --- |
| 304 | test: unexpected record type |
| 305 | error: true |
| 306 | records: |
| 307 | - TXT age=3 |
| 308 | - (invalid) |
| 309 | DLGLOBAL ERROR unexpected record type |
| 310 | => OK |
| 311 | --- |
| 312 | test: missing record: age |
| 313 | error: true |
| 314 | records: |
| 315 | - A 42.42.42.42 |
| 316 | - TXT port=444 |
| 317 | DLGLOBAL ERROR missing resource records in mDNS answer |
| 318 | => OK |
| 319 | --- |
| 320 | test: missing record: port for ipv4 |
| 321 | error: true |
| 322 | records: |
| 323 | - TXT age=3 |
| 324 | - A 42.42.42.42 |
| 325 | DLGLOBAL ERROR missing resource records in mDNS answer |
| 326 | => OK |
| 327 | --- |
| 328 | test: missing record: port for ipv4 #2 |
| 329 | error: true |
| 330 | records: |
| 331 | - TXT age=3 |
| 332 | - AAAA 1122:3344:5566:7788:99aa:bbcc:ddee:ff00 |
| 333 | - TXT port=666 |
| 334 | - A 42.42.42.42 |
| 335 | DLGLOBAL ERROR missing resource records in mDNS answer |
| 336 | => OK |