From: Kees Monshouwer Date: Mon, 16 Jan 2017 09:19:47 +0000 (+0100) Subject: auth: bind-backend, improve the domain_id check in lookup() X-Git-Tag: dnsdist-1.4.0-rc3~12^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75c4c101b35d9c3a3e7839ed05d2e23c5a26871a;p=pdns auth: bind-backend, improve the domain_id check in lookup() zone_id was not checked for a root zone and finding the right zone for a specific zone_id was super slow With this commit, the uncached output of bind backen will increase by approximately 10% --- diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index 221508e01..bfd52c1df 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -1056,17 +1056,26 @@ bool Bind2Backend::getBeforeAndAfterNamesAbsolute(uint32_t id, const DNSName& qn void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, int zoneId, DNSPacket *pkt_p ) { d_handle.reset(); - DNSName domain(qname); static bool mustlog=::arg().mustDo("query-logging"); - if(mustlog) - g_log<= 0) { + if ((found = safeGetBBDomainInfo(zoneId, &bbd))) { + domain = bbd.d_name; + } + } else { + domain = qname; + do { + found = safeGetBBDomainInfo(domain, &bbd); + } while (!found && qtype != QType::SOA && domain.chopOff()); + } if(!found) { if(mustlog) @@ -1077,12 +1086,9 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, int zoneId, if(mustlog) g_log<