From: Willem Toorop Date: Thu, 25 Apr 2013 08:54:23 +0000 (+0000) Subject: Update Changelog and implement EUI48 and EUI64 X-Git-Tag: release-1.6.17rc1~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40733b6a351f6bdb1c9035b2460780b1792becf7;p=thirdparty%2Fldns.git Update Changelog and implement EUI48 and EUI64 svn:NO REGRESSION --- diff --git a/Changelog b/Changelog index 89e7497e..e56ca144 100644 --- a/Changelog +++ b/Changelog @@ -1,12 +1,18 @@ 1.6.17 + * New RR types NINFO, RKEY, CDS, EUI48, EUI64 & TA. + * Fix b{32,64}_{ntop,pton} detection and handling. + * -T option for ldns-dane that has specific exit status for PKIX + validated connections without (secure) TLSA records. + * Bind to source address for resolvers. drill binds to source with -I. + Thanks Bryan Duff. * README now shows preferred way to configure for examples and drill. * Miscellaneous prototype fixes. Thanks Dag-Erling Smørgrav. + * Make sure executables are linked against libcrypto with the + LIBSSL_LDFLAGS. Thanks Leo Baltus. * Add --disable-dane option to configure and check availability of the for dane needed X509_check_ca function in openssl. * Fix ldns_dnssec_zone_new_frm_fp_l to allow the last parsed line of a zone to be an NSEC3 (or its RRSIG) covering an empty non terminal. - * Make sure executables are linked against libcrypto with the - LIBSSL_LDFLAGS. Thanks Leo Baltus. 1.6.16 2012-11-13 * Fix Makefile to build pyldns with BSD make diff --git a/error.c b/error.c index e7a36c7e..ca78e77b 100644 --- a/error.c +++ b/error.c @@ -127,6 +127,12 @@ ldns_lookup_table ldns_error_str[] = { "did not end in a self-signed certificate" }, { LDNS_STATUS_INVALID_ILNP64, "Conversion error, 4 colon seperated hex numbers expected" }, + { LDNS_STATUS_INVALID_EUI48, + "Conversion error, 6 two character hex numbers " + "seperated by dashes expected (i.e. xx-xx-xx-xx-xx-xx" }, + { LDNS_STATUS_INVALID_EUI64, + "Conversion error, 8 two character hex numbers " + "seperated by dashes expected (i.e. xx-xx-xx-xx-xx-xx-xx-xx" }, { 0, NULL } }; diff --git a/host2str.c b/host2str.c index 0c85d331..605fba93 100644 --- a/host2str.c +++ b/host2str.c @@ -1060,6 +1060,27 @@ ldns_rdf2buffer_str_ilnp64(ldns_buffer *output, const ldns_rdf *rdf) return ldns_buffer_status(output); } +ldns_status +ldns_rdf2buffer_str_eui48(ldns_buffer *output, const ldns_rdf *rdf) +{ + ldns_buffer_printf(output,"%.2x-%.2x-%.2x-%.2x-%.2x-%.2x", + ldns_rdf_data(rdf)[0], ldns_rdf_data(rdf)[1], + ldns_rdf_data(rdf)[2], ldns_rdf_data(rdf)[3], + ldns_rdf_data(rdf)[4], ldns_rdf_data(rdf)[5]); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_eui64(ldns_buffer *output, const ldns_rdf *rdf) +{ + ldns_buffer_printf(output,"%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x-%.2x", + ldns_rdf_data(rdf)[0], ldns_rdf_data(rdf)[1], + ldns_rdf_data(rdf)[2], ldns_rdf_data(rdf)[3], + ldns_rdf_data(rdf)[4], ldns_rdf_data(rdf)[5], + ldns_rdf_data(rdf)[6], ldns_rdf_data(rdf)[7]); + return ldns_buffer_status(output); +} + ldns_status ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) { @@ -1161,6 +1182,12 @@ ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) case LDNS_RDF_TYPE_ILNP64: res = ldns_rdf2buffer_str_ilnp64(buffer, rdf); break; + case LDNS_RDF_TYPE_EUI48: + res = ldns_rdf2buffer_str_eui48(buffer, rdf); + break; + case LDNS_RDF_TYPE_EUI64: + res = ldns_rdf2buffer_str_eui64(buffer, rdf); + break; } } else { /** This will write mangled RRs */ diff --git a/ldns/error.h b/ldns/error.h index ee31e3cd..67b3d314 100644 --- a/ldns/error.h +++ b/ldns/error.h @@ -119,7 +119,9 @@ enum ldns_enum_status { LDNS_STATUS_DANE_PKIX_DID_NOT_VALIDATE, LDNS_STATUS_DANE_PKIX_NO_SELF_SIGNED_TRUST_ANCHOR, LDNS_STATUS_EXISTS_ERR, - LDNS_STATUS_INVALID_ILNP64 + LDNS_STATUS_INVALID_ILNP64, + LDNS_STATUS_INVALID_EUI48, + LDNS_STATUS_INVALID_EUI64 }; typedef enum ldns_enum_status ldns_status; diff --git a/ldns/host2str.h b/ldns/host2str.h index 4b69ca62..6b5fcd03 100644 --- a/ldns/host2str.h +++ b/ldns/host2str.h @@ -528,6 +528,26 @@ ldns_status ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf); ldns_status ldns_rdf2buffer_str_ilnp64(ldns_buffer *output, const ldns_rdf *rdf); +/** + * Converts an LDNS_RDF_TYPE_EUI48 rdata element to 6 hexadecimal numbers + * seperated by dashes and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_eui48(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_EUI64 rdata element to 8 hexadecimal numbers + * seperated by dashes and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_eui64(ldns_buffer *output, + const ldns_rdf *rdf); + /** * Converts the data in the rdata field to presentation format and * returns that as a char *. diff --git a/ldns/rdata.h b/ldns/rdata.h index 7a91af47..70ce5679 100644 --- a/ldns/rdata.h +++ b/ldns/rdata.h @@ -107,7 +107,11 @@ enum ldns_enum_rdf_type /** nsec3 base32 string (with length byte on wire */ LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, /** 4 shorts represented as 4 * 16 bit hex numbers seperated by colons */ - LDNS_RDF_TYPE_ILNP64 + LDNS_RDF_TYPE_ILNP64, + /** EUI48; 6 * 8 bit hex numbers seperated by dashes */ + LDNS_RDF_TYPE_EUI48, + /** EUI64; 8 * 8 bit hex numbers seperated by dashes */ + LDNS_RDF_TYPE_EUI64 }; typedef enum ldns_enum_rdf_type ldns_rdf_type; diff --git a/ldns/rr.h b/ldns/rr.h index db9fd07c..00de3591 100644 --- a/ldns/rr.h +++ b/ldns/rr.h @@ -203,6 +203,10 @@ enum ldns_enum_rr_type LDNS_RR_TYPE_L64 = 106, /* RFC 6742 */ LDNS_RR_TYPE_LP = 107, /* RFC 6742 */ + /** draft-jabley-dnsext-eui48-eui64-rrtypes */ + LDNS_RR_TYPE_EUI48 = 108, + LDNS_RR_TYPE_EUI64 = 109, + LDNS_RR_TYPE_TSIG = 250, LDNS_RR_TYPE_IXFR = 251, LDNS_RR_TYPE_AXFR = 252, diff --git a/ldns/str2host.h b/ldns/str2host.h index 5ec2ccc9..cff43538 100644 --- a/ldns/str2host.h +++ b/ldns/str2host.h @@ -252,6 +252,22 @@ ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); */ ldns_status ldns_str2rdf_ilnp64(ldns_rdf **rd, const char *str); +/** + * convert 6 hex bytes seperated by dashes into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_eui48(ldns_rdf **rd, const char *str); + +/** + * convert 8 hex bytes seperated by dashes into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_eui64(ldns_rdf **rd, const char *str); + #ifdef __cplusplus } #endif diff --git a/rdata.c b/rdata.c index 4c6e125e..08342e98 100644 --- a/rdata.c +++ b/rdata.c @@ -339,6 +339,12 @@ ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) case LDNS_RDF_TYPE_ILNP64: status = ldns_str2rdf_ilnp64(&rdf, str); break; + case LDNS_RDF_TYPE_EUI48: + status = ldns_str2rdf_eui48(&rdf, str); + break; + case LDNS_RDF_TYPE_EUI64: + status = ldns_str2rdf_eui64(&rdf, str); + break; case LDNS_RDF_TYPE_NONE: default: /* default default ??? */ diff --git a/rr.c b/rr.c index 3069bcbe..f97f89d2 100644 --- a/rr.c +++ b/rr.c @@ -1956,6 +1956,12 @@ static const ldns_rdf_type type_lp_wireformat[] = { LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_eui48_wireformat[] = { + LDNS_RDF_TYPE_EUI48 +}; +static const ldns_rdf_type type_eui64_wireformat[] = { + LDNS_RDF_TYPE_EUI64 +}; /** \endcond */ /** \cond */ @@ -2135,8 +2141,10 @@ static ldns_rr_descriptor rdata_field_descriptors[] = { {LDNS_RR_TYPE_L64, "L64", 2, 2, type_l64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, /* 107 */ {LDNS_RR_TYPE_LP, "LP", 2, 2, type_lp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, -{LDNS_RR_TYPE_NULL, "TYPE108", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE109", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 108 */ +{LDNS_RR_TYPE_EUI48, "EUI48", 1, 1, type_eui48_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 109 */ +{LDNS_RR_TYPE_EUI64, "EUI64", 1, 1, type_eui64_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, {LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, diff --git a/str2host.c b/str2host.c index a60030e3..07154db7 100644 --- a/str2host.c +++ b/str2host.c @@ -1340,3 +1340,55 @@ ldns_str2rdf_ilnp64(ldns_rdf **rd, const char *str) } return *rd ? LDNS_STATUS_OK : LDNS_STATUS_MEM_ERR; } + +ldns_status +ldns_str2rdf_eui48(ldns_rdf **rd, const char *str) +{ + unsigned int a, b, c, d, e, f; + uint8_t bytes[6]; + int l; + + if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x%n", + &a, &b, &c, &d, &e, &f, &l) != 6 || + l != (int)strlen(str) || /* more data to read */ + strpbrk(str, "+-") /* signed hexes */ + ) { + return LDNS_STATUS_INVALID_EUI48; + } else { + bytes[0] = a; + bytes[1] = b; + bytes[2] = c; + bytes[3] = d; + bytes[4] = e; + bytes[5] = f; + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_EUI48, 6, &bytes); + } + return *rd ? LDNS_STATUS_OK : LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_eui64(ldns_rdf **rd, const char *str) +{ + unsigned int a, b, c, d, e, f, g, h; + uint8_t bytes[8]; + int l; + + if (sscanf(str, "%2x-%2x-%2x-%2x-%2x-%2x-%2x-%2x%n", + &a, &b, &c, &d, &e, &f, &g, &h, &l) != 8 || + l != (int)strlen(str) || /* more data to read */ + strpbrk(str, "+-") /* signed hexes */ + ) { + return LDNS_STATUS_INVALID_EUI64; + } else { + bytes[0] = a; + bytes[1] = b; + bytes[2] = c; + bytes[3] = d; + bytes[4] = e; + bytes[5] = f; + bytes[6] = g; + bytes[7] = h; + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_EUI64, 8, &bytes); + } + return *rd ? LDNS_STATUS_OK : LDNS_STATUS_MEM_ERR; +} diff --git a/wire2host.c b/wire2host.c index dc9544d4..ac532c88 100644 --- a/wire2host.c +++ b/wire2host.c @@ -210,9 +210,11 @@ ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) cur_rdf_length = LDNS_RDF_SIZE_DOUBLEWORD; break; case LDNS_RDF_TYPE_TSIGTIME: + case LDNS_RDF_TYPE_EUI48: cur_rdf_length = LDNS_RDF_SIZE_6BYTES; break; case LDNS_RDF_TYPE_ILNP64: + case LDNS_RDF_TYPE_EUI64: cur_rdf_length = LDNS_RDF_SIZE_8BYTES; break; case LDNS_RDF_TYPE_AAAA: