From: Remi Gacogne Date: Thu, 30 Jan 2020 14:12:57 +0000 (+0100) Subject: auth: Skip the construction of a root DNSName when possible X-Git-Tag: auth-4.3.0~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e51884c78ad9af7414c4294ae34af2ebcbb4472;p=thirdparty%2Fpdns.git auth: Skip the construction of a root DNSName when possible (cherry picked from commit 020b94c9e00434a509b8f46af070afb2f2afa4b5) --- diff --git a/pdns/ixfrutils.cc b/pdns/ixfrutils.cc index cf38c1c1f2..feec7c3392 100644 --- a/pdns/ixfrutils.cc +++ b/pdns/ixfrutils.cc @@ -92,10 +92,9 @@ uint32_t getSerialFromDir(const std::string& dir) uint32_t getSerialFromRecords(const records_t& records, DNSRecord& soaret) { - DNSName root("."); uint16_t t=QType::SOA; - auto found = records.equal_range(tie(root, t)); + auto found = records.equal_range(tie(g_rootdnsname, t)); for(auto iter = found.first; iter != found.second; ++iter) { auto soa = std::dynamic_pointer_cast(iter->d_content); diff --git a/pdns/sdig.cc b/pdns/sdig.cc index 55d516253f..7e31abe4d2 100644 --- a/pdns/sdig.cc +++ b/pdns/sdig.cc @@ -84,7 +84,7 @@ void fillPacket(vector& packet, const string& q, const string& t, if (xpfcode) { ComboAddress src(xpfsrc), dst(xpfdst); - pw.startRecord(DNSName("."), xpfcode, 0, QClass::IN, DNSResourceRecord::ADDITIONAL); + pw.startRecord(g_rootdnsname, xpfcode, 0, QClass::IN, DNSResourceRecord::ADDITIONAL); // xpf->toPacket(pw); pw.xfr8BitInt(xpfversion); pw.xfr8BitInt(xpfproto); diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index bd4aa71b17..4b16a46565 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -30,7 +30,7 @@ class ZoneParserTNG { public: - ZoneParserTNG(const string& fname, const DNSName& zname=DNSName("."), const string& reldir=""); + ZoneParserTNG(const string& fname, const DNSName& zname=g_rootdnsname, const string& reldir=""); ZoneParserTNG(const vector zonedata, const DNSName& zname); ~ZoneParserTNG();