]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Update Changelog and implement EUI48 and EUI64
authorWillem Toorop <willem@NLnetLabs.nl>
Thu, 25 Apr 2013 08:54:23 +0000 (08:54 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Thu, 25 Apr 2013 08:54:23 +0000 (08:54 +0000)
svn:NO REGRESSION

12 files changed:
Changelog
error.c
host2str.c
ldns/error.h
ldns/host2str.h
ldns/rdata.h
ldns/rr.h
ldns/str2host.h
rdata.c
rr.c
str2host.c
wire2host.c

index 89e7497ea1e9cf0c013dc383d3be637cbc7e03b2..e56ca144cc60ea083854a326f86e0b65ad566d82 100644 (file)
--- 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 e7a36c7e96a34ddf1c99051ed8d5fe615f718d77..ca78e77bf1210cb8d5176e117e903571a2d0aaa2 100644 (file)
--- 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 }
 };
 
index 0c85d331b560dafe2e61194a049f0dc7f2bfab47..605fba9303c6bc39761b054a1922a529271163b0 100644 (file)
@@ -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 */
index ee31e3cd3da93824f13c52b0fe9808694a991d1b..67b3d3143a097077bbc0a953ae5b59cc335d42a2 100644 (file)
@@ -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;
 
index 4b69ca628fbc16c61407b4137f8da088baa916d6..6b5fcd035b0b658c82be6ed54df957245396f533 100644 (file)
@@ -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 *.
index 7a91af4730dabeb441677c3777b2263046828d57..70ce5679aa3367fad95b69d9170bdf7dd4abce21 100644 (file)
@@ -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;
 
index db9fd07cf71d80bfd363b3a66b6d04ca4b3a5008..00de359144c2cd9d09c96911f51502fb366d13d3 100644 (file)
--- 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,
index 5ec2ccc975a0381fbb5c5b33c72cce0b046411da..cff435384deb529f996069b463b173b48b772478 100644 (file)
@@ -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 4c6e125eb095ba096e98ea4a199c7072df7e6e49..08342e9892c7742c8ef77c7eaf5dd70e86b7b7d6 100644 (file)
--- 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 3069bcbee01509a69c004ec7e4195da77746c06b..f97f89d21c1a72214e271583535afb26e1f9a233 100644 (file)
--- 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 },
index a60030e3e34369fab01163323416512ec16731e3..07154db7fb651cf2f9ca67354715856ab44e182b 100644 (file)
@@ -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;
+}
index dc9544d407fe89c7338ca9aef628da3b0c5201c8..ac532c88ad9d30d3d084e83447b45094ed56cc97 100644 (file)
@@ -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: