summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/dig/lib/dns/include/dns/types.h1
-rw-r--r--usr.bin/dig/lib/dns/rdata.c5
-rw-r--r--usr.bin/dig/lib/dns/rdata/generic/resinfo_261.c83
3 files changed, 88 insertions, 1 deletions
diff --git a/usr.bin/dig/lib/dns/include/dns/types.h b/usr.bin/dig/lib/dns/include/dns/types.h
index 88dfe4fa312..0efc49d4927 100644
--- a/usr.bin/dig/lib/dns/include/dns/types.h
+++ b/usr.bin/dig/lib/dns/include/dns/types.h
@@ -150,6 +150,7 @@ enum {
dns_rdatatype_caa = 257,
dns_rdatatype_avc = 258,
dns_rdatatype_doa = 259,
+ dns_rdatatype_resinfo = 261,
dns_rdatatype_ta = 32768,
dns_rdatatype_dlv = 32769,
dns_rdatatype_keydata = 65533,
diff --git a/usr.bin/dig/lib/dns/rdata.c b/usr.bin/dig/lib/dns/rdata.c
index 395f3cf1262..f39da4d8aae 100644
--- a/usr.bin/dig/lib/dns/rdata.c
+++ b/usr.bin/dig/lib/dns/rdata.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdata.c,v 1.36 2024/04/23 13:34:50 jsg Exp $ */
+/* $Id: rdata.c,v 1.37 2024/12/09 12:24:01 florian Exp $ */
/*! \file */
@@ -811,6 +811,7 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
{"ptr", 12},
{"px", 26},
{"reserved0", 0},
+ {"resinfo", 261},
{"rkey", 57},
{"rp", 17},
{"rrsig", 46},
@@ -1055,6 +1056,8 @@ dns_rdatatype_totext(dns_rdatatype_t type, isc_buffer_t *target) {
return (isc_str_tobuffer("AVC", target));
case 259:
return (isc_str_tobuffer("DOA", target));
+ case 261:
+ return (isc_str_tobuffer("RESINFO", target));
case 32768:
return (isc_str_tobuffer("TA", target));
case 32769:
diff --git a/usr.bin/dig/lib/dns/rdata/generic/resinfo_261.c b/usr.bin/dig/lib/dns/rdata/generic/resinfo_261.c
new file mode 100644
index 00000000000..6ad04d04f2d
--- /dev/null
+++ b/usr.bin/dig/lib/dns/rdata/generic/resinfo_261.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* RFC 9606, based on txt_16.c */
+
+#ifndef RDATA_GENERIC_RESINFO_261_C
+#define RDATA_GENERIC_RESINFO_261_C
+
+static inline isc_result_t
+generic_totext_resinfo(ARGS_TOTEXT) {
+ isc_region_t region;
+
+ UNUSED(tctx);
+
+ dns_rdata_toregion(rdata, &region);
+
+ while (region.length > 0) {
+ RETERR(txt_totext(&region, 1, target));
+ if (region.length > 0)
+ RETERR(isc_str_tobuffer(" ", target));
+ }
+
+ return (ISC_R_SUCCESS);
+}
+
+static inline isc_result_t
+generic_fromwire_resinfo(ARGS_FROMWIRE) {
+ isc_result_t result;
+
+ UNUSED(type);
+ UNUSED(dctx);
+ UNUSED(rdclass);
+ UNUSED(options);
+
+ do {
+ result = txt_fromwire(source, target);
+ if (result != ISC_R_SUCCESS)
+ return (result);
+ } while (!buffer_empty(source));
+ return (ISC_R_SUCCESS);
+}
+
+static inline isc_result_t
+totext_resinfo(ARGS_TOTEXT) {
+
+ REQUIRE(rdata->type == dns_rdatatype_resinfo);
+
+ return (generic_totext_resinfo(rdata, tctx, target));
+}
+
+static inline isc_result_t
+fromwire_resinfo(ARGS_FROMWIRE) {
+
+ REQUIRE(type == dns_rdatatype_resinfo);
+
+ return (generic_fromwire_resinfo(rdclass, type, source, dctx, options,
+ target));
+}
+
+static inline isc_result_t
+towire_resinfo(ARGS_TOWIRE) {
+
+ REQUIRE(rdata->type == dns_rdatatype_resinfo);
+
+ UNUSED(cctx);
+
+ return (isc_mem_tobuffer(target, rdata->data, rdata->length));
+}
+
+#endif /* RDATA_GENERIC_RESINFO_261_C */