Skip to content

Commit 071ff62

Browse files
committed
[0.3.0-draft] Make DNS-error-payload more detailed.
Use dedicated enums instead of `string` and `u16` values for the `DNS-error-payload` `rcode` and `info-code` fields, using the known values semi-automatically extracted from [IANA]. And add an `extra-text` value, which may hold the EXTRA-TEXT field from RFC 8914, or an implementation-specific error message. This is an alternative to #204. [IANA]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
1 parent 14a19b3 commit 071ff62

File tree

1 file changed

+192
-2
lines changed

1 file changed

+192
-2
lines changed

wit-0.3.0-draft/types.wit

Lines changed: 192 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,198 @@ interface types {
7575

7676
/// Defines the case payload type for `DNS-error` above:
7777
record DNS-error-payload {
78-
rcode: option<string>,
79-
info-code: option<u16>
78+
/// The DNS RCODE value, if known.
79+
rcode: option<DNS-RCODE>,
80+
81+
/// The DNS INFO-CODE value, if known.
82+
info-code: option<DNS-INFO-CODE>,
83+
84+
/// An information error message, if available.
85+
///
86+
/// This may contain either the [RFC 8914] EXTRA-TEXT value if one is
87+
/// present and available, or an implementation-specific error message.
88+
///
89+
/// As in the RFC 8914 EXTRA-TEXT specification, this information is
90+
/// intended for human consumption (not automated parsing). And, care
91+
/// should be taken not to include private information that an observer
92+
/// would not otherwise have access to, such as account numbers.
93+
///
94+
/// [RFC 8914]: https://www.rfc-editor.org/rfc/rfc8914.html
95+
extra-text: option<string>,
96+
}
97+
98+
/// DNS RCODEs
99+
///
100+
/// These correspond to [DNS RCODE values].
101+
///
102+
/// [DNS RCODE values]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6
103+
enum DNS-RCODE {
104+
/// `NoError`: No Error (RFC1035)
105+
no-error,
106+
107+
/// `FormErr`: Format Error (RFC1035)
108+
form-err,
109+
110+
/// `ServFail`: Server Failure (RFC1035)
111+
serv-fail,
112+
113+
/// `NXDomain`: Non-Existent Domain (RFC1035)
114+
NX-domain,
115+
116+
/// `NotImp`: Not Implemented (RFC1035)
117+
not-imp,
118+
119+
/// `Refused`: Query Refused (RFC1035)
120+
refused,
121+
122+
/// `YXDomain`: Name Exists when it should not (RFC2136](RFC6672)
123+
YX-domain,
124+
125+
/// `YXRRSet`: RR Set Exists when it should not (RFC2136)
126+
YX-RR-set,
127+
128+
/// `NXRRSet`: RR Set that should exist does not (RFC2136)
129+
NX-RR-set,
130+
131+
/// `NotAuth`: Not Authorized (RFC8945)
132+
///
133+
/// Alternatively:
134+
///
135+
/// `NotAuth`: Server Not Authoritative for zone (RFC2136)
136+
not-auth,
137+
138+
/// `NotZone`: Name not contained in zone (RFC2136)
139+
not-zone,
140+
141+
/// `DSOTYPENI`: DSO-TYPE Not Implemented (RFC8490)
142+
DSO-TYPE-NI,
143+
144+
/// `BADVERS`: Bad OPT Version (RFC6891)
145+
BADVERS,
146+
147+
/// `BADSIG`: TSIG Signature Failure (RFC8945)
148+
BADSIG,
149+
150+
/// `BADKEY`: Key not recognized (RFC8945)
151+
BADKEY,
152+
153+
/// `BADTIME`: Signature out of time window (RFC8945)
154+
BADTIME,
155+
156+
/// `BADMODE`: Bad TKEY Mode (RFC2930)
157+
BADMODE,
158+
159+
/// `BADNAME`: Duplicate key name (RFC2930)
160+
BADNAME,
161+
162+
/// `BADALG`: Algorithm not supported (RFC2930)
163+
BADALG,
164+
165+
/// `BADTRUNC`: Bad Truncation (RFC8945)
166+
BADTRUNC,
167+
168+
/// `BADCOOKIE`: Bad/missing Server Cookie (RFC7873)
169+
BADCOOKIE,
170+
}
171+
172+
/// Extended DNS Error Codes
173+
///
174+
/// These correspond to [Extended DNS Error Codes], also known as `INFO-CODE`s.
175+
///
176+
/// [Extended DNS Error Codes]: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#extended-dns-error-codes
177+
enum DNS-INFO-CODE {
178+
/// Other Error (RFC8914, Section 4.1)
179+
other-error,
180+
181+
/// Unsupported DNSKEY Algorithm (RFC8914, Section 4.2)
182+
unsupported-DNSKEY-algorithm,
183+
184+
/// Unsupported DS Digest Type (RFC8914, Section 4.3)
185+
unsupported-DS-digest-type,
186+
187+
/// Stale Answer (RFC8914, Section 4.4][RFC8767)
188+
stale-answer,
189+
190+
/// Forged Answer (RFC8914, Section 4.5)
191+
forged-answer,
192+
193+
/// DNSSEC Indeterminate (RFC8914, Section 4.6)
194+
DNSSEC-jndeterminate,
195+
196+
/// DNSSEC Bogus (RFC8914, Section 4.7)
197+
DNSSEC-bogus,
198+
199+
/// Signature Expired (RFC8914, Section 4.8)
200+
signature-expired,
201+
202+
/// Signature Not Yet Valid (RFC8914, Section 4.9)
203+
signature-not-yet-valid,
204+
205+
/// DNSKEY Missing (RFC8914, Section 4.10)
206+
DNSKEY-missing,
207+
208+
/// RRSIGs Missing (RFC8914, Section 4.11)
209+
rrsigs-missing,
210+
211+
/// No Zone Key Bit Set (RFC8914, Section 4.12)
212+
no-zone-key-bit-set,
213+
214+
/// NSEC Missing (RFC8914, Section 4.13)
215+
NSEC-missing,
216+
217+
/// Cached Error (RFC8914, Section 4.14)
218+
cached-error,
219+
220+
/// Not Ready (RFC8914, Section 4.15)
221+
not-ready,
222+
223+
/// Blocked (RFC8914, Section 4.16)
224+
blocked,
225+
226+
/// Censored (RFC8914, Section 4.17)
227+
censored,
228+
229+
/// Filtered (RFC8914, Section 4.18)
230+
filtered,
231+
232+
/// Prohibited (RFC8914, Section 4.19)
233+
prohibited,
234+
235+
/// Stale NXDomain Answer (RFC8914, Section 4.20)
236+
stale-NX-domain-answer,
237+
238+
/// Not Authoritative (RFC8914, Section 4.21)
239+
not-authoritative,
240+
241+
/// Not Supported (RFC8914, Section 4.22)
242+
not-supported,
243+
244+
/// No Reachable Authority (RFC8914, Section 4.23)
245+
no-reachable-authority,
246+
247+
/// Network Error (RFC8914, Section 4.24)
248+
network-error,
249+
250+
/// Invalid Data (RFC8914, Section 4.25)
251+
invalid-data,
252+
253+
/// Signature Expired before Valid (https://github.com/NLnetLabs/unbound/pull/604#discussion_r802678343][Willem_Toorop)
254+
signature-expired-before-valid,
255+
256+
/// Too Early (RFC9250)
257+
too-early,
258+
259+
/// Unsupported NSEC3 Iterations Value (RFC9276)
260+
unsupported-NSEC3-iterations-value,
261+
262+
/// Unable to conform to policy (draft-homburg-dnsop-codcp-00)
263+
unable-to-conform-to-policy,
264+
265+
/// Synthesized (https://github.com/PowerDNS/pdns/pull/12334][Otto_Moerbeek)
266+
synthesized,
267+
268+
/// Invalid Query Type (RFC9824)
269+
invalid-query-type,
80270
}
81271

82272
/// Defines the case payload type for `TLS-alert-received` above:

0 commit comments

Comments
 (0)