]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4326. [protocol] Add support for AVC. [RT #41819
authorMark Andrews <marka@isc.org>
Fri, 4 Mar 2016 07:11:41 +0000 (18:11 +1100)
committerMark Andrews <marka@isc.org>
Fri, 4 Mar 2016 07:15:47 +0000 (18:15 +1100)
(cherry picked from commit 8398f0015625495e228eea195e3adccfcf59ffcc)

CHANGES
bin/tests/system/genzone.sh
bin/tests/system/xfer/dig1.good
bin/tests/system/xfer/dig2.good
lib/dns/rdata/generic/avc_258.c [new file with mode: 0644]
lib/dns/rdata/generic/avc_258.h [new file with mode: 0644]

diff --git a/CHANGES b/CHANGES
index aa9b6c8e85520f24a46bf05db2a27ce7decd319d..47589983a04fd66af22cf7639f3ba245dd98ce7c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+4326.  [protocol]      Add support for AVC. [RT #41819]
+
 4324.  [bug]           When deleting records from a zone database, interior
                        nodes could be left empty but not deleted, damaging
                        search performance afterward. [RT #40997]
index c9df657a9447f66599f54f986b9cc2d6a83afff7..e3a0715fe701b6b387c7c504854aaf6ae64c4c47 100644 (file)
@@ -359,6 +359,9 @@ caa01                       CAA     0 issue "ca.example.net; policy=ev"
 caa02                  CAA     128 tbs "Unknown"
 caa03                  CAA     128 tbs ""
 
+; type 258
+avc                    AVC     foo:bar
+
 ; type 32768
 ta                     TA      30795 1 1 (
                                        310D27F4D82C1FC2400704EA9939FE6E1CEA
index 8f60c2e24d0861a276d999b534fd966796654166..9af36c41593a6593acf1a3e35015835348b91387 100644 (file)
@@ -9,6 +9,7 @@ a601.example.           3600    IN      A6      127 ::1 foo.
 a601.example.          3600    IN      A6      128  .
 afsdb01.example.       3600    IN      AFSDB   0 hostname.example.
 afsdb02.example.       3600    IN      AFSDB   65535 .
+avc.example.           3600    IN      AVC     "foo:bar"
 caa01.example.         3600    IN      CAA     0 issue "ca.example.net\; policy=ev"
 caa02.example.         3600    IN      CAA     128 tbs "Unknown"
 caa03.example.         3600    IN      CAA     128 tbs ""
index 4d388e1bdbbae43f9eec78b04606d2de1644069d..72d4fc16ef3b8c707e749be58b97b0f3d8d798c1 100644 (file)
@@ -9,6 +9,7 @@ a601.example.           3600    IN      A6      127 ::1 foo.
 a601.example.          3600    IN      A6      128  .
 afsdb01.example.       3600    IN      AFSDB   0 hostname.example.
 afsdb02.example.       3600    IN      AFSDB   65535 .
+avc.example.           3600    IN      AVC     "foo:bar"
 caa01.example.         3600    IN      CAA     0 issue "ca.example.net\; policy=ev"
 caa02.example.         3600    IN      CAA     128 tbs "Unknown"
 caa03.example.         3600    IN      CAA     128 tbs ""
diff --git a/lib/dns/rdata/generic/avc_258.c b/lib/dns/rdata/generic/avc_258.c
new file mode 100644 (file)
index 0000000..e74903f
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2016  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.
+ */
+
+#ifndef RDATA_GENERIC_AVC_258_C
+#define RDATA_GENERIC_AVC_258_C
+
+#define RRTYPE_AVC_ATTRIBUTES (0)
+
+static inline isc_result_t
+fromtext_avc(ARGS_FROMTEXT) {
+
+       REQUIRE(type == dns_rdatatype_avc);
+
+       UNUSED(type);
+       UNUSED(rdclass);
+       UNUSED(origin);
+       UNUSED(options);
+       UNUSED(callbacks);
+
+       return (generic_fromtext_txt(rdclass, type, lexer, origin, options,
+                                    target, callbacks));
+}
+
+static inline isc_result_t
+totext_avc(ARGS_TOTEXT) {
+
+       UNUSED(tctx);
+
+       REQUIRE(rdata->type == dns_rdatatype_avc);
+
+       return (generic_totext_txt(rdata, tctx, target));
+}
+
+static inline isc_result_t
+fromwire_avc(ARGS_FROMWIRE) {
+
+       REQUIRE(type == dns_rdatatype_avc);
+
+       UNUSED(type);
+       UNUSED(dctx);
+       UNUSED(rdclass);
+       UNUSED(options);
+
+       return (generic_fromwire_txt(rdclass, type, source, dctx, options,
+                                    target));
+}
+
+static inline isc_result_t
+towire_avc(ARGS_TOWIRE) {
+
+       REQUIRE(rdata->type == dns_rdatatype_avc);
+
+       UNUSED(cctx);
+
+       return (mem_tobuffer(target, rdata->data, rdata->length));
+}
+
+static inline int
+compare_avc(ARGS_COMPARE) {
+       isc_region_t r1;
+       isc_region_t r2;
+
+       REQUIRE(rdata1->type == rdata2->type);
+       REQUIRE(rdata1->rdclass == rdata2->rdclass);
+       REQUIRE(rdata1->type == dns_rdatatype_avc);
+
+       dns_rdata_toregion(rdata1, &r1);
+       dns_rdata_toregion(rdata2, &r2);
+       return (isc_region_compare(&r1, &r2));
+}
+
+static inline isc_result_t
+fromstruct_avc(ARGS_FROMSTRUCT) {
+
+       REQUIRE(type == dns_rdatatype_avc);
+
+       return (generic_fromstruct_txt(rdclass, type, source, target));
+}
+
+static inline isc_result_t
+tostruct_avc(ARGS_TOSTRUCT) {
+       dns_rdata_avc_t *avc = target;
+
+       REQUIRE(rdata->type == dns_rdatatype_avc);
+       REQUIRE(target != NULL);
+
+       avc->common.rdclass = rdata->rdclass;
+       avc->common.rdtype = rdata->type;
+       ISC_LINK_INIT(&avc->common, link);
+
+       return (generic_tostruct_txt(rdata, target, mctx));
+}
+
+static inline void
+freestruct_avc(ARGS_FREESTRUCT) {
+       dns_rdata_avc_t *txt = source;
+
+       REQUIRE(source != NULL);
+       REQUIRE(txt->common.rdtype == dns_rdatatype_avc);
+
+       generic_freestruct_txt(source);
+}
+
+static inline isc_result_t
+additionaldata_avc(ARGS_ADDLDATA) {
+       REQUIRE(rdata->type == dns_rdatatype_avc);
+
+       UNUSED(rdata);
+       UNUSED(add);
+       UNUSED(arg);
+
+       return (ISC_R_SUCCESS);
+}
+
+static inline isc_result_t
+digest_avc(ARGS_DIGEST) {
+       isc_region_t r;
+
+       REQUIRE(rdata->type == dns_rdatatype_avc);
+
+       dns_rdata_toregion(rdata, &r);
+
+       return ((digest)(arg, &r));
+}
+
+static inline isc_boolean_t
+checkowner_avc(ARGS_CHECKOWNER) {
+
+       REQUIRE(type == dns_rdatatype_avc);
+
+       UNUSED(name);
+       UNUSED(type);
+       UNUSED(rdclass);
+       UNUSED(wildcard);
+
+       return (ISC_TRUE);
+}
+
+static inline isc_boolean_t
+checknames_avc(ARGS_CHECKNAMES) {
+
+       REQUIRE(rdata->type == dns_rdatatype_avc);
+
+       UNUSED(rdata);
+       UNUSED(owner);
+       UNUSED(bad);
+
+       return (ISC_TRUE);
+}
+
+static inline int
+casecompare_avc(ARGS_COMPARE) {
+       return (compare_avc(rdata1, rdata2));
+}
+#endif /* RDATA_GENERIC_AVC_258_C */
diff --git a/lib/dns/rdata/generic/avc_258.h b/lib/dns/rdata/generic/avc_258.h
new file mode 100644 (file)
index 0000000..d32282e
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016  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.
+ */
+
+#ifndef GENERIC_AVC_258_H
+#define GENERIC_AVC_258_H 1
+
+typedef dns_rdata_txt_string_t dns_rdata_avc_string_t;
+
+typedef struct dns_rdata_avc {
+       dns_rdatacommon_t       common;
+       isc_mem_t               *mctx;
+       unsigned char           *data;
+       isc_uint16_t            length;
+       /* private */
+       isc_uint16_t            offset;
+} dns_rdata_avc_t;
+
+/*
+ * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done
+ * via rdatastructpre.h and rdatastructsuf.h.
+ */
+#endif /* GENERIC_AVC_258_H */