2 * Copyright (C) 2004-2012 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2003 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15 * PERFORMANCE OF THIS SOFTWARE.
25 #include <isc/base64.h>
29 #include <isc/parseint.h>
30 #include <isc/print.h>
31 #include <isc/string.h>
32 #include <isc/stdlib.h>
35 #include <dns/callbacks.h>
37 #include <dns/compress.h>
38 #include <dns/enumtype.h>
39 #include <dns/keyflags.h>
40 #include <dns/keyvalues.h>
41 #include <dns/message.h>
42 #include <dns/rcode.h>
43 #include <dns/rdata.h>
44 #include <dns/rdataclass.h>
45 #include <dns/rdatastruct.h>
46 #include <dns/rdatatype.h>
47 #include <dns/result.h>
48 #include <dns/secalg.h>
49 #include <dns/secproto.h>
55 isc_result_t _r = (x); \
56 if (_r != ISC_R_SUCCESS) \
62 isc_result_t _r = (x); \
63 if (_r != ISC_R_SUCCESS) { \
64 isc_lex_ungettoken(lexer, &token); \
69 #define DNS_AS_STR(t) ((t).value.as_textregion.base)
71 #define ARGS_FROMTEXT int rdclass, dns_rdatatype_t type, \
72 isc_lex_t *lexer, dns_name_t *origin, \
73 unsigned int options, isc_buffer_t *target, \
74 dns_rdatacallbacks_t *callbacks
76 #define ARGS_TOTEXT dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, \
79 #define ARGS_FROMWIRE int rdclass, dns_rdatatype_t type, \
80 isc_buffer_t *source, dns_decompress_t *dctx, \
81 unsigned int options, isc_buffer_t *target
83 #define ARGS_TOWIRE dns_rdata_t *rdata, dns_compress_t *cctx, \
86 #define ARGS_COMPARE const dns_rdata_t *rdata1, const dns_rdata_t *rdata2
88 #define ARGS_FROMSTRUCT int rdclass, dns_rdatatype_t type, \
89 void *source, isc_buffer_t *target
91 #define ARGS_TOSTRUCT dns_rdata_t *rdata, void *target, isc_mem_t *mctx
93 #define ARGS_FREESTRUCT void *source
95 #define ARGS_ADDLDATA dns_rdata_t *rdata, dns_additionaldatafunc_t add, \
98 #define ARGS_DIGEST dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg
100 #define ARGS_CHECKOWNER dns_name_t *name, dns_rdataclass_t rdclass, \
101 dns_rdatatype_t type, isc_boolean_t wildcard
103 #define ARGS_CHECKNAMES dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad
107 * Context structure for the totext_ functions.
108 * Contains formatting options for rdata-to-text
111 typedef struct dns_rdata_textctx {
112 dns_name_t *origin; /*%< Current origin, or NULL. */
113 unsigned int flags; /*%< DNS_STYLEFLAG_* */
114 unsigned int width; /*%< Width of rdata column. */
115 const char *linebreak; /*%< Line break string. */
116 } dns_rdata_textctx_t;
119 txt_totext(isc_region_t *source, isc_buffer_t *target);
122 txt_fromtext(isc_textregion_t *source, isc_buffer_t *target);
125 txt_fromwire(isc_buffer_t *source, isc_buffer_t *target);
128 name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target);
131 name_length(dns_name_t *name);
134 str_totext(const char *source, isc_buffer_t *target);
137 inet_totext(int af, isc_region_t *src, isc_buffer_t *target);
140 buffer_empty(isc_buffer_t *source);
143 buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region);
146 uint32_tobuffer(isc_uint32_t, isc_buffer_t *target);
149 uint16_tobuffer(isc_uint32_t, isc_buffer_t *target);
152 uint8_tobuffer(isc_uint32_t, isc_buffer_t *target);
155 name_tobuffer(dns_name_t *name, isc_buffer_t *target);
158 uint32_fromregion(isc_region_t *region);
161 uint16_fromregion(isc_region_t *region);
164 uint8_fromregion(isc_region_t *region);
167 uint8_consume_fromregion(isc_region_t *region);
170 mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length);
173 hexvalue(char value);
176 decvalue(char value);
179 btoa_totext(unsigned char *inbuf, int inbuflen, isc_buffer_t *target);
182 atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target);
185 default_fromtext_callback(dns_rdatacallbacks_t *callbacks, const char *, ...)
186 ISC_FORMAT_PRINTF(2, 3);
189 fromtext_error(void (*callback)(dns_rdatacallbacks_t *, const char *, ...),
190 dns_rdatacallbacks_t *callbacks, const char *name,
191 unsigned long line, isc_token_t *token, isc_result_t result);
194 fromtext_warneof(isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks);
197 rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
198 isc_buffer_t *target);
201 warn_badname(dns_name_t *name, isc_lex_t *lexer,
202 dns_rdatacallbacks_t *callbacks);
205 warn_badmx(isc_token_t *token, isc_lex_t *lexer,
206 dns_rdatacallbacks_t *callbacks);
209 uint16_consume_fromregion(isc_region_t *region);
212 unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
213 isc_buffer_t *target);
216 getquad(const void *src, struct in_addr *dst,
217 isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks)
222 result = inet_aton(src, dst);
223 if (result == 1 && callbacks != NULL &&
224 inet_pton(AF_INET, src, &tmp) != 1) {
225 const char *name = isc_lex_getsourcename(lexer);
228 (*callbacks->warn)(callbacks, "%s:%lu: \"%s\" "
229 "is not a decimal dotted quad", name,
230 isc_lex_getsourceline(lexer), src);
235 static inline isc_result_t
236 name_duporclone(dns_name_t *source, isc_mem_t *mctx, dns_name_t *target) {
239 return (dns_name_dup(source, mctx, target));
240 dns_name_clone(source, target);
241 return (ISC_R_SUCCESS);
245 mem_maybedup(isc_mem_t *mctx, void *source, size_t length) {
250 new = isc_mem_allocate(mctx, length);
252 memcpy(new, source, length);
257 static const char hexdigits[] = "0123456789abcdef";
258 static const char decdigits[] = "0123456789";
263 #define RESERVED 0x0002
270 dns_rdata_init(dns_rdata_t *rdata) {
272 REQUIRE(rdata != NULL);
279 ISC_LINK_INIT(rdata, link);
280 /* ISC_LIST_INIT(rdata->list); */
284 dns_rdata_reset(dns_rdata_t *rdata) {
286 REQUIRE(rdata != NULL);
288 REQUIRE(!ISC_LINK_LINKED(rdata, link));
289 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
303 dns_rdata_clone(const dns_rdata_t *src, dns_rdata_t *target) {
305 REQUIRE(src != NULL);
306 REQUIRE(target != NULL);
308 REQUIRE(DNS_RDATA_INITIALIZED(target));
310 REQUIRE(DNS_RDATA_VALIDFLAGS(src));
311 REQUIRE(DNS_RDATA_VALIDFLAGS(target));
313 target->data = src->data;
314 target->length = src->length;
315 target->rdclass = src->rdclass;
316 target->type = src->type;
317 target->flags = src->flags;
326 dns_rdata_compare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) {
328 isc_boolean_t use_default = ISC_FALSE;
330 REQUIRE(rdata1 != NULL);
331 REQUIRE(rdata2 != NULL);
332 REQUIRE(rdata1->length == 0 || rdata1->data != NULL);
333 REQUIRE(rdata2->length == 0 || rdata2->data != NULL);
334 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1));
335 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2));
337 if (rdata1->rdclass != rdata2->rdclass)
338 return (rdata1->rdclass < rdata2->rdclass ? -1 : 1);
340 if (rdata1->type != rdata2->type)
341 return (rdata1->type < rdata2->type ? -1 : 1);
349 dns_rdata_toregion(rdata1, &r1);
350 dns_rdata_toregion(rdata2, &r2);
351 result = isc_region_compare(&r1, &r2);
357 dns_rdata_casecompare(const dns_rdata_t *rdata1, const dns_rdata_t *rdata2) {
359 isc_boolean_t use_default = ISC_FALSE;
361 REQUIRE(rdata1 != NULL);
362 REQUIRE(rdata2 != NULL);
363 REQUIRE(rdata1->length == 0 || rdata1->data != NULL);
364 REQUIRE(rdata2->length == 0 || rdata2->data != NULL);
365 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1));
366 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2));
368 if (rdata1->rdclass != rdata2->rdclass)
369 return (rdata1->rdclass < rdata2->rdclass ? -1 : 1);
371 if (rdata1->type != rdata2->type)
372 return (rdata1->type < rdata2->type ? -1 : 1);
380 dns_rdata_toregion(rdata1, &r1);
381 dns_rdata_toregion(rdata2, &r2);
382 result = isc_region_compare(&r1, &r2);
392 dns_rdata_fromregion(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
393 dns_rdatatype_t type, isc_region_t *r)
396 REQUIRE(rdata != NULL);
397 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
400 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
402 rdata->data = r->base;
403 rdata->length = r->length;
404 rdata->rdclass = rdclass;
410 dns_rdata_toregion(const dns_rdata_t *rdata, isc_region_t *r) {
412 REQUIRE(rdata != NULL);
414 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
416 r->base = rdata->data;
417 r->length = rdata->length;
421 dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
422 dns_rdatatype_t type, isc_buffer_t *source,
423 dns_decompress_t *dctx, unsigned int options,
424 isc_buffer_t *target)
426 isc_result_t result = ISC_R_NOTIMPLEMENTED;
430 isc_boolean_t use_default = ISC_FALSE;
431 isc_uint32_t activelength;
433 REQUIRE(dctx != NULL);
435 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
436 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
440 return (DNS_R_FORMERR);
445 activelength = isc_buffer_activelength(source);
446 INSIST(activelength < 65536);
451 if (activelength > isc_buffer_availablelength(target))
452 result = ISC_R_NOSPACE;
454 isc_buffer_putmem(target, isc_buffer_current(source),
456 isc_buffer_forward(source, activelength);
457 result = ISC_R_SUCCESS;
462 * We should have consumed all of our buffer.
464 if (result == ISC_R_SUCCESS && !buffer_empty(source))
465 result = DNS_R_EXTRADATA;
467 if (rdata != NULL && result == ISC_R_SUCCESS) {
468 region.base = isc_buffer_used(&st);
469 region.length = isc_buffer_usedlength(target) -
470 isc_buffer_usedlength(&st);
471 dns_rdata_fromregion(rdata, rdclass, type, ®ion);
474 if (result != ISC_R_SUCCESS) {
482 dns_rdata_towire(dns_rdata_t *rdata, dns_compress_t *cctx,
483 isc_buffer_t *target)
485 isc_result_t result = ISC_R_NOTIMPLEMENTED;
486 isc_boolean_t use_default = ISC_FALSE;
490 REQUIRE(rdata != NULL);
491 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
494 * Some DynDNS meta-RRs have empty rdata.
496 if ((rdata->flags & DNS_RDATA_UPDATE) != 0) {
497 INSIST(rdata->length == 0);
498 return (ISC_R_SUCCESS);
506 isc_buffer_availableregion(target, &tr);
507 if (tr.length < rdata->length)
508 return (ISC_R_NOSPACE);
509 memcpy(tr.base, rdata->data, rdata->length);
510 isc_buffer_add(target, rdata->length);
511 return (ISC_R_SUCCESS);
513 if (result != ISC_R_SUCCESS) {
515 INSIST(target->used < 65536);
516 dns_compress_rollback(cctx, (isc_uint16_t)target->used);
522 * If the binary data in 'src' is valid uncompressed wire format
523 * rdata of class 'rdclass' and type 'type', return ISC_R_SUCCESS
524 * and copy the validated rdata to 'dest'. Otherwise return an error.
527 rdata_validate(isc_buffer_t *src, isc_buffer_t *dest, dns_rdataclass_t rdclass,
528 dns_rdatatype_t type)
530 dns_decompress_t dctx;
531 dns_rdata_t rdata = DNS_RDATA_INIT;
534 dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_NONE);
535 isc_buffer_setactive(src, isc_buffer_usedlength(src));
536 result = dns_rdata_fromwire(&rdata, rdclass, type, src,
538 dns_decompress_invalidate(&dctx);
544 unknown_fromtext(dns_rdataclass_t rdclass, dns_rdatatype_t type,
545 isc_lex_t *lexer, isc_mem_t *mctx, isc_buffer_t *target)
548 isc_buffer_t *buf = NULL;
551 if (type == 0 || dns_rdatatype_ismeta(type))
552 return (DNS_R_METATYPE);
554 result = isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
556 if (result == ISC_R_SUCCESS && token.value.as_ulong > 65535U)
557 return (ISC_R_RANGE);
558 result = isc_buffer_allocate(mctx, &buf, token.value.as_ulong);
559 if (result != ISC_R_SUCCESS)
562 result = isc_hex_tobuffer(lexer, buf,
563 (unsigned int)token.value.as_ulong);
564 if (result != ISC_R_SUCCESS)
566 if (isc_buffer_usedlength(buf) != token.value.as_ulong) {
567 result = ISC_R_UNEXPECTEDEND;
571 if (dns_rdatatype_isknown(type)) {
572 result = rdata_validate(buf, target, rdclass, type);
575 isc_buffer_usedregion(buf, &r);
576 result = isc_buffer_copyregion(target, &r);
578 if (result != ISC_R_SUCCESS)
581 isc_buffer_free(&buf);
582 return (ISC_R_SUCCESS);
585 isc_buffer_free(&buf);
590 dns_rdata_fromtext(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
591 dns_rdatatype_t type, isc_lex_t *lexer,
592 dns_name_t *origin, unsigned int options, isc_mem_t *mctx,
593 isc_buffer_t *target, dns_rdatacallbacks_t *callbacks)
595 isc_result_t result = ISC_R_NOTIMPLEMENTED;
599 unsigned int lexoptions = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF |
600 ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE;
603 void (*callback)(dns_rdatacallbacks_t *, const char *, ...);
604 isc_result_t tresult;
606 REQUIRE(origin == NULL || dns_name_isabsolute(origin) == ISC_TRUE);
608 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
609 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
611 if (callbacks != NULL) {
612 REQUIRE(callbacks->warn != NULL);
613 REQUIRE(callbacks->error != NULL);
618 if (callbacks != NULL)
619 callback = callbacks->error;
621 callback = default_fromtext_callback;
623 result = isc_lex_getmastertoken(lexer, &token, isc_tokentype_qstring,
625 if (result != ISC_R_SUCCESS) {
626 name = isc_lex_getsourcename(lexer);
627 line = isc_lex_getsourceline(lexer);
628 fromtext_error(callback, callbacks, name, line, NULL, result);
632 if (strcmp(DNS_AS_STR(token), "\\#") == 0)
633 result = unknown_fromtext(rdclass, type, lexer, mctx, target);
635 isc_lex_ungettoken(lexer, &token);
641 * Consume to end of line / file.
642 * If not at end of line initially set error code.
643 * Call callback via fromtext_error once if there was an error.
646 name = isc_lex_getsourcename(lexer);
647 line = isc_lex_getsourceline(lexer);
648 tresult = isc_lex_gettoken(lexer, lexoptions, &token);
649 if (tresult != ISC_R_SUCCESS) {
650 if (result == ISC_R_SUCCESS)
652 if (callback != NULL)
653 fromtext_error(callback, callbacks, name,
656 } else if (token.type != isc_tokentype_eol &&
657 token.type != isc_tokentype_eof) {
658 if (result == ISC_R_SUCCESS)
659 result = DNS_R_EXTRATOKEN;
660 if (callback != NULL) {
661 fromtext_error(callback, callbacks, name,
662 line, &token, result);
665 } else if (result != ISC_R_SUCCESS && callback != NULL) {
666 fromtext_error(callback, callbacks, name, line,
670 if (token.type == isc_tokentype_eof)
671 fromtext_warneof(lexer, callbacks);
676 if (rdata != NULL && result == ISC_R_SUCCESS) {
677 region.base = isc_buffer_used(&st);
678 region.length = isc_buffer_usedlength(target) -
679 isc_buffer_usedlength(&st);
680 dns_rdata_fromregion(rdata, rdclass, type, ®ion);
682 if (result != ISC_R_SUCCESS) {
689 unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
690 isc_buffer_t *target)
693 char buf[sizeof("65535")];
696 strlcpy(buf, "\\# ", sizeof(buf));
697 result = str_totext(buf, target);
698 if (result != ISC_R_SUCCESS)
701 dns_rdata_toregion(rdata, &sr);
702 INSIST(sr.length < 65536);
703 snprintf(buf, sizeof(buf), "%u", sr.length);
704 result = str_totext(buf, target);
705 if (result != ISC_R_SUCCESS)
708 if (sr.length != 0U) {
709 if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
710 result = str_totext(" ( ", target);
712 result = str_totext(" ", target);
714 if (result != ISC_R_SUCCESS)
717 if (tctx->width == 0) /* No splitting */
718 result = isc_hex_totext(&sr, 0, "", target);
720 result = isc_hex_totext(&sr, tctx->width - 2,
723 if (result == ISC_R_SUCCESS &&
724 (tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
725 result = str_totext(" )", target);
731 rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
732 isc_buffer_t *target)
734 isc_result_t result = ISC_R_NOTIMPLEMENTED;
735 isc_boolean_t use_default = ISC_FALSE;
737 REQUIRE(rdata != NULL);
738 REQUIRE(tctx->origin == NULL ||
739 dns_name_isabsolute(tctx->origin) == ISC_TRUE);
742 * Some DynDNS meta-RRs have empty rdata.
744 if ((rdata->flags & DNS_RDATA_UPDATE) != 0) {
745 INSIST(rdata->length == 0);
746 return (ISC_R_SUCCESS);
752 result = unknown_totext(rdata, tctx, target);
758 dns_rdata_totext(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target)
760 dns_rdata_textctx_t tctx;
762 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
765 * Set up formatting options for single-line output.
767 tctx.origin = origin;
770 tctx.linebreak = " ";
771 return (rdata_totext(rdata, &tctx, target));
775 dns_rdata_tofmttext(dns_rdata_t *rdata, dns_name_t *origin,
776 unsigned int flags, unsigned int width,
777 const char *linebreak, isc_buffer_t *target)
779 dns_rdata_textctx_t tctx;
781 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
784 * Set up formatting options for formatted output.
786 tctx.origin = origin;
788 if ((flags & DNS_STYLEFLAG_MULTILINE) != 0) {
790 tctx.linebreak = linebreak;
792 tctx.width = 60; /* Used for hex word length only. */
793 tctx.linebreak = " ";
795 return (rdata_totext(rdata, &tctx, target));
799 dns_rdata_fromstruct(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
800 dns_rdatatype_t type, void *source,
801 isc_buffer_t *target)
803 isc_result_t result = ISC_R_NOTIMPLEMENTED;
806 isc_boolean_t use_default = ISC_FALSE;
808 REQUIRE(source != NULL);
810 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
811 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
821 if (rdata != NULL && result == ISC_R_SUCCESS) {
822 region.base = isc_buffer_used(&st);
823 region.length = isc_buffer_usedlength(target) -
824 isc_buffer_usedlength(&st);
825 dns_rdata_fromregion(rdata, rdclass, type, ®ion);
827 if (result != ISC_R_SUCCESS)
833 dns_rdata_tostruct(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
834 isc_result_t result = ISC_R_NOTIMPLEMENTED;
835 isc_boolean_t use_default = ISC_FALSE;
837 REQUIRE(rdata != NULL);
838 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
849 dns_rdata_freestruct(void *source) {
850 dns_rdatacommon_t *common = source;
851 REQUIRE(source != NULL);
857 dns_rdata_additionaldata(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
860 isc_result_t result = ISC_R_NOTIMPLEMENTED;
861 isc_boolean_t use_default = ISC_FALSE;
864 * Call 'add' for each name and type from 'rdata' which is subject to
865 * additional section processing.
868 REQUIRE(rdata != NULL);
869 REQUIRE(add != NULL);
870 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
874 /* No additional processing for unknown types */
876 result = ISC_R_SUCCESS;
882 dns_rdata_digest(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
883 isc_result_t result = ISC_R_NOTIMPLEMENTED;
884 isc_boolean_t use_default = ISC_FALSE;
888 * Send 'rdata' in DNSSEC canonical form to 'digest'.
891 REQUIRE(rdata != NULL);
892 REQUIRE(digest != NULL);
893 REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
898 dns_rdata_toregion(rdata, &r);
899 result = (digest)(arg, &r);
906 dns_rdata_checkowner(dns_name_t *name, dns_rdataclass_t rdclass,
907 dns_rdatatype_t type, isc_boolean_t wildcard)
909 isc_boolean_t result;
916 dns_rdata_checknames(dns_rdata_t *rdata, dns_name_t *owner, dns_name_t *bad)
918 isc_boolean_t result;
925 dns_rdatatype_attributes(dns_rdatatype_t type)
927 RDATATYPE_ATTRIBUTE_SW
928 if (type >= (dns_rdatatype_t)128 && type < (dns_rdatatype_t)255)
929 return (DNS_RDATATYPEATTR_UNKNOWN | DNS_RDATATYPEATTR_META);
930 return (DNS_RDATATYPEATTR_UNKNOWN);
934 dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
942 return (DNS_R_UNKNOWN);
944 a = tolower((unsigned char)source->base[0]);
945 b = tolower((unsigned char)source->base[n - 1]);
947 hash = ((a + n) * b) % 256;
950 * This switch block is inlined via \#define, and will use "return"
951 * to return a result to the caller if it is a valid (known)
954 RDATATYPE_FROMTEXT_SW(hash, source->base, n, typep);
956 if (source->length > 4 && source->length < (4 + sizeof("65000")) &&
957 strncasecmp("type", source->base, 4) == 0) {
958 char buf[sizeof("65000")];
962 strncpy(buf, source->base + 4, source->length - 4);
963 buf[source->length - 4] = '\0';
964 val = strtoul(buf, &endp, 10);
965 if (*endp == '\0' && val <= 0xffff) {
966 *typep = (dns_rdatatype_t)val;
967 return (ISC_R_SUCCESS);
971 return (DNS_R_UNKNOWN);
975 dns_rdatatype_totext(dns_rdatatype_t type, isc_buffer_t *target) {
976 char buf[sizeof("TYPE65535")];
979 snprintf(buf, sizeof(buf), "TYPE%u", type);
980 return (str_totext(buf, target));
984 dns_rdatatype_format(dns_rdatatype_t rdtype,
985 char *array, unsigned int size)
993 isc_buffer_init(&buf, array, size);
994 result = dns_rdatatype_totext(rdtype, &buf);
998 if (result == ISC_R_SUCCESS) {
999 if (isc_buffer_availablelength(&buf) >= 1)
1000 isc_buffer_putuint8(&buf, 0);
1002 result = ISC_R_NOSPACE;
1004 if (result != ISC_R_SUCCESS)
1005 strlcpy(array, "<unknown>", size);
1013 name_length(dns_name_t *name) {
1014 return (name->length);
1018 txt_totext(isc_region_t *source, isc_buffer_t *target) {
1023 isc_region_t region;
1025 isc_buffer_availableregion(target, ®ion);
1027 tp = (char *)region.base;
1032 REQUIRE(n + 1 <= source->length);
1035 return (ISC_R_NOSPACE);
1039 if (*sp < 0x20 || *sp >= 0x7f) {
1041 return (ISC_R_NOSPACE);
1043 *tp++ = 0x30 + ((*sp / 100) % 10);
1044 *tp++ = 0x30 + ((*sp / 10) % 10);
1045 *tp++ = 0x30 + (*sp % 10);
1050 /* double quote, semi-colon, backslash */
1051 if (*sp == 0x22 || *sp == 0x3b || *sp == 0x5c) {
1053 return (ISC_R_NOSPACE);
1058 return (ISC_R_NOSPACE);
1063 return (ISC_R_NOSPACE);
1066 isc_buffer_add(target, tp - (char *)region.base);
1067 isc_region_consume(source, *source->base + 1);
1068 return (ISC_R_SUCCESS);
1072 txt_fromtext(isc_textregion_t *source, isc_buffer_t *target) {
1073 isc_region_t tregion;
1074 isc_boolean_t escape;
1075 unsigned int n, nrem;
1081 isc_buffer_availableregion(target, &tregion);
1085 nrem = tregion.length;
1088 return (ISC_R_NOSPACE);
1095 * Maximum text string length.
1101 if (escape && (d = decvalue((char)c)) != -1) {
1104 return (DNS_R_SYNTAX);
1106 if ((d = decvalue(*s++)) != -1)
1109 return (DNS_R_SYNTAX);
1111 return (DNS_R_SYNTAX);
1113 if ((d = decvalue(*s++)) != -1)
1116 return (DNS_R_SYNTAX);
1118 return (DNS_R_SYNTAX);
1119 } else if (!escape && c == '\\') {
1125 return ((tregion.length <= 256U) ?
1126 ISC_R_NOSPACE : DNS_R_SYNTAX);
1131 return (DNS_R_SYNTAX);
1132 *tregion.base = t - tregion.base - 1;
1133 isc_buffer_add(target, *tregion.base + 1);
1134 return (ISC_R_SUCCESS);
1138 txt_fromwire(isc_buffer_t *source, isc_buffer_t *target) {
1140 isc_region_t sregion;
1141 isc_region_t tregion;
1143 isc_buffer_activeregion(source, &sregion);
1144 if (sregion.length == 0)
1145 return(ISC_R_UNEXPECTEDEND);
1146 n = *sregion.base + 1;
1147 if (n > sregion.length)
1148 return (ISC_R_UNEXPECTEDEND);
1150 isc_buffer_availableregion(target, &tregion);
1151 if (n > tregion.length)
1152 return (ISC_R_NOSPACE);
1154 memcpy(tregion.base, sregion.base, n);
1155 isc_buffer_forward(source, n);
1156 isc_buffer_add(target, n);
1157 return (ISC_R_SUCCESS);
1160 static isc_boolean_t
1161 name_prefix(dns_name_t *name, dns_name_t *origin, dns_name_t *target) {
1167 if (dns_name_compare(origin, dns_rootname) == 0)
1170 if (!dns_name_issubdomain(name, origin))
1173 l1 = dns_name_countlabels(name);
1174 l2 = dns_name_countlabels(origin);
1179 /* Master files should be case preserving. */
1180 dns_name_getlabelsequence(name, l1 - l2, l2, target);
1181 if (!dns_name_caseequal(origin, target))
1184 dns_name_getlabelsequence(name, 0, l1 - l2, target);
1193 str_totext(const char *source, isc_buffer_t *target) {
1195 isc_region_t region;
1197 isc_buffer_availableregion(target, ®ion);
1200 if (l > region.length)
1201 return (ISC_R_NOSPACE);
1203 memcpy(region.base, source, l);
1204 isc_buffer_add(target, l);
1205 return (ISC_R_SUCCESS);
1209 inet_totext(int af, isc_region_t *src, isc_buffer_t *target) {
1212 /* Note - inet_ntop doesn't do size checking on its input. */
1213 if (inet_ntop(af, src->base, tmpbuf, sizeof(tmpbuf)) == NULL)
1214 return (ISC_R_NOSPACE);
1215 if (strlen(tmpbuf) > isc_buffer_availablelength(target))
1216 return (ISC_R_NOSPACE);
1217 isc_buffer_putstr(target, tmpbuf);
1218 return (ISC_R_SUCCESS);
1221 static isc_boolean_t
1222 buffer_empty(isc_buffer_t *source) {
1223 return((source->current == source->active) ? ISC_TRUE : ISC_FALSE);
1227 buffer_fromregion(isc_buffer_t *buffer, isc_region_t *region) {
1228 isc_buffer_init(buffer, region->base, region->length);
1229 isc_buffer_add(buffer, region->length);
1230 isc_buffer_setactive(buffer, region->length);
1234 uint32_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
1235 isc_region_t region;
1237 isc_buffer_availableregion(target, ®ion);
1238 if (region.length < 4)
1239 return (ISC_R_NOSPACE);
1240 isc_buffer_putuint32(target, value);
1241 return (ISC_R_SUCCESS);
1245 uint16_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
1246 isc_region_t region;
1249 return (ISC_R_RANGE);
1250 isc_buffer_availableregion(target, ®ion);
1251 if (region.length < 2)
1252 return (ISC_R_NOSPACE);
1253 isc_buffer_putuint16(target, (isc_uint16_t)value);
1254 return (ISC_R_SUCCESS);
1258 uint8_tobuffer(isc_uint32_t value, isc_buffer_t *target) {
1259 isc_region_t region;
1262 return (ISC_R_RANGE);
1263 isc_buffer_availableregion(target, ®ion);
1264 if (region.length < 1)
1265 return (ISC_R_NOSPACE);
1266 isc_buffer_putuint8(target, (isc_uint8_t)value);
1267 return (ISC_R_SUCCESS);
1271 name_tobuffer(dns_name_t *name, isc_buffer_t *target) {
1273 dns_name_toregion(name, &r);
1274 return (isc_buffer_copyregion(target, &r));
1278 uint32_fromregion(isc_region_t *region) {
1281 REQUIRE(region->length >= 4);
1282 value = region->base[0] << 24;
1283 value |= region->base[1] << 16;
1284 value |= region->base[2] << 8;
1285 value |= region->base[3];
1290 uint16_consume_fromregion(isc_region_t *region) {
1291 isc_uint16_t r = uint16_fromregion(region);
1293 isc_region_consume(region, 2);
1298 uint16_fromregion(isc_region_t *region) {
1300 REQUIRE(region->length >= 2);
1302 return ((region->base[0] << 8) | region->base[1]);
1306 uint8_fromregion(isc_region_t *region) {
1308 REQUIRE(region->length >= 1);
1310 return (region->base[0]);
1314 uint8_consume_fromregion(isc_region_t *region) {
1315 isc_uint8_t r = uint8_fromregion(region);
1317 isc_region_consume(region, 1);
1322 mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) {
1325 isc_buffer_availableregion(target, &tr);
1326 if (length > tr.length)
1327 return (ISC_R_NOSPACE);
1328 memcpy(tr.base, base, length);
1329 isc_buffer_add(target, length);
1330 return (ISC_R_SUCCESS);
1334 hexvalue(char value) {
1338 c = (unsigned char)value;
1344 if ((s = strchr(hexdigits, c)) == NULL)
1346 return (s - hexdigits);
1350 decvalue(char value) {
1354 * isascii() is valid for full range of int values, no need to
1357 if (!isascii(value))
1359 if ((s = strchr(decdigits, value)) == NULL)
1361 return (s - decdigits);
1364 static const char atob_digits[86] =
1365 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" \
1366 "abcdefghijklmnopqrstu";
1368 * Subroutines to convert between 8 bit binary bytes and printable ASCII.
1369 * Computes the number of bytes, and three kinds of simple checksums.
1370 * Incoming bytes are collected into 32-bit words, then printed in base 85:
1371 * exp(85,5) > exp(2,32)
1372 * The ASCII characters used are between '!' and 'u';
1373 * 'z' encodes 32-bit zero; 'x' is used to mark the end of encoded data.
1375 * Originally by Paul Rutter (philabs!per) and Joe Orost (petsd!joe) for
1376 * the atob/btoa programs, released with the compress program, in mod.sources.
1377 * Modified by Mike Schwartz 8/19/86 for use in BIND.
1378 * Modified to be re-entrant 3/2/99.
1390 #define Ceor state->Ceor
1391 #define Csum state->Csum
1392 #define Crot state->Crot
1393 #define word state->word
1394 #define bcount state->bcount
1396 #define times85(x) ((((((x<<2)+x)<<2)+x)<<2)+x)
1398 static isc_result_t byte_atob(int c, isc_buffer_t *target,
1399 struct state *state);
1400 static isc_result_t putbyte(int c, isc_buffer_t *, struct state *state);
1401 static isc_result_t byte_btoa(int c, isc_buffer_t *, struct state *state);
1404 * Decode ASCII-encoded byte c into binary representation and
1405 * place into *bufp, advancing bufp.
1408 byte_atob(int c, isc_buffer_t *target, struct state *state) {
1412 return(DNS_R_SYNTAX);
1414 RETERR(putbyte(0, target, state));
1415 RETERR(putbyte(0, target, state));
1416 RETERR(putbyte(0, target, state));
1417 RETERR(putbyte(0, target, state));
1419 } else if ((s = strchr(atob_digits, c)) != NULL) {
1421 word = s - atob_digits;
1423 } else if (bcount < 4) {
1424 word = times85(word);
1425 word += s - atob_digits;
1428 word = times85(word);
1429 word += s - atob_digits;
1430 RETERR(putbyte((word >> 24) & 0xff, target, state));
1431 RETERR(putbyte((word >> 16) & 0xff, target, state));
1432 RETERR(putbyte((word >> 8) & 0xff, target, state));
1433 RETERR(putbyte(word & 0xff, target, state));
1438 return(DNS_R_SYNTAX);
1439 return(ISC_R_SUCCESS);
1443 * Compute checksum info and place c into target.
1446 putbyte(int c, isc_buffer_t *target, struct state *state) {
1452 if ((Crot & 0x80000000)) {
1459 isc_buffer_availableregion(target, &tr);
1461 return (ISC_R_NOSPACE);
1463 isc_buffer_add(target, 1);
1464 return (ISC_R_SUCCESS);
1468 * Read the ASCII-encoded data from inbuf, of length inbuflen, and convert
1469 * it into T_UNSPEC (binary data) in outbuf, not to exceed outbuflen bytes;
1470 * outbuflen must be divisible by 4. (Note: this is because outbuf is filled
1471 * in 4 bytes at a time. If the actual data doesn't end on an even 4-byte
1472 * boundary, there will be no problem...it will be padded with 0 bytes, and
1473 * numbytes will indicate the correct number of bytes. The main point is
1474 * that since the buffer is filled in 4 bytes at a time, even if there is
1475 * not a full 4 bytes of data at the end, there has to be room to 0-pad the
1476 * data, so the buffer must be of size divisible by 4). Place the number of
1477 * output bytes in numbytes, and return a failure/success status.
1481 atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
1482 long oeor, osum, orot;
1483 struct state statebuf, *state= &statebuf;
1488 Ceor = Csum = Crot = word = bcount = 0;
1490 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
1492 while (token.value.as_textregion.length != 0) {
1493 if ((c = token.value.as_textregion.base[0]) == 'x') {
1496 RETERR(byte_atob(c, target, state));
1497 isc_textregion_consume(&token.value.as_textregion, 1);
1503 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
1505 if ((token.value.as_ulong % 4) != 0U)
1506 isc_buffer_subtract(target, 4 - (token.value.as_ulong % 4));
1511 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
1513 oeor = strtol(DNS_AS_STR(token), &e, 16);
1515 return (DNS_R_SYNTAX);
1520 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
1522 osum = strtol(DNS_AS_STR(token), &e, 16);
1524 return (DNS_R_SYNTAX);
1529 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
1531 orot = strtol(DNS_AS_STR(token), &e, 16);
1533 return (DNS_R_SYNTAX);
1535 if ((oeor != Ceor) || (osum != Csum) || (orot != Crot))
1536 return(DNS_R_BADCKSUM);
1537 return (ISC_R_SUCCESS);
1541 * Encode binary byte c into ASCII representation and place into *bufp,
1545 byte_btoa(int c, isc_buffer_t *target, struct state *state) {
1548 isc_buffer_availableregion(target, &tr);
1552 if ((Crot & 0x80000000)) {
1565 return (ISC_R_NOSPACE);
1567 isc_buffer_add(target, 1);
1569 register int tmp = 0;
1570 register isc_int32_t tmpword = word;
1574 * Because some don't support u_long.
1577 tmpword -= (isc_int32_t)(85 * 85 * 85 * 85 * 32);
1581 tmpword -= (isc_int32_t)(85 * 85 * 85 * 85 * 32);
1584 return (ISC_R_NOSPACE);
1585 tr.base[0] = atob_digits[(tmpword /
1586 (isc_int32_t)(85 * 85 * 85 * 85))
1588 tmpword %= (isc_int32_t)(85 * 85 * 85 * 85);
1589 tr.base[1] = atob_digits[tmpword / (85 * 85 * 85)];
1590 tmpword %= (85 * 85 * 85);
1591 tr.base[2] = atob_digits[tmpword / (85 * 85)];
1592 tmpword %= (85 * 85);
1593 tr.base[3] = atob_digits[tmpword / 85];
1595 tr.base[4] = atob_digits[tmpword];
1596 isc_buffer_add(target, 5);
1602 return (ISC_R_SUCCESS);
1607 * Encode the binary data from inbuf, of length inbuflen, into a
1608 * target. Return success/failure status
1611 btoa_totext(unsigned char *inbuf, int inbuflen, isc_buffer_t *target) {
1613 struct state statebuf, *state = &statebuf;
1614 char buf[sizeof("x 2000000000 ffffffff ffffffff ffffffff")];
1616 Ceor = Csum = Crot = word = bcount = 0;
1617 for (inc = 0; inc < inbuflen; inbuf++, inc++)
1618 RETERR(byte_btoa(*inbuf, target, state));
1621 RETERR(byte_btoa(0, target, state));
1624 * Put byte count and checksum information at end of buffer,
1627 snprintf(buf, sizeof(buf), "x %d %x %x %x", inbuflen, Ceor, Csum, Crot);
1628 return (str_totext(buf, target));
1633 default_fromtext_callback(dns_rdatacallbacks_t *callbacks, const char *fmt,
1641 vfprintf(stderr, fmt, ap);
1643 fprintf(stderr, "\n");
1647 fromtext_warneof(isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks) {
1648 if (isc_lex_isfile(lexer) && callbacks != NULL) {
1649 const char *name = isc_lex_getsourcename(lexer);
1652 (*callbacks->warn)(callbacks,
1653 "%s:%lu: file does not end with newline",
1654 name, isc_lex_getsourceline(lexer));
1659 warn_badmx(isc_token_t *token, isc_lex_t *lexer,
1660 dns_rdatacallbacks_t *callbacks)
1665 if (lexer != NULL) {
1666 file = isc_lex_getsourcename(lexer);
1667 line = isc_lex_getsourceline(lexer);
1668 (*callbacks->warn)(callbacks, "%s:%u: warning: '%s': %s",
1669 file, line, DNS_AS_STR(*token),
1670 dns_result_totext(DNS_R_MXISADDRESS));
1675 warn_badname(dns_name_t *name, isc_lex_t *lexer,
1676 dns_rdatacallbacks_t *callbacks)
1680 char namebuf[DNS_NAME_FORMATSIZE];
1682 if (lexer != NULL) {
1683 file = isc_lex_getsourcename(lexer);
1684 line = isc_lex_getsourceline(lexer);
1685 dns_name_format(name, namebuf, sizeof(namebuf));
1686 (*callbacks->warn)(callbacks, "%s:%u: warning: %s: %s",
1687 file, line, namebuf,
1688 dns_result_totext(DNS_R_BADNAME));
1693 fromtext_error(void (*callback)(dns_rdatacallbacks_t *, const char *, ...),
1694 dns_rdatacallbacks_t *callbacks, const char *name,
1695 unsigned long line, isc_token_t *token, isc_result_t result)
1700 if (token != NULL) {
1701 switch (token->type) {
1702 case isc_tokentype_eol:
1703 (*callback)(callbacks, "%s: %s:%lu: near eol: %s",
1704 "dns_rdata_fromtext", name, line,
1705 dns_result_totext(result));
1707 case isc_tokentype_eof:
1708 (*callback)(callbacks, "%s: %s:%lu: near eof: %s",
1709 "dns_rdata_fromtext", name, line,
1710 dns_result_totext(result));
1712 case isc_tokentype_number:
1713 (*callback)(callbacks, "%s: %s:%lu: near %lu: %s",
1714 "dns_rdata_fromtext", name, line,
1715 token->value.as_ulong,
1716 dns_result_totext(result));
1718 case isc_tokentype_string:
1719 case isc_tokentype_qstring:
1720 (*callback)(callbacks, "%s: %s:%lu: near '%s': %s",
1721 "dns_rdata_fromtext", name, line,
1723 dns_result_totext(result));
1726 (*callback)(callbacks, "%s: %s:%lu: %s",
1727 "dns_rdata_fromtext", name, line,
1728 dns_result_totext(result));
1732 (*callback)(callbacks, "dns_rdata_fromtext: %s:%lu: %s",
1733 name, line, dns_result_totext(result));
1738 dns_rdata_covers(dns_rdata_t *rdata) {
1739 if (rdata->type == 46)
1740 return (covers_rrsig(rdata));
1741 return (covers_sig(rdata));
1745 dns_rdatatype_ismeta(dns_rdatatype_t type) {
1746 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_META) != 0)
1752 dns_rdatatype_issingleton(dns_rdatatype_t type) {
1753 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_SINGLETON)
1760 dns_rdatatype_notquestion(dns_rdatatype_t type) {
1761 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_NOTQUESTION)
1768 dns_rdatatype_questiononly(dns_rdatatype_t type) {
1769 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_QUESTIONONLY)
1776 dns_rdatatype_atparent(dns_rdatatype_t type) {
1777 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_ATPARENT) != 0)
1783 dns_rdataclass_ismeta(dns_rdataclass_t rdclass) {
1785 if (rdclass == dns_rdataclass_reserved0
1786 || rdclass == dns_rdataclass_none
1787 || rdclass == dns_rdataclass_any)
1790 return (ISC_FALSE); /* Assume it is not a meta class. */
1794 dns_rdatatype_isdnssec(dns_rdatatype_t type) {
1795 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_DNSSEC) != 0)
1801 dns_rdatatype_iszonecutauth(dns_rdatatype_t type) {
1802 if ((dns_rdatatype_attributes(type)
1803 & (DNS_RDATATYPEATTR_DNSSEC | DNS_RDATATYPEATTR_ZONECUTAUTH))
1810 dns_rdatatype_isknown(dns_rdatatype_t type) {
1811 if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_UNKNOWN)
1818 dns_rdata_exists(dns_rdata_t *rdata, dns_rdatatype_t type) {
1820 REQUIRE(rdata != NULL);
1821 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
1825 rdata->flags = DNS_RDATA_UPDATE;
1827 rdata->rdclass = dns_rdataclass_any;
1831 dns_rdata_notexist(dns_rdata_t *rdata, dns_rdatatype_t type) {
1833 REQUIRE(rdata != NULL);
1834 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
1838 rdata->flags = DNS_RDATA_UPDATE;
1840 rdata->rdclass = dns_rdataclass_none;
1844 dns_rdata_deleterrset(dns_rdata_t *rdata, dns_rdatatype_t type) {
1846 REQUIRE(rdata != NULL);
1847 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
1851 rdata->flags = DNS_RDATA_UPDATE;
1853 rdata->rdclass = dns_rdataclass_any;
1857 dns_rdata_makedelete(dns_rdata_t *rdata) {
1858 REQUIRE(rdata != NULL);
1860 rdata->rdclass = dns_rdataclass_none;
1864 dns_rdata_updateop(dns_rdata_t *rdata, dns_section_t section) {
1866 REQUIRE(rdata != NULL);
1867 REQUIRE(DNS_RDATA_INITIALIZED(rdata));
1870 case DNS_SECTION_PREREQUISITE:
1871 switch (rdata->rdclass) {
1872 case dns_rdataclass_none:
1873 switch (rdata->type) {
1874 case dns_rdatatype_any:
1875 return ("domain doesn't exist");
1877 return ("rrset doesn't exist");
1879 case dns_rdataclass_any:
1880 switch (rdata->type) {
1881 case dns_rdatatype_any:
1882 return ("domain exists");
1884 return ("rrset exists (value independent)");
1887 return ("rrset exists (value dependent)");
1889 case DNS_SECTION_UPDATE:
1890 switch (rdata->rdclass) {
1891 case dns_rdataclass_none:
1893 case dns_rdataclass_any:
1894 switch (rdata->type) {
1895 case dns_rdatatype_any:
1896 return ("delete all rrsets");
1898 return ("delete rrset");