Commit fbab1004 authored by Mark Andrews's avatar Mark Andrews Committed by Evan Hunt

Add support for EID and NIMLOC

parent 343333f5
Pipeline #5773 passed with stages
in 8 minutes and 32 seconds
5061. [protocol] Add support for EID and NIMLOC. [GL #626]
5060. [bug] GID, UID and UINFO could not be loaded using unknown
record format. [GL #627]
......
......@@ -186,12 +186,15 @@ loc02 LOC 60 09 00.000 N 24 39 00.000 E 10.00m 20.00m (
;nxt03 NXT . 1
;nxt04 NXT . 127
; type 31 (EID - not implemented by BIND)
; type 32 (NIMLOC - not implemented by BIND)
; type 31
eid01 EID 12 89 AB
; type 32
nimloc01 NIMLOC 12 89 AB
; type 33
srv01 SRV 0 0 0 .
srv02 SRV 65535 65535 65535 old-slow-box
srv01 SRV 0 0 0 .
srv02 SRV 65535 65535 65535 old-slow-box
; type 34
atma01 ATMA +61200000000
......
......@@ -41,6 +41,7 @@ ds01.example. 3600 IN NS ns42.example.
ds01.example. 3600 IN DS 12892 5 2 26584835CA80C81C91999F31CFAF2A0E89D4FF1C8FAFD0DDB31A85C7 19277C13
ds02.example. 3600 IN NS ns43.example.
ds02.example. 3600 IN DS 12892 5 1 7AA4A3F416C2F2391FB7AB0D434F762CD62D1390
eid01.example. 3600 IN EID 1289AB
eui48.example. 3600 IN EUI48 01-23-45-67-89-ab
eui64.example. 3600 IN EUI64 01-23-45-67-89-ab-cd-ef
gid01.example. 3600 IN GID \# 1 03
......@@ -83,6 +84,7 @@ mx01.example. 3600 IN MX 10 mail.example.
mx02.example. 3600 IN MX 10 .
naptr01.example. 3600 IN NAPTR 0 0 "" "" "" .
naptr02.example. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo.
nimloc01.example. 3600 IN NIMLOC 1289AB
ninfo01.example. 3600 IN NINFO "foo"
ninfo02.example. 3600 IN NINFO "foo" "bar"
ninfo03.example. 3600 IN NINFO "foo"
......
......@@ -41,6 +41,7 @@ ds01.example. 3600 IN NS ns42.example.
ds01.example. 3600 IN DS 12892 5 2 26584835CA80C81C91999F31CFAF2A0E89D4FF1C8FAFD0DDB31A85C7 19277C13
ds02.example. 3600 IN NS ns43.example.
ds02.example. 3600 IN DS 12892 5 1 7AA4A3F416C2F2391FB7AB0D434F762CD62D1390
eid01.example. 3600 IN EID 1289AB
eui48.example. 3600 IN EUI48 01-23-45-67-89-ab
eui64.example. 3600 IN EUI64 01-23-45-67-89-ab-cd-ef
gid01.example. 3600 IN GID \# 1 03
......@@ -83,6 +84,7 @@ mx01.example. 3600 IN MX 10 mail.example.
mx02.example. 3600 IN MX 10 .
naptr01.example. 3600 IN NAPTR 0 0 "" "" "" .
naptr02.example. 3600 IN NAPTR 65535 65535 "blurgh" "blorf" "blllbb" foo.
nimloc01.example. 3600 IN NIMLOC 1289AB
ninfo01.example. 3600 IN NINFO "foo"
ninfo02.example. 3600 IN NINFO "foo" "bar"
ninfo03.example. 3600 IN NINFO "foo"
......
......@@ -697,8 +697,6 @@ main(int argc, char **argv) {
* sort them without special cases.
*/
insert_into_typenames(0, "reserved0", RESERVED);
insert_into_typenames(31, "eid", RESERVED);
insert_into_typenames(32, "nimloc", RESERVED);
insert_into_typenames(100, "uinfo", RESERVEDNAME);
insert_into_typenames(101, "uid", RESERVEDNAME);
insert_into_typenames(102, "gid", RESERVEDNAME);
......
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/* http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt */
#ifndef RDATA_IN_1_EID_31_C
#define RDATA_IN_1_EID_31_C
#define RRTYPE_EID_ATTRIBUTES (0)
static inline isc_result_t
fromtext_in_eid(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_eid);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(type);
UNUSED(origin);
UNUSED(options);
UNUSED(rdclass);
UNUSED(callbacks);
return (isc_hex_tobuffer(lexer, target, -1));
}
static inline isc_result_t
totext_in_eid(ARGS_TOTEXT) {
isc_region_t region;
REQUIRE(rdata->type == dns_rdatatype_eid);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
REQUIRE(rdata->length != 0);
dns_rdata_toregion(rdata, &region);
if (tctx->width == 0) {
return (isc_hex_totext(&region, 60, "", target));
} else {
return (isc_hex_totext(&region, tctx->width - 2,
tctx->linebreak, target));
}
}
static inline isc_result_t
fromwire_in_eid(ARGS_FROMWIRE) {
isc_region_t region;
REQUIRE(type == dns_rdatatype_eid);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(type);
UNUSED(dctx);
UNUSED(options);
UNUSED(rdclass);
isc_buffer_activeregion(source, &region);
if (region.length < 1) {
return (ISC_R_UNEXPECTEDEND);
}
RETERR(mem_tobuffer(target, region.base, region.length));
isc_buffer_forward(source, region.length);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
towire_in_eid(ARGS_TOWIRE) {
REQUIRE(rdata->type == dns_rdatatype_eid);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
REQUIRE(rdata->length != 0);
UNUSED(cctx);
return (mem_tobuffer(target, rdata->data, rdata->length));
}
static inline int
compare_in_eid(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_eid);
REQUIRE(rdata1->rdclass == dns_rdataclass_in);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
fromstruct_in_eid(ARGS_FROMSTRUCT) {
dns_rdata_in_eid_t *eid = source;
REQUIRE(type == dns_rdatatype_eid);
REQUIRE(rdclass == dns_rdataclass_in);
REQUIRE(source != NULL);
REQUIRE(eid->common.rdtype == type);
REQUIRE(eid->common.rdclass == rdclass);
REQUIRE(eid->eid != NULL || eid->eid_len == 0);
UNUSED(type);
UNUSED(rdclass);
return (mem_tobuffer(target, eid->eid, eid->eid_len));
}
static inline isc_result_t
tostruct_in_eid(ARGS_TOSTRUCT) {
dns_rdata_in_eid_t *eid = target;
isc_region_t r;
REQUIRE(rdata->type == dns_rdatatype_eid);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
REQUIRE(target != NULL);
REQUIRE(rdata->length != 0);
eid->common.rdclass = rdata->rdclass;
eid->common.rdtype = rdata->type;
ISC_LINK_INIT(&eid->common, link);
dns_rdata_toregion(rdata, &r);
eid->eid_len = r.length;
eid->eid = mem_maybedup(mctx, r.base, r.length);
if (eid->eid == NULL) {
return (ISC_R_NOMEMORY);
}
eid->mctx = mctx;
return (ISC_R_SUCCESS);
}
static inline void
freestruct_in_eid(ARGS_FREESTRUCT) {
dns_rdata_in_eid_t *eid = source;
REQUIRE(source != NULL);
REQUIRE(eid->common.rdclass == dns_rdataclass_in);
REQUIRE(eid->common.rdtype == dns_rdatatype_eid);
if (eid->mctx == NULL) {
return;
}
if (eid->eid != NULL) {
isc_mem_free(eid->mctx, eid->eid);
}
eid->mctx = NULL;
}
static inline isc_result_t
additionaldata_in_eid(ARGS_ADDLDATA) {
REQUIRE(rdata->type == dns_rdatatype_eid);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
UNUSED(rdata);
UNUSED(add);
UNUSED(arg);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
digest_in_eid(ARGS_DIGEST) {
isc_region_t r;
REQUIRE(rdata->type == dns_rdatatype_eid);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
dns_rdata_toregion(rdata, &r);
return ((digest)(arg, &r));
}
static inline bool
checkowner_in_eid(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_eid);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(name);
UNUSED(type);
UNUSED(rdclass);
UNUSED(wildcard);
return (true);
}
static inline bool
checknames_in_eid(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == dns_rdatatype_eid);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
UNUSED(rdata);
UNUSED(owner);
UNUSED(bad);
return (true);
}
static inline int
casecompare_in_eid(ARGS_COMPARE) {
return (compare_in_eid(rdata1, rdata2));
}
#endif /* RDATA_IN_1_EID_31_C */
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef IN_1_EID_31_H
#define IN_1_EID_31_H 1
/*!
* \brief http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt
*/
typedef struct dns_rdata_in_eid {
dns_rdatacommon_t common;
isc_mem_t *mctx;
unsigned char *eid;
uint16_t eid_len;
} dns_rdata_in_eid_t;
#endif /* IN_1_EID_31_H */
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
/* http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt */
#ifndef RDATA_IN_1_NIMLOC_32_C
#define RDATA_IN_1_NIMLOC_32_C
#define RRTYPE_NIMLOC_ATTRIBUTES (0)
static inline isc_result_t
fromtext_in_nimloc(ARGS_FROMTEXT) {
REQUIRE(type == dns_rdatatype_nimloc);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(type);
UNUSED(origin);
UNUSED(options);
UNUSED(rdclass);
UNUSED(callbacks);
return (isc_hex_tobuffer(lexer, target, -1));
}
static inline isc_result_t
totext_in_nimloc(ARGS_TOTEXT) {
isc_region_t region;
REQUIRE(rdata->type == dns_rdatatype_nimloc);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
REQUIRE(rdata->length != 0);
dns_rdata_toregion(rdata, &region);
if (tctx->width == 0) {
return (isc_hex_totext(&region, 60, "", target));
} else {
return (isc_hex_totext(&region, tctx->width - 2,
tctx->linebreak, target));
}
}
static inline isc_result_t
fromwire_in_nimloc(ARGS_FROMWIRE) {
isc_region_t region;
REQUIRE(type == dns_rdatatype_nimloc);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(type);
UNUSED(dctx);
UNUSED(options);
UNUSED(rdclass);
isc_buffer_activeregion(source, &region);
if (region.length < 1) {
return (ISC_R_UNEXPECTEDEND);
}
RETERR(mem_tobuffer(target, region.base, region.length));
isc_buffer_forward(source, region.length);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
towire_in_nimloc(ARGS_TOWIRE) {
REQUIRE(rdata->type == dns_rdatatype_nimloc);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
REQUIRE(rdata->length != 0);
UNUSED(cctx);
return (mem_tobuffer(target, rdata->data, rdata->length));
}
static inline int
compare_in_nimloc(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_nimloc);
REQUIRE(rdata1->rdclass == dns_rdataclass_in);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_rdata_toregion(rdata1, &r1);
dns_rdata_toregion(rdata2, &r2);
return (isc_region_compare(&r1, &r2));
}
static inline isc_result_t
fromstruct_in_nimloc(ARGS_FROMSTRUCT) {
dns_rdata_in_nimloc_t *nimloc = source;
REQUIRE(type == dns_rdatatype_nimloc);
REQUIRE(rdclass == dns_rdataclass_in);
REQUIRE(source != NULL);
REQUIRE(nimloc->common.rdtype == type);
REQUIRE(nimloc->common.rdclass == rdclass);
REQUIRE(nimloc->nimloc != NULL || nimloc->nimloc_len == 0);
UNUSED(type);
UNUSED(rdclass);
return (mem_tobuffer(target, nimloc->nimloc, nimloc->nimloc_len));
}
static inline isc_result_t
tostruct_in_nimloc(ARGS_TOSTRUCT) {
dns_rdata_in_nimloc_t *nimloc = target;
isc_region_t r;
REQUIRE(rdata->type == dns_rdatatype_nimloc);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
REQUIRE(target != NULL);
REQUIRE(rdata->length != 0);
nimloc->common.rdclass = rdata->rdclass;
nimloc->common.rdtype = rdata->type;
ISC_LINK_INIT(&nimloc->common, link);
dns_rdata_toregion(rdata, &r);
nimloc->nimloc_len = r.length;
nimloc->nimloc = mem_maybedup(mctx, r.base, r.length);
if (nimloc->nimloc == NULL) {
return (ISC_R_NOMEMORY);
}
nimloc->mctx = mctx;
return (ISC_R_SUCCESS);
}
static inline void
freestruct_in_nimloc(ARGS_FREESTRUCT) {
dns_rdata_in_nimloc_t *nimloc = source;
REQUIRE(source != NULL);
REQUIRE(nimloc->common.rdclass == dns_rdataclass_in);
REQUIRE(nimloc->common.rdtype == dns_rdatatype_nimloc);
if (nimloc->mctx == NULL) {
return;
}
if (nimloc->nimloc != NULL) {
isc_mem_free(nimloc->mctx, nimloc->nimloc);
}
nimloc->mctx = NULL;
}
static inline isc_result_t
additionaldata_in_nimloc(ARGS_ADDLDATA) {
REQUIRE(rdata->type == dns_rdatatype_nimloc);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
UNUSED(rdata);
UNUSED(add);
UNUSED(arg);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
digest_in_nimloc(ARGS_DIGEST) {
isc_region_t r;
REQUIRE(rdata->type == dns_rdatatype_nimloc);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
dns_rdata_toregion(rdata, &r);
return ((digest)(arg, &r));
}
static inline bool
checkowner_in_nimloc(ARGS_CHECKOWNER) {
REQUIRE(type == dns_rdatatype_nimloc);
REQUIRE(rdclass == dns_rdataclass_in);
UNUSED(name);
UNUSED(type);
UNUSED(rdclass);
UNUSED(wildcard);
return (true);
}
static inline bool
checknames_in_nimloc(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == dns_rdatatype_nimloc);
REQUIRE(rdata->rdclass == dns_rdataclass_in);
UNUSED(rdata);
UNUSED(owner);
UNUSED(bad);
return (true);
}
static inline int
casecompare_in_nimloc(ARGS_COMPARE) {
return (compare_in_nimloc(rdata1, rdata2));
}
#endif /* RDATA_IN_1_NIMLOC_32_C */
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#ifndef IN_1_NIMLOC_32_H
#define IN_1_NIMLOC_32_H 1
/*!
* \brief http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt
*/
typedef struct dns_rdata_in_nimloc {
dns_rdatacommon_t common;
isc_mem_t *mctx;
unsigned char *nimloc;
uint16_t nimloc_len;
} dns_rdata_in_nimloc_t;
#endif /* IN_1_NIMLOC_32_H */
......@@ -936,6 +936,47 @@ ATF_TC_BODY(edns_client_subnet, tc) {
dns_rdatatype_opt, sizeof(dns_rdata_opt_t));
}
/*
* http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt
*
* The RDATA portion of both the NIMLOC and EID records contains
* uninterpreted binary data. The representation in the text master file
* is an even number of hex characters (0 to 9, a to f), case is not
* significant. For readability, whitespace may be included in the value
* field and should be ignored when reading a master file.
*/
ATF_TC(eid);
ATF_TC_HEAD(eid, tc) {
atf_tc_set_md_var(tc, "descr", "EID RDATA manipulations");
}
ATF_TC_BODY(eid, tc) {
text_ok_t text_ok[] = {
TEXT_VALID("AABBCC"),
TEXT_VALID_CHANGED("AA bb cc", "AABBCC"),
TEXT_INVALID("aab"),
/*
* Sentinel.
*/
TEXT_SENTINEL()
};
wire_ok_t wire_ok[] = {
/*
* Too short.
*/
WIRE_INVALID(),
WIRE_VALID(0x00),
/*
* Sentinel.
*/
WIRE_SENTINEL()
};
UNUSED(tc);
check_rdata(text_ok, wire_ok, false, dns_rdataclass_in,
dns_rdatatype_eid, sizeof(dns_rdata_in_eid_t));
}
/*
* Successful load test.
*/
......@@ -1078,6 +1119,47 @@ ATF_TC_BODY(isdn, tc) {
dns_rdatatype_isdn, sizeof(dns_rdata_isdn_t));
}
/*
* http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt
*
* The RDATA portion of both the NIMLOC and EID records contains
* uninterpreted binary data. The representation in the text master file
* is an even number of hex characters (0 to 9, a to f), case is not
* significant. For readability, whitespace may be included in the value
* field and should be ignored when reading a master file.
*/
ATF_TC(nimloc);
ATF_TC_HEAD(nimloc, tc) {
atf_tc_set_md_var(tc, "descr", "NIMLOC RDATA manipulations");
}
ATF_TC_BODY(nimloc, tc) {
text_ok_t text_ok[] = {
TEXT_VALID("AABBCC"),
TEXT_VALID_CHANGED("AA bb cc", "AABBCC"),
TEXT_INVALID("aab"),
/*
* Sentinel.
*/
TEXT_SENTINEL()
};
wire_ok_t wire_ok[] = {
/*
* Too short.
*/
WIRE_INVALID(),
WIRE_VALID(0x00),
/*
* Sentinel.
*/
WIRE_SENTINEL()