From 16d97b607c8d15220544273bd46328dac6e7b6c9 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Tue, 2 May 2017 15:54:12 +0200 Subject: [PATCH] Add missing RR types SMIMEA and AVC + fix rdata of TA RR type --- configure.ac | 1 + src/const-info.c | 2 ++ src/getdns/getdns.h.in | 2 ++ src/gldns/rrdef.c | 12 +++++++++++- src/gldns/rrdef.h | 3 ++- src/rr-dict.c | 15 ++++++++------- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 1aa801f2..f819c3f8 100644 --- a/configure.ac +++ b/configure.ac @@ -1144,6 +1144,7 @@ esac AC_SUBST(C99COMPATFLAGS) AC_DEFINE_UNQUOTED([MAX_CNAME_REFERRALS], [100], [The maximum number of cname referrals.]) +AC_DEFINE_UNQUOTED([DRAFT_RRTYPES], [1], [Define this to enable all rrtypes in gldns.]) AH_BOTTOM([ diff --git a/src/const-info.c b/src/const-info.c index 6f87eb62..563574d1 100644 --- a/src/const-info.c +++ b/src/const-info.c @@ -244,6 +244,7 @@ static struct const_name_info consts_name_info[] = { { "GETDNS_RRTYPE_ANY", 255 }, { "GETDNS_RRTYPE_APL", 42 }, { "GETDNS_RRTYPE_ATMA", 34 }, + { "GETDNS_RRTYPE_AVC", 258 }, { "GETDNS_RRTYPE_AXFR", 252 }, { "GETDNS_RRTYPE_CAA", 257 }, { "GETDNS_RRTYPE_CDNSKEY", 60 }, @@ -297,6 +298,7 @@ static struct const_name_info consts_name_info[] = { { "GETDNS_RRTYPE_RT", 21 }, { "GETDNS_RRTYPE_SIG", 24 }, { "GETDNS_RRTYPE_SINK", 40 }, + { "GETDNS_RRTYPE_SMIMEA", 53 }, { "GETDNS_RRTYPE_SOA", 6 }, { "GETDNS_RRTYPE_SPF", 99 }, { "GETDNS_RRTYPE_SRV", 33 }, diff --git a/src/getdns/getdns.h.in b/src/getdns/getdns.h.in index f22e91da..b483c7ea 100644 --- a/src/getdns/getdns.h.in +++ b/src/getdns/getdns.h.in @@ -407,6 +407,7 @@ typedef enum getdns_callback_type_t { #define GETDNS_RRTYPE_NSEC3 50 #define GETDNS_RRTYPE_NSEC3PARAM 51 #define GETDNS_RRTYPE_TLSA 52 +#define GETDNS_RRTYPE_SMIMEA 53 #define GETDNS_RRTYPE_HIP 55 #define GETDNS_RRTYPE_NINFO 56 #define GETDNS_RRTYPE_RKEY 57 @@ -435,6 +436,7 @@ typedef enum getdns_callback_type_t { #define GETDNS_RRTYPE_ANY 255 #define GETDNS_RRTYPE_URI 256 #define GETDNS_RRTYPE_CAA 257 +#define GETDNS_RRTYPE_AVC 258 #define GETDNS_RRTYPE_TA 32768 #define GETDNS_RRTYPE_DLV 32769 /** @} diff --git a/src/gldns/rrdef.c b/src/gldns/rrdef.c index 6e6995a7..7750322a 100644 --- a/src/gldns/rrdef.c +++ b/src/gldns/rrdef.c @@ -341,8 +341,12 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { {GLDNS_RR_TYPE_NSEC3PARAM, "NSEC3PARAM", 4, 4, type_nsec3param_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 52 */ {GLDNS_RR_TYPE_TLSA, "TLSA", 4, 4, type_tlsa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, - + /*53 */ +#ifdef DRAFT_RRTYPES + {GLDNS_RR_TYPE_SMIMEA, "SMIMEA", 4, 4, type_tlsa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +#else {GLDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +#endif {GLDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 55 * Hip ends with 0 or more Rendezvous Servers represented as dname's. @@ -600,6 +604,12 @@ static gldns_rr_descriptor rdata_field_descriptors[] = { {GLDNS_RR_TYPE_URI, "URI", 3, 3, type_uri_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, /* 257 */ {GLDNS_RR_TYPE_CAA, "CAA", 3, 3, type_caa_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +#ifdef DRAFT_RRTYPES + /* 258 */ + {GLDNS_RR_TYPE_AVC, "AVC", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +#else +{GLDNS_RR_TYPE_NULL, "TYPE258", 1, 1, type_0_wireformat, GLDNS_RDF_TYPE_NONE, GLDNS_RR_NO_COMPRESS, 0 }, +#endif /* split in array, no longer contiguous */ diff --git a/src/gldns/rrdef.h b/src/gldns/rrdef.h index 58132c23..2bdd336e 100644 --- a/src/gldns/rrdef.h +++ b/src/gldns/rrdef.h @@ -38,7 +38,7 @@ extern "C" { #define GLDNS_KEY_REVOKE_KEY 0x0080 /* used to revoke KSK, rfc 5011 */ /* The first fields are contiguous and can be referenced instantly */ -#define GLDNS_RDATA_FIELD_DESCRIPTORS_COMMON 258 +#define GLDNS_RDATA_FIELD_DESCRIPTORS_COMMON 259 /** lookuptable for rr classes */ extern struct gldns_struct_lookup_table* gldns_rr_classes; @@ -226,6 +226,7 @@ enum gldns_enum_rr_type GLDNS_RR_TYPE_ANY = 255, GLDNS_RR_TYPE_URI = 256, /* RFC 7553 */ GLDNS_RR_TYPE_CAA = 257, /* RFC 6844 */ + GLDNS_RR_TYPE_AVC = 258, /** DNSSEC Trust Authorities */ GLDNS_RR_TYPE_TA = 32768, diff --git a/src/rr-dict.c b/src/rr-dict.c index 76900718..76ed85af 100644 --- a/src/rr-dict.c +++ b/src/rr-dict.c @@ -714,8 +714,8 @@ static _getdns_rr_def _getdns_rr_defs[] = { { "DHCID", dhcid_rdata, ALEN( dhcid_rdata) }, { "NSEC3", nsec3_rdata, ALEN( nsec3_rdata) }, { "NSEC3PARAM", nsec3param_rdata, ALEN(nsec3param_rdata) }, - { "TLSA", tlsa_rdata, ALEN( tlsa_rdata) }, /* - 52 */ - { NULL, NULL, 0 }, + { "TLSA", tlsa_rdata, ALEN( tlsa_rdata) }, + { "SMIMEA", tlsa_rdata, ALEN( tlsa_rdata) }, /* - 53 */ { NULL, NULL, 0 }, { "HIP", hip_rdata, ALEN( hip_rdata) }, /* 55 - */ { "NINFO", UNKNOWN_RDATA, 0 }, @@ -919,20 +919,21 @@ static _getdns_rr_def _getdns_rr_defs[] = { { "MAILA", UNKNOWN_RDATA, 0 }, /* - 254 */ { NULL, NULL, 0 }, { "URI", uri_rdata, ALEN( uri_rdata) }, /* 256 - */ - { "CAA", caa_rdata, ALEN( caa_rdata) }, /* - 257 */ - { "TA", UNKNOWN_RDATA, 0 }, /* 32768 */ + { "CAA", caa_rdata, ALEN( caa_rdata) }, + { "AVC", txt_rdata, ALEN( txt_rdata) }, /* - 258 */ + { "TA", ds_rdata, ALEN( ds_rdata) }, /* 32768 */ { "DLV", dlv_rdata, ALEN( dlv_rdata) } /* 32769 */ }; const _getdns_rr_def * _getdns_rr_def_lookup(uint16_t rr_type) { - if (rr_type <= 257) + if (rr_type <= 258) return &_getdns_rr_defs[rr_type]; else if (rr_type == 32768) - return &_getdns_rr_defs[258]; - else if (rr_type == 32769) return &_getdns_rr_defs[259]; + else if (rr_type == 32769) + return &_getdns_rr_defs[260]; return _getdns_rr_defs; }