From: Pieter Lexis Date: Tue, 21 Jul 2015 11:22:41 +0000 (+0200) Subject: Add CDS and CDNSKEY QTypes (RFC 7344) X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~27^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=882de365922b673b8964ec863c1f7d61415572a0;p=pdns Add CDS and CDNSKEY QTypes (RFC 7344) --- diff --git a/docs/markdown/types.md b/docs/markdown/types.md index cad49343c..debe5d559 100644 --- a/docs/markdown/types.md +++ b/docs/markdown/types.md @@ -17,6 +17,12 @@ Since 2.9.21. Specialised record type for the 'Andrew Filesystem'. Stored as: '\ ## CERT Since 2.9.21. Specialised record type for storing certificates, defined in [RFC 2538](http://tools.ietf.org/html/rfc2538). +## CDNSKEY +Since 4.0.0. The CDNSKEY ([Child DNSKEY](https://tools.ietf.org/html/rfc7344#section-3.2)) type is supported. + +## CDS +Since 4.0.0. The CDS ([Child DS](https://tools.ietf.org/html/rfc7344#section-3.1)) type is supported. + ## CNAME The CNAME record specifies the canonical name of a record. It is stored plainly. Like all other records, it is not terminated by a dot. A sample might be 'webserver-01.yourcompany.com'. diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 14a7d67fe..cf5128e20 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -279,6 +279,14 @@ boilerplate_conv(DS, 43, conv.xfrHexBlob(d_digest, true); // keep reading across spaces ) +CDSRecordContent::CDSRecordContent() : DNSRecordContent(59) {} +boilerplate_conv(CDS, 59, + conv.xfr16BitInt(d_tag); + conv.xfr8BitInt(d_algorithm); + conv.xfr8BitInt(d_digesttype); + conv.xfrHexBlob(d_digest, true); // keep reading across spaces + ) + DLVRecordContent::DLVRecordContent() : DNSRecordContent(32769) {} boilerplate_conv(DLV,32769 , conv.xfr16BitInt(d_tag); @@ -316,6 +324,14 @@ boilerplate_conv(DNSKEY, 48, ) DNSKEYRecordContent::DNSKEYRecordContent() : DNSRecordContent(48) {} +boilerplate_conv(CDNSKEY, 60, + conv.xfr16BitInt(d_flags); + conv.xfr8BitInt(d_protocol); + conv.xfr8BitInt(d_algorithm); + conv.xfrBlob(d_key); + ) +CDNSKEYRecordContent::CDNSKEYRecordContent() : DNSRecordContent(60) {} + boilerplate_conv(RKEY, 57, conv.xfr16BitInt(d_flags); conv.xfr8BitInt(d_protocol); @@ -494,9 +510,11 @@ void reportOtherTypes() RPRecordContent::report(); KEYRecordContent::report(); DNSKEYRecordContent::report(); + CDNSKEYRecordContent::report(); RKEYRecordContent::report(); RRSIGRecordContent::report(); DSRecordContent::report(); + CDSRecordContent::report(); SSHFPRecordContent::report(); CERTRecordContent::report(); NSECRecordContent::report(); diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 50e150817..86a50f283 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -284,6 +284,19 @@ public: string d_key; }; +class CDNSKEYRecordContent : public DNSRecordContent +{ +public: + CDNSKEYRecordContent(); + includeboilerplate(CDNSKEY) + uint16_t getTag(); + + uint16_t d_flags; + uint8_t d_protocol; + uint8_t d_algorithm; + string d_key; +}; + class DSRecordContent : public DNSRecordContent { public: @@ -295,6 +308,17 @@ public: string d_digest; }; +class CDSRecordContent : public DNSRecordContent +{ +public: + CDSRecordContent(); + includeboilerplate(CDS) + + uint16_t d_tag; + uint8_t d_algorithm, d_digesttype; + string d_digest; +}; + class DLVRecordContent : public DNSRecordContent { public: diff --git a/pdns/qtype.hh b/pdns/qtype.hh index 7a170d24e..699a2d4b5 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -81,7 +81,8 @@ public: #undef DS enum typeenum : uint16_t {A=1, NS=2, CNAME=5, SOA=6, MR=9, WKS=11, PTR=12, HINFO=13, MINFO=14, MX=15, TXT=16, RP=17, AFSDB=18, SIG=24, KEY=25, AAAA=28, LOC=29, SRV=33, NAPTR=35, KX=36, CERT=37, A6=38, DNAME=39, OPT=41, DS=43, SSHFP=44, IPSECKEY=45, RRSIG=46, NSEC=47, DNSKEY=48, DHCID=49, NSEC3=50, NSEC3PARAM=51, - TLSA=52, SPF=99, EUI48=108, EUI64=109, TKEY=249, TSIG=250, IXFR=251, AXFR=252, MAILB=253, MAILA=254, ANY=255, ADDR=259, ALIAS=260, DLV=32769}; + TLSA=52, CDS=59, CDNSKEY=60, SPF=99, EUI48=108, EUI64=109, TKEY=249, TSIG=250, IXFR=251, AXFR=252, MAILB=253, MAILA=254, ANY=255, ADDR=259, + ALIAS=260, DLV=32769}; typedef pair namenum; static vector names; @@ -152,6 +153,8 @@ private: qtype_insert("NSEC3", 50); qtype_insert("NSEC3PARAM", 51); qtype_insert("TLSA", 52); + qtype_insert("CDS", 59); + qtype_insert("CDNSKEY", 60); qtype_insert("SPF", 99); qtype_insert("EUI48", 108); qtype_insert("EUI64", 109);