| 1 |
/* |
| 2 |
* Copyright (C) Internet Systems Consortium, Inc. ("ISC") |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MPL-2.0 |
| 5 |
* |
| 6 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 7 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 8 |
* file, you can obtain one at https://mozilla.org/MPL/2.0/. |
| 9 |
* |
| 10 |
* See the COPYRIGHT file distributed with this work for additional |
| 11 |
* information regarding copyright ownership. |
| 12 |
*/ |
| 13 |
|
| 14 |
#include <inttypes.h> |
| 15 |
#include <sched.h> /* IWYU pragma: keep */ |
| 16 |
#include <setjmp.h> |
| 17 |
#include <stdarg.h> |
| 18 |
#include <stdbool.h> |
| 19 |
#include <stddef.h> |
| 20 |
#include <stdlib.h> |
| 21 |
#include <string.h> |
| 22 |
#include <unistd.h> |
| 23 |
|
| 24 |
#define UNIT_TESTING |
| 25 |
|
| 26 |
#include <cmocka.h> |
| 27 |
#include <openssl_shim.h> |
| 28 |
|
| 29 |
#include <openssl/err.h> |
| 30 |
|
| 31 |
#include <isc/commandline.h> |
| 32 |
#include <isc/hex.h> |
| 33 |
#include <isc/lex.h> |
| 34 |
#include <isc/stdio.h> |
| 35 |
#include <isc/types.h> |
| 36 |
#include <isc/util.h> |
| 37 |
|
| 38 |
#include <dns/rdata.h> |
| 39 |
|
| 40 |
#include <tests/dns.h> |
| 41 |
|
| 42 |
/* |
| 43 |
* An array of these structures is passed to compare_ok(). |
| 44 |
*/ |
| 45 |
struct compare_ok { |
| 46 |
const char *text1; /* text passed to fromtext_*() */ |
| 47 |
const char *text2; /* text passed to fromtext_*() */ |
| 48 |
int answer; /* -1, 0, 1 */ |
| 49 |
int lineno; /* source line defining this RDATA */ |
| 50 |
}; |
| 51 |
typedef struct compare_ok compare_ok_t; |
| 52 |
|
| 53 |
struct textvsunknown { |
| 54 |
const char *text1; |
| 55 |
const char *text2; |
| 56 |
}; |
| 57 |
typedef struct textvsunknown textvsunknown_t; |
| 58 |
|
| 59 |
/* |
| 60 |
* An array of these structures is passed to check_text_ok(). |
| 61 |
*/ |
| 62 |
typedef struct text_ok { |
| 63 |
const char *text_in; /* text passed to fromtext_*() */ |
| 64 |
const char *text_out; /* text expected from totext_*(); |
| 65 |
* NULL indicates text_in is invalid */ |
| 66 |
unsigned int loop; |
| 67 |
} text_ok_t; |
| 68 |
|
| 69 |
/* |
| 70 |
* An array of these structures is passed to check_wire_ok(). |
| 71 |
*/ |
| 72 |
typedef struct wire_ok { |
| 73 |
unsigned char data[512]; /* RDATA in wire format */ |
| 74 |
size_t len; /* octets of data to parse */ |
| 75 |
bool ok; /* is this RDATA valid? */ |
| 76 |
unsigned int loop; |
| 77 |
} wire_ok_t; |
| 78 |
|
| 79 |
#define COMPARE(r1, r2, answer) { r1, r2, answer, __LINE__ } |
| 80 |
#define COMPARE_SENTINEL() { NULL, NULL, 0, __LINE__ } |
| 81 |
|
| 82 |
#define TEXT_VALID_CHANGED(data_in, data_out) { data_in, data_out, 0 } |
| 83 |
#define TEXT_VALID(data) { data, data, 0 } |
| 84 |
#define TEXT_VALID_LOOP(loop, data) { data, data, loop } |
| 85 |
#define TEXT_VALID_LOOPCHG(loop, data_in, data_out) { data_in, data_out, loop } |
| 86 |
#define TEXT_INVALID(data) { data, NULL, 0 } |
| 87 |
#define TEXT_SENTINEL() TEXT_INVALID(NULL) |
| 88 |
|
| 89 |
#define VARGC(...) (sizeof((unsigned char[]){ __VA_ARGS__ })) |
| 90 |
#define WIRE_TEST(ok, loop, ...) \ |
| 91 |
{ { __VA_ARGS__ }, VARGC(__VA_ARGS__), ok, loop } |
| 92 |
#define WIRE_VALID(...) WIRE_TEST(true, 0, __VA_ARGS__) |
| 93 |
#define WIRE_VALID_LOOP(loop, ...) WIRE_TEST(true, loop, __VA_ARGS__) |
| 94 |
/* |
| 95 |
* WIRE_INVALID() test cases must always have at least one octet specified to |
| 96 |
* distinguish them from WIRE_SENTINEL(). Use the 'empty_ok' parameter passed |
| 97 |
* to check_wire_ok() for indicating whether empty RDATA is allowed for a given |
| 98 |
* RR type or not. |
| 99 |
*/ |
| 100 |
#define WIRE_INVALID(FIRST, ...) WIRE_TEST(false, 0, FIRST, __VA_ARGS__) |
| 101 |
#define WIRE_SENTINEL() WIRE_TEST(false, 0) |
| 102 |
|
| 103 |
static void |
| 104 |
detect_uncleared_libcrypto_error(void) { |
| 105 |
const char *file, *func, *data; |
| 106 |
int line, flags; |
| 107 |
long err; |
| 108 |
bool leak = false; |
| 109 |
while ((err = ERR_get_error_all(&file, &line, &func, &data, &flags)) != |
| 110 |
0L) |
| 111 |
{ |
| 112 |
fprintf(stderr, |
| 113 |
"# Uncleared libcrypto error: %s:%d %s %s %ld %x\n", |
| 114 |
file, line, func, data, err, flags); |
| 115 |
leak = true; |
| 116 |
} |
| 117 |
assert_false(leak); |
| 118 |
} |
| 119 |
|
| 120 |
/* |
| 121 |
* Call dns_rdata_fromwire() for data in 'src', which is 'srclen' octets in |
| 122 |
* size and represents RDATA of given 'type' and 'class'. Store the resulting |
| 123 |
* uncompressed wire form in 'dst', which is 'dstlen' octets in size, and make |
| 124 |
* 'rdata' refer to that uncompressed wire form. |
| 125 |
*/ |
| 126 |
static isc_result_t |
| 127 |
wire_to_rdata(const unsigned char *src, size_t srclen, dns_rdataclass_t rdclass, |
| 128 |
dns_rdatatype_t type, unsigned char *dst, size_t dstlen, |
| 129 |
dns_rdata_t *rdata) { |
| 130 |
isc_buffer_t source, target; |
| 131 |
isc_result_t result; |
| 132 |
|
| 133 |
/* |
| 134 |
* Set up len-octet buffer pointing at data. |
| 135 |
*/ |
| 136 |
isc_buffer_constinit(&source, src, srclen); |
| 137 |
isc_buffer_add(&source, srclen); |
| 138 |
isc_buffer_setactive(&source, srclen); |
| 139 |
|
| 140 |
/* |
| 141 |
* Initialize target buffer. |
| 142 |
*/ |
| 143 |
isc_buffer_init(&target, dst, dstlen); |
| 144 |
|
| 145 |
/* |
| 146 |
* Try converting input data into uncompressed wire form. |
| 147 |
*/ |
| 148 |
result = dns_rdata_fromwire(rdata, rdclass, type, &source, |
| 149 |
DNS_DECOMPRESS_ALWAYS, &target); |
| 150 |
detect_uncleared_libcrypto_error(); |
| 151 |
|
| 152 |
return result; |
| 153 |
} |
| 154 |
|
| 155 |
/* |
| 156 |
* Call dns_rdata_towire() for rdata and write to result to dst. |
| 157 |
*/ |
| 158 |
static isc_result_t |
| 159 |
rdata_towire(dns_rdata_t *rdata, unsigned char *dst, size_t dstlen, |
| 160 |
size_t *length) { |
| 161 |
isc_buffer_t target; |
| 162 |
dns_compress_t cctx; |
| 163 |
isc_result_t result; |
| 164 |
|
| 165 |
/* |
| 166 |
* Initialize target buffer. |
| 167 |
*/ |
| 168 |
isc_buffer_init(&target, dst, dstlen); |
| 169 |
|
| 170 |
/* |
| 171 |
* Try converting input data into uncompressed wire form. |
| 172 |
*/ |
| 173 |
dns_compress_init(&cctx, mctx, 0); |
| 174 |
result = dns_rdata_towire(rdata, &cctx, &target); |
| 175 |
detect_uncleared_libcrypto_error(); |
| 176 |
dns_compress_invalidate(&cctx); |
| 177 |
|
| 178 |
*length = isc_buffer_usedlength(&target); |
| 179 |
|
| 180 |
return result; |
| 181 |
} |
| 182 |
|
| 183 |
static isc_result_t |
| 184 |
additionaldata_cb(void *arg, const dns_name_t *name, dns_rdatatype_t qtype, |
| 185 |
dns_rdataset_t *found DNS__DB_FLARG) { |
| 186 |
UNUSED(arg); |
| 187 |
UNUSED(name); |
| 188 |
UNUSED(qtype); |
| 189 |
UNUSED(found); |
| 190 |
return ISC_R_SUCCESS; |
| 191 |
} |
| 192 |
|
| 193 |
/* |
| 194 |
* call dns_rdata_additionaldata() for rdata. |
| 195 |
*/ |
| 196 |
static isc_result_t |
| 197 |
rdata_additionadata(dns_rdata_t *rdata) { |
| 198 |
return dns_rdata_additionaldata(rdata, dns_rootname, additionaldata_cb, |
| 199 |
NULL); |
| 200 |
} |
| 201 |
|
| 202 |
/* |
| 203 |
* Call dns_rdata_checknames() with various owner names chosen to |
| 204 |
* match well known forms. |
| 205 |
* |
| 206 |
* We are currently only checking that the calls do not trigger |
| 207 |
* assertion failures. |
| 208 |
* |
| 209 |
* XXXMPA A future extension could be to record the expected |
| 210 |
* result and the expected value of 'bad'. |
| 211 |
*/ |
| 212 |
static void |
| 213 |
rdata_checknames(dns_rdata_t *rdata) { |
| 214 |
dns_fixedname_t fixed, bfixed; |
| 215 |
dns_name_t *name, *bad; |
| 216 |
isc_result_t result; |
| 217 |
|
| 218 |
name = dns_fixedname_initname(&fixed); |
| 219 |
bad = dns_fixedname_initname(&bfixed); |
| 220 |
|
| 221 |
(void)dns_rdata_checknames(rdata, dns_rootname, NULL); |
| 222 |
(void)dns_rdata_checknames(rdata, dns_rootname, bad); |
| 223 |
|
| 224 |
result = dns_name_fromstring(name, "example.net", dns_rootname, 0, |
| 225 |
NULL); |
| 226 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 227 |
(void)dns_rdata_checknames(rdata, name, NULL); |
| 228 |
(void)dns_rdata_checknames(rdata, name, bad); |
| 229 |
|
| 230 |
result = dns_name_fromstring(name, "in-addr.arpa", dns_rootname, 0, |
| 231 |
NULL); |
| 232 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 233 |
(void)dns_rdata_checknames(rdata, name, NULL); |
| 234 |
(void)dns_rdata_checknames(rdata, name, bad); |
| 235 |
|
| 236 |
result = dns_name_fromstring(name, "ip6.arpa", dns_rootname, 0, NULL); |
| 237 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 238 |
(void)dns_rdata_checknames(rdata, name, NULL); |
| 239 |
(void)dns_rdata_checknames(rdata, name, bad); |
| 240 |
} |
| 241 |
|
| 242 |
/* |
| 243 |
* Test whether converting rdata to a type-specific struct and then back to |
| 244 |
* rdata results in the same uncompressed wire form. This checks whether |
| 245 |
* tostruct_*() and fromstruct_*() routines for given RR class and type behave |
| 246 |
* consistently. |
| 247 |
* |
| 248 |
* This function is called for every correctly processed input RDATA, from both |
| 249 |
* check_text_ok_single() and check_wire_ok_single(). |
| 250 |
*/ |
| 251 |
static void |
| 252 |
check_struct_conversions(dns_rdata_t *rdata, size_t structsize, |
| 253 |
unsigned int loop) { |
| 254 |
dns_rdataclass_t rdclass = rdata->rdclass; |
| 255 |
dns_rdatatype_t type = rdata->type; |
| 256 |
isc_result_t result; |
| 257 |
isc_buffer_t target; |
| 258 |
void *rdata_struct; |
| 259 |
char buf[1024]; |
| 260 |
unsigned int count = 0; |
| 261 |
|
| 262 |
rdata_struct = isc_mem_allocate(mctx, structsize); |
| 263 |
assert_non_null(rdata_struct); |
| 264 |
|
| 265 |
/* |
| 266 |
* Convert from uncompressed wire form into type-specific struct. |
| 267 |
*/ |
| 268 |
result = dns_rdata_tostruct(rdata, rdata_struct, NULL); |
| 269 |
detect_uncleared_libcrypto_error(); |
| 270 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 271 |
|
| 272 |
/* |
| 273 |
* Convert from type-specific struct into uncompressed wire form. |
| 274 |
*/ |
| 275 |
isc_buffer_init(&target, buf, sizeof(buf)); |
| 276 |
result = dns_rdata_fromstruct(NULL, rdclass, type, rdata_struct, |
| 277 |
&target); |
| 278 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 279 |
|
| 280 |
/* |
| 281 |
* Ensure results are consistent. |
| 282 |
*/ |
| 283 |
assert_int_equal(isc_buffer_usedlength(&target), rdata->length); |
| 284 |
|
| 285 |
assert_memory_equal(buf, rdata->data, rdata->length); |
| 286 |
|
| 287 |
/* |
| 288 |
* Check that one can walk hip rendezvous servers and |
| 289 |
* https/svcb parameters. |
| 290 |
*/ |
| 291 |
switch (type) { |
| 292 |
case dns_rdatatype_hip: { |
| 293 |
dns_rdata_hip_t *hip = rdata_struct; |
| 294 |
|
| 295 |
for (result = dns_rdata_hip_first(hip); result == ISC_R_SUCCESS; |
| 296 |
result = dns_rdata_hip_next(hip)) |
| 297 |
{ |
| 298 |
dns_name_t name; |
| 299 |
dns_name_init(&name, NULL); |
| 300 |
dns_rdata_hip_current(hip, &name); |
| 301 |
assert_int_not_equal(dns_name_countlabels(&name), 0); |
| 302 |
assert_true(dns_name_isabsolute(&name)); |
| 303 |
count++; |
| 304 |
} |
| 305 |
assert_int_equal(result, ISC_R_NOMORE); |
| 306 |
assert_int_equal(count, loop); |
| 307 |
break; |
| 308 |
} |
| 309 |
case dns_rdatatype_https: { |
| 310 |
dns_rdata_in_https_t *https = rdata_struct; |
| 311 |
|
| 312 |
for (result = dns_rdata_in_https_first(https); |
| 313 |
result == ISC_R_SUCCESS; |
| 314 |
result = dns_rdata_in_https_next(https)) |
| 315 |
{ |
| 316 |
isc_region_t region; |
| 317 |
dns_rdata_in_https_current(https, ®ion); |
| 318 |
assert_true(region.length >= 4); |
| 319 |
count++; |
| 320 |
} |
| 321 |
assert_int_equal(result, ISC_R_NOMORE); |
| 322 |
assert_int_equal(count, loop); |
| 323 |
break; |
| 324 |
} |
| 325 |
case dns_rdatatype_svcb: { |
| 326 |
dns_rdata_in_svcb_t *svcb = rdata_struct; |
| 327 |
|
| 328 |
for (result = dns_rdata_in_svcb_first(svcb); |
| 329 |
result == ISC_R_SUCCESS; |
| 330 |
result = dns_rdata_in_svcb_next(svcb)) |
| 331 |
{ |
| 332 |
isc_region_t region; |
| 333 |
dns_rdata_in_svcb_current(svcb, ®ion); |
| 334 |
assert_true(region.length >= 4); |
| 335 |
count++; |
| 336 |
} |
| 337 |
assert_int_equal(result, ISC_R_NOMORE); |
| 338 |
assert_int_equal(count, loop); |
| 339 |
break; |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
isc_mem_free(mctx, rdata_struct); |
| 344 |
} |
| 345 |
|
| 346 |
/* |
| 347 |
* Check whether converting supplied text form RDATA into uncompressed wire |
| 348 |
* form succeeds (tests fromtext_*()). If so, try converting it back into text |
| 349 |
* form and see if it results in the original text (tests totext_*()). |
| 350 |
*/ |
| 351 |
static void |
| 352 |
check_text_ok_single(const text_ok_t *text_ok, dns_rdataclass_t rdclass, |
| 353 |
dns_rdatatype_t type, size_t structsize) { |
| 354 |
unsigned char buf_fromtext[1024], buf_fromwire[1024], buf_towire[1024]; |
| 355 |
dns_rdata_t rdata = DNS_RDATA_INIT, rdata2 = DNS_RDATA_INIT; |
| 356 |
char buf_totext[1024] = { 0 }; |
| 357 |
isc_buffer_t target; |
| 358 |
isc_result_t result; |
| 359 |
size_t length = 0; |
| 360 |
|
| 361 |
if (debug) { |
| 362 |
fprintf(stdout, "#check_text_ok_single(%s)\n", |
| 363 |
text_ok->text_in); |
| 364 |
} |
| 365 |
/* |
| 366 |
* Try converting text form RDATA into uncompressed wire form. |
| 367 |
*/ |
| 368 |
result = dns_test_rdatafromstring(&rdata, rdclass, type, buf_fromtext, |
| 369 |
sizeof(buf_fromtext), |
| 370 |
text_ok->text_in, false); |
| 371 |
/* |
| 372 |
* Check whether result is as expected. |
| 373 |
*/ |
| 374 |
if (text_ok->text_out != NULL) { |
| 375 |
if (debug && result != ISC_R_SUCCESS) { |
| 376 |
fprintf(stdout, "# '%s'\n", text_ok->text_in); |
| 377 |
fprintf(stdout, "# result=%s\n", |
| 378 |
isc_result_totext(result)); |
| 379 |
} |
| 380 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 381 |
} else { |
| 382 |
if (debug && result == ISC_R_SUCCESS) { |
| 383 |
fprintf(stdout, "#'%s'\n", text_ok->text_in); |
| 384 |
} |
| 385 |
assert_int_not_equal(result, ISC_R_SUCCESS); |
| 386 |
} |
| 387 |
|
| 388 |
/* |
| 389 |
* If text form RDATA was not parsed correctly, performing any |
| 390 |
* additional checks is pointless. |
| 391 |
*/ |
| 392 |
if (result != ISC_R_SUCCESS) { |
| 393 |
return; |
| 394 |
} |
| 395 |
|
| 396 |
/* |
| 397 |
* Try converting uncompressed wire form RDATA back into text form and |
| 398 |
* check whether the resulting text is the same as the original one. |
| 399 |
*/ |
| 400 |
isc_buffer_init(&target, buf_totext, sizeof(buf_totext)); |
| 401 |
result = dns_rdata_totext(&rdata, NULL, &target); |
| 402 |
detect_uncleared_libcrypto_error(); |
| 403 |
if (result != ISC_R_SUCCESS && debug) { |
| 404 |
size_t i; |
| 405 |
fprintf(stdout, "# dns_rdata_totext -> %s", |
| 406 |
isc_result_totext(result)); |
| 407 |
for (i = 0; i < rdata.length; i++) { |
| 408 |
if ((i % 16) == 0) { |
| 409 |
fprintf(stdout, "\n#"); |
| 410 |
} |
| 411 |
fprintf(stdout, " %02x", rdata.data[i]); |
| 412 |
} |
| 413 |
fprintf(stdout, "\n"); |
| 414 |
} |
| 415 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 416 |
/* |
| 417 |
* Ensure buf_totext is properly NUL terminated as dns_rdata_totext() |
| 418 |
* may attempt different output formats writing into the apparently |
| 419 |
* unused part of the buffer. |
| 420 |
*/ |
| 421 |
isc_buffer_putuint8(&target, 0); |
| 422 |
if (debug && strcmp(buf_totext, text_ok->text_out) != 0) { |
| 423 |
fprintf(stdout, "# '%s' != '%s'\n", buf_totext, |
| 424 |
text_ok->text_out); |
| 425 |
} |
| 426 |
assert_string_equal(buf_totext, text_ok->text_out); |
| 427 |
|
| 428 |
if (debug) { |
| 429 |
fprintf(stdout, "#dns_rdata_totext -> '%s'\n", buf_totext); |
| 430 |
} |
| 431 |
|
| 432 |
/* |
| 433 |
* Ensure that fromtext_*() output is valid input for fromwire_*(). |
| 434 |
*/ |
| 435 |
result = wire_to_rdata(rdata.data, rdata.length, rdclass, type, |
| 436 |
buf_fromwire, sizeof(buf_fromwire), &rdata2); |
| 437 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 438 |
assert_int_equal(rdata.length, rdata2.length); |
| 439 |
assert_memory_equal(rdata.data, buf_fromwire, rdata.length); |
| 440 |
|
| 441 |
/* |
| 442 |
* Ensure that fromtext_*() output is valid input for towire_*(). |
| 443 |
*/ |
| 444 |
result = rdata_towire(&rdata, buf_towire, sizeof(buf_towire), &length); |
| 445 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 446 |
assert_int_equal(rdata.length, length); |
| 447 |
assert_memory_equal(rdata.data, buf_towire, length); |
| 448 |
|
| 449 |
/* |
| 450 |
* Test that additionaldata_*() succeeded. |
| 451 |
*/ |
| 452 |
result = rdata_additionadata(&rdata); |
| 453 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 454 |
|
| 455 |
/* |
| 456 |
* Exercise checknames_*(). |
| 457 |
*/ |
| 458 |
rdata_checknames(&rdata); |
| 459 |
|
| 460 |
/* |
| 461 |
* Perform two-way conversion checks between uncompressed wire form and |
| 462 |
* type-specific struct. |
| 463 |
*/ |
| 464 |
check_struct_conversions(&rdata, structsize, text_ok->loop); |
| 465 |
} |
| 466 |
|
| 467 |
/* |
| 468 |
* Test whether converting rdata to text form and then parsing the result of |
| 469 |
* that conversion again results in the same uncompressed wire form. This |
| 470 |
* checks whether totext_*() output is parsable by fromtext_*() for given RR |
| 471 |
* class and type. |
| 472 |
* |
| 473 |
* This function is called for every input RDATA which is successfully parsed |
| 474 |
* by check_wire_ok_single() and whose type is not a meta-type. |
| 475 |
*/ |
| 476 |
static void |
| 477 |
check_text_conversions(dns_rdata_t *rdata) { |
| 478 |
char buf_totext[1024] = { 0 }; |
| 479 |
unsigned char buf_fromtext[1024]; |
| 480 |
isc_result_t result; |
| 481 |
isc_buffer_t target; |
| 482 |
dns_rdata_t rdata2 = DNS_RDATA_INIT; |
| 483 |
|
| 484 |
/* |
| 485 |
* Convert uncompressed wire form RDATA into text form. This |
| 486 |
* conversion must succeed since input RDATA was successfully |
| 487 |
* parsed by check_wire_ok_single(). |
| 488 |
*/ |
| 489 |
isc_buffer_init(&target, buf_totext, sizeof(buf_totext)); |
| 490 |
result = dns_rdata_totext(rdata, NULL, &target); |
| 491 |
detect_uncleared_libcrypto_error(); |
| 492 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 493 |
/* |
| 494 |
* Ensure buf_totext is properly NUL terminated as dns_rdata_totext() |
| 495 |
* may attempt different output formats writing into the apparently |
| 496 |
* unused part of the buffer. |
| 497 |
*/ |
| 498 |
isc_buffer_putuint8(&target, 0); |
| 499 |
if (debug) { |
| 500 |
fprintf(stdout, "#'%s'\n", buf_totext); |
| 501 |
} |
| 502 |
|
| 503 |
/* |
| 504 |
* Try parsing text form RDATA output by dns_rdata_totext() again. |
| 505 |
*/ |
| 506 |
result = dns_test_rdatafromstring(&rdata2, rdata->rdclass, rdata->type, |
| 507 |
buf_fromtext, sizeof(buf_fromtext), |
| 508 |
buf_totext, false); |
| 509 |
if (debug && result != ISC_R_SUCCESS) { |
| 510 |
fprintf(stdout, "# result = %s\n", isc_result_totext(result)); |
| 511 |
fprintf(stdout, "# '%s'\n", buf_fromtext); |
| 512 |
} |
| 513 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 514 |
assert_int_equal(rdata2.length, rdata->length); |
| 515 |
assert_memory_equal(buf_fromtext, rdata->data, rdata->length); |
| 516 |
} |
| 517 |
|
| 518 |
/* |
| 519 |
* Test whether converting rdata to multi-line text form and then parsing the |
| 520 |
* result of that conversion again results in the same uncompressed wire form. |
| 521 |
* This checks whether multi-line totext_*() output is parsable by fromtext_*() |
| 522 |
* for given RR class and type. |
| 523 |
* |
| 524 |
* This function is called for every input RDATA which is successfully parsed |
| 525 |
* by check_wire_ok_single() and whose type is not a meta-type. |
| 526 |
*/ |
| 527 |
static void |
| 528 |
check_multiline_text_conversions(dns_rdata_t *rdata) { |
| 529 |
char buf_totext[1024] = { 0 }; |
| 530 |
unsigned char buf_fromtext[1024]; |
| 531 |
isc_result_t result; |
| 532 |
isc_buffer_t target; |
| 533 |
dns_rdata_t rdata2 = DNS_RDATA_INIT; |
| 534 |
unsigned int flags; |
| 535 |
|
| 536 |
/* |
| 537 |
* Convert uncompressed wire form RDATA into multi-line text form. |
| 538 |
* This conversion must succeed since input RDATA was successfully |
| 539 |
* parsed by check_wire_ok_single(). |
| 540 |
*/ |
| 541 |
isc_buffer_init(&target, buf_totext, sizeof(buf_totext)); |
| 542 |
flags = dns_master_styleflags(&dns_master_style_default); |
| 543 |
result = dns_rdata_tofmttext(rdata, dns_rootname, flags, 80 - 32, 4, |
| 544 |
"\n", &target); |
| 545 |
detect_uncleared_libcrypto_error(); |
| 546 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 547 |
/* |
| 548 |
* Ensure buf_totext is properly NUL terminated as |
| 549 |
* dns_rdata_tofmttext() may attempt different output formats |
| 550 |
* writing into the apparently unused part of the buffer. |
| 551 |
*/ |
| 552 |
isc_buffer_putuint8(&target, 0); |
| 553 |
if (debug) { |
| 554 |
fprintf(stdout, "#'%s'\n", buf_totext); |
| 555 |
} |
| 556 |
|
| 557 |
/* |
| 558 |
* Try parsing multi-line text form RDATA output by |
| 559 |
* dns_rdata_tofmttext() again. |
| 560 |
*/ |
| 561 |
result = dns_test_rdatafromstring(&rdata2, rdata->rdclass, rdata->type, |
| 562 |
buf_fromtext, sizeof(buf_fromtext), |
| 563 |
buf_totext, false); |
| 564 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 565 |
assert_int_equal(rdata2.length, rdata->length); |
| 566 |
assert_memory_equal(buf_fromtext, rdata->data, rdata->length); |
| 567 |
} |
| 568 |
|
| 569 |
/* |
| 570 |
* Test whether supplied wire form RDATA is properly handled as being either |
| 571 |
* valid or invalid for an RR of given rdclass and type. |
| 572 |
*/ |
| 573 |
static void |
| 574 |
check_wire_ok_single(const wire_ok_t *wire_ok, dns_rdataclass_t rdclass, |
| 575 |
dns_rdatatype_t type, size_t structsize) { |
| 576 |
unsigned char buf[1024], buf_towire[1024]; |
| 577 |
isc_result_t result; |
| 578 |
dns_rdata_t rdata = DNS_RDATA_INIT; |
| 579 |
size_t length = 0; |
| 580 |
|
| 581 |
/* |
| 582 |
* Try converting wire data into uncompressed wire form. |
| 583 |
*/ |
| 584 |
result = wire_to_rdata(wire_ok->data, wire_ok->len, rdclass, type, buf, |
| 585 |
sizeof(buf), &rdata); |
| 586 |
/* |
| 587 |
* Check whether result is as expected. |
| 588 |
*/ |
| 589 |
if (wire_ok->ok) { |
| 590 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 591 |
} else { |
| 592 |
assert_int_not_equal(result, ISC_R_SUCCESS); |
| 593 |
} |
| 594 |
|
| 595 |
if (result != ISC_R_SUCCESS) { |
| 596 |
return; |
| 597 |
} |
| 598 |
|
| 599 |
/* |
| 600 |
* If data was parsed correctly, perform two-way conversion checks |
| 601 |
* between uncompressed wire form and type-specific struct. |
| 602 |
* |
| 603 |
* If the RR type is not a meta-type, additionally perform two-way |
| 604 |
* conversion checks between: |
| 605 |
* |
| 606 |
* - uncompressed wire form and text form, |
| 607 |
* - uncompressed wire form and multi-line text form. |
| 608 |
*/ |
| 609 |
check_struct_conversions(&rdata, structsize, wire_ok->loop); |
| 610 |
if (!dns_rdatatype_ismeta(rdata.type)) { |
| 611 |
check_text_conversions(&rdata); |
| 612 |
check_multiline_text_conversions(&rdata); |
| 613 |
} |
| 614 |
|
| 615 |
/* |
| 616 |
* Ensure that fromwire_*() output is valid input for towire_*(). |
| 617 |
*/ |
| 618 |
result = rdata_towire(&rdata, buf_towire, sizeof(buf_towire), &length); |
| 619 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 620 |
assert_int_equal(rdata.length, length); |
| 621 |
assert_memory_equal(rdata.data, buf_towire, length); |
| 622 |
|
| 623 |
/* |
| 624 |
* Test that additionaldata_*() succeeded. |
| 625 |
*/ |
| 626 |
result = rdata_additionadata(&rdata); |
| 627 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 628 |
|
| 629 |
/* |
| 630 |
* Exercise checknames_*(). |
| 631 |
*/ |
| 632 |
rdata_checknames(&rdata); |
| 633 |
} |
| 634 |
|
| 635 |
/* |
| 636 |
* Test fromtext_*() and totext_*() routines for given RR class and type for |
| 637 |
* each text form RDATA in the supplied array. See the comment for |
| 638 |
* check_text_ok_single() for an explanation of how exactly these routines are |
| 639 |
* tested. |
| 640 |
*/ |
| 641 |
static void |
| 642 |
check_text_ok(const text_ok_t *text_ok, dns_rdataclass_t rdclass, |
| 643 |
dns_rdatatype_t type, size_t structsize) { |
| 644 |
size_t i; |
| 645 |
|
| 646 |
/* |
| 647 |
* Check all entries in the supplied array. |
| 648 |
*/ |
| 649 |
for (i = 0; text_ok[i].text_in != NULL; i++) { |
| 650 |
check_text_ok_single(&text_ok[i], rdclass, type, structsize); |
| 651 |
} |
| 652 |
} |
| 653 |
|
| 654 |
/* |
| 655 |
* For each wire form RDATA in the supplied array, check whether it is properly |
| 656 |
* handled as being either valid or invalid for an RR of given rdclass and |
| 657 |
* type, then check whether trying to process a zero-length wire data buffer |
| 658 |
* yields the expected result. This checks whether the fromwire_*() routine |
| 659 |
* for given RR class and type behaves as expected. |
| 660 |
*/ |
| 661 |
static void |
| 662 |
check_wire_ok(const wire_ok_t *wire_ok, bool empty_ok, dns_rdataclass_t rdclass, |
| 663 |
dns_rdatatype_t type, size_t structsize) { |
| 664 |
wire_ok_t empty_wire = WIRE_TEST(empty_ok, 0); |
| 665 |
size_t i; |
| 666 |
|
| 667 |
/* |
| 668 |
* Check all entries in the supplied array. |
| 669 |
*/ |
| 670 |
for (i = 0; wire_ok[i].len != 0; i++) { |
| 671 |
if (debug) { |
| 672 |
fprintf(stderr, "calling check_wire_ok_single on %zu\n", |
| 673 |
i); |
| 674 |
} |
| 675 |
check_wire_ok_single(&wire_ok[i], rdclass, type, structsize); |
| 676 |
} |
| 677 |
|
| 678 |
/* |
| 679 |
* Check empty wire data. |
| 680 |
*/ |
| 681 |
check_wire_ok_single(&empty_wire, rdclass, type, structsize); |
| 682 |
} |
| 683 |
|
| 684 |
/* |
| 685 |
* Check that two records compare as expected with dns_rdata_compare(). |
| 686 |
*/ |
| 687 |
static void |
| 688 |
check_compare_ok_single(const compare_ok_t *compare_ok, |
| 689 |
dns_rdataclass_t rdclass, dns_rdatatype_t type) { |
| 690 |
dns_rdata_t rdata1 = DNS_RDATA_INIT, rdata2 = DNS_RDATA_INIT; |
| 691 |
unsigned char buf1[1024], buf2[1024]; |
| 692 |
isc_result_t result; |
| 693 |
int answer; |
| 694 |
|
| 695 |
result = dns_test_rdatafromstring(&rdata1, rdclass, type, buf1, |
| 696 |
sizeof(buf1), compare_ok->text1, |
| 697 |
false); |
| 698 |
if (result != ISC_R_SUCCESS) { |
| 699 |
fail_msg("# line %d: '%s': expected success, got failure", |
| 700 |
compare_ok->lineno, compare_ok->text1); |
| 701 |
} |
| 702 |
|
| 703 |
result = dns_test_rdatafromstring(&rdata2, rdclass, type, buf2, |
| 704 |
sizeof(buf2), compare_ok->text2, |
| 705 |
false); |
| 706 |
|
| 707 |
if (result != ISC_R_SUCCESS) { |
| 708 |
fail_msg("# line %d: '%s': expected success, got failure", |
| 709 |
compare_ok->lineno, compare_ok->text2); |
| 710 |
} |
| 711 |
|
| 712 |
answer = dns_rdata_compare(&rdata1, &rdata2); |
| 713 |
detect_uncleared_libcrypto_error(); |
| 714 |
if (compare_ok->answer == 0 && answer != 0) { |
| 715 |
fail_msg("# line %d: dns_rdata_compare('%s', '%s'): " |
| 716 |
"expected equal, got %s", |
| 717 |
compare_ok->lineno, compare_ok->text1, |
| 718 |
compare_ok->text2, |
| 719 |
(answer > 0) ? "greater than" : "less than"); |
| 720 |
} |
| 721 |
if (compare_ok->answer < 0 && answer >= 0) { |
| 722 |
fail_msg("# line %d: dns_rdata_compare('%s', '%s'): " |
| 723 |
"expected less than, got %s", |
| 724 |
compare_ok->lineno, compare_ok->text1, |
| 725 |
compare_ok->text2, |
| 726 |
(answer == 0) ? "equal" : "greater than"); |
| 727 |
} |
| 728 |
if (compare_ok->answer > 0 && answer <= 0) { |
| 729 |
fail_msg("line %d: dns_rdata_compare('%s', '%s'): " |
| 730 |
"expected greater than, got %s", |
| 731 |
compare_ok->lineno, compare_ok->text1, |
| 732 |
compare_ok->text2, |
| 733 |
(answer == 0) ? "equal" : "less than"); |
| 734 |
} |
| 735 |
} |
| 736 |
|
| 737 |
/* |
| 738 |
* Check that all the records sets in compare_ok compare as expected |
| 739 |
* with dns_rdata_compare(). |
| 740 |
*/ |
| 741 |
static void |
| 742 |
check_compare_ok(const compare_ok_t *compare_ok, dns_rdataclass_t rdclass, |
| 743 |
dns_rdatatype_t type) { |
| 744 |
size_t i; |
| 745 |
/* |
| 746 |
* Check all entries in the supplied array. |
| 747 |
*/ |
| 748 |
for (i = 0; compare_ok[i].text1 != NULL; i++) { |
| 749 |
check_compare_ok_single(&compare_ok[i], rdclass, type); |
| 750 |
} |
| 751 |
} |
| 752 |
|
| 753 |
/* |
| 754 |
* Test whether supplied sets of text form and/or wire form RDATA are handled |
| 755 |
* as expected. |
| 756 |
* |
| 757 |
* The empty_ok argument denotes whether an attempt to parse a zero-length wire |
| 758 |
* data buffer should succeed or not (it is valid for some RR types). There is |
| 759 |
* no point in performing a similar check for empty text form RDATA, because |
| 760 |
* dns_rdata_fromtext() returns ISC_R_UNEXPECTEDEND before calling fromtext_*() |
| 761 |
* for the given RR class and type. |
| 762 |
*/ |
| 763 |
static void |
| 764 |
check_rdata(const text_ok_t *text_ok, const wire_ok_t *wire_ok, |
| 765 |
const compare_ok_t *compare_ok, bool empty_ok, |
| 766 |
dns_rdataclass_t rdclass, dns_rdatatype_t type, size_t structsize) { |
| 767 |
if (text_ok != NULL) { |
| 768 |
check_text_ok(text_ok, rdclass, type, structsize); |
| 769 |
} |
| 770 |
if (wire_ok != NULL) { |
| 771 |
check_wire_ok(wire_ok, empty_ok, rdclass, type, structsize); |
| 772 |
} |
| 773 |
if (compare_ok != NULL) { |
| 774 |
check_compare_ok(compare_ok, rdclass, type); |
| 775 |
} |
| 776 |
} |
| 777 |
|
| 778 |
/* |
| 779 |
* Check presentation vs unknown format of the record. |
| 780 |
*/ |
| 781 |
static void |
| 782 |
check_textvsunknown_single(const textvsunknown_t *textvsunknown, |
| 783 |
dns_rdataclass_t rdclass, dns_rdatatype_t type) { |
| 784 |
dns_rdata_t rdata1 = DNS_RDATA_INIT, rdata2 = DNS_RDATA_INIT; |
| 785 |
unsigned char buf1[1024], buf2[1024]; |
| 786 |
isc_result_t result; |
| 787 |
|
| 788 |
result = dns_test_rdatafromstring(&rdata1, rdclass, type, buf1, |
| 789 |
sizeof(buf1), textvsunknown->text1, |
| 790 |
false); |
| 791 |
if (debug && result != ISC_R_SUCCESS) { |
| 792 |
fprintf(stdout, "# '%s'\n", textvsunknown->text1); |
| 793 |
fprintf(stdout, "# result=%s\n", isc_result_totext(result)); |
| 794 |
} |
| 795 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 796 |
result = dns_test_rdatafromstring(&rdata2, rdclass, type, buf2, |
| 797 |
sizeof(buf2), textvsunknown->text2, |
| 798 |
false); |
| 799 |
if (debug && result != ISC_R_SUCCESS) { |
| 800 |
fprintf(stdout, "# '%s'\n", textvsunknown->text2); |
| 801 |
fprintf(stdout, "# result=%s\n", isc_result_totext(result)); |
| 802 |
} |
| 803 |
assert_int_equal(result, ISC_R_SUCCESS); |
| 804 |
if (debug && rdata1.length != rdata2.length) { |
| 805 |
fprintf(stdout, "# '%s'\n", textvsunknown->text1); |
| 806 |
fprintf(stdout, "# rdata1.length (%u) != rdata2.length (%u)\n", |
| 807 |
rdata1.length, rdata2.length); |
| 808 |
} |
| 809 |
assert_int_equal(rdata1.length, rdata2.length); |
| 810 |
if (debug && memcmp(rdata1.data, rdata2.data, rdata1.length) != 0) { |
| 811 |
unsigned int i; |
| 812 |
fprintf(stdout, "# '%s'\n", textvsunknown->text1); |
| 813 |
for (i = 0; i < rdata1.length; i++) { |
| 814 |
if (rdata1.data[i] != rdata2.data[i]) { |
| 815 |
fprintf(stderr, "# %u: %02x != %02x\n", i, |
| 816 |
rdata1.data[i], rdata2.data[i]); |
| 817 |
} |
| 818 |
} |
| 819 |
} |
| 820 |
assert_memory_equal(rdata1.data, rdata2.data, rdata1.length); |
| 821 |
} |
| 822 |
|
| 823 |
static void |
| 824 |
check_textvsunknown(const textvsunknown_t *textvsunknown, |
| 825 |
dns_rdataclass_t rdclass, dns_rdatatype_t type) { |
| 826 |
size_t i; |
| 827 |
|
| 828 |
/* |
| 829 |
* Check all entries in the supplied array. |
| 830 |
*/ |
| 831 |
for (i = 0; textvsunknown[i].text1 != NULL; i++) { |
| 832 |
check_textvsunknown_single(&textvsunknown[i], rdclass, type); |
| 833 |
} |
| 834 |
} |
| 835 |
|
| 836 |
/* |
| 837 |
* Common tests for RR types based on KEY that require key data: |
| 838 |
* |
| 839 |
* - CDNSKEY (RFC 7344) |
| 840 |
* - DNSKEY (RFC 4034) |
| 841 |
* - RKEY (draft-reid-dnsext-rkey-00) |
| 842 |
*/ |
| 843 |
static void |
| 844 |
key_required(void **state, dns_rdatatype_t type, size_t size) { |
| 845 |
wire_ok_t wire_ok[] = { /* |
| 846 |
* RDATA must be at least 5 octets in size: |
| 847 |
* |
| 848 |
* - 2 octets for Flags, |
| 849 |
* - 1 octet for Protocol, |
| 850 |
* - 1 octet for Algorithm, |
| 851 |
* - Public Key must not be empty. |
| 852 |
* |
| 853 |
* RFC 2535 section 3.1.2 allows the Public Key |
| 854 |
* to be empty if bits 0-1 of Flags are both |
| 855 |
* set, but that only applies to KEY records: |
| 856 |
* for the RR types tested here, the Public Key |
| 857 |
* must not be empty. |
| 858 |
*/ |
| 859 |
WIRE_INVALID(0x00), |
| 860 |
WIRE_INVALID(0x00, 0x00), |
| 861 |
WIRE_INVALID(0x00, 0x00, 0x00), |
| 862 |
WIRE_INVALID(0xc0, 0x00, 0x00, 0x00), |
| 863 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00), |
| 864 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00), |
| 865 |
WIRE_SENTINEL() |
| 866 |
}; |
| 867 |
|
| 868 |
UNUSED(state); |
| 869 |
|
| 870 |
check_rdata(NULL, wire_ok, NULL, false, dns_rdataclass_in, type, size); |
| 871 |
} |
| 872 |
|
| 873 |
/* APL RDATA manipulations */ |
| 874 |
ISC_RUN_TEST_IMPL(apl) { |
| 875 |
text_ok_t text_ok[] = { |
| 876 |
/* empty list */ |
| 877 |
TEXT_VALID(""), |
| 878 |
/* min,max prefix IPv4 */ |
| 879 |
TEXT_VALID("1:0.0.0.0/0"), TEXT_VALID("1:127.0.0.1/32"), |
| 880 |
/* min,max prefix IPv6 */ |
| 881 |
TEXT_VALID("2:::/0"), TEXT_VALID("2:::1/128"), |
| 882 |
/* negated */ |
| 883 |
TEXT_VALID("!1:0.0.0.0/0"), TEXT_VALID("!1:127.0.0.1/32"), |
| 884 |
TEXT_VALID("!2:::/0"), TEXT_VALID("!2:::1/128"), |
| 885 |
/* bits set after prefix length - not disallowed */ |
| 886 |
TEXT_VALID("1:127.0.0.0/0"), TEXT_VALID("2:8000::/0"), |
| 887 |
/* multiple */ |
| 888 |
TEXT_VALID("1:0.0.0.0/0 1:127.0.0.1/32"), |
| 889 |
TEXT_VALID("1:0.0.0.0/0 !1:127.0.0.1/32"), |
| 890 |
/* family 0, prefix 0, positive */ |
| 891 |
TEXT_VALID("\\# 4 00000000"), |
| 892 |
/* family 0, prefix 0, negative */ |
| 893 |
TEXT_VALID("\\# 4 00000080"), |
| 894 |
/* prefix too long */ |
| 895 |
TEXT_INVALID("1:0.0.0.0/33"), TEXT_INVALID("2:::/129"), |
| 896 |
/* |
| 897 |
* Sentinel. |
| 898 |
*/ |
| 899 |
TEXT_SENTINEL() |
| 900 |
}; |
| 901 |
wire_ok_t wire_ok[] = { /* zero length */ |
| 902 |
WIRE_VALID(), |
| 903 |
/* prefix too big IPv4 */ |
| 904 |
WIRE_INVALID(0x00, 0x01, 33U, 0x00), |
| 905 |
/* prefix too big IPv6 */ |
| 906 |
WIRE_INVALID(0x00, 0x02, 129U, 0x00), |
| 907 |
/* trailing zero octet in afdpart */ |
| 908 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x01, 0x00), |
| 909 |
/* |
| 910 |
* Sentinel. |
| 911 |
*/ |
| 912 |
WIRE_SENTINEL() |
| 913 |
}; |
| 914 |
|
| 915 |
check_rdata(text_ok, wire_ok, NULL, true, dns_rdataclass_in, |
| 916 |
dns_rdatatype_apl, sizeof(dns_rdata_in_apl_t)); |
| 917 |
} |
| 918 |
|
| 919 |
/* |
| 920 |
* http://broadband-forum.org/ftp/pub/approved-specs/af-saa-0069.000.pdf |
| 921 |
* |
| 922 |
* ATMA RR’s have the following RDATA format: |
| 923 |
* |
| 924 |
* 1 1 1 1 1 1 |
| 925 |
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
| 926 |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
| 927 |
* | FORMAT | | |
| 928 |
* +--+--+--+--+--+--+--+--+ | |
| 929 |
* / ADDRESS / |
| 930 |
* | | |
| 931 |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
| 932 |
* |
| 933 |
* The fields have the following meaning: |
| 934 |
* |
| 935 |
* * FORMAT: One octet that indicates the format of ADDRESS. The two |
| 936 |
* possible values for FORMAT are value 0 indicating ATM End System Address |
| 937 |
* (AESA) format and value 1 indicating E.164 format. |
| 938 |
* |
| 939 |
* * ADDRESS: Variable length string of octets containing the ATM address of |
| 940 |
* the node to which this RR pertains. |
| 941 |
* |
| 942 |
* When the format value is 0, indicating that the address is in AESA format, |
| 943 |
* the address is coded as described in ISO 8348/AD 2 using the preferred |
| 944 |
* binary encoding of the ISO NSAP format. When the format value is 1, |
| 945 |
* indicating that the address is in E.164 format, the Address/Number Digits |
| 946 |
* appear in the order in which they would be entered on a numeric keypad. |
| 947 |
* Digits are coded in IA5 characters with the leftmost bit of each digit set |
| 948 |
* to 0. This ATM address appears in ATM End System Address Octets field (AESA |
| 949 |
* format) or the Address/Number Digits field (E.164 format) of the Called |
| 950 |
* party number information element [ATMUNI3.1]. Subaddress information is |
| 951 |
* intentionally not included because E.164 subaddress information is used for |
| 952 |
* routing. |
| 953 |
* |
| 954 |
* ATMA RRs cause no additional section processing. |
| 955 |
*/ |
| 956 |
ISC_RUN_TEST_IMPL(atma) { |
| 957 |
text_ok_t text_ok[] = { TEXT_VALID("00"), |
| 958 |
TEXT_VALID_CHANGED("0.0", "00"), |
| 959 |
/* |
| 960 |
* multiple consecutive periods |
| 961 |
*/ |
| 962 |
TEXT_INVALID("0..0"), |
| 963 |
/* |
| 964 |
* trailing period |
| 965 |
*/ |
| 966 |
TEXT_INVALID("00."), |
| 967 |
/* |
| 968 |
* leading period |
| 969 |
*/ |
| 970 |
TEXT_INVALID(".00"), |
| 971 |
/* |
| 972 |
* Not full octets. |
| 973 |
*/ |
| 974 |
TEXT_INVALID("000"), |
| 975 |
/* |
| 976 |
* E.164 |
| 977 |
*/ |
| 978 |
TEXT_VALID("+61200000000"), |
| 979 |
/* |
| 980 |
* E.164 with periods |
| 981 |
*/ |
| 982 |
TEXT_VALID_CHANGED("+61.2.0000.0000", "+6120000" |
| 983 |
"0000"), |
| 984 |
/* |
| 985 |
* E.164 with period at end |
| 986 |
*/ |
| 987 |
TEXT_INVALID("+61200000000."), |
| 988 |
/* |
| 989 |
* E.164 with multiple consecutive periods |
| 990 |
*/ |
| 991 |
TEXT_INVALID("+612..00000000"), |
| 992 |
/* |
| 993 |
* E.164 with period before the leading digit. |
| 994 |
*/ |
| 995 |
TEXT_INVALID("+.61200000000"), |
| 996 |
/* |
| 997 |
* Sentinel. |
| 998 |
*/ |
| 999 |
TEXT_SENTINEL() }; |
| 1000 |
wire_ok_t wire_ok[] = { |
| 1001 |
/* |
| 1002 |
* Too short. |
| 1003 |
*/ |
| 1004 |
WIRE_INVALID(0x00), WIRE_INVALID(0x01), |
| 1005 |
/* |
| 1006 |
* all digits |
| 1007 |
*/ |
| 1008 |
WIRE_VALID(0x01, '6', '1', '2', '0', '0', '0'), |
| 1009 |
/* |
| 1010 |
* non digit |
| 1011 |
*/ |
| 1012 |
WIRE_INVALID(0x01, '+', '6', '1', '2', '0', '0', '0'), |
| 1013 |
/* |
| 1014 |
* Sentinel. |
| 1015 |
*/ |
| 1016 |
WIRE_SENTINEL() |
| 1017 |
}; |
| 1018 |
|
| 1019 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 1020 |
dns_rdatatype_atma, sizeof(dns_rdata_in_atma_t)); |
| 1021 |
} |
| 1022 |
|
| 1023 |
/* AMTRELAY RDATA manipulations */ |
| 1024 |
ISC_RUN_TEST_IMPL(amtrelay) { |
| 1025 |
text_ok_t text_ok[] = { |
| 1026 |
TEXT_INVALID(""), TEXT_INVALID("0"), TEXT_INVALID("0 0"), |
| 1027 |
/* gateway type 0 */ |
| 1028 |
TEXT_VALID("0 0 0"), TEXT_VALID("0 1 0"), |
| 1029 |
TEXT_INVALID("0 2 0"), /* discovery out of range */ |
| 1030 |
TEXT_VALID("255 1 0"), /* max precedence */ |
| 1031 |
TEXT_INVALID("256 1 0"), /* precedence out of range */ |
| 1032 |
|
| 1033 |
/* IPv4 gateway */ |
| 1034 |
TEXT_INVALID("0 0 1"), /* no address */ |
| 1035 |
TEXT_VALID("0 0 1 0.0.0.0"), |
| 1036 |
TEXT_INVALID("0 0 1 0.0.0.0 x"), /* extra */ |
| 1037 |
TEXT_INVALID("0 0 1 0.0.0.0.0"), /* bad address */ |
| 1038 |
TEXT_INVALID("0 0 1 ::"), /* bad address */ |
| 1039 |
TEXT_INVALID("0 0 1 ."), /* bad address */ |
| 1040 |
|
| 1041 |
/* IPv6 gateway */ |
| 1042 |
TEXT_INVALID("0 0 2"), /* no address */ |
| 1043 |
TEXT_VALID("0 0 2 ::"), TEXT_INVALID("0 0 2 :: xx"), /* extra */ |
| 1044 |
TEXT_INVALID("0 0 2 0.0.0.0"), /* bad address */ |
| 1045 |
TEXT_INVALID("0 0 2 ."), /* bad address */ |
| 1046 |
|
| 1047 |
/* hostname gateway */ |
| 1048 |
TEXT_INVALID("0 0 3"), /* no name */ |
| 1049 |
/* IPv4 is a valid name */ |
| 1050 |
TEXT_VALID_CHANGED("0 0 3 0.0.0.0", "0 0 3 0.0.0.0."), |
| 1051 |
/* IPv6 is a valid name */ |
| 1052 |
TEXT_VALID_CHANGED("0 0 3 ::", "0 0 3 ::."), |
| 1053 |
TEXT_VALID_CHANGED("0 0 3 example", "0 0 3 example."), |
| 1054 |
TEXT_VALID("0 0 3 example."), |
| 1055 |
TEXT_INVALID("0 0 3 example. x"), /* extra */ |
| 1056 |
|
| 1057 |
/* unknown gateway */ |
| 1058 |
TEXT_VALID("\\# 2 0004"), TEXT_VALID("\\# 2 0084"), |
| 1059 |
TEXT_VALID("\\# 2 007F"), TEXT_VALID("\\# 3 000400"), |
| 1060 |
TEXT_VALID("\\# 3 008400"), TEXT_VALID("\\# 3 00FF00"), |
| 1061 |
|
| 1062 |
/* |
| 1063 |
* Sentinel. |
| 1064 |
*/ |
| 1065 |
TEXT_SENTINEL() |
| 1066 |
}; |
| 1067 |
wire_ok_t wire_ok[] = { |
| 1068 |
WIRE_INVALID(0x00), WIRE_VALID(0x00, 0x00), |
| 1069 |
WIRE_VALID(0x00, 0x80), WIRE_INVALID(0x00, 0x00, 0x00), |
| 1070 |
WIRE_INVALID(0x00, 0x80, 0x00), |
| 1071 |
|
| 1072 |
WIRE_INVALID(0x00, 0x01), WIRE_INVALID(0x00, 0x01, 0x00), |
| 1073 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00), |
| 1074 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x00), |
| 1075 |
WIRE_VALID(0x00, 0x01, 0x00, 0x00, 0x00, 0x00), |
| 1076 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1077 |
|
| 1078 |
WIRE_INVALID(0x00, 0x02), WIRE_INVALID(0x00, 0x02, 0x00), |
| 1079 |
WIRE_VALID(0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, |
| 1080 |
0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, |
| 1081 |
0x15), |
| 1082 |
WIRE_INVALID(0x00, 0x02, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, |
| 1083 |
0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, |
| 1084 |
0x14, 0x15, 0x16), |
| 1085 |
|
| 1086 |
WIRE_INVALID(0x00, 0x03), WIRE_VALID(0x00, 0x03, 0x00), |
| 1087 |
WIRE_INVALID(0x00, 0x03, 0x00, 0x00), /* extra */ |
| 1088 |
|
| 1089 |
WIRE_VALID(0x00, 0x04), WIRE_VALID(0x00, 0x04, 0x00), |
| 1090 |
/* |
| 1091 |
* Sentinel. |
| 1092 |
*/ |
| 1093 |
WIRE_SENTINEL() |
| 1094 |
}; |
| 1095 |
|
| 1096 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 1097 |
dns_rdatatype_amtrelay, sizeof(dns_rdata_amtrelay_t)); |
| 1098 |
} |
| 1099 |
|
| 1100 |
ISC_RUN_TEST_IMPL(cdnskey) { |
| 1101 |
key_required(state, dns_rdatatype_cdnskey, sizeof(dns_rdata_cdnskey_t)); |
| 1102 |
} |
| 1103 |
|
| 1104 |
/* |
| 1105 |
* CSYNC tests. |
| 1106 |
* |
| 1107 |
* RFC 7477: |
| 1108 |
* |
| 1109 |
* 2.1. The CSYNC Resource Record Format |
| 1110 |
* |
| 1111 |
* 2.1.1. The CSYNC Resource Record Wire Format |
| 1112 |
* |
| 1113 |
* The CSYNC RDATA consists of the following fields: |
| 1114 |
* |
| 1115 |
* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 |
| 1116 |
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 1117 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1118 |
* | SOA Serial | |
| 1119 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1120 |
* | Flags | Type Bit Map / |
| 1121 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1122 |
* / Type Bit Map (continued) / |
| 1123 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1124 |
* |
| 1125 |
* 2.1.1.1. The SOA Serial Field |
| 1126 |
* |
| 1127 |
* The SOA Serial field contains a copy of the 32-bit SOA serial number |
| 1128 |
* from the child zone. If the soaminimum flag is set, parental agents |
| 1129 |
* querying children's authoritative servers MUST NOT act on data from |
| 1130 |
* zones advertising an SOA serial number less than this value. See |
| 1131 |
* [RFC1982] for properly implementing "less than" logic. If the |
| 1132 |
* soaminimum flag is not set, parental agents MUST ignore the value in |
| 1133 |
* the SOA Serial field. Clients can set the field to any value if the |
| 1134 |
* soaminimum flag is unset, such as the number zero. |
| 1135 |
* |
| 1136 |
* (...) |
| 1137 |
* |
| 1138 |
* 2.1.1.2. The Flags Field |
| 1139 |
* |
| 1140 |
* The Flags field contains 16 bits of boolean flags that define |
| 1141 |
* operations that affect the processing of the CSYNC record. The flags |
| 1142 |
* defined in this document are as follows: |
| 1143 |
* |
| 1144 |
* 0x00 0x01: "immediate" |
| 1145 |
* |
| 1146 |
* 0x00 0x02: "soaminimum" |
| 1147 |
* |
| 1148 |
* The definitions for how the flags are to be used can be found in |
| 1149 |
* Section 3. |
| 1150 |
* |
| 1151 |
* The remaining flags are reserved for use by future specifications. |
| 1152 |
* Undefined flags MUST be set to 0 by CSYNC publishers. Parental |
| 1153 |
* agents MUST NOT process a CSYNC record if it contains a 1 value for a |
| 1154 |
* flag that is unknown to or unsupported by the parental agent. |
| 1155 |
* |
| 1156 |
* 2.1.1.2.1. The Type Bit Map Field |
| 1157 |
* |
| 1158 |
* The Type Bit Map field indicates the record types to be processed by |
| 1159 |
* the parental agent, according to the procedures in Section 3. The |
| 1160 |
* Type Bit Map field is encoded in the same way as the Type Bit Map |
| 1161 |
* field of the NSEC record, described in [RFC4034], Section 4.1.2. If |
| 1162 |
* a bit has been set that a parental agent implementation does not |
| 1163 |
* understand, the parental agent MUST NOT act upon the record. |
| 1164 |
* Specifically, a parental agent must not simply copy the data, and it |
| 1165 |
* must understand the semantics associated with a bit in the Type Bit |
| 1166 |
* Map field that has been set to 1. |
| 1167 |
*/ |
| 1168 |
ISC_RUN_TEST_IMPL(csync) { |
| 1169 |
text_ok_t text_ok[] = { TEXT_INVALID(""), |
| 1170 |
TEXT_INVALID("0"), |
| 1171 |
TEXT_VALID("0 0"), |
| 1172 |
TEXT_VALID("0 0 A"), |
| 1173 |
TEXT_VALID("0 0 NS"), |
| 1174 |
TEXT_VALID("0 0 AAAA"), |
| 1175 |
TEXT_VALID("0 0 A AAAA"), |
| 1176 |
TEXT_VALID("0 0 A NS AAAA"), |
| 1177 |
TEXT_INVALID("0 0 A NS AAAA BOGUS"), |
| 1178 |
TEXT_SENTINEL() }; |
| 1179 |
wire_ok_t wire_ok[] = { |
| 1180 |
/* |
| 1181 |
* Short. |
| 1182 |
*/ |
| 1183 |
WIRE_INVALID(0x00), |
| 1184 |
/* |
| 1185 |
* Short. |
| 1186 |
*/ |
| 1187 |
WIRE_INVALID(0x00, 0x00), |
| 1188 |
/* |
| 1189 |
* Short. |
| 1190 |
*/ |
| 1191 |
WIRE_INVALID(0x00, 0x00, 0x00), |
| 1192 |
/* |
| 1193 |
* Short. |
| 1194 |
*/ |
| 1195 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00), |
| 1196 |
/* |
| 1197 |
* Short. |
| 1198 |
*/ |
| 1199 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x00), |
| 1200 |
/* |
| 1201 |
* Serial + flags only. |
| 1202 |
*/ |
| 1203 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1204 |
/* |
| 1205 |
* Bad type map. |
| 1206 |
*/ |
| 1207 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1208 |
/* |
| 1209 |
* Bad type map. |
| 1210 |
*/ |
| 1211 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1212 |
/* |
| 1213 |
* Good type map. |
| 1214 |
*/ |
| 1215 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 1216 |
0x02), |
| 1217 |
/* |
| 1218 |
* Sentinel. |
| 1219 |
*/ |
| 1220 |
WIRE_SENTINEL() |
| 1221 |
}; |
| 1222 |
|
| 1223 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 1224 |
dns_rdatatype_csync, sizeof(dns_rdata_csync_t)); |
| 1225 |
} |
| 1226 |
|
| 1227 |
ISC_RUN_TEST_IMPL(dnskey) { |
| 1228 |
key_required(state, dns_rdatatype_dnskey, sizeof(dns_rdata_dnskey_t)); |
| 1229 |
} |
| 1230 |
|
| 1231 |
/* |
| 1232 |
* DOA tests. |
| 1233 |
* |
| 1234 |
* draft-durand-doa-over-dns-03: |
| 1235 |
* |
| 1236 |
* 3.2. DOA RDATA Wire Format |
| 1237 |
* |
| 1238 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1239 |
* 0: | | |
| 1240 |
* | DOA-ENTERPRISE | |
| 1241 |
* | | |
| 1242 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1243 |
* 4: | | |
| 1244 |
* | DOA-TYPE | |
| 1245 |
* | | |
| 1246 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1247 |
* 8: | DOA-LOCATION | DOA-MEDIA-TYPE / |
| 1248 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1249 |
* 10: / / |
| 1250 |
* / DOA-MEDIA-TYPE (continued) / |
| 1251 |
* / / |
| 1252 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1253 |
* / / |
| 1254 |
* / DOA-DATA / |
| 1255 |
* / / |
| 1256 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1257 |
* |
| 1258 |
* DOA-ENTERPRISE: a 32-bit unsigned integer in network order. |
| 1259 |
* |
| 1260 |
* DOA-TYPE: a 32-bit unsigned integer in network order. |
| 1261 |
* |
| 1262 |
* DOA-LOCATION: an 8-bit unsigned integer. |
| 1263 |
* |
| 1264 |
* DOA-MEDIA-TYPE: A <character-string> (see [RFC1035]). The first |
| 1265 |
* octet of the <character-string> contains the number of characters to |
| 1266 |
* follow. |
| 1267 |
* |
| 1268 |
* DOA-DATA: A variable length blob of binary data. The length of the |
| 1269 |
* DOA-DATA is not contained within the wire format of the RR and has to |
| 1270 |
* be computed from the RDLENGTH of the entire RR once other fields have |
| 1271 |
* been taken into account. |
| 1272 |
* |
| 1273 |
* 3.3. DOA RDATA Presentation Format |
| 1274 |
* |
| 1275 |
* The DOA-ENTERPRISE field is presented as an unsigned 32-bit decimal |
| 1276 |
* integer with range 0 - 4,294,967,295. |
| 1277 |
* |
| 1278 |
* The DOA-TYPE field is presented as an unsigned 32-bit decimal integer |
| 1279 |
* with range 0 - 4,294,967,295. |
| 1280 |
* |
| 1281 |
* The DOA-LOCATION field is presented as an unsigned 8-bit decimal |
| 1282 |
* integer with range 0 - 255. |
| 1283 |
* |
| 1284 |
* The DOA-MEDIA-TYPE field is presented as a single <character-string>. |
| 1285 |
* |
| 1286 |
* The DOA-DATA is presented as Base64 encoded data [RFC4648] unless the |
| 1287 |
* DOA-DATA is empty in which case it is presented as a single dash |
| 1288 |
* character ("-", ASCII 45). White space is permitted within Base64 |
| 1289 |
* data. |
| 1290 |
*/ |
| 1291 |
ISC_RUN_TEST_IMPL(doa) { |
| 1292 |
text_ok_t text_ok[] = { |
| 1293 |
/* |
| 1294 |
* Valid, non-empty DOA-DATA. |
| 1295 |
*/ |
| 1296 |
TEXT_VALID("0 0 1 \"text/plain\" Zm9v"), |
| 1297 |
/* |
| 1298 |
* Valid, non-empty DOA-DATA with whitespace in between. |
| 1299 |
*/ |
| 1300 |
TEXT_VALID_CHANGED("0 0 1 \"text/plain\" Zm 9v", "0 0 1 " |
| 1301 |
"\"text/" |
| 1302 |
"plain\" " |
| 1303 |
"Zm9v"), |
| 1304 |
/* |
| 1305 |
* Valid, unquoted DOA-MEDIA-TYPE, non-empty DOA-DATA. |
| 1306 |
*/ |
| 1307 |
TEXT_VALID_CHANGED("0 0 1 text/plain Zm9v", "0 0 1 " |
| 1308 |
"\"text/plain\" " |
| 1309 |
"Zm9v"), |
| 1310 |
/* |
| 1311 |
* Invalid, quoted non-empty DOA-DATA. |
| 1312 |
*/ |
| 1313 |
TEXT_INVALID("0 0 1 \"text/plain\" \"Zm9v\""), |
| 1314 |
/* |
| 1315 |
* Valid, empty DOA-DATA. |
| 1316 |
*/ |
| 1317 |
TEXT_VALID("0 0 1 \"text/plain\" -"), |
| 1318 |
/* |
| 1319 |
* Invalid, quoted empty DOA-DATA. |
| 1320 |
*/ |
| 1321 |
TEXT_INVALID("0 0 1 \"text/plain\" \"-\""), |
| 1322 |
/* |
| 1323 |
* Invalid, missing "-" in empty DOA-DATA. |
| 1324 |
*/ |
| 1325 |
TEXT_INVALID("0 0 1 \"text/plain\""), |
| 1326 |
/* |
| 1327 |
* Valid, undefined DOA-LOCATION. |
| 1328 |
*/ |
| 1329 |
TEXT_VALID("0 0 100 \"text/plain\" Zm9v"), |
| 1330 |
/* |
| 1331 |
* Invalid, DOA-LOCATION too big. |
| 1332 |
*/ |
| 1333 |
TEXT_INVALID("0 0 256 \"text/plain\" ZM9v"), |
| 1334 |
/* |
| 1335 |
* Valid, empty DOA-MEDIA-TYPE, non-empty DOA-DATA. |
| 1336 |
*/ |
| 1337 |
TEXT_VALID("0 0 2 \"\" aHR0cHM6Ly93d3cuaXNjLm9yZy8="), |
| 1338 |
/* |
| 1339 |
* Valid, empty DOA-MEDIA-TYPE, empty DOA-DATA. |
| 1340 |
*/ |
| 1341 |
TEXT_VALID("0 0 1 \"\" -"), |
| 1342 |
/* |
| 1343 |
* Valid, DOA-MEDIA-TYPE with a space. |
| 1344 |
*/ |
| 1345 |
TEXT_VALID("0 0 1 \"plain text\" Zm9v"), |
| 1346 |
/* |
| 1347 |
* Invalid, missing DOA-MEDIA-TYPE. |
| 1348 |
*/ |
| 1349 |
TEXT_INVALID("1234567890 1234567890 1"), |
| 1350 |
/* |
| 1351 |
* Valid, DOA-DATA over 255 octets. |
| 1352 |
*/ |
| 1353 |
TEXT_VALID("1234567890 1234567890 1 \"image/gif\" " |
| 1354 |
"R0lGODlhKAAZAOMCAGZmZgBmmf///zOZzMz//5nM/zNmmWbM" |
| 1355 |
"/5nMzMzMzACZ/////////////////////yH5BAEKAA8ALAAA" |
| 1356 |
"AAAoABkAAATH8IFJK5U2a4337F5ogRkpnoCJrly7PrCKyh8c" |
| 1357 |
"3HgAhzT35MDbbtO7/IJIHbGiOiaTxVTpSVWWLqNq1UVyapNS" |
| 1358 |
"1wd3OAxug0LhnCubcVhsxysQnOt4ATpvvzHlFzl1AwODhWeF" |
| 1359 |
"AgRpen5/UhheAYMFdUB4SFcpGEGGdQeCAqBBLTuSk30EeXd9" |
| 1360 |
"pEsAbKGxjHqDSE0Sp6ixN4N1BJmbc7lIhmsBich1awPAjkY1" |
| 1361 |
"SZR8bJWrz382SGqIBQQFQd4IsUTaX+ceuudPEQA7"), |
| 1362 |
/* |
| 1363 |
* Invalid, bad Base64 in DOA-DATA. |
| 1364 |
*/ |
| 1365 |
TEXT_INVALID("1234567890 1234567890 1 \"image/gif\" R0lGODl"), |
| 1366 |
/* |
| 1367 |
* Sentinel. |
| 1368 |
*/ |
| 1369 |
TEXT_SENTINEL() |
| 1370 |
}; |
| 1371 |
wire_ok_t wire_ok[] = { |
| 1372 |
/* |
| 1373 |
* Valid, empty DOA-MEDIA-TYPE, empty DOA-DATA. |
| 1374 |
*/ |
| 1375 |
WIRE_VALID(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0x01, |
| 1376 |
0x00), |
| 1377 |
/* |
| 1378 |
* Invalid, missing DOA-MEDIA-TYPE. |
| 1379 |
*/ |
| 1380 |
WIRE_INVALID(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, |
| 1381 |
0x01), |
| 1382 |
/* |
| 1383 |
* Invalid, malformed DOA-MEDIA-TYPE length. |
| 1384 |
*/ |
| 1385 |
WIRE_INVALID(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, |
| 1386 |
0x01, 0xff), |
| 1387 |
/* |
| 1388 |
* Valid, empty DOA-DATA. |
| 1389 |
*/ |
| 1390 |
WIRE_VALID(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0x01, |
| 1391 |
0x03, 0x66, 0x6f, 0x6f), |
| 1392 |
/* |
| 1393 |
* Valid, non-empty DOA-DATA. |
| 1394 |
*/ |
| 1395 |
WIRE_VALID(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0x01, |
| 1396 |
0x03, 0x66, 0x6f, 0x6f, 0x62, 0x61, 0x72), |
| 1397 |
/* |
| 1398 |
* Valid, DOA-DATA over 255 octets. |
| 1399 |
*/ |
| 1400 |
WIRE_VALID(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78, 0x01, |
| 1401 |
0x06, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x00, 0x66, |
| 1402 |
0x99, 0xff, 0xff, 0xff, 0x33, 0x99, 0xcc, 0xcc, 0xff, |
| 1403 |
0xff, 0x99, 0xcc, 0xff, 0x33, 0x66, 0x99, 0x66, 0xcc, |
| 1404 |
0xff, 0x99, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x99, |
| 1405 |
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 1406 |
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x21, 0xf9, |
| 1407 |
0x04, 0x01, 0x0a, 0x00, 0x0f, 0x00, 0x2c, 0x00, 0x00, |
| 1408 |
0x00, 0x00, 0x28, 0x00, 0x19, 0x00, 0x00, 0x04, 0xc7, |
| 1409 |
0xf0, 0x81, 0x49, 0x2b, 0x95, 0x36, 0x6b, 0x8d, 0xf7, |
| 1410 |
0xec, 0x5e, 0x68, 0x81, 0x19, 0x29, 0x9e, 0x80, 0x89, |
| 1411 |
0xae, 0x5c, 0xbb, 0x3e, 0xb0, 0x8a, 0xca, 0x1f, 0x1c, |
| 1412 |
0xdc, 0x78, 0x00, 0x87, 0x34, 0xf7, 0xe4, 0xc0, 0xdb, |
| 1413 |
0x6e, 0xd3, 0xbb, 0xfc, 0x82, 0x48, 0x1d, 0xb1, 0xa2, |
| 1414 |
0x3a, 0x26, 0x93, 0xc5, 0x54, 0xe9, 0x49, 0x55, 0x96, |
| 1415 |
0x2e, 0xa3, 0x6a, 0xd5, 0x45, 0x72, 0x6a, 0x93, 0x52, |
| 1416 |
0xd7, 0x07, 0x77, 0x38, 0x0c, 0x6e, 0x83, 0x42, 0xe1, |
| 1417 |
0x9c, 0x2b, 0x9b, 0x71, 0x58, 0x6c, 0xc7, 0x2b, 0x10, |
| 1418 |
0x9c, 0xeb, 0x78, 0x01, 0x3a, 0x6f, 0xbf, 0x31, 0xe5, |
| 1419 |
0x17, 0x39, 0x75, 0x03, 0x03, 0x83, 0x85, 0x67, 0x85, |
| 1420 |
0x02, 0x04, 0x69, 0x7a, 0x7e, 0x7f, 0x52, 0x18, 0x5e, |
| 1421 |
0x01, 0x83, 0x05, 0x75, 0x40, 0x78, 0x48, 0x57, 0x29, |
| 1422 |
0x18, 0x41, 0x86, 0x75, 0x07, 0x82, 0x02, 0xa0, 0x41, |
| 1423 |
0x2d, 0x3b, 0x92, 0x93, 0x7d, 0x04, 0x79, 0x77, 0x7d, |
| 1424 |
0xa4, 0x4b, 0x00, 0x6c, 0xa1, 0xb1, 0x8c, 0x7a, 0x83, |
| 1425 |
0x48, 0x4d, 0x12, 0xa7, 0xa8, 0xb1, 0x37, 0x83, 0x75, |
| 1426 |
0x04, 0x99, 0x9b, 0x73, 0xb9, 0x48, 0x86, 0x6b, 0x01, |
| 1427 |
0x89, 0xc8, 0x75, 0x6b, 0x03, 0xc0, 0x8e, 0x46, 0x35, |
| 1428 |
0x49, 0x94, 0x7c, 0x6c, 0x95, 0xab, 0xcf, 0x7f, 0x36, |
| 1429 |
0x48, 0x6a, 0x88, 0x05, 0x04, 0x05, 0x41, 0xde, 0x08, |
| 1430 |
0xb1, 0x44, 0xda, 0x5f, 0xe7, 0x1e, 0xba, 0xe7, 0x4f, |
| 1431 |
0x11, 0x00, 0x3b), |
| 1432 |
/* |
| 1433 |
* Sentinel. |
| 1434 |
*/ |
| 1435 |
WIRE_SENTINEL() |
| 1436 |
}; |
| 1437 |
|
| 1438 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 1439 |
dns_rdatatype_doa, sizeof(dns_rdata_doa_t)); |
| 1440 |
} |
| 1441 |
|
| 1442 |
/* |
| 1443 |
* DS tests. |
| 1444 |
* |
| 1445 |
* RFC 4034: |
| 1446 |
* |
| 1447 |
* 5.1. DS RDATA Wire Format |
| 1448 |
* |
| 1449 |
* The RDATA for a DS RR consists of a 2 octet Key Tag field, a 1 octet |
| 1450 |
* Algorithm field, a 1 octet Digest Type field, and a Digest field. |
| 1451 |
* |
| 1452 |
* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 |
| 1453 |
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 1454 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1455 |
* | Key Tag | Algorithm | Digest Type | |
| 1456 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1457 |
* / / |
| 1458 |
* / Digest / |
| 1459 |
* / / |
| 1460 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 1461 |
* |
| 1462 |
* 5.1.1. The Key Tag Field |
| 1463 |
* |
| 1464 |
* The Key Tag field lists the key tag of the DNSKEY RR referred to by |
| 1465 |
* the DS record, in network byte order. |
| 1466 |
* |
| 1467 |
* The Key Tag used by the DS RR is identical to the Key Tag used by |
| 1468 |
* RRSIG RRs. Appendix B describes how to compute a Key Tag. |
| 1469 |
* |
| 1470 |
* 5.1.2. The Algorithm Field |
| 1471 |
* |
| 1472 |
* The Algorithm field lists the algorithm number of the DNSKEY RR |
| 1473 |
* referred to by the DS record. |
| 1474 |
* |
| 1475 |
* The algorithm number used by the DS RR is identical to the algorithm |
| 1476 |
* number used by RRSIG and DNSKEY RRs. Appendix A.1 lists the |
| 1477 |
* algorithm number types. |
| 1478 |
* |
| 1479 |
* 5.1.3. The Digest Type Field |
| 1480 |
* |
| 1481 |
* The DS RR refers to a DNSKEY RR by including a digest of that DNSKEY |
| 1482 |
* RR. The Digest Type field identifies the algorithm used to construct |
| 1483 |
* the digest. Appendix A.2 lists the possible digest algorithm types. |
| 1484 |
* |
| 1485 |
* 5.1.4. The Digest Field |
| 1486 |
* |
| 1487 |
* The DS record refers to a DNSKEY RR by including a digest of that |
| 1488 |
* DNSKEY RR. |
| 1489 |
* |
| 1490 |
* The digest is calculated by concatenating the canonical form of the |
| 1491 |
* fully qualified owner name of the DNSKEY RR with the DNSKEY RDATA, |
| 1492 |
* and then applying the digest algorithm. |
| 1493 |
* |
| 1494 |
* digest = digest_algorithm( DNSKEY owner name | DNSKEY RDATA); |
| 1495 |
* |
| 1496 |
* "|" denotes concatenation |
| 1497 |
* |
| 1498 |
* DNSKEY RDATA = Flags | Protocol | Algorithm | Public Key. |
| 1499 |
* |
| 1500 |
* The size of the digest may vary depending on the digest algorithm and |
| 1501 |
* DNSKEY RR size. As of the time of this writing, the only defined |
| 1502 |
* digest algorithm is SHA-1, which produces a 20 octet digest. |
| 1503 |
*/ |
| 1504 |
ISC_RUN_TEST_IMPL(ds) { |
| 1505 |
text_ok_t text_ok[] = { |
| 1506 |
/* |
| 1507 |
* Invalid, empty record. |
| 1508 |
*/ |
| 1509 |
TEXT_INVALID(""), |
| 1510 |
/* |
| 1511 |
* Invalid, no algorithm. |
| 1512 |
*/ |
| 1513 |
TEXT_INVALID("0"), |
| 1514 |
/* |
| 1515 |
* Invalid, no digest type. |
| 1516 |
*/ |
| 1517 |
TEXT_INVALID("0 0"), |
| 1518 |
/* |
| 1519 |
* Invalid, no digest. |
| 1520 |
*/ |
| 1521 |
TEXT_INVALID("0 0 0"), |
| 1522 |
/* |
| 1523 |
* Valid, 1-octet digest for a reserved digest type. |
| 1524 |
*/ |
| 1525 |
TEXT_VALID("0 0 0 00"), |
| 1526 |
/* |
| 1527 |
* Invalid, short SHA-1 digest. |
| 1528 |
*/ |
| 1529 |
TEXT_INVALID("0 0 1 00"), |
| 1530 |
TEXT_INVALID("0 0 1 4FDCE83016EDD29077621FE568F8DADDB5809B"), |
| 1531 |
/* |
| 1532 |
* Valid, 20-octet SHA-1 digest. |
| 1533 |
*/ |
| 1534 |
TEXT_VALID("0 0 1 4FDCE83016EDD29077621FE568F8DADDB5809B6A"), |
| 1535 |
/* |
| 1536 |
* Invalid, excessively long SHA-1 digest. |
| 1537 |
*/ |
| 1538 |
TEXT_INVALID("0 0 1 4FDCE83016EDD29077621FE568F8DADDB5809B" |
| 1539 |
"6A00"), |
| 1540 |
/* |
| 1541 |
* Invalid, short SHA-256 digest. |
| 1542 |
*/ |
| 1543 |
TEXT_INVALID("0 0 2 00"), |
| 1544 |
TEXT_INVALID("0 0 2 D001BD422FFDA9B745425B71DC17D007E69186" |
| 1545 |
"9BD59C5F237D9BF85434C313"), |
| 1546 |
/* |
| 1547 |
* Valid, 32-octet SHA-256 digest. |
| 1548 |
*/ |
| 1549 |
TEXT_VALID_CHANGED("0 0 2 " |
| 1550 |
"D001BD422FFDA9B745425B71DC17D007E691869B" |
| 1551 |
"D59C5F237D9BF85434C3133F", |
| 1552 |
"0 0 2 " |
| 1553 |
"D001BD422FFDA9B745425B71DC17D007E691869B" |
| 1554 |
"D59C5F237D9BF854 34C3133F"), |
| 1555 |
/* |
| 1556 |
* Invalid, excessively long SHA-256 digest. |
| 1557 |
*/ |
| 1558 |
TEXT_INVALID("0 0 2 D001BD422FFDA9B745425B71DC17D007E69186" |
| 1559 |
"9BD59C5F237D9BF85434C3133F00"), |
| 1560 |
/* |
| 1561 |
* Valid, GOST is no longer supported, hence no length checks. |
| 1562 |
*/ |
| 1563 |
TEXT_VALID("0 0 3 00"), |
| 1564 |
/* |
| 1565 |
* Invalid, short SHA-384 digest. |
| 1566 |
*/ |
| 1567 |
TEXT_INVALID("0 0 4 00"), |
| 1568 |
TEXT_INVALID("0 0 4 AC748D6C5AA652904A8763D64B7DFFFFA98152" |
| 1569 |
"BE12128D238BEBB4814B648F5A841E15CAA2DE348891" |
| 1570 |
"A37A699F65E5"), |
| 1571 |
/* |
| 1572 |
* Valid, 48-octet SHA-384 digest. |
| 1573 |
*/ |
| 1574 |
TEXT_VALID_CHANGED("0 0 4 " |
| 1575 |
"AC748D6C5AA652904A8763D64B7DFFFFA98152BE" |
| 1576 |
"12128D238BEBB4814B648F5A841E15CAA2DE348891A" |
| 1577 |
"37A" |
| 1578 |
"699F65E54D", |
| 1579 |
"0 0 4 " |
| 1580 |
"AC748D6C5AA652904A8763D64B7DFFFFA98152BE" |
| 1581 |
"12128D238BEBB481 " |
| 1582 |
"4B648F5A841E15CAA2DE348891A37A" |
| 1583 |
"699F65E54D"), |
| 1584 |
/* |
| 1585 |
* Invalid, excessively long SHA-384 digest. |
| 1586 |
*/ |
| 1587 |
TEXT_INVALID("0 0 4 AC748D6C5AA652904A8763D64B7DFFFFA98152" |
| 1588 |
"BE12128D238BEBB4814B648F5A841E15CAA2DE348891" |
| 1589 |
"A37A699F65E54D00"), |
| 1590 |
/* |
| 1591 |
* Valid, 1-octet digest for an unassigned digest type. |
| 1592 |
*/ |
| 1593 |
TEXT_VALID("0 0 5 00"), |
| 1594 |
/* |
| 1595 |
* Sentinel. |
| 1596 |
*/ |
| 1597 |
TEXT_SENTINEL() |
| 1598 |
}; |
| 1599 |
wire_ok_t wire_ok[] = { |
| 1600 |
/* |
| 1601 |
* Invalid, truncated key tag. |
| 1602 |
*/ |
| 1603 |
WIRE_INVALID(0x00), |
| 1604 |
/* |
| 1605 |
* Invalid, no algorithm. |
| 1606 |
*/ |
| 1607 |
WIRE_INVALID(0x00, 0x00), |
| 1608 |
/* |
| 1609 |
* Invalid, no digest type. |
| 1610 |
*/ |
| 1611 |
WIRE_INVALID(0x00, 0x00, 0x00), |
| 1612 |
/* |
| 1613 |
* Invalid, no digest. |
| 1614 |
*/ |
| 1615 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00), |
| 1616 |
/* |
| 1617 |
* Valid, 1-octet digest for a reserved digest type. |
| 1618 |
*/ |
| 1619 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00), |
| 1620 |
/* |
| 1621 |
* Invalid, short SHA-1 digest. |
| 1622 |
*/ |
| 1623 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x01, 0x00), |
| 1624 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x01, 0x4F, 0xDC, 0xE8, 0x30, |
| 1625 |
0x16, 0xED, 0xD2, 0x90, 0x77, 0x62, 0x1F, 0xE5, |
| 1626 |
0x68, 0xF8, 0xDA, 0xDD, 0xB5, 0x80, 0x9B), |
| 1627 |
/* |
| 1628 |
* Valid, 20-octet SHA-1 digest. |
| 1629 |
*/ |
| 1630 |
WIRE_VALID(0x00, 0x00, 0x00, 0x01, 0x4F, 0xDC, 0xE8, 0x30, 0x16, |
| 1631 |
0xED, 0xD2, 0x90, 0x77, 0x62, 0x1F, 0xE5, 0x68, 0xF8, |
| 1632 |
0xDA, 0xDD, 0xB5, 0x80, 0x9B, 0x6A), |
| 1633 |
/* |
| 1634 |
* Invalid, excessively long SHA-1 digest. |
| 1635 |
*/ |
| 1636 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x01, 0x4F, 0xDC, 0xE8, 0x30, |
| 1637 |
0x16, 0xED, 0xD2, 0x90, 0x77, 0x62, 0x1F, 0xE5, |
| 1638 |
0x68, 0xF8, 0xDA, 0xDD, 0xB5, 0x80, 0x9B, 0x6A, |
| 1639 |
0x00), |
| 1640 |
/* |
| 1641 |
* Invalid, short SHA-256 digest. |
| 1642 |
*/ |
| 1643 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x02, 0x00), |
| 1644 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x02, 0xD0, 0x01, 0xBD, 0x42, |
| 1645 |
0x2F, 0xFD, 0xA9, 0xB7, 0x45, 0x42, 0x5B, 0x71, |
| 1646 |
0xDC, 0x17, 0xD0, 0x07, 0xE6, 0x91, 0x86, 0x9B, |
| 1647 |
0xD5, 0x9C, 0x5F, 0x23, 0x7D, 0x9B, 0xF8, 0x54, |
| 1648 |
0x34, 0xC3, 0x13), |
| 1649 |
/* |
| 1650 |
* Valid, 32-octet SHA-256 digest. |
| 1651 |
*/ |
| 1652 |
WIRE_VALID(0x00, 0x00, 0x00, 0x02, 0xD0, 0x01, 0xBD, 0x42, 0x2F, |
| 1653 |
0xFD, 0xA9, 0xB7, 0x45, 0x42, 0x5B, 0x71, 0xDC, 0x17, |
| 1654 |
0xD0, 0x07, 0xE6, 0x91, 0x86, 0x9B, 0xD5, 0x9C, 0x5F, |
| 1655 |
0x23, 0x7D, 0x9B, 0xF8, 0x54, 0x34, 0xC3, 0x13, |
| 1656 |
0x3F), |
| 1657 |
/* |
| 1658 |
* Invalid, excessively long SHA-256 digest. |
| 1659 |
*/ |
| 1660 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x02, 0xD0, 0x01, 0xBD, 0x42, |
| 1661 |
0x2F, 0xFD, 0xA9, 0xB7, 0x45, 0x42, 0x5B, 0x71, |
| 1662 |
0xDC, 0x17, 0xD0, 0x07, 0xE6, 0x91, 0x86, 0x9B, |
| 1663 |
0xD5, 0x9C, 0x5F, 0x23, 0x7D, 0x9B, 0xF8, 0x54, |
| 1664 |
0x34, 0xC3, 0x13, 0x3F, 0x00), |
| 1665 |
/* |
| 1666 |
* Valid, GOST is no longer supported, hence no length checks. |
| 1667 |
*/ |
| 1668 |
WIRE_VALID(0x00, 0x00, 0x00, 0x03, 0x00), |
| 1669 |
/* |
| 1670 |
* Invalid, short SHA-384 digest. |
| 1671 |
*/ |
| 1672 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x04, 0x00), |
| 1673 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x04, 0xAC, 0x74, 0x8D, 0x6C, |
| 1674 |
0x5A, 0xA6, 0x52, 0x90, 0x4A, 0x87, 0x63, 0xD6, |
| 1675 |
0x4B, 0x7D, 0xFF, 0xFF, 0xA9, 0x81, 0x52, 0xBE, |
| 1676 |
0x12, 0x12, 0x8D, 0x23, 0x8B, 0xEB, 0xB4, 0x81, |
| 1677 |
0x4B, 0x64, 0x8F, 0x5A, 0x84, 0x1E, 0x15, 0xCA, |
| 1678 |
0xA2, 0xDE, 0x34, 0x88, 0x91, 0xA3, 0x7A, 0x69, |
| 1679 |
0x9F, 0x65, 0xE5), |
| 1680 |
/* |
| 1681 |
* Valid, 48-octet SHA-384 digest. |
| 1682 |
*/ |
| 1683 |
WIRE_VALID(0x00, 0x00, 0x00, 0x04, 0xAC, 0x74, 0x8D, 0x6C, 0x5A, |
| 1684 |
0xA6, 0x52, 0x90, 0x4A, 0x87, 0x63, 0xD6, 0x4B, 0x7D, |
| 1685 |
0xFF, 0xFF, 0xA9, 0x81, 0x52, 0xBE, 0x12, 0x12, 0x8D, |
| 1686 |
0x23, 0x8B, 0xEB, 0xB4, 0x81, 0x4B, 0x64, 0x8F, 0x5A, |
| 1687 |
0x84, 0x1E, 0x15, 0xCA, 0xA2, 0xDE, 0x34, 0x88, 0x91, |
| 1688 |
0xA3, 0x7A, 0x69, 0x9F, 0x65, 0xE5, 0x4D), |
| 1689 |
/* |
| 1690 |
* Invalid, excessively long SHA-384 digest. |
| 1691 |
*/ |
| 1692 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x04, 0xAC, 0x74, 0x8D, 0x6C, |
| 1693 |
0x5A, 0xA6, 0x52, 0x90, 0x4A, 0x87, 0x63, 0xD6, |
| 1694 |
0x4B, 0x7D, 0xFF, 0xFF, 0xA9, 0x81, 0x52, 0xBE, |
| 1695 |
0x12, 0x12, 0x8D, 0x23, 0x8B, 0xEB, 0xB4, 0x81, |
| 1696 |
0x4B, 0x64, 0x8F, 0x5A, 0x84, 0x1E, 0x15, 0xCA, |
| 1697 |
0xA2, 0xDE, 0x34, 0x88, 0x91, 0xA3, 0x7A, 0x69, |
| 1698 |
0x9F, 0x65, 0xE5, 0x4D, 0x00), |
| 1699 |
WIRE_VALID(0x00, 0x00, 0x04, 0x00, 0x00), |
| 1700 |
/* |
| 1701 |
* Sentinel. |
| 1702 |
*/ |
| 1703 |
WIRE_SENTINEL() |
| 1704 |
}; |
| 1705 |
|
| 1706 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 1707 |
dns_rdatatype_ds, sizeof(dns_rdata_ds_t)); |
| 1708 |
} |
| 1709 |
|
| 1710 |
/* |
| 1711 |
* EDNS Client Subnet tests. |
| 1712 |
* |
| 1713 |
* RFC 7871: |
| 1714 |
* |
| 1715 |
* 6. Option Format |
| 1716 |
* |
| 1717 |
* This protocol uses an EDNS0 [RFC6891] option to include client |
| 1718 |
* address information in DNS messages. The option is structured as |
| 1719 |
* follows: |
| 1720 |
* |
| 1721 |
* +0 (MSB) +1 (LSB) |
| 1722 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1723 |
* 0: | OPTION-CODE | |
| 1724 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1725 |
* 2: | OPTION-LENGTH | |
| 1726 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1727 |
* 4: | FAMILY | |
| 1728 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1729 |
* 6: | SOURCE PREFIX-LENGTH | SCOPE PREFIX-LENGTH | |
| 1730 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1731 |
* 8: | ADDRESS... / |
| 1732 |
* +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |
| 1733 |
* |
| 1734 |
* o (Defined in [RFC6891]) OPTION-CODE, 2 octets, for ECS is 8 (0x00 |
| 1735 |
* 0x08). |
| 1736 |
* |
| 1737 |
* o (Defined in [RFC6891]) OPTION-LENGTH, 2 octets, contains the |
| 1738 |
* length of the payload (everything after OPTION-LENGTH) in octets. |
| 1739 |
* |
| 1740 |
* o FAMILY, 2 octets, indicates the family of the address contained in |
| 1741 |
* the option, using address family codes as assigned by IANA in |
| 1742 |
* Address Family Numbers [Address_Family_Numbers]. |
| 1743 |
* |
| 1744 |
* The format of the address part depends on the value of FAMILY. This |
| 1745 |
* document only defines the format for FAMILY 1 (IPv4) and FAMILY 2 |
| 1746 |
* (IPv6), which are as follows: |
| 1747 |
* |
| 1748 |
* o SOURCE PREFIX-LENGTH, an unsigned octet representing the leftmost |
| 1749 |
* number of significant bits of ADDRESS to be used for the lookup. |
| 1750 |
* In responses, it mirrors the same value as in the queries. |
| 1751 |
* |
| 1752 |
* o SCOPE PREFIX-LENGTH, an unsigned octet representing the leftmost |
| 1753 |
* number of significant bits of ADDRESS that the response covers. |
| 1754 |
* In queries, it MUST be set to 0. |
| 1755 |
* |
| 1756 |
* o ADDRESS, variable number of octets, contains either an IPv4 or |
| 1757 |
* IPv6 address, depending on FAMILY, which MUST be truncated to the |
| 1758 |
* number of bits indicated by the SOURCE PREFIX-LENGTH field, |
| 1759 |
* padding with 0 bits to pad to the end of the last octet needed. |
| 1760 |
* |
| 1761 |
* o A server receiving an ECS option that uses either too few or too |
| 1762 |
* many ADDRESS octets, or that has non-zero ADDRESS bits set beyond |
| 1763 |
* SOURCE PREFIX-LENGTH, SHOULD return FORMERR to reject the packet, |
| 1764 |
* as a signal to the software developer making the request to fix |
| 1765 |
* their implementation. |
| 1766 |
* |
| 1767 |
* All fields are in network byte order ("big-endian", per [RFC1700], |
| 1768 |
* Data Notation). |
| 1769 |
*/ |
| 1770 |
ISC_RUN_TEST_IMPL(edns_client_subnet) { |
| 1771 |
wire_ok_t wire_ok[] = { |
| 1772 |
/* |
| 1773 |
* Option code with no content. |
| 1774 |
*/ |
| 1775 |
WIRE_INVALID(0x00, 0x08, 0x00, 0x00), |
| 1776 |
/* |
| 1777 |
* Option code family 0, source 0, scope 0. |
| 1778 |
*/ |
| 1779 |
WIRE_VALID(0x00, 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00), |
| 1780 |
/* |
| 1781 |
* Option code family 1 (IPv4), source 0, scope 0. |
| 1782 |
*/ |
| 1783 |
WIRE_VALID(0x00, 0x08, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00), |
| 1784 |
/* |
| 1785 |
* Option code family 2 (IPv6) , source 0, scope 0. |
| 1786 |
*/ |
| 1787 |
WIRE_VALID(0x00, 0x08, 0x00, 0x04, 0x00, 0x02, 0x00, 0x00), |
| 1788 |
/* |
| 1789 |
* Extra octet. |
| 1790 |
*/ |
| 1791 |
WIRE_INVALID(0x00, 0x08, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, |
| 1792 |
0x00), |
| 1793 |
/* |
| 1794 |
* Source too long for IPv4. |
| 1795 |
*/ |
| 1796 |
WIRE_INVALID(0x00, 0x08, 0x00, 8, 0x00, 0x01, 33, 0x00, 0x00, |
| 1797 |
0x00, 0x00, 0x00), |
| 1798 |
/* |
| 1799 |
* Source too long for IPv6. |
| 1800 |
*/ |
| 1801 |
WIRE_INVALID(0x00, 0x08, 0x00, 20, 0x00, 0x02, 129, 0x00, 0x00, |
| 1802 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1803 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1804 |
/* |
| 1805 |
* Scope too long for IPv4. |
| 1806 |
*/ |
| 1807 |
WIRE_INVALID(0x00, 0x08, 0x00, 8, 0x00, 0x01, 0x00, 33, 0x00, |
| 1808 |
0x00, 0x00, 0x00), |
| 1809 |
/* |
| 1810 |
* Scope too long for IPv6. |
| 1811 |
*/ |
| 1812 |
WIRE_INVALID(0x00, 0x08, 0x00, 20, 0x00, 0x02, 0x00, 129, 0x00, |
| 1813 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1814 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1815 |
/* |
| 1816 |
* When family=0, source and scope should be 0. |
| 1817 |
*/ |
| 1818 |
WIRE_VALID(0x00, 0x08, 0x00, 4, 0x00, 0x00, 0x00, 0x00), |
| 1819 |
/* |
| 1820 |
* When family=0, source and scope should be 0. |
| 1821 |
*/ |
| 1822 |
WIRE_INVALID(0x00, 0x08, 0x00, 5, 0x00, 0x00, 0x01, 0x00, 0x00), |
| 1823 |
/* |
| 1824 |
* When family=0, source and scope should be 0. |
| 1825 |
*/ |
| 1826 |
WIRE_INVALID(0x00, 0x08, 0x00, 5, 0x00, 0x00, 0x00, 0x01, 0x00), |
| 1827 |
/* |
| 1828 |
* Length too short for source IPv4. |
| 1829 |
*/ |
| 1830 |
WIRE_INVALID(0x00, 0x08, 0x00, 7, 0x00, 0x01, 32, 0x00, 0x00, |
| 1831 |
0x00, 0x00), |
| 1832 |
/* |
| 1833 |
* Length too short for source IPv6. |
| 1834 |
*/ |
| 1835 |
WIRE_INVALID(0x00, 0x08, 0x00, 19, 0x00, 0x02, 128, 0x00, 0x00, |
| 1836 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 1837 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 1838 |
/* |
| 1839 |
* Sentinel. |
| 1840 |
*/ |
| 1841 |
WIRE_SENTINEL() |
| 1842 |
}; |
| 1843 |
|
| 1844 |
check_rdata(NULL, wire_ok, NULL, true, dns_rdataclass_in, |
| 1845 |
dns_rdatatype_opt, sizeof(dns_rdata_opt_t)); |
| 1846 |
} |
| 1847 |
|
| 1848 |
/* |
| 1849 |
* http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt |
| 1850 |
* |
| 1851 |
* The RDATA portion of both the NIMLOC and EID records contains |
| 1852 |
* uninterpreted binary data. The representation in the text master file |
| 1853 |
* is an even number of hex characters (0 to 9, a to f), case is not |
| 1854 |
* significant. For readability, whitespace may be included in the value |
| 1855 |
* field and should be ignored when reading a master file. |
| 1856 |
*/ |
| 1857 |
ISC_RUN_TEST_IMPL(eid) { |
| 1858 |
text_ok_t text_ok[] = { TEXT_VALID("AABBCC"), |
| 1859 |
TEXT_VALID_CHANGED("AA bb cc", "AABBCC"), |
| 1860 |
TEXT_INVALID("aab"), |
| 1861 |
/* |
| 1862 |
* Sentinel. |
| 1863 |
*/ |
| 1864 |
TEXT_SENTINEL() }; |
| 1865 |
wire_ok_t wire_ok[] = { WIRE_VALID(0x00), WIRE_VALID(0xAA, 0xBB, 0xCC), |
| 1866 |
/* |
| 1867 |
* Sentinel. |
| 1868 |
*/ |
| 1869 |
WIRE_SENTINEL() }; |
| 1870 |
|
| 1871 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 1872 |
dns_rdatatype_eid, sizeof(dns_rdata_in_eid_t)); |
| 1873 |
} |
| 1874 |
|
| 1875 |
/* |
| 1876 |
* test that an oversized HIP record will be rejected |
| 1877 |
*/ |
| 1878 |
ISC_RUN_TEST_IMPL(hip) { |
| 1879 |
text_ok_t text_ok[] = { |
| 1880 |
/* RFC 8005 examples. */ |
| 1881 |
TEXT_VALID_LOOP(0, "2 200100107B1A74DF365639CC39F1D578 " |
| 1882 |
"AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cI" |
| 1883 |
"vM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbW" |
| 1884 |
"Iy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+b" |
| 1885 |
"SRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWx" |
| 1886 |
"Z48AWkskmdHaVDP4BcelrTI3rMXdXF5D"), |
| 1887 |
TEXT_VALID_LOOP(1, "2 200100107B1A74DF365639CC39F1D578 " |
| 1888 |
"AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cI" |
| 1889 |
"vM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbW" |
| 1890 |
"Iy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+b" |
| 1891 |
"SRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWx" |
| 1892 |
"Z48AWkskmdHaVDP4BcelrTI3rMXdXF5D " |
| 1893 |
"rvs1.example.com."), |
| 1894 |
TEXT_VALID_LOOP(2, "2 200100107B1A74DF365639CC39F1D578 " |
| 1895 |
"AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cI" |
| 1896 |
"vM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbW" |
| 1897 |
"Iy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+b" |
| 1898 |
"SRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWx" |
| 1899 |
"Z48AWkskmdHaVDP4BcelrTI3rMXdXF5D " |
| 1900 |
"rvs1.example.com. rvs2.example.com."), |
| 1901 |
/* |
| 1902 |
* Sentinel. |
| 1903 |
*/ |
| 1904 |
TEXT_SENTINEL() |
| 1905 |
}; |
| 1906 |
unsigned char hipwire[DNS_RDATA_MAXLENGTH] = { 0x01, 0x00, 0x00, 0x01, |
| 1907 |
0x00, 0x00, 0x04, 0x41, |
| 1908 |
0x42, 0x43, 0x44, 0x00 }; |
| 1909 |
unsigned char buf[1024 * 1024]; |
| 1910 |
dns_rdata_t rdata = DNS_RDATA_INIT; |
| 1911 |
isc_result_t result; |
| 1912 |
size_t i; |
| 1913 |
|
| 1914 |
/* |
| 1915 |
* Fill the rest of input buffer with compression pointers. |
| 1916 |
*/ |
| 1917 |
for (i = 12; i < sizeof(hipwire) - 2; i += 2) { |
| 1918 |
hipwire[i] = 0xc0; |
| 1919 |
hipwire[i + 1] = 0x06; |
| 1920 |
} |
| 1921 |
|
| 1922 |
result = wire_to_rdata(hipwire, sizeof(hipwire), dns_rdataclass_in, |
| 1923 |
dns_rdatatype_hip, buf, sizeof(buf), &rdata); |
| 1924 |
assert_int_equal(result, DNS_R_FORMERR); |
| 1925 |
check_text_ok(text_ok, dns_rdataclass_in, dns_rdatatype_hip, |
| 1926 |
sizeof(dns_rdata_hip_t)); |
| 1927 |
} |
| 1928 |
|
| 1929 |
/* |
| 1930 |
* ISDN tests. |
| 1931 |
* |
| 1932 |
* RFC 1183: |
| 1933 |
* |
| 1934 |
* 3.2. The ISDN RR |
| 1935 |
* |
| 1936 |
* The ISDN RR is defined with mnemonic ISDN and type code 20 (decimal). |
| 1937 |
* |
| 1938 |
* An ISDN (Integrated Service Digital Network) number is simply a |
| 1939 |
* telephone number. The intent of the members of the CCITT is to |
| 1940 |
* upgrade all telephone and data network service to a common service. |
| 1941 |
* |
| 1942 |
* The numbering plan (E.163/E.164) is the same as the familiar |
| 1943 |
* international plan for POTS (an un-official acronym, meaning Plain |
| 1944 |
* Old Telephone Service). In E.166, CCITT says "An E.163/E.164 |
| 1945 |
* telephony subscriber may become an ISDN subscriber without a number |
| 1946 |
* change." |
| 1947 |
* |
| 1948 |
* ISDN has the following format: |
| 1949 |
* |
| 1950 |
* <owner> <ttl> <class> ISDN <ISDN-address> <sa> |
| 1951 |
* |
| 1952 |
* The <ISDN-address> field is required; <sa> is optional. |
| 1953 |
* |
| 1954 |
* <ISDN-address> identifies the ISDN number of <owner> and DDI (Direct |
| 1955 |
* Dial In) if any, as defined by E.164 [8] and E.163 [7], the ISDN and |
| 1956 |
* PSTN (Public Switched Telephone Network) numbering plan. E.163 |
| 1957 |
* defines the country codes, and E.164 the form of the addresses. Its |
| 1958 |
* format in master files is a <character-string> syntactically |
| 1959 |
* identical to that used in TXT and HINFO. |
| 1960 |
* |
| 1961 |
* <sa> specifies the subaddress (SA). The format of <sa> in master |
| 1962 |
* files is a <character-string> syntactically identical to that used in |
| 1963 |
* TXT and HINFO. |
| 1964 |
* |
| 1965 |
* The format of ISDN is class insensitive. ISDN RRs cause no |
| 1966 |
* additional section processing. |
| 1967 |
* |
| 1968 |
* The <ISDN-address> is a string of characters, normally decimal |
| 1969 |
* digits, beginning with the E.163 country code and ending with the DDI |
| 1970 |
* if any. Note that ISDN, in Q.931, permits any IA5 character in the |
| 1971 |
* general case. |
| 1972 |
* |
| 1973 |
* The <sa> is a string of hexadecimal digits. For digits 0-9, the |
| 1974 |
* concrete encoding in the Q.931 call setup information element is |
| 1975 |
* identical to BCD. |
| 1976 |
* |
| 1977 |
* For example: |
| 1978 |
* |
| 1979 |
* Relay.Prime.COM. IN ISDN 150862028003217 |
| 1980 |
* sh.Prime.COM. IN ISDN 150862028003217 004 |
| 1981 |
* |
| 1982 |
* (Note: "1" is the country code for the North American Integrated |
| 1983 |
* Numbering Area, i.e., the system of "area codes" familiar to people |
| 1984 |
* in those countries.) |
| 1985 |
* |
| 1986 |
* The RR data is the ASCII representation of the digits. It is encoded |
| 1987 |
* as one or two <character-string>s, i.e., count followed by |
| 1988 |
* characters. |
| 1989 |
*/ |
| 1990 |
ISC_RUN_TEST_IMPL(isdn) { |
| 1991 |
wire_ok_t wire_ok[] = { /* |
| 1992 |
* "". |
| 1993 |
*/ |
| 1994 |
WIRE_VALID(0x00), |
| 1995 |
/* |
| 1996 |
* "\001". |
| 1997 |
*/ |
| 1998 |
WIRE_VALID(0x01, 0x01), |
| 1999 |
/* |
| 2000 |
* "\001" "". |
| 2001 |
*/ |
| 2002 |
WIRE_VALID(0x01, 0x01, 0x00), |
| 2003 |
/* |
| 2004 |
* "\001" "\001". |
| 2005 |
*/ |
| 2006 |
WIRE_VALID(0x01, 0x01, 0x01, 0x01), |
| 2007 |
/* |
| 2008 |
* Sentinel. |
| 2009 |
*/ |
| 2010 |
WIRE_SENTINEL() |
| 2011 |
}; |
| 2012 |
|
| 2013 |
check_rdata(NULL, wire_ok, NULL, false, dns_rdataclass_in, |
| 2014 |
dns_rdatatype_isdn, sizeof(dns_rdata_isdn_t)); |
| 2015 |
} |
| 2016 |
|
| 2017 |
/* |
| 2018 |
* KEY tests. |
| 2019 |
*/ |
| 2020 |
ISC_RUN_TEST_IMPL(key) { |
| 2021 |
wire_ok_t wire_ok[] = { |
| 2022 |
/* |
| 2023 |
* RDATA is comprised of: |
| 2024 |
* |
| 2025 |
* - 2 octets for Flags, |
| 2026 |
* - 1 octet for Protocol, |
| 2027 |
* - 1 octet for Algorithm, |
| 2028 |
* - variable number of octets for Public Key. |
| 2029 |
* |
| 2030 |
* RFC 2535 section 3.1.2 states that if bits |
| 2031 |
* 0-1 of Flags are both set, the RR stops after |
| 2032 |
* the algorithm octet and thus its length must |
| 2033 |
* be 4 octets. In any other case, though, the |
| 2034 |
* Public Key part must not be empty. |
| 2035 |
* |
| 2036 |
* Algorithms PRIVATEDNS (253) and PRIVATEOID (254) |
| 2037 |
* have an algorithm identifier embedded and the start |
| 2038 |
* of the public key. |
| 2039 |
*/ |
| 2040 |
WIRE_INVALID(0x00), WIRE_INVALID(0x00, 0x00), |
| 2041 |
WIRE_INVALID(0x00, 0x00, 0x00), |
| 2042 |
WIRE_VALID(0xc0, 0x00, 0x00, 0x00), |
| 2043 |
WIRE_INVALID(0xc0, 0x00, 0x00, 0x00, 0x00), |
| 2044 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00), |
| 2045 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00), |
| 2046 |
/* PRIVATEDNS example. */ |
| 2047 |
WIRE_INVALID(0x00, 0x00, 0x00, 253, 0x07, 'e', 'x', 'a', 'm', |
| 2048 |
'p', 'l', 'e', 0x00), |
| 2049 |
/* PRIVATEDNS example. + keydata */ |
| 2050 |
WIRE_VALID(0x00, 0x00, 0x00, 253, 0x07, 'e', 'x', 'a', 'm', 'p', |
| 2051 |
'l', 'e', 0x00, 0x00), |
| 2052 |
/* PRIVATEDNS compression pointer. */ |
| 2053 |
WIRE_INVALID(0x00, 0x00, 0x00, 253, 0xc0, 0x00, 0x00), |
| 2054 |
/* PRIVATEOID */ |
| 2055 |
WIRE_INVALID(0x00, 0x00, 0x00, 254, 0x00), |
| 2056 |
/* PRIVATEOID 1.3.6.1.4.1.2495 */ |
| 2057 |
WIRE_INVALID(0x00, 0x00, 0x00, 254, 0x06, 0x07, 0x2b, 0x06, |
| 2058 |
0x01, 0x04, 0x01, 0x93, 0x3f), |
| 2059 |
/* PRIVATEOID 1.3.6.1.4.1.2495 + keydata */ |
| 2060 |
WIRE_VALID(0x00, 0x00, 0x00, 254, 0x06, 0x07, 0x2b, 0x06, 0x01, |
| 2061 |
0x04, 0x01, 0x93, 0x3f, 0x00), |
| 2062 |
/* PRIVATEOID malformed OID - high-bit set on last octet */ |
| 2063 |
WIRE_INVALID(0x00, 0x00, 0x00, 254, 0x06, 0x07, 0x2b, 0x06, |
| 2064 |
0x01, 0x04, 0x01, 0x93, 0xbf, 0x00), |
| 2065 |
/* PRIVATEOID malformed OID - wrong tag */ |
| 2066 |
WIRE_INVALID(0x00, 0x00, 0x00, 254, 0x07, 0x07, 0x2b, 0x06, |
| 2067 |
0x01, 0x04, 0x01, 0x93, 0x3f, 0x00), |
| 2068 |
WIRE_SENTINEL() |
| 2069 |
}; |
| 2070 |
text_ok_t text_ok[] = { /* PRIVATEDNS example. */ |
| 2071 |
TEXT_INVALID("0 0 253 B2V4YW1wbGUA"), |
| 2072 |
/* PRIVATEDNS example. + keydata */ |
| 2073 |
TEXT_VALID("0 0 253 B2V4YW1wbGUAAA=="), |
| 2074 |
/* PRIVATEDNS compression pointer. */ |
| 2075 |
TEXT_INVALID("0 0 253 wAAA"), |
| 2076 |
/* PRIVATEOID */ |
| 2077 |
TEXT_INVALID("0 0 254 AA=="), |
| 2078 |
/* PRIVATEOID 1.3.6.1.4.1.2495 */ |
| 2079 |
TEXT_INVALID("0 0 254 BgcrBgEEAZM/"), |
| 2080 |
/* PRIVATEOID 1.3.6.1.4.1.2495 + keydata */ |
| 2081 |
TEXT_VALID("0 0 254 BgcrBgEEAZM/AA=="), |
| 2082 |
/* PRIVATEOID malformed OID - high-bit set on |
| 2083 |
last octet */ |
| 2084 |
TEXT_INVALID("0 0 254 BgcrBgEEAZO/AA=="), |
| 2085 |
/* PRIVATEOID malformed OID - wrong tag */ |
| 2086 |
TEXT_INVALID("0 0 254 BwcrBgEEAZM/AA=="), |
| 2087 |
/* |
| 2088 |
* Sentinel. |
| 2089 |
*/ |
| 2090 |
TEXT_SENTINEL() |
| 2091 |
}; |
| 2092 |
|
| 2093 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2094 |
dns_rdatatype_key, sizeof(dns_rdata_key_t)); |
| 2095 |
} |
| 2096 |
|
| 2097 |
/* |
| 2098 |
* LOC tests. |
| 2099 |
*/ |
| 2100 |
ISC_RUN_TEST_IMPL(loc) { |
| 2101 |
text_ok_t text_ok[] = { |
| 2102 |
TEXT_VALID_CHANGED("0 N 0 E 0", "0 0 0.000 N 0 0 0.000 E 0.00m " |
| 2103 |
"1m 10000m 10m"), |
| 2104 |
TEXT_VALID_CHANGED("0 S 0 W 0", "0 0 0.000 N 0 0 0.000 E 0.00m " |
| 2105 |
"1m 10000m 10m"), |
| 2106 |
TEXT_VALID_CHANGED("0 0 N 0 0 E 0", "0 0 0.000 N 0 0 0.000 E " |
| 2107 |
"0.00m 1m 10000m 10m"), |
| 2108 |
TEXT_VALID_CHANGED("0 0 0 N 0 0 0 E 0", |
| 2109 |
"0 0 0.000 N 0 0 0.000 E 0.00m 1m 10000m " |
| 2110 |
"10m"), |
| 2111 |
TEXT_VALID_CHANGED("0 0 0 N 0 0 0 E 0", |
| 2112 |
"0 0 0.000 N 0 0 0.000 E 0.00m 1m 10000m " |
| 2113 |
"10m"), |
| 2114 |
TEXT_VALID_CHANGED("0 0 0. N 0 0 0. E 0", |
| 2115 |
"0 0 0.000 N 0 0 0.000 E 0.00m 1m 10000m " |
| 2116 |
"10m"), |
| 2117 |
TEXT_VALID_CHANGED("0 0 .0 N 0 0 .0 E 0", |
| 2118 |
"0 0 0.000 N 0 0 0.000 E 0.00m 1m 10000m " |
| 2119 |
"10m"), |
| 2120 |
TEXT_INVALID("0 North 0 East 0"), |
| 2121 |
TEXT_INVALID("0 South 0 West 0"), |
| 2122 |
TEXT_INVALID("0 0 . N 0 0 0. E 0"), |
| 2123 |
TEXT_INVALID("0 0 0. N 0 0 . E 0"), |
| 2124 |
TEXT_INVALID("0 0 0. N 0 0 0. E m"), |
| 2125 |
TEXT_INVALID("0 0 0. N 0 0 0. E 0 ."), |
| 2126 |
TEXT_INVALID("0 0 0. N 0 0 0. E 0 m"), |
| 2127 |
TEXT_INVALID("0 0 0. N 0 0 0. E 0 0 ."), |
| 2128 |
TEXT_INVALID("0 0 0. N 0 0 0. E 0 0 m"), |
| 2129 |
TEXT_INVALID("0 0 0. N 0 0 0. E 0 0 0 ."), |
| 2130 |
TEXT_INVALID("0 0 0. N 0 0 0. E 0 0 0 m"), |
| 2131 |
TEXT_VALID_CHANGED("90 N 180 E 0", "90 0 0.000 N 180 0 0.000 E " |
| 2132 |
"0.00m 1m 10000m 10m"), |
| 2133 |
TEXT_INVALID("90 1 N 180 E 0"), |
| 2134 |
TEXT_INVALID("90 0 1 N 180 E 0"), |
| 2135 |
TEXT_INVALID("90 N 180 1 E 0"), |
| 2136 |
TEXT_INVALID("90 N 180 0 1 E 0"), |
| 2137 |
TEXT_VALID_CHANGED("90 S 180 W 0", "90 0 0.000 S 180 0 0.000 W " |
| 2138 |
"0.00m 1m 10000m 10m"), |
| 2139 |
TEXT_INVALID("90 1 S 180 W 0"), |
| 2140 |
TEXT_INVALID("90 0 1 S 180 W 0"), |
| 2141 |
TEXT_INVALID("90 S 180 1 W 0"), |
| 2142 |
TEXT_INVALID("90 S 180 0 1 W 0"), |
| 2143 |
TEXT_INVALID("0 0 0.000 E 0 0 0.000 E -0.95m 1m 10000m 10m"), |
| 2144 |
TEXT_VALID("0 0 0.000 N 0 0 0.000 E -0.95m 1m 10000m 10m"), |
| 2145 |
TEXT_VALID("0 0 0.000 N 0 0 0.000 E -0.05m 1m 10000m 10m"), |
| 2146 |
TEXT_VALID("0 0 0.000 N 0 0 0.000 E -100000.00m 1m 10000m 10m"), |
| 2147 |
TEXT_VALID("0 0 0.000 N 0 0 0.000 E 42849672.95m 1m 10000m " |
| 2148 |
"10m"), |
| 2149 |
/* |
| 2150 |
* Sentinel. |
| 2151 |
*/ |
| 2152 |
TEXT_SENTINEL() |
| 2153 |
}; |
| 2154 |
|
| 2155 |
check_rdata(text_ok, 0, NULL, false, dns_rdataclass_in, |
| 2156 |
dns_rdatatype_loc, sizeof(dns_rdata_loc_t)); |
| 2157 |
} |
| 2158 |
|
| 2159 |
/* |
| 2160 |
* http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt |
| 2161 |
* |
| 2162 |
* The RDATA portion of both the NIMLOC and EID records contains |
| 2163 |
* uninterpreted binary data. The representation in the text master file |
| 2164 |
* is an even number of hex characters (0 to 9, a to f), case is not |
| 2165 |
* significant. For readability, whitespace may be included in the value |
| 2166 |
* field and should be ignored when reading a master file. |
| 2167 |
*/ |
| 2168 |
ISC_RUN_TEST_IMPL(nimloc) { |
| 2169 |
text_ok_t text_ok[] = { TEXT_VALID("AABBCC"), |
| 2170 |
TEXT_VALID_CHANGED("AA bb cc", "AABBCC"), |
| 2171 |
TEXT_INVALID("aab"), |
| 2172 |
/* |
| 2173 |
* Sentinel. |
| 2174 |
*/ |
| 2175 |
TEXT_SENTINEL() }; |
| 2176 |
wire_ok_t wire_ok[] = { WIRE_VALID(0x00), WIRE_VALID(0xAA, 0xBB, 0xCC), |
| 2177 |
/* |
| 2178 |
* Sentinel. |
| 2179 |
*/ |
| 2180 |
WIRE_SENTINEL() }; |
| 2181 |
|
| 2182 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2183 |
dns_rdatatype_nimloc, sizeof(dns_rdata_in_nimloc_t)); |
| 2184 |
} |
| 2185 |
|
| 2186 |
/* |
| 2187 |
* NSEC tests. |
| 2188 |
* |
| 2189 |
* RFC 4034: |
| 2190 |
* |
| 2191 |
* 4.1. NSEC RDATA Wire Format |
| 2192 |
* |
| 2193 |
* The RDATA of the NSEC RR is as shown below: |
| 2194 |
* |
| 2195 |
* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 |
| 2196 |
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 2197 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 2198 |
* / Next Domain Name / |
| 2199 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 2200 |
* / Type Bit Maps / |
| 2201 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 2202 |
* |
| 2203 |
* 4.1.1. The Next Domain Name Field |
| 2204 |
* |
| 2205 |
* The Next Domain field contains the next owner name (in the canonical |
| 2206 |
* ordering of the zone) that has authoritative data or contains a |
| 2207 |
* delegation point NS RRset; see Section 6.1 for an explanation of |
| 2208 |
* canonical ordering. The value of the Next Domain Name field in the |
| 2209 |
* last NSEC record in the zone is the name of the zone apex (the owner |
| 2210 |
* name of the zone's SOA RR). This indicates that the owner name of |
| 2211 |
* the NSEC RR is the last name in the canonical ordering of the zone. |
| 2212 |
* |
| 2213 |
* A sender MUST NOT use DNS name compression on the Next Domain Name |
| 2214 |
* field when transmitting an NSEC RR. |
| 2215 |
* |
| 2216 |
* Owner names of RRsets for which the given zone is not authoritative |
| 2217 |
* (such as glue records) MUST NOT be listed in the Next Domain Name |
| 2218 |
* unless at least one authoritative RRset exists at the same owner |
| 2219 |
* name. |
| 2220 |
* |
| 2221 |
* 4.1.2. The Type Bit Maps Field |
| 2222 |
* |
| 2223 |
* The Type Bit Maps field identifies the RRset types that exist at the |
| 2224 |
* NSEC RR's owner name. |
| 2225 |
* |
| 2226 |
* The RR type space is split into 256 window blocks, each representing |
| 2227 |
* the low-order 8 bits of the 16-bit RR type space. Each block that |
| 2228 |
* has at least one active RR type is encoded using a single octet |
| 2229 |
* window number (from 0 to 255), a single octet bitmap length (from 1 |
| 2230 |
* to 32) indicating the number of octets used for the window block's |
| 2231 |
* bitmap, and up to 32 octets (256 bits) of bitmap. |
| 2232 |
* |
| 2233 |
* Blocks are present in the NSEC RR RDATA in increasing numerical |
| 2234 |
* order. |
| 2235 |
* |
| 2236 |
* Type Bit Maps Field = ( Window Block # | Bitmap Length | Bitmap )+ |
| 2237 |
* |
| 2238 |
* where "|" denotes concatenation. |
| 2239 |
* |
| 2240 |
* Each bitmap encodes the low-order 8 bits of RR types within the |
| 2241 |
* window block, in network bit order. The first bit is bit 0. For |
| 2242 |
* window block 0, bit 1 corresponds to RR type 1 (A), bit 2 corresponds |
| 2243 |
* to RR type 2 (NS), and so forth. For window block 1, bit 1 |
| 2244 |
* corresponds to RR type 257, and bit 2 to RR type 258. If a bit is |
| 2245 |
* set, it indicates that an RRset of that type is present for the NSEC |
| 2246 |
* RR's owner name. If a bit is clear, it indicates that no RRset of |
| 2247 |
* that type is present for the NSEC RR's owner name. |
| 2248 |
* |
| 2249 |
* Bits representing pseudo-types MUST be clear, as they do not appear |
| 2250 |
* in zone data. If encountered, they MUST be ignored upon being read. |
| 2251 |
*/ |
| 2252 |
ISC_RUN_TEST_IMPL(nsec) { |
| 2253 |
text_ok_t text_ok[] = { TEXT_INVALID(""), TEXT_INVALID("."), |
| 2254 |
TEXT_VALID(". RRSIG"), TEXT_SENTINEL() }; |
| 2255 |
wire_ok_t wire_ok[] = { WIRE_INVALID(0x00), WIRE_INVALID(0x00, 0x00), |
| 2256 |
WIRE_INVALID(0x00, 0x00, 0x00), |
| 2257 |
WIRE_VALID(0x00, 0x00, 0x01, 0x02), |
| 2258 |
WIRE_SENTINEL() }; |
| 2259 |
|
| 2260 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2261 |
dns_rdatatype_nsec, sizeof(dns_rdata_nsec_t)); |
| 2262 |
} |
| 2263 |
|
| 2264 |
/* |
| 2265 |
* NSEC3 tests. |
| 2266 |
* |
| 2267 |
* RFC 5155. |
| 2268 |
*/ |
| 2269 |
ISC_RUN_TEST_IMPL(nsec3) { |
| 2270 |
text_ok_t text_ok[] = { TEXT_INVALID(""), |
| 2271 |
TEXT_INVALID("."), |
| 2272 |
TEXT_INVALID(". RRSIG"), |
| 2273 |
TEXT_INVALID("1 0 10 76931F"), |
| 2274 |
TEXT_INVALID("1 0 10 76931F " |
| 2275 |
"IMQ912BREQP1POLAH3RMONG&" |
| 2276 |
"UED541AS"), |
| 2277 |
TEXT_INVALID("1 0 10 76931F " |
| 2278 |
"IMQ912BREQP1POLAH3RMONGAUED541AS " |
| 2279 |
"A RRSIG BADTYPE"), |
| 2280 |
TEXT_VALID("1 0 10 76931F " |
| 2281 |
"AJHVGTICN6K0VDA53GCHFMT219SRRQLM A " |
| 2282 |
"RRSIG"), |
| 2283 |
TEXT_VALID("1 0 10 76931F " |
| 2284 |
"AJHVGTICN6K0VDA53GCHFMT219SRRQLM"), |
| 2285 |
TEXT_VALID("1 0 10 - " |
| 2286 |
"AJHVGTICN6K0VDA53GCHFMT219SRRQLM"), |
| 2287 |
TEXT_SENTINEL() }; |
| 2288 |
|
| 2289 |
check_rdata(text_ok, NULL, NULL, false, dns_rdataclass_in, |
| 2290 |
dns_rdatatype_nsec3, sizeof(dns_rdata_nsec3_t)); |
| 2291 |
} |
| 2292 |
|
| 2293 |
/* NXT RDATA manipulations */ |
| 2294 |
ISC_RUN_TEST_IMPL(nxt) { |
| 2295 |
compare_ok_t compare_ok[] = { |
| 2296 |
COMPARE("a. A SIG", "a. A SIG", 0), |
| 2297 |
/* |
| 2298 |
* Records that differ only in the case of the next |
| 2299 |
* name should be equal. |
| 2300 |
*/ |
| 2301 |
COMPARE("A. A SIG", "a. A SIG", 0), |
| 2302 |
/* |
| 2303 |
* Sorting on name field. |
| 2304 |
*/ |
| 2305 |
COMPARE("A. A SIG", "b. A SIG", -1), |
| 2306 |
COMPARE("b. A SIG", "A. A SIG", 1), |
| 2307 |
/* bit map differs */ |
| 2308 |
COMPARE("b. A SIG", "b. A AAAA SIG", -1), |
| 2309 |
/* order of bit map does not matter */ |
| 2310 |
COMPARE("b. A SIG AAAA", "b. A AAAA SIG", 0), COMPARE_SENTINEL() |
| 2311 |
}; |
| 2312 |
|
| 2313 |
check_rdata(NULL, NULL, compare_ok, false, dns_rdataclass_in, |
| 2314 |
dns_rdatatype_nxt, sizeof(dns_rdata_nxt_t)); |
| 2315 |
} |
| 2316 |
|
| 2317 |
ISC_RUN_TEST_IMPL(rkey) { |
| 2318 |
text_ok_t text_ok[] = { /* |
| 2319 |
* Valid, flags set to 0 and a key is present. |
| 2320 |
*/ |
| 2321 |
TEXT_VALID("0 0 0 aaaa"), |
| 2322 |
/* |
| 2323 |
* Invalid, non-zero flags. |
| 2324 |
*/ |
| 2325 |
TEXT_INVALID("1 0 0 aaaa"), |
| 2326 |
TEXT_INVALID("65535 0 0 aaaa"), |
| 2327 |
/* |
| 2328 |
* Sentinel. |
| 2329 |
*/ |
| 2330 |
TEXT_SENTINEL() |
| 2331 |
}; |
| 2332 |
wire_ok_t wire_ok[] = { /* |
| 2333 |
* Valid, flags set to 0 and a key is present. |
| 2334 |
*/ |
| 2335 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00), |
| 2336 |
/* |
| 2337 |
* Invalid, non-zero flags. |
| 2338 |
*/ |
| 2339 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x00), |
| 2340 |
WIRE_INVALID(0xff, 0xff, 0x00, 0x00, 0x00), |
| 2341 |
/* |
| 2342 |
* Sentinel. |
| 2343 |
*/ |
| 2344 |
WIRE_SENTINEL() |
| 2345 |
}; |
| 2346 |
key_required(state, dns_rdatatype_rkey, sizeof(dns_rdata_rkey_t)); |
| 2347 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2348 |
dns_rdatatype_rkey, sizeof(dns_rdata_rkey_t)); |
| 2349 |
} |
| 2350 |
|
| 2351 |
ISC_RUN_TEST_IMPL(resinfo) { |
| 2352 |
text_ok_t text_ok[] = { |
| 2353 |
TEXT_VALID_CHANGED("qnamemin exterr=15,16,17 " |
| 2354 |
"infourl=https://resolver.example.com/guide", |
| 2355 |
"\"qnamemin\" \"exterr=15,16,17\" " |
| 2356 |
"\"infourl=https://resolver.example.com/" |
| 2357 |
"guide\""), |
| 2358 |
/* |
| 2359 |
* Sentinel. |
| 2360 |
*/ |
| 2361 |
TEXT_SENTINEL() |
| 2362 |
}; |
| 2363 |
check_rdata(text_ok, NULL, NULL, false, dns_rdataclass_in, |
| 2364 |
dns_rdatatype_resinfo, sizeof(dns_rdata_rkey_t)); |
| 2365 |
} |
| 2366 |
|
| 2367 |
/* SSHFP RDATA manipulations */ |
| 2368 |
ISC_RUN_TEST_IMPL(sshfp) { |
| 2369 |
text_ok_t text_ok[] = { TEXT_INVALID(""), /* too short */ |
| 2370 |
TEXT_INVALID("0"), /* reserved, too short */ |
| 2371 |
TEXT_VALID("0 0"), /* no finger print */ |
| 2372 |
TEXT_VALID("0 0 AA"), /* reserved */ |
| 2373 |
TEXT_INVALID("0 1 AA"), /* too short SHA 1 |
| 2374 |
* digest */ |
| 2375 |
TEXT_INVALID("0 2 AA"), /* too short SHA 256 |
| 2376 |
* digest */ |
| 2377 |
TEXT_VALID("0 3 AA"), /* unknown finger print |
| 2378 |
* type */ |
| 2379 |
/* good length SHA 1 digest */ |
| 2380 |
TEXT_VALID("1 1 " |
| 2381 |
"00112233445566778899AABBCCDDEEFF171" |
| 2382 |
"81920"), |
| 2383 |
/* good length SHA 256 digest */ |
| 2384 |
TEXT_VALID("4 2 " |
| 2385 |
"A87F1B687AC0E57D2A081A2F282672334D9" |
| 2386 |
"0ED316D2B818CA9580EA3 84D92401"), |
| 2387 |
/* |
| 2388 |
* totext splits the fingerprint into chunks and |
| 2389 |
* emits uppercase hex. |
| 2390 |
*/ |
| 2391 |
TEXT_VALID_CHANGED("1 2 " |
| 2392 |
"00112233445566778899aabbccd" |
| 2393 |
"deeff " |
| 2394 |
"00112233445566778899AABBCCD" |
| 2395 |
"DEEFF", |
| 2396 |
"1 2 " |
| 2397 |
"00112233445566778899AABBCCD" |
| 2398 |
"DEEFF" |
| 2399 |
"00112233445566778899AABB " |
| 2400 |
"CCDDEEFF"), |
| 2401 |
TEXT_SENTINEL() }; |
| 2402 |
wire_ok_t wire_ok[] = { |
| 2403 |
WIRE_INVALID(0x00), /* reserved too short */ |
| 2404 |
WIRE_VALID(0x00, 0x00), /* reserved no finger print */ |
| 2405 |
WIRE_VALID(0x00, 0x00, 0x00), /* reserved */ |
| 2406 |
|
| 2407 |
/* too short SHA 1 digests */ |
| 2408 |
WIRE_INVALID(0x00, 0x01), WIRE_INVALID(0x00, 0x01, 0x00), |
| 2409 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, |
| 2410 |
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, |
| 2411 |
0xEE, 0xFF, 0x17, 0x18, 0x19), |
| 2412 |
/* good length SHA 1 digest */ |
| 2413 |
WIRE_VALID(0x00, 0x01, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, |
| 2414 |
0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, |
| 2415 |
0x17, 0x18, 0x19, 0x20), |
| 2416 |
/* too long SHA 1 digest */ |
| 2417 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, |
| 2418 |
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, |
| 2419 |
0xEE, 0xFF, 0x17, 0x18, 0x19, 0x20, 0x21), |
| 2420 |
/* too short SHA 256 digests */ |
| 2421 |
WIRE_INVALID(0x00, 0x02), WIRE_INVALID(0x00, 0x02, 0x00), |
| 2422 |
WIRE_INVALID(0x00, 0x02, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, |
| 2423 |
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, |
| 2424 |
0xEE, 0xFF, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, |
| 2425 |
0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, |
| 2426 |
0x31), |
| 2427 |
/* good length SHA 256 digest */ |
| 2428 |
WIRE_VALID(0x00, 0x02, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, |
| 2429 |
0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, |
| 2430 |
0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, |
| 2431 |
0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32), |
| 2432 |
/* too long SHA 256 digest */ |
| 2433 |
WIRE_INVALID(0x00, 0x02, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, |
| 2434 |
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, |
| 2435 |
0xEE, 0xFF, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, |
| 2436 |
0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, |
| 2437 |
0x31, 0x32, 0x33), |
| 2438 |
/* unknown digest, * no fingerprint */ |
| 2439 |
WIRE_VALID(0x00, 0x03), WIRE_VALID(0x00, 0x03, 0x00), /* unknown |
| 2440 |
* digest |
| 2441 |
*/ |
| 2442 |
WIRE_SENTINEL() |
| 2443 |
}; |
| 2444 |
|
| 2445 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2446 |
dns_rdatatype_sshfp, sizeof(dns_rdata_sshfp_t)); |
| 2447 |
} |
| 2448 |
|
| 2449 |
ISC_RUN_TEST_IMPL(wallet) { |
| 2450 |
text_ok_t text_ok[] = { TEXT_VALID_CHANGED("cid-example wid-example", |
| 2451 |
"\"cid-example\" " |
| 2452 |
"\"wid-example\""), |
| 2453 |
/* |
| 2454 |
* Sentinel. |
| 2455 |
*/ |
| 2456 |
TEXT_SENTINEL() }; |
| 2457 |
check_rdata(text_ok, NULL, NULL, false, dns_rdataclass_in, |
| 2458 |
dns_rdatatype_wallet, sizeof(dns_rdata_rkey_t)); |
| 2459 |
} |
| 2460 |
|
| 2461 |
/* |
| 2462 |
* WKS tests. |
| 2463 |
* |
| 2464 |
* RFC 1035: |
| 2465 |
* |
| 2466 |
* 3.4.2. WKS RDATA format |
| 2467 |
* |
| 2468 |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
| 2469 |
* | ADDRESS | |
| 2470 |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
| 2471 |
* | PROTOCOL | | |
| 2472 |
* +--+--+--+--+--+--+--+--+ | |
| 2473 |
* | | |
| 2474 |
* / <BIT MAP> / |
| 2475 |
* / / |
| 2476 |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ |
| 2477 |
* |
| 2478 |
* where: |
| 2479 |
* |
| 2480 |
* ADDRESS An 32 bit Internet address |
| 2481 |
* |
| 2482 |
* PROTOCOL An 8 bit IP protocol number |
| 2483 |
* |
| 2484 |
* <BIT MAP> A variable length bit map. The bit map must be a |
| 2485 |
* multiple of 8 bits long. |
| 2486 |
* |
| 2487 |
* The WKS record is used to describe the well known services supported by |
| 2488 |
* a particular protocol on a particular internet address. The PROTOCOL |
| 2489 |
* field specifies an IP protocol number, and the bit map has one bit per |
| 2490 |
* port of the specified protocol. The first bit corresponds to port 0, |
| 2491 |
* the second to port 1, etc. If the bit map does not include a bit for a |
| 2492 |
* protocol of interest, that bit is assumed zero. The appropriate values |
| 2493 |
* and mnemonics for ports and protocols are specified in [RFC-1010]. |
| 2494 |
* |
| 2495 |
* For example, if PROTOCOL=TCP (6), the 26th bit corresponds to TCP port |
| 2496 |
* 25 (SMTP). If this bit is set, a SMTP server should be listening on TCP |
| 2497 |
* port 25; if zero, SMTP service is not supported on the specified |
| 2498 |
* address. |
| 2499 |
*/ |
| 2500 |
ISC_RUN_TEST_IMPL(wks) { |
| 2501 |
text_ok_t text_ok[] = { /* |
| 2502 |
* Valid, IPv4 address in dotted-quad form. |
| 2503 |
*/ |
| 2504 |
TEXT_VALID("127.0.0.1 6"), |
| 2505 |
/* |
| 2506 |
* Invalid, IPv4 address not in dotted-quad |
| 2507 |
* form. |
| 2508 |
*/ |
| 2509 |
TEXT_INVALID("127.1 6"), |
| 2510 |
/* |
| 2511 |
* Sentinel. |
| 2512 |
*/ |
| 2513 |
TEXT_SENTINEL() |
| 2514 |
}; |
| 2515 |
wire_ok_t wire_ok[] = { /* |
| 2516 |
* Too short. |
| 2517 |
*/ |
| 2518 |
WIRE_INVALID(0x00, 0x08, 0x00, 0x00), |
| 2519 |
/* |
| 2520 |
* Minimal TCP. |
| 2521 |
*/ |
| 2522 |
WIRE_VALID(0x00, 0x08, 0x00, 0x00, 6), |
| 2523 |
/* |
| 2524 |
* Minimal UDP. |
| 2525 |
*/ |
| 2526 |
WIRE_VALID(0x00, 0x08, 0x00, 0x00, 17), |
| 2527 |
/* |
| 2528 |
* Minimal other. |
| 2529 |
*/ |
| 2530 |
WIRE_VALID(0x00, 0x08, 0x00, 0x00, 1), |
| 2531 |
/* |
| 2532 |
* Sentinel. |
| 2533 |
*/ |
| 2534 |
WIRE_SENTINEL() |
| 2535 |
}; |
| 2536 |
|
| 2537 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2538 |
dns_rdatatype_wks, sizeof(dns_rdata_in_wks_t)); |
| 2539 |
} |
| 2540 |
|
| 2541 |
ISC_RUN_TEST_IMPL(https_svcb) { |
| 2542 |
/* |
| 2543 |
* Known keys: mandatory, apln, no-default-alpn, port, |
| 2544 |
* ipv4hint, port, ipv6hint, dohpath. |
| 2545 |
*/ |
| 2546 |
text_ok_t text_ok[] = { |
| 2547 |
/* unknown key invalid */ |
| 2548 |
TEXT_INVALID("1 . unknown="), |
| 2549 |
/* no domain */ |
| 2550 |
TEXT_INVALID("0"), |
| 2551 |
/* minimal record */ |
| 2552 |
TEXT_VALID_LOOP(0, "0 ."), |
| 2553 |
/* Alias form possible future extension */ |
| 2554 |
TEXT_VALID_LOOP(1, "0 . alpn=\"h2\""), |
| 2555 |
/* no "key" prefix */ |
| 2556 |
TEXT_INVALID("2 svc.example.net. 0=\"2222\""), |
| 2557 |
/* no key value */ |
| 2558 |
TEXT_INVALID("2 svc.example.net. key"), |
| 2559 |
/* no key value */ |
| 2560 |
TEXT_INVALID("2 svc.example.net. key=\"2222\""), |
| 2561 |
/* zero pad invalid */ |
| 2562 |
TEXT_INVALID("2 svc.example.net. key07=\"2222\""), |
| 2563 |
TEXT_VALID_LOOP(1, "2 svc.example.net. key8=\"2222\""), |
| 2564 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. key8=2222", |
| 2565 |
"2 svc.example.net. key8=\"2222\""), |
| 2566 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. alpn=h2", |
| 2567 |
"2 svc.example.net. alpn=\"h2\""), |
| 2568 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. alpn=h3", |
| 2569 |
"2 svc.example.net. alpn=\"h3\""), |
| 2570 |
/* alpn has 2 sub field "h2" and "h3" */ |
| 2571 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. alpn=h2,h3", |
| 2572 |
"2 svc.example.net. alpn=\"h2,h3\""), |
| 2573 |
/* apln has 2 sub fields "h1,h2" and "h3" (comma escaped) */ |
| 2574 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. alpn=h1\\\\,h2,h3", |
| 2575 |
"2 svc.example.net. alpn=\"h1\\\\,h2,h3\""), |
| 2576 |
TEXT_VALID_LOOP(1, "2 svc.example.net. port=50"), |
| 2577 |
/* no-default-alpn, alpn is required */ |
| 2578 |
TEXT_INVALID("2 svc.example.net. no-default-alpn"), |
| 2579 |
/* no-default-alpn with alpn present */ |
| 2580 |
TEXT_VALID_LOOPCHG( |
| 2581 |
2, "2 svc.example.net. no-default-alpn alpn=h2", |
| 2582 |
"2 svc.example.net. alpn=\"h2\" no-default-alpn"), |
| 2583 |
/* empty hint */ |
| 2584 |
TEXT_INVALID("2 svc.example.net. ipv4hint="), |
| 2585 |
TEXT_VALID_LOOP(1, "2 svc.example.net. " |
| 2586 |
"ipv4hint=10.50.0.1,10.50.0.2"), |
| 2587 |
/* empty hint */ |
| 2588 |
TEXT_INVALID("2 svc.example.net. ipv6hint="), |
| 2589 |
TEXT_VALID_LOOP(1, "2 svc.example.net. ipv6hint=::1,2002::1"), |
| 2590 |
TEXT_VALID_LOOP(1, "2 svc.example.net. ech=abcdefghijkl"), |
| 2591 |
/* bad base64 */ |
| 2592 |
TEXT_INVALID("2 svc.example.net. ech=abcdefghijklm"), |
| 2593 |
TEXT_VALID_LOOP(1, "2 svc.example.net. key8=\"2222\""), |
| 2594 |
/* Out of key order on input (alpn == key1). */ |
| 2595 |
TEXT_VALID_LOOPCHG(2, |
| 2596 |
"2 svc.example.net. key8=\"2222\" alpn=h2", |
| 2597 |
"2 svc.example.net. alpn=\"h2\" " |
| 2598 |
"key8=\"2222\""), |
| 2599 |
TEXT_VALID_LOOP(1, "2 svc.example.net. key65535=\"2222\""), |
| 2600 |
TEXT_INVALID("2 svc.example.net. key65536=\"2222\""), |
| 2601 |
TEXT_VALID_LOOP(1, "2 svc.example.net. key10"), |
| 2602 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. key11=", |
| 2603 |
"2 svc.example.net. key11"), |
| 2604 |
TEXT_VALID_LOOPCHG(1, "2 svc.example.net. key12=\"\"", |
| 2605 |
"2 svc.example.net. key12"), |
| 2606 |
/* empty alpn-id sub fields */ |
| 2607 |
TEXT_INVALID("2 svc.example.net. alpn"), |
| 2608 |
TEXT_INVALID("2 svc.example.net. alpn="), |
| 2609 |
TEXT_INVALID("2 svc.example.net. alpn=,h1"), |
| 2610 |
TEXT_INVALID("2 svc.example.net. alpn=h1,"), |
| 2611 |
TEXT_INVALID("2 svc.example.net. alpn=h1,,h2"), |
| 2612 |
/* empty alpn-id sub fields - RFC 1035 escaped commas */ |
| 2613 |
TEXT_INVALID("2 svc.example.net. alpn=\\,abc"), |
| 2614 |
TEXT_INVALID("2 svc.example.net. alpn=abc\\,"), |
| 2615 |
TEXT_INVALID("2 svc.example.net. alpn=a\\,\\,abc"), |
| 2616 |
/* mandatory */ |
| 2617 |
TEXT_VALID_LOOP(2, "2 svc.example.net. mandatory=alpn " |
| 2618 |
"alpn=\"h2\""), |
| 2619 |
TEXT_VALID_LOOP(3, "2 svc.example.net. mandatory=alpn,port " |
| 2620 |
"alpn=\"h2\" port=443"), |
| 2621 |
TEXT_VALID_LOOPCHG(3, |
| 2622 |
"2 svc.example.net. mandatory=port,alpn " |
| 2623 |
"alpn=\"h2\" port=443", |
| 2624 |
"2 svc.example.net. mandatory=alpn,port " |
| 2625 |
"alpn=\"h2\" port=443"), |
| 2626 |
TEXT_INVALID("2 svc.example.net. mandatory=mandatory"), |
| 2627 |
TEXT_INVALID("2 svc.example.net. mandatory=port"), |
| 2628 |
TEXT_INVALID("2 svc.example.net. mandatory=,port port=433"), |
| 2629 |
TEXT_INVALID("2 svc.example.net. mandatory=port, port=433"), |
| 2630 |
TEXT_INVALID("2 svc.example.net. " |
| 2631 |
"mandatory=alpn,,port alpn=h2 port=433"), |
| 2632 |
/* mandatory w/ unknown key values */ |
| 2633 |
TEXT_VALID_LOOP(2, "2 svc.example.net. mandatory=key8 key8"), |
| 2634 |
TEXT_VALID_LOOP(3, "2 svc.example.net. mandatory=key8,key9 " |
| 2635 |
"key8 key9"), |
| 2636 |
TEXT_VALID_LOOPCHG( |
| 2637 |
3, "2 svc.example.net. mandatory=key9,key8 key8 key9", |
| 2638 |
"2 svc.example.net. mandatory=key8,key9 key8 key9"), |
| 2639 |
TEXT_INVALID("2 svc.example.net. " |
| 2640 |
"mandatory=key8,key8"), |
| 2641 |
TEXT_INVALID("2 svc.example.net. mandatory=,key8"), |
| 2642 |
TEXT_INVALID("2 svc.example.net. mandatory=key8,"), |
| 2643 |
TEXT_INVALID("2 svc.example.net. " |
| 2644 |
"mandatory=key8,,key8"), |
| 2645 |
/* Invalid test vectors */ |
| 2646 |
TEXT_INVALID("1 foo.example.com. ( key123=abc key123=def )"), |
| 2647 |
TEXT_INVALID("1 foo.example.com. mandatory"), |
| 2648 |
TEXT_INVALID("1 foo.example.com. alpn"), |
| 2649 |
TEXT_INVALID("1 foo.example.com. port"), |
| 2650 |
TEXT_INVALID("1 foo.example.com. ipv4hint"), |
| 2651 |
TEXT_INVALID("1 foo.example.com. ipv6hint"), |
| 2652 |
TEXT_INVALID("1 foo.example.com. no-default-alpn=abc"), |
| 2653 |
TEXT_INVALID("1 foo.example.com. mandatory=key123"), |
| 2654 |
TEXT_INVALID("1 foo.example.com. mandatory=mandatory"), |
| 2655 |
TEXT_INVALID("1 foo.example.com. ( mandatory=key123,key123 " |
| 2656 |
"key123=abc)"), |
| 2657 |
/* dohpath tests */ |
| 2658 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{dns}", |
| 2659 |
"1 example.net. key7=\"/{dns}\""), |
| 2660 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{+dns}", |
| 2661 |
"1 example.net. key7=\"/{+dns}\""), |
| 2662 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{#dns}", |
| 2663 |
"1 example.net. key7=\"/{#dns}\""), |
| 2664 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{.dns}", |
| 2665 |
"1 example.net. key7=\"/{.dns}\""), |
| 2666 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=\"/{;dns}\"", |
| 2667 |
"1 example.net. key7=\"/{;dns}\""), |
| 2668 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{?dns}", |
| 2669 |
"1 example.net. key7=\"/{?dns}\""), |
| 2670 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/some/path{?dns}", |
| 2671 |
"1 example.net. key7=\"/some/path{?dns}\""), |
| 2672 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{dns:9999}", |
| 2673 |
"1 example.net. key7=\"/{dns:9999}\""), |
| 2674 |
TEXT_VALID_LOOPCHG(1, "1 example.net. dohpath=/{dns*}", |
| 2675 |
"1 example.net. key7=\"/{dns*}\""), |
| 2676 |
TEXT_VALID_LOOPCHG( |
| 2677 |
1, "1 example.net. dohpath=/some/path?key=value{&dns}", |
| 2678 |
"1 example.net. key7=\"/some/path?key=value{&dns}\""), |
| 2679 |
TEXT_VALID_LOOPCHG(1, |
| 2680 |
"1 example.net. " |
| 2681 |
"dohpath=/some/path?key=value{&dns,x*}", |
| 2682 |
"1 example.net. " |
| 2683 |
"key7=\"/some/path?key=value{&dns,x*}\""), |
| 2684 |
TEXT_INVALID("1 example.com. dohpath=not-relative"), |
| 2685 |
TEXT_INVALID("1 example.com. dohpath=/{?no_dns_variable}"), |
| 2686 |
TEXT_INVALID("1 example.com. dohpath=/novariable"), |
| 2687 |
TEXT_INVALID("1 example.com. dohpath=/{?dnsx}"), |
| 2688 |
/* index too big > 9999 */ |
| 2689 |
TEXT_INVALID("1 example.com. dohpath=/{?dns:10000}"), |
| 2690 |
/* index not postive */ |
| 2691 |
TEXT_INVALID("1 example.com. dohpath=/{?dns:0}"), |
| 2692 |
/* index leading zero */ |
| 2693 |
TEXT_INVALID("1 example.com. dohpath=/{?dns:01}"), |
| 2694 |
/* two operators */ |
| 2695 |
TEXT_INVALID("1 example.com. dohpath=/{??dns}"), |
| 2696 |
/* invalid % encoding */ |
| 2697 |
TEXT_INVALID("1 example.com. dohpath=/%a{?dns}"), |
| 2698 |
/* invalid % encoding */ |
| 2699 |
TEXT_INVALID("1 example.com. dohpath=/{?dns,%a}"), |
| 2700 |
/* incomplete macro */ |
| 2701 |
TEXT_INVALID("1 example.com. dohpath=/{?dns" /*}*/), |
| 2702 |
TEXT_SENTINEL() |
| 2703 |
|
| 2704 |
}; |
| 2705 |
wire_ok_t wire_ok[] = { |
| 2706 |
/* |
| 2707 |
* Too short |
| 2708 |
*/ |
| 2709 |
WIRE_INVALID(0x00, 0x00), |
| 2710 |
/* |
| 2711 |
* Minimal length record. |
| 2712 |
*/ |
| 2713 |
WIRE_VALID(0x00, 0x00, 0x00), |
| 2714 |
/* |
| 2715 |
* Alias with invalid dohpath. |
| 2716 |
*/ |
| 2717 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00), |
| 2718 |
/* |
| 2719 |
* Bad key7= length (longer than rdata). |
| 2720 |
*/ |
| 2721 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x07, 0x00, 0x01), |
| 2722 |
/* |
| 2723 |
* Port (0x03) too small (zero and one octets). |
| 2724 |
*/ |
| 2725 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00), |
| 2726 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00), |
| 2727 |
/* Valid port */ |
| 2728 |
WIRE_VALID_LOOP(1, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x02, |
| 2729 |
0x00, 0x00), |
| 2730 |
/* |
| 2731 |
* Port (0x03) too big (three octets). |
| 2732 |
*/ |
| 2733 |
WIRE_INVALID(0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, |
| 2734 |
0x00, 0x00), |
| 2735 |
/* |
| 2736 |
* Duplicate keys. |
| 2737 |
*/ |
| 2738 |
WIRE_INVALID(0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, |
| 2739 |
0x80, 0x00, 0x00), |
| 2740 |
/* |
| 2741 |
* Out of order keys. |
| 2742 |
*/ |
| 2743 |
WIRE_INVALID(0x01, 0x01, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, |
| 2744 |
0x80, 0x00, 0x00), |
| 2745 |
/* |
| 2746 |
* Empty of mandatory key list. |
| 2747 |
*/ |
| 2748 |
WIRE_INVALID(0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 2749 |
/* |
| 2750 |
* "mandatory=mandatory" is invalid |
| 2751 |
*/ |
| 2752 |
WIRE_INVALID(0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, |
| 2753 |
0x00), |
| 2754 |
/* |
| 2755 |
* Out of order mandatory key list. |
| 2756 |
*/ |
| 2757 |
WIRE_INVALID(0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, |
| 2758 |
0x80, 0x00, 0x71, 0x00, 0x71, 0x00, 0x00, 0x00, |
| 2759 |
0x80, 0x00, 0x00), |
| 2760 |
/* |
| 2761 |
* Alpn(0x00 0x01) (length 0x00 0x09) "h1,h2" + "h3" |
| 2762 |
*/ |
| 2763 |
WIRE_VALID_LOOP(0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, |
| 2764 |
5, 'h', '1', ',', 'h', '2', 2, 'h', '3'), |
| 2765 |
/* |
| 2766 |
* Alpn(0x00 0x01) (length 0x00 0x09) "h1\h2" + "h3" |
| 2767 |
*/ |
| 2768 |
WIRE_VALID_LOOP(0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, |
| 2769 |
5, 'h', '1', '\\', 'h', '2', 2, 'h', '3'), |
| 2770 |
/* |
| 2771 |
* no-default-alpn (0x00 0x02) without alpn, alpn is required. |
| 2772 |
*/ |
| 2773 |
WIRE_INVALID(0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00), |
| 2774 |
/* |
| 2775 |
* Alpn(0x00 0x01) with zero length elements is invalid |
| 2776 |
*/ |
| 2777 |
WIRE_INVALID(0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x05, |
| 2778 |
0x00, 0x00, 0x00, 0x00, 0x00), |
| 2779 |
WIRE_SENTINEL() |
| 2780 |
}; |
| 2781 |
/* Test vectors from RFCXXXX */ |
| 2782 |
textvsunknown_t textvsunknown[] = { |
| 2783 |
/* AliasForm */ |
| 2784 |
{ "0 foo.example.com", "\\# 19 ( 00 00 03 66 6f 6f 07 65 78 61 " |
| 2785 |
"6d 70 6c 65 03 63 6f 6d 00)" }, |
| 2786 |
/* ServiceForm */ |
| 2787 |
{ "1 .", "\\# 3 ( 00 01 00)" }, |
| 2788 |
/* Port example */ |
| 2789 |
{ "16 foo.example.com port=53", |
| 2790 |
"\\# 25 ( 00 10 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 63 6f " |
| 2791 |
"6d 00 00 03 00 02 00 35 )" }, |
| 2792 |
/* Unregistered keys with unquoted value. */ |
| 2793 |
{ "1 foo.example.com key667=hello", |
| 2794 |
"\\# 28 ( 00 01 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 63 6f " |
| 2795 |
"6d 00 02 9b 00 05 68 65 6c 6c 6f )" }, |
| 2796 |
/* |
| 2797 |
* Quoted decimal-escaped character. |
| 2798 |
* 1 foo.example.com key667="hello\210qoo" |
| 2799 |
*/ |
| 2800 |
{ "1 foo.example.com key667=\"hello\\210qoo\"", |
| 2801 |
"\\# 32 ( 00 01 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 63 6f " |
| 2802 |
"6d 00 02 9b 00 09 68 65 6c 6c 6f d2 71 6f 6f )" }, |
| 2803 |
/* |
| 2804 |
* IPv6 hints example, quoted. |
| 2805 |
* 1 foo.example.com ipv6hint="2001:db8::1,2001:db8::53:1" |
| 2806 |
*/ |
| 2807 |
{ "1 foo.example.com ipv6hint=\"2001:db8::1,2001:db8::53:1\"", |
| 2808 |
"\\# 55 ( 00 01 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 63 6f " |
| 2809 |
"6d 00 00 06 00 20 20 01 0d b8 00 00 00 00 00 00 00 00 00 00 " |
| 2810 |
"00 01 20 01 0d b8 00 00 00 00 00 00 00 00 00 53 00 01 )" }, |
| 2811 |
/* SvcParamValues and mandatory out of order. */ |
| 2812 |
{ "16 foo.example.org alpn=h2,h3-19 mandatory=ipv4hint,alpn " |
| 2813 |
"ipv4hint=192.0.2.1", |
| 2814 |
"\\# 48 ( 00 10 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 6f 72 " |
| 2815 |
"67 00 00 00 00 04 00 01 00 04 00 01 00 09 02 68 32 05 68 33 " |
| 2816 |
"2d 31 39 00 04 00 04 c0 00 02 01 )" }, |
| 2817 |
/* |
| 2818 |
* Quoted ALPN with escaped comma and backslash. |
| 2819 |
* 16 foo.example.org alpn="f\\\\oo\\,bar,h2" |
| 2820 |
*/ |
| 2821 |
{ "16 foo.example.org alpn=\"f\\\\\\\\oo\\\\,bar,h2\"", |
| 2822 |
"\\# 35 ( 00 10 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 6f 72 " |
| 2823 |
"67 00 00 01 00 0c 08 66 5c 6f 6f 2c 62 61 72 02 68 32 )" }, |
| 2824 |
/* |
| 2825 |
* Unquoted ALPN with escaped comma and backslash. |
| 2826 |
* 16 foo.example.org alpn=f\\\092oo\092,bar,h2 |
| 2827 |
*/ |
| 2828 |
{ "16 foo.example.org alpn=f\\\\\\092oo\\092,bar,h2", |
| 2829 |
"\\# 35 ( 00 10 03 66 6f 6f 07 65 78 61 6d 70 6c 65 03 6f 72 " |
| 2830 |
"67 00 00 01 00 0c 08 66 5c 6f 6f 2c 62 61 72 02 68 32 )" }, |
| 2831 |
{ NULL, NULL } |
| 2832 |
}; |
| 2833 |
|
| 2834 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2835 |
dns_rdatatype_svcb, sizeof(dns_rdata_in_svcb_t)); |
| 2836 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 2837 |
dns_rdatatype_https, sizeof(dns_rdata_in_https_t)); |
| 2838 |
|
| 2839 |
check_textvsunknown(textvsunknown, dns_rdataclass_in, |
| 2840 |
dns_rdatatype_svcb); |
| 2841 |
check_textvsunknown(textvsunknown, dns_rdataclass_in, |
| 2842 |
dns_rdatatype_https); |
| 2843 |
} |
| 2844 |
|
| 2845 |
/* |
| 2846 |
* ZONEMD tests. |
| 2847 |
* |
| 2848 |
* Excerpted from RFC 8976: |
| 2849 |
* |
| 2850 |
* The ZONEMD RDATA wire format is encoded as follows: |
| 2851 |
* |
| 2852 |
* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 |
| 2853 |
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 2854 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 2855 |
* | Serial | |
| 2856 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 2857 |
* | Scheme |Hash Algorithm | | |
| 2858 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 2859 |
* | Digest | |
| 2860 |
* / / |
| 2861 |
* / / |
| 2862 |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 2863 |
* |
| 2864 |
* 2.2.1. The Serial Field |
| 2865 |
* |
| 2866 |
* The Serial field is a 32-bit unsigned integer in network byte order. |
| 2867 |
* It is the serial number from the zone's SOA record ([RFC1035], |
| 2868 |
* Section 3.3.13) for which the zone digest was generated. |
| 2869 |
* |
| 2870 |
* It is included here to clearly bind the ZONEMD RR to a particular |
| 2871 |
* version of the zone's content. Without the serial number, a stand- |
| 2872 |
* alone ZONEMD digest has no obvious association to any particular |
| 2873 |
* instance of a zone. |
| 2874 |
* |
| 2875 |
* 2.2.2. The Scheme Field |
| 2876 |
* |
| 2877 |
* The Scheme field is an 8-bit unsigned integer that identifies the |
| 2878 |
* methods by which data is collated and presented as input to the |
| 2879 |
* hashing function. |
| 2880 |
* |
| 2881 |
* Herein, SIMPLE, with Scheme value 1, is the only standardized Scheme |
| 2882 |
* defined for ZONEMD records and it MUST be supported by |
| 2883 |
* implementations. The "ZONEMD Schemes" registry is further described |
| 2884 |
* in Section 5. |
| 2885 |
* |
| 2886 |
* Scheme values 240-254 are allocated for Private Use. |
| 2887 |
* |
| 2888 |
* 2.2.3. The Hash Algorithm Field |
| 2889 |
* |
| 2890 |
* The Hash Algorithm field is an 8-bit unsigned integer that identifies |
| 2891 |
* the cryptographic hash algorithm used to construct the digest. |
| 2892 |
* |
| 2893 |
* Herein, SHA384 ([RFC6234]), with Hash Algorithm value 1, is the only |
| 2894 |
* standardized Hash Algorithm defined for ZONEMD records that MUST be |
| 2895 |
* supported by implementations. When SHA384 is used, the size of the |
| 2896 |
* Digest field is 48 octets. The result of the SHA384 digest algorithm |
| 2897 |
* MUST NOT be truncated, and the entire 48-octet digest is published in |
| 2898 |
* the ZONEMD record. |
| 2899 |
* |
| 2900 |
* SHA512 ([RFC6234]), with Hash Algorithm value 2, is also defined for |
| 2901 |
* ZONEMD records and SHOULD be supported by implementations. When |
| 2902 |
* SHA512 is used, the size of the Digest field is 64 octets. The |
| 2903 |
* result of the SHA512 digest algorithm MUST NOT be truncated, and the |
| 2904 |
* entire 64-octet digest is published in the ZONEMD record. |
| 2905 |
* |
| 2906 |
* Hash Algorithm values 240-254 are allocated for Private Use. |
| 2907 |
* |
| 2908 |
* The "ZONEMD Hash Algorithms" registry is further described in |
| 2909 |
* Section 5. |
| 2910 |
* |
| 2911 |
* 2.2.4. The Digest Field |
| 2912 |
* |
| 2913 |
* The Digest field is a variable-length sequence of octets containing |
| 2914 |
* the output of the hash algorithm. The length of the Digest field is |
| 2915 |
* determined by deducting the fixed size of the Serial, Scheme, and |
| 2916 |
* Hash Algorithm fields from the RDATA size in the ZONEMD RR header. |
| 2917 |
* |
| 2918 |
* The Digest field MUST NOT be shorter than 12 octets. Digests for the |
| 2919 |
* SHA384 and SHA512 hash algorithms specified herein are never |
| 2920 |
* truncated. Digests for future hash algorithms MAY be truncated but |
| 2921 |
* MUST NOT be truncated to a length that results in less than 96 bits |
| 2922 |
* (12 octets) of equivalent strength. |
| 2923 |
* |
| 2924 |
* Section 3 describes how to calculate the digest for a zone. |
| 2925 |
* Section 4 describes how to use the digest to verify the contents of a |
| 2926 |
* zone. |
| 2927 |
* |
| 2928 |
*/ |
| 2929 |
|
| 2930 |
ISC_RUN_TEST_IMPL(zonemd) { |
| 2931 |
text_ok_t text_ok[] = { |
| 2932 |
TEXT_INVALID(""), |
| 2933 |
/* No digest scheme or digest type*/ |
| 2934 |
TEXT_INVALID("0"), |
| 2935 |
/* No digest type */ |
| 2936 |
TEXT_INVALID("0 0"), |
| 2937 |
/* No digest */ |
| 2938 |
TEXT_INVALID("0 0 0"), |
| 2939 |
/* No digest */ |
| 2940 |
TEXT_INVALID("99999999 0 0"), |
| 2941 |
/* No digest */ |
| 2942 |
TEXT_INVALID("2019020700 0 0"), |
| 2943 |
/* Digest too short */ |
| 2944 |
TEXT_INVALID("2019020700 1 1 DEADBEEF"), |
| 2945 |
/* Digest too short */ |
| 2946 |
TEXT_INVALID("2019020700 1 2 DEADBEEF"), |
| 2947 |
/* Digest too short */ |
| 2948 |
TEXT_INVALID("2019020700 1 3 DEADBEEFDEADBEEFDEADBE"), |
| 2949 |
/* Digest type unknown */ |
| 2950 |
TEXT_VALID("2019020700 1 3 DEADBEEFDEADBEEFDEADBEEF"), |
| 2951 |
/* Digest type max */ |
| 2952 |
TEXT_VALID("2019020700 1 255 DEADBEEFDEADBEEFDEADBEEF"), |
| 2953 |
/* Digest type too big */ |
| 2954 |
TEXT_INVALID("2019020700 0 256 DEADBEEFDEADBEEFDEADBEEF"), |
| 2955 |
/* Scheme max */ |
| 2956 |
TEXT_VALID("2019020700 255 3 DEADBEEFDEADBEEFDEADBEEF"), |
| 2957 |
/* Scheme too big */ |
| 2958 |
TEXT_INVALID("2019020700 256 3 DEADBEEFDEADBEEFDEADBEEF"), |
| 2959 |
/* SHA384 */ |
| 2960 |
TEXT_VALID("2019020700 1 1 " |
| 2961 |
"7162D2BB75C047A53DE98767C9192BEB" |
| 2962 |
"14DB01E7E2267135DAF0230A 19BA4A31" |
| 2963 |
"6AF6BF64AA5C7BAE24B2992850300509"), |
| 2964 |
/* SHA512 */ |
| 2965 |
TEXT_VALID("2019020700 1 2 " |
| 2966 |
"08CFA1115C7B948C4163A901270395EA" |
| 2967 |
"226A930CD2CBCF2FA9A5E6EB 85F37C8A" |
| 2968 |
"4E114D884E66F176EAB121CB02DB7D65" |
| 2969 |
"2E0CC4827E7A3204 F166B47E5613FD27"), |
| 2970 |
/* SHA384 too short and with private scheme */ |
| 2971 |
TEXT_INVALID("2021042801 0 1 " |
| 2972 |
"7162D2BB75C047A53DE98767C9192BEB" |
| 2973 |
"6AF6BF64AA5C7BAE24B2992850300509"), |
| 2974 |
/* SHA512 too short and with private scheme */ |
| 2975 |
TEXT_INVALID("2021042802 5 2 " |
| 2976 |
"A897B40072ECAE9E4CA3F1F227DE8F5E" |
| 2977 |
"480CDEBB16DFC64C1C349A7B5F6C71AB" |
| 2978 |
"E8A88B76EF0BA1604EC25752E946BF98"), |
| 2979 |
TEXT_SENTINEL() |
| 2980 |
}; |
| 2981 |
wire_ok_t wire_ok[] = { |
| 2982 |
/* |
| 2983 |
* Short. |
| 2984 |
*/ |
| 2985 |
WIRE_INVALID(0x00), |
| 2986 |
/* |
| 2987 |
* Short. |
| 2988 |
*/ |
| 2989 |
WIRE_INVALID(0x00, 0x00), |
| 2990 |
/* |
| 2991 |
* Short. |
| 2992 |
*/ |
| 2993 |
WIRE_INVALID(0x00, 0x00, 0x00), |
| 2994 |
/* |
| 2995 |
* Short. |
| 2996 |
*/ |
| 2997 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00), |
| 2998 |
/* |
| 2999 |
* Short. |
| 3000 |
*/ |
| 3001 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x00), |
| 3002 |
/* |
| 3003 |
* Short. |
| 3004 |
*/ |
| 3005 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00), |
| 3006 |
/* |
| 3007 |
* Short 11-octet digest. |
| 3008 |
*/ |
| 3009 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3010 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3011 |
0x00), |
| 3012 |
/* |
| 3013 |
* Minimal, 12-octet hash for an undefined digest type. |
| 3014 |
*/ |
| 3015 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3016 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3017 |
0x00), |
| 3018 |
/* |
| 3019 |
* SHA-384 is defined, so we insist there be a digest of |
| 3020 |
* the expected length. |
| 3021 |
*/ |
| 3022 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, |
| 3023 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3024 |
0x00, 0x00), |
| 3025 |
/* |
| 3026 |
* 48-octet digest, valid for SHA-384. |
| 3027 |
*/ |
| 3028 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xde, 0xad, 0xbe, |
| 3029 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3030 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3031 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3032 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3033 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, |
| 3034 |
0xce), |
| 3035 |
/* |
| 3036 |
* 56-octet digest, too long for SHA-384. |
| 3037 |
*/ |
| 3038 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xde, 0xad, |
| 3039 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3040 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3041 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, |
| 3042 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3043 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3044 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, |
| 3045 |
0xbe, 0xef, 0xfa, 0xce), |
| 3046 |
/* |
| 3047 |
* 56-octet digest, too short for SHA-512 |
| 3048 |
*/ |
| 3049 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xde, 0xad, |
| 3050 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3051 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3052 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, |
| 3053 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3054 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3055 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, |
| 3056 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad), |
| 3057 |
/* |
| 3058 |
* 64-octet digest, just right for SHA-512 |
| 3059 |
*/ |
| 3060 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xde, 0xad, 0xbe, |
| 3061 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3062 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3063 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3064 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3065 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3066 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3067 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef), |
| 3068 |
/* |
| 3069 |
* 72-octet digest, too long for SHA-512 |
| 3070 |
*/ |
| 3071 |
WIRE_INVALID(0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0xde, 0xad, |
| 3072 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3073 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3074 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, |
| 3075 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3076 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3077 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, |
| 3078 |
0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, |
| 3079 |
0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3080 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce), |
| 3081 |
/* |
| 3082 |
* 56-octet digest, valid for an undefined digest type. |
| 3083 |
*/ |
| 3084 |
WIRE_VALID(0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xde, 0xad, 0xbe, |
| 3085 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3086 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3087 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3088 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, |
| 3089 |
0xef, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce, |
| 3090 |
0xde, 0xad, 0xbe, 0xef, 0xfa, 0xce), |
| 3091 |
/* |
| 3092 |
* Sentinel. |
| 3093 |
*/ |
| 3094 |
WIRE_SENTINEL() |
| 3095 |
}; |
| 3096 |
|
| 3097 |
check_rdata(text_ok, wire_ok, NULL, false, dns_rdataclass_in, |
| 3098 |
dns_rdatatype_zonemd, sizeof(dns_rdata_zonemd_t)); |
| 3099 |
} |
| 3100 |
|
| 3101 |
ISC_RUN_TEST_IMPL(atcname) { |
| 3102 |
unsigned int i; |
| 3103 |
|
| 3104 |
#define UNR "# Unexpected result from dns_rdatatype_atcname for type %u\n" |
| 3105 |
for (i = 0; i < 0xffffU; i++) { |
| 3106 |
bool tf = dns_rdatatype_atcname((dns_rdatatype_t)i); |
| 3107 |
switch (i) { |
| 3108 |
case dns_rdatatype_nsec: |
| 3109 |
case dns_rdatatype_key: |
| 3110 |
case dns_rdatatype_rrsig: |
| 3111 |
if (!tf) { |
| 3112 |
print_message(UNR, i); |
| 3113 |
} |
| 3114 |
assert_true(tf); |
| 3115 |
break; |
| 3116 |
default: |
| 3117 |
if (tf) { |
| 3118 |
print_message(UNR, i); |
| 3119 |
} |
| 3120 |
assert_false(tf); |
| 3121 |
break; |
| 3122 |
} |
| 3123 |
} |
| 3124 |
#undef UNR |
| 3125 |
} |
| 3126 |
|
| 3127 |
ISC_RUN_TEST_IMPL(atparent) { |
| 3128 |
unsigned int i; |
| 3129 |
|
| 3130 |
#define UNR "# Unexpected result from dns_rdatatype_atparent for type %u\n" |
| 3131 |
for (i = 0; i < 0xffffU; i++) { |
| 3132 |
bool tf = dns_rdatatype_atparent((dns_rdatatype_t)i); |
| 3133 |
switch (i) { |
| 3134 |
case dns_rdatatype_ds: |
| 3135 |
if (!tf) { |
| 3136 |
print_message(UNR, i); |
| 3137 |
} |
| 3138 |
assert_true(tf); |
| 3139 |
break; |
| 3140 |
default: |
| 3141 |
if (tf) { |
| 3142 |
print_message(UNR, i); |
| 3143 |
} |
| 3144 |
assert_false(tf); |
| 3145 |
break; |
| 3146 |
} |
| 3147 |
} |
| 3148 |
#undef UNR |
| 3149 |
} |
| 3150 |
|
| 3151 |
ISC_RUN_TEST_IMPL(iszonecutauth) { |
| 3152 |
unsigned int i; |
| 3153 |
#define UNR "# Unexpected result from dns_rdatatype_iszonecutauth for type %u\n" |
| 3154 |
for (i = 0; i < 0xffffU; i++) { |
| 3155 |
bool tf = dns_rdatatype_iszonecutauth((dns_rdatatype_t)i); |
| 3156 |
switch (i) { |
| 3157 |
case dns_rdatatype_ns: |
| 3158 |
case dns_rdatatype_ds: |
| 3159 |
case dns_rdatatype_nsec: |
| 3160 |
case dns_rdatatype_key: |
| 3161 |
case dns_rdatatype_rrsig: |
| 3162 |
if (!tf) { |
| 3163 |
print_message(UNR, i); |
| 3164 |
} |
| 3165 |
assert_true(tf); |
| 3166 |
break; |
| 3167 |
default: |
| 3168 |
if (tf) { |
| 3169 |
print_message(UNR, i); |
| 3170 |
} |
| 3171 |
assert_false(tf); |
| 3172 |
break; |
| 3173 |
} |
| 3174 |
} |
| 3175 |
#undef UNR |
| 3176 |
} |
| 3177 |
|
| 3178 |
ISC_TEST_LIST_START |
| 3179 |
|
| 3180 |
/* types */ |
| 3181 |
ISC_TEST_ENTRY(amtrelay) |
| 3182 |
ISC_TEST_ENTRY(apl) |
| 3183 |
ISC_TEST_ENTRY(atma) |
| 3184 |
ISC_TEST_ENTRY(cdnskey) |
| 3185 |
ISC_TEST_ENTRY(csync) |
| 3186 |
ISC_TEST_ENTRY(dnskey) |
| 3187 |
ISC_TEST_ENTRY(doa) |
| 3188 |
ISC_TEST_ENTRY(ds) |
| 3189 |
ISC_TEST_ENTRY(eid) |
| 3190 |
ISC_TEST_ENTRY(hip) |
| 3191 |
ISC_TEST_ENTRY(https_svcb) |
| 3192 |
ISC_TEST_ENTRY(isdn) |
| 3193 |
ISC_TEST_ENTRY(key) |
| 3194 |
ISC_TEST_ENTRY(loc) |
| 3195 |
ISC_TEST_ENTRY(nimloc) |
| 3196 |
ISC_TEST_ENTRY(nsec) |
| 3197 |
ISC_TEST_ENTRY(nsec3) |
| 3198 |
ISC_TEST_ENTRY(nxt) |
| 3199 |
ISC_TEST_ENTRY(rkey) |
| 3200 |
ISC_TEST_ENTRY(resinfo) |
| 3201 |
ISC_TEST_ENTRY(sshfp) |
| 3202 |
ISC_TEST_ENTRY(wallet) |
| 3203 |
ISC_TEST_ENTRY(wks) |
| 3204 |
ISC_TEST_ENTRY(zonemd) |
| 3205 |
|
| 3206 |
/* other tests */ |
| 3207 |
ISC_TEST_ENTRY(edns_client_subnet) |
| 3208 |
ISC_TEST_ENTRY(atcname) |
| 3209 |
ISC_TEST_ENTRY(atparent) |
| 3210 |
ISC_TEST_ENTRY(iszonecutauth) |
| 3211 |
ISC_TEST_LIST_END |
| 3212 |
|
| 3213 |
ISC_TEST_MAIN |