1633838b8255282d10af15c5c84cee5a51466712Bob Halley/*
fc42a7d4d94c0fb7c8e94bb116d29e8e5b76711cTinderbox User * Copyright (C) 1998-2005, 2007-2017 Internet Systems Consortium, Inc. ("ISC")
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
1633838b8255282d10af15c5c84cee5a51466712Bob Halley */
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/*! \file */
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence
d25afd60ee2286cb171c4960a790f3d7041b6f85Bob Halley#include <config.h>
d25afd60ee2286cb171c4960a790f3d7041b6f85Bob Halley
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley#include <isc/once.h>
364a82f7c25b62967678027043425201a5e5171aBob Halley#include <isc/util.h>
96754ed7b400ce080279de2f92111ad868105290Bob Halley
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley#include <dns/result.h>
96754ed7b400ce080279de2f92111ad868105290Bob Halley#include <dns/lib.h>
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencestatic const char *text[DNS_R_NRESULTS] = {
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "label too long", /*%< 0 DNS_R_LABELTOOLONG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad escape", /*%< 1 DNS_R_BADESCAPE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein /*!
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews * Note that DNS_R_BADBITSTRING and DNS_R_BITSTRINGTOOLONG are
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews * deprecated.
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad bitstring", /*%< 2 DNS_R_BADBITSTRING */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bitstring too long", /*%< 3 DNS_R_BITSTRINGTOOLONG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "empty label", /*%< 4 DNS_R_EMPTYLABEL */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad dotted quad", /*%< 5 DNS_R_BADDOTTEDQUAD */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "invalid NS owner name (wildcard)", /*%< 6 DNS_R_INVALIDNS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unknown class/type", /*%< 7 DNS_R_UNKNOWN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad label type", /*%< 8 DNS_R_BADLABELTYPE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad compression pointer", /*%< 9 DNS_R_BADPOINTER */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "too many hops", /*%< 10 DNS_R_TOOMANYHOPS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "disallowed (by application policy)", /*%< 11 DNS_R_DISALLOWED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "extra input text", /*%< 12 DNS_R_EXTRATOKEN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "extra input data", /*%< 13 DNS_R_EXTRADATA */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "text too long", /*%< 14 DNS_R_TEXTTOOLONG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "not at top of zone", /*%< 15 DNS_R_NOTZONETOP */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "syntax error", /*%< 16 DNS_R_SYNTAX */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad checksum", /*%< 17 DNS_R_BADCKSUM */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad IPv6 address", /*%< 18 DNS_R_BADAAAA */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no owner", /*%< 19 DNS_R_NOOWNER */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no ttl", /*%< 20 DNS_R_NOTTL */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad class", /*%< 21 DNS_R_BADCLASS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "name too long", /*%< 22 DNS_R_NAMETOOLONG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "partial match", /*%< 23 DNS_R_PARTIALMATCH */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "new origin", /*%< 24 DNS_R_NEWORIGIN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unchanged", /*%< 25 DNS_R_UNCHANGED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad ttl", /*%< 26 DNS_R_BADTTL */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "more data needed/to be rendered", /*%< 27 DNS_R_NOREDATA */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "continue", /*%< 28 DNS_R_CONTINUE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "delegation", /*%< 29 DNS_R_DELEGATION */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "glue", /*%< 30 DNS_R_GLUE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "dname", /*%< 31 DNS_R_DNAME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "cname", /*%< 32 DNS_R_CNAME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad database", /*%< 33 DNS_R_BADDB */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "zonecut", /*%< 34 DNS_R_ZONECUT */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad zone", /*%< 35 DNS_R_BADZONE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "more data", /*%< 36 DNS_R_MOREDATA */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "up to date", /*%< 37 DNS_R_UPTODATE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "tsig verify failure", /*%< 38 DNS_R_TSIGVERIFYFAILURE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "tsig indicates error", /*%< 39 DNS_R_TSIGERRORSET */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "RRSIG failed to verify", /*%< 40 DNS_R_SIGINVALID */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "RRSIG has expired", /*%< 41 DNS_R_SIGEXPIRED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "RRSIG validity period has not begun", /*%< 42 DNS_R_SIGFUTURE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "key is unauthorized to sign data", /*%< 43 DNS_R_KEYUNAUTHORIZED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "invalid time", /*%< 44 DNS_R_INVALIDTIME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "expected a TSIG or SIG(0)", /*%< 45 DNS_R_EXPECTEDTSIG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "did not expect a TSIG or SIG(0)", /*%< 46 DNS_R_UNEXPECTEDTSIG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "TKEY is unacceptable", /*%< 47 DNS_R_INVALIDTKEY */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "hint", /*%< 48 DNS_R_HINT */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "drop", /*%< 49 DNS_R_DROP */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "zone not loaded", /*%< 50 DNS_R_NOTLOADED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "ncache nxdomain", /*%< 51 DNS_R_NCACHENXDOMAIN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "ncache nxrrset", /*%< 52 DNS_R_NCACHENXRRSET */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "wait", /*%< 53 DNS_R_WAIT */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "not verified yet", /*%< 54 DNS_R_NOTVERIFIEDYET */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no identity", /*%< 55 DNS_R_NOIDENTITY */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no journal", /*%< 56 DNS_R_NOJOURNAL */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "alias", /*%< 57 DNS_R_ALIAS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "use TCP", /*%< 58 DNS_R_USETCP */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no valid RRSIG", /*%< 59 DNS_R_NOVALIDSIG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no valid NSEC", /*%< 60 DNS_R_NOVALIDNSEC */
bfe0517fdcbe1dc62fee18e460ecf467dd491d9bEvan Hunt "insecurity proof failed", /*%< 61 DNS_R_NOTINSECURE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unknown service", /*%< 62 DNS_R_UNKNOWNSERVICE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "recoverable error occurred", /*%< 63 DNS_R_RECOVERABLE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unknown opt attribute record", /*%< 64 DNS_R_UNKNOWNOPT */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unexpected message id", /*%< 65 DNS_R_UNEXPECTEDID */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "seen include file", /*%< 66 DNS_R_SEENINCLUDE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "not exact", /*%< 67 DNS_R_NOTEXACT */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "address blackholed", /*%< 68 DNS_R_BLACKHOLED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad algorithm", /*%< 69 DNS_R_BADALG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "invalid use of a meta type", /*%< 70 DNS_R_METATYPE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "CNAME and other data", /*%< 71 DNS_R_CNAMEANDOTHER */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "multiple RRs of singleton type", /*%< 72 DNS_R_SINGLETON */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "hint nxrrset", /*%< 73 DNS_R_HINTNXRRSET */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no master file configured", /*%< 74 DNS_R_NOMASTERFILE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unknown protocol", /*%< 75 DNS_R_UNKNOWNPROTO */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "clocks are unsynchronized", /*%< 76 DNS_R_CLOCKSKEW */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "IXFR failed", /*%< 77 DNS_R_BADIXFR */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "not authoritative", /*%< 78 DNS_R_NOTAUTHORITATIVE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no valid KEY", /*%< 79 DNS_R_NOVALIDKEY */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "obsolete", /*%< 80 DNS_R_OBSOLETE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "already frozen", /*%< 81 DNS_R_FROZEN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unknown flag", /*%< 82 DNS_R_UNKNOWNFLAG */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "expected a response", /*%< 83 DNS_R_EXPECTEDRESPONSE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "no valid DS", /*%< 84 DNS_R_NOVALIDDS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "NS is an address", /*%< 85 DNS_R_NSISADDRESS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "received FORMERR", /*%< 86 DNS_R_REMOTEFORMERR */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "truncated TCP response", /*%< 87 DNS_R_TRUNCATEDTCP */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "lame server detected", /*%< 88 DNS_R_LAME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unexpected RCODE", /*%< 89 DNS_R_UNEXPECTEDRCODE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unexpected OPCODE", /*%< 90 DNS_R_UNEXPECTEDOPCODE */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "chase DS servers", /*%< 91 DNS_R_CHASEDSSERVERS */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "empty name", /*%< 92 DNS_R_EMPTYNAME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "empty wild", /*%< 93 DNS_R_EMPTYWILD */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad bitmap", /*%< 94 DNS_R_BADBITMAP */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "from wildcard", /*%< 95 DNS_R_FROMWILDCARD */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad owner name (check-names)", /*%< 96 DNS_R_BADOWNERNAME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "bad name (check-names)", /*%< 97 DNS_R_BADNAME */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "dynamic zone", /*%< 98 DNS_R_DYNAMIC */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "unknown command", /*%< 99 DNS_R_UNKNOWNCOMMAND */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "must-be-secure", /*%< 100 DNS_R_MUSTBESECURE */
c5223c9cb7c22620d5ee6611228673e95b48a270Mark Andrews "covering NSEC record returned", /*%< 101 DNS_R_COVERINGNSEC */
9b80f3a7c739a99b498a37a711a51b6a88df3a78Mark Andrews "MX is an address", /*%< 102 DNS_R_MXISADDRESS */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "duplicate query", /*%< 103 DNS_R_DUPLICATE */
6098d364b690cb9dabf96e9664c4689c8559bd2eMark Andrews "invalid NSEC3 owner name (wildcard)", /*%< 104 DNS_R_INVALIDNSEC3 */
0cae66577c69c89086cd065bb297690072b471b4Mark Andrews
77b8f88f144928eddcca144c348d6ef53e7d5c43Evan Hunt "not master", /*%< 105 DNS_R_NOTMASTER */
0cae66577c69c89086cd065bb297690072b471b4Mark Andrews "broken trust chain", /*%< 106 DNS_R_BROKENCHAIN */
3ad3e9c948fd8781d0343b19f0412f5bf3ea6415Evan Hunt "expired", /*%< 107 DNS_R_EXPIRED */
3a6d62c59f73d024d1b2ba2ac94d7600530166ffMark Andrews "not dynamic", /*%< 108 DNS_R_NOTDYNAMIC */
bad93fb90cc5f14e200f23ff67cce3127f45b705Mark Andrews "bad EUI", /*%< 109 DNS_R_BADEUI */
bad93fb90cc5f14e200f23ff67cce3127f45b705Mark Andrews
ce67023ae3ad39a77da5361d0187ab6f3f0219cbMark Andrews "covered by negative trust anchor", /*%< 110 DNS_R_NTACOVERED */
709ea210685233a2ba873d6b2aaf9810fcecc865Evan Hunt "bad CDS", /*%< 111 DNS_R_BADCDS */
ce67023ae3ad39a77da5361d0187ab6f3f0219cbMark Andrews "bad CDNSKEY", /*%< 112 DNS_R_BADCDNSKEY */
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt "malformed OPT option", /*%< 113 DNS_R_OPTERR */
8475bed9de77920f884f1ae296f581efbd1e42f8Mark Andrews "malformed DNSTAP data", /*%< 114 DNS_R_BADDNSTAP */
8475bed9de77920f884f1ae296f581efbd1e42f8Mark Andrews
8475bed9de77920f884f1ae296f581efbd1e42f8Mark Andrews "TSIG in wrong location", /*%< 115 DNS_R_BADTSIG */
8475bed9de77920f884f1ae296f581efbd1e42f8Mark Andrews "SIG(0) in wrong location", /*%< 116 DNS_R_BADSIG0 */
744c1db6352c4c3f11c8538e4a2a57c8b0e0d570Mark Andrews "too many records", /*%< 117 DNS_R_TOOMANYRECORDS */
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley};
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntstatic const char *ids[DNS_R_NRESULTS] = {
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_LABELTOOLONG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADESCAPE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt /*!
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * Note that DNS_R_BADBITSTRING and DNS_R_BITSTRINGTOOLONG are
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt * deprecated.
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADBITSTRING",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BITSTRINGTOOLONG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EMPTYLABEL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADDOTTEDQUAD",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_INVALIDNS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNKNOWN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADLABELTYPE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADPOINTER",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_TOOMANYHOPS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_DISALLOWED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EXTRATOKEN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EXTRADATA",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_TEXTTOOLONG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTZONETOP",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SYNTAX",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADCKSUM",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADAAAA",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOOWNER",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTTL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADCLASS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NAMETOOLONG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_PARTIALMATCH",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NEWORIGIN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNCHANGED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADTTL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOREDATA",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_CONTINUE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_DELEGATION",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_GLUE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_DNAME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_CNAME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADDB",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_ZONECUT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADZONE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_MOREDATA",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UPTODATE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_TSIGVERIFYFAILURE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_TSIGERRORSET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SIGINVALID",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SIGEXPIRED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SIGFUTURE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_KEYUNAUTHORIZED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_INVALIDTIME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EXPECTEDTSIG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNEXPECTEDTSIG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_INVALIDTKEY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_HINT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_DROP",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTLOADED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NCACHENXDOMAIN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NCACHENXRRSET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_WAIT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTVERIFIEDYET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOIDENTITY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOJOURNAL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_ALIAS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_USETCP",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOVALIDSIG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOVALIDNSEC",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTINSECURE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNKNOWNSERVICE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_RECOVERABLE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNKNOWNOPT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNEXPECTEDID",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SEENINCLUDE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTEXACT",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BLACKHOLED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADALG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_METATYPE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_CNAMEANDOTHER",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SINGLETON",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_HINTNXRRSET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOMASTERFILE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNKNOWNPROTO",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_CLOCKSKEW",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADIXFR",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTAUTHORITATIVE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOVALIDKEY",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_OBSOLETE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_FROZEN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNKNOWNFLAG",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EXPECTEDRESPONSE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOVALIDDS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NSISADDRESS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_REMOTEFORMERR",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_TRUNCATEDTCP",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_LAME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNEXPECTEDRCODE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNEXPECTEDOPCODE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_CHASEDSSERVERS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EMPTYNAME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EMPTYWILD",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADBITMAP",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_FROMWILDCARD",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADOWNERNAME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADNAME",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_DYNAMIC",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_UNKNOWNCOMMAND",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_MUSTBESECURE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_COVERINGNSEC",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_MXISADDRESS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_DUPLICATE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_INVALIDNSEC3",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTMASTER",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BROKENCHAIN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_EXPIRED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTDYNAMIC",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADEUI",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NTACOVERED",
709ea210685233a2ba873d6b2aaf9810fcecc865Evan Hunt "DNS_R_BADCDS",
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt "DNS_R_BADCDNSKEY",
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt "DNS_R_OPTERR",
b66b333f59cf51ef87f973084a5023acd9317fb2Evan Hunt "DNS_R_BADDNSTAP",
8475bed9de77920f884f1ae296f581efbd1e42f8Mark Andrews "DNS_R_BADTSIG",
8475bed9de77920f884f1ae296f581efbd1e42f8Mark Andrews "DNS_R_BADSIG0",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt};
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrencestatic const char *rcode_text[DNS_R_NRCODERESULTS] = {
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "NOERROR", /*%< 0 DNS_R_NOERROR */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "FORMERR", /*%< 1 DNS_R_FORMERR */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "SERVFAIL", /*%< 2 DNS_R_SERVFAIL */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "NXDOMAIN", /*%< 3 DNS_R_NXDOMAIN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "NOTIMP", /*%< 4 DNS_R_NOTIMP */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "REFUSED", /*%< 5 DNS_R_REFUSED */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "YXDOMAIN", /*%< 6 DNS_R_YXDOMAIN */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "YXRRSET", /*%< 7 DNS_R_YXRRSET */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "NXRRSET", /*%< 8 DNS_R_NXRRSET */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "NOTAUTH", /*%< 9 DNS_R_NOTAUTH */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "NOTZONE", /*%< 10 DNS_R_NOTZONE */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "<rcode 11>", /*%< 11 DNS_R_RCODE11 */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "<rcode 12>", /*%< 12 DNS_R_RCODE12 */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "<rcode 13>", /*%< 13 DNS_R_RCODE13 */
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "<rcode 14>", /*%< 14 DNS_R_RCODE14 */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "<rcode 15>", /*%< 15 DNS_R_RCODE15 */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein "BADVERS", /*%< 16 DNS_R_BADVERS */
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley};
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
9e804040a29b9c3066c8471b43835f30707039b7Evan Huntstatic const char *rcode_ids[DNS_R_NRCODERESULTS] = {
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOERROR",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_FORMERR",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_SERVFAIL",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NXDOMAIN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTIMP",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_REFUSED",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_YXDOMAIN",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_YXRRSET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NXRRSET",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTAUTH",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_NOTZONE",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_RCODE11",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "RNS_R_RCODE12",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_RCODE13",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_RCODE14",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_RCODE15",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "DNS_R_BADVERS",
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt};
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt
138a6660fb74d458270511ca0ba24aa19bf375d5Bob Halley#define DNS_RESULT_RESULTSET 2
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley#define DNS_RESULT_RCODERESULTSET 3
138a6660fb74d458270511ca0ba24aa19bf375d5Bob Halley
d8dcd6ad4617cc8d7df979bd62101fa9c4bac1bcBob Halleystatic isc_once_t once = ISC_ONCE_INIT;
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
e4e071ae12aee942fefc2c0a3280e402938669deBob Halleystatic void
e4e071ae12aee942fefc2c0a3280e402938669deBob Halleyinitialize_action(void) {
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley isc_result_t result;
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley result = isc_result_register(ISC_RESULTCLASS_DNS, DNS_R_NRESULTS,
138a6660fb74d458270511ca0ba24aa19bf375d5Bob Halley text, dns_msgcat, DNS_RESULT_RESULTSET);
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley if (result == ISC_R_SUCCESS)
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley result = isc_result_register(ISC_RESULTCLASS_DNSRCODE,
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley DNS_R_NRCODERESULTS,
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley rcode_text, dns_msgcat,
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley DNS_RESULT_RCODERESULTSET);
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley if (result != ISC_R_SUCCESS)
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley UNEXPECTED_ERROR(__FILE__, __LINE__,
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley "isc_result_register() failed: %u", result);
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt result = isc_result_registerids(ISC_RESULTCLASS_DNS, DNS_R_NRESULTS,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt ids, dns_msgcat, DNS_RESULT_RESULTSET);
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt if (result == ISC_R_SUCCESS)
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt result = isc_result_registerids(ISC_RESULTCLASS_DNSRCODE,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt DNS_R_NRCODERESULTS,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt rcode_ids, dns_msgcat,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt DNS_RESULT_RCODERESULTSET);
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt if (result != ISC_R_SUCCESS)
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt UNEXPECTED_ERROR(__FILE__, __LINE__,
9e804040a29b9c3066c8471b43835f30707039b7Evan Hunt "isc_result_registerids() failed: %u", result);
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley}
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
e4e071ae12aee942fefc2c0a3280e402938669deBob Halleystatic void
e4e071ae12aee942fefc2c0a3280e402938669deBob Halleyinitialize(void) {
96754ed7b400ce080279de2f92111ad868105290Bob Halley dns_lib_initmsgcat();
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley}
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrenceconst char *
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleydns_result_totext(isc_result_t result) {
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley initialize();
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley return (isc_result_totext(result));
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley}
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
e4e071ae12aee942fefc2c0a3280e402938669deBob Halleyvoid
e4e071ae12aee942fefc2c0a3280e402938669deBob Halleydns_result_register(void) {
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley initialize();
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley}
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleydns_rcode_t
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleydns_result_torcode(isc_result_t result) {
711b0bed7b7f9e505c81e5810224f01df80a2ee4Bob Halley dns_rcode_t rcode = dns_rcode_servfail;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley if (DNS_RESULT_ISRCODE(result)) {
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley /*
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley * Rcodes can't be bigger than 12 bits, which is why we
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley * AND with 0xFFF instead of 0xFFFF.
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley */
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley return ((dns_rcode_t)((result) & 0xFFF));
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley }
ce67023ae3ad39a77da5361d0187ab6f3f0219cbMark Andrews
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley /*
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley * Try to supply an appropriate rcode.
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley */
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley switch (result) {
542189f21b3ea9b27b0fbc047d832a34dcaf75bcAndreas Gustafsson case ISC_R_SUCCESS:
fa756a197b059b28c44f24e332bd072178861dc6Mark Andrews rcode = dns_rcode_noerror;
542189f21b3ea9b27b0fbc047d832a34dcaf75bcAndreas Gustafsson break;
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case ISC_R_BADBASE64:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case ISC_R_NOSPACE:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case ISC_R_RANGE:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case ISC_R_UNEXPECTEDEND:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_BADAAAA:
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews /* case DNS_R_BADBITSTRING: deprecated */
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case DNS_R_BADCKSUM:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case DNS_R_BADCLASS:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_BADLABELTYPE:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_BADPOINTER:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case DNS_R_BADTTL:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case DNS_R_BADZONE:
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews /* case DNS_R_BITSTRINGTOOLONG: deprecated */
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_EXTRADATA:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_LABELTOOLONG:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_NOREDATA:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_SYNTAX:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_TEXTTOOLONG:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_TOOMANYHOPS:
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellington case DNS_R_TSIGERRORSET:
34b394b43e2207e8f8f3703f0402422121455638David Lawrence case DNS_R_UNKNOWN:
c07c2a862e0f9d671e2961cd179c7b28d7b04f10Mark Andrews case DNS_R_NAMETOOLONG:
ce67023ae3ad39a77da5361d0187ab6f3f0219cbMark Andrews case DNS_R_OPTERR:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley rcode = dns_rcode_formerr;
147fd0bdf83272952521a7f343d88a421e2ff997Brian Wellington break;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley case DNS_R_DISALLOWED:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley rcode = dns_rcode_refused;
147fd0bdf83272952521a7f343d88a421e2ff997Brian Wellington break;
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellington case DNS_R_TSIGVERIFYFAILURE:
95b604c5e972a5e9eb713bf45cf0b2d9b98da27eMark Andrews case DNS_R_CLOCKSKEW:
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellington rcode = dns_rcode_notauth;
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellington break;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley default:
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley rcode = dns_rcode_servfail;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley }
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley return (rcode);
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley}