From: Pieter Lexis Date: Fri, 19 Sep 2025 09:16:42 +0000 (+0200) Subject: feat: Add DRIP records (HHIT and BRID) X-Git-Tag: rec-5.4.0-alpha1~248^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e127f337840ed49cb0a2c1fc381dcf26cf16fa24;p=thirdparty%2Fpdns.git feat: Add DRIP records (HHIT and BRID) These are defined in draft-ietf-drip-registries-33. --- diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index ca15552ac6..31cd51eed6 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -371,6 +371,14 @@ boilerplate_conv(HTTPS, } ) +boilerplate_conv(HHIT, + conv.xfrBlob(d_data); + ) + +boilerplate_conv(BRID, + conv.xfrBlob(d_data); + ) + boilerplate_conv(SMIMEA, conv.xfr8BitInt(d_certusage); conv.xfr8BitInt(d_selector); @@ -833,6 +841,16 @@ std::shared_ptr HTTPSRecordContent::clone() const /* SVCB end */ +std::shared_ptr HHITRecordContent::clone() const +{ + return {std::make_shared(*this)}; +} + +std::shared_ptr BRIDRecordContent::clone() const +{ + return {std::make_shared(*this)}; +} + boilerplate_conv(TKEY, conv.xfrName(d_algo); conv.xfr32BitInt(d_inception); @@ -963,6 +981,8 @@ static void reportOtherTypes(const ReportIsOnlyCallableByReportAllTypes& guard) OPENPGPKEYRecordContent::report(guard); SVCBRecordContent::report(guard); HTTPSRecordContent::report(guard); + HHITRecordContent::report(guard); + BRIDRecordContent::report(guard); DLVRecordContent::report(guard); DNSRecordContent::regist(QClass::ANY, QType::TSIG, &TSIGRecordContent::make, &TSIGRecordContent::make, "TSIG"); DNSRecordContent::regist(QClass::ANY, QType::TKEY, &TKEYRecordContent::make, &TKEYRecordContent::make, "TKEY"); diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index ccfbd13a36..2677cd6b1d 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -716,6 +716,30 @@ public: std::shared_ptr clone() const override; }; +class DRIPBaseRecordContent : public DNSKEYRecordContent +{ +public: + [[nodiscard]] size_t sizeEstimate() const override + { + return sizeof(*this) + d_data.size(); + } + virtual std::shared_ptr clone() const = 0; +protected: + string d_data; +}; + +class HHITRecordContent : public DRIPBaseRecordContent { +public: + includeboilerplate(HHIT); + std::shared_ptr clone() const override; +}; + +class BRIDRecordContent : public DRIPBaseRecordContent { +public: + includeboilerplate(BRID); + std::shared_ptr clone() const override; +}; + class RRSIGRecordContent : public DNSRecordContent { public: diff --git a/pdns/qtype.cc b/pdns/qtype.cc index b72749c835..c5eb47c855 100644 --- a/pdns/qtype.cc +++ b/pdns/qtype.cc @@ -76,6 +76,8 @@ const map QType::names = { {"ZONEMD", 63}, {"SVCB", 64}, {"HTTPS", 65}, + {"HHIT", 67}, + {"BRID", 68}, {"SPF", 99}, {"NID", 104}, {"L32", 105}, diff --git a/pdns/qtype.hh b/pdns/qtype.hh index d03b3963e9..fa9bde78f8 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -120,6 +120,8 @@ public: ZONEMD = 63, SVCB = 64, HTTPS = 65, + HHIT = 67, + BRID = 68, SPF = 99, NID = 104, L32 = 105, diff --git a/pdns/test-dnsrecords_cc.cc b/pdns/test-dnsrecords_cc.cc index 321d9a6e85..d787e86331 100644 --- a/pdns/test-dnsrecords_cc.cc +++ b/pdns/test-dnsrecords_cc.cc @@ -259,6 +259,11 @@ BOOST_AUTO_TEST_CASE(test_record_types) { (CASE_L(QType::SVCB, R"XXX(16 foo.example.org. alpn=f\\\092oo\092,bar,h2)XXX", R"XXX(16 foo.example.org. alpn=f\\\\oo\\,bar,h2)XXX", "\x00\x10\3foo\7example\3org\x00\x00\x01\x00\x0c\x08\x66\\oo,bar\x02h2")) // END SVCB draft test vectors + (CASE_S(QType::HHIT, "1234abcd", "\xd7\x6d\xf8\x69\xb7\x1d")) + (CASE_L(QType::HHIT, "1234 abcd", "1234abcd", "\xd7\x6d\xf8\x69\xb7\x1d")) + (CASE_S(QType::BRID, "1234abcd", "\xd7\x6d\xf8\x69\xb7\x1d")) + (CASE_L(QType::BRID, "1234 abcd", "1234abcd", "\xd7\x6d\xf8\x69\xb7\x1d")) + (CASE_S(QType::SPF, "\"v=spf1 a:mail.rec.test ~all\"", "\x1bv=spf1 a:mail.rec.test ~all")) (CASE_S(QType::NID, "15 0123:4567:89AB:CDEF", "\x00\x0F\x01\x23\x45\x67\x89\xab\xcd\xef"))