From: Remi Gacogne Date: Wed, 26 Oct 2016 13:42:27 +0000 (+0200) Subject: auth: In `Bind2Backend::lookup()`, use the `zoneId` when we have it X-Git-Tag: dnsdist-1.1.0-beta2~9^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=937a66255ff05f2e754ef113833e54cc4cf2004b;p=thirdparty%2Fpdns.git auth: In `Bind2Backend::lookup()`, use the `zoneId` when we have it After the initial lookup corresponding to a `DNSBackend::getAuth()`, the subsequent ones already have the `zoneId`, so use it instead of looping on `chopOff()` again. This should be much more efficient. --- diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index 53c0db16fc..4eb5bda856 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -1033,9 +1033,17 @@ void Bind2Backend::lookup(const QType &qtype, const DNSName &qname, DNSPacket *p bool found=false; BB2DomainInfo bbd; - do { - found = safeGetBBDomainInfo(domain, &bbd); - } while ((!found || (zoneId != (int)bbd.d_id && zoneId != -1)) && domain.chopOff()); + if (zoneId != -1) { + found = safeGetBBDomainInfo(zoneId, &bbd); + if (found) { + domain = bbd.d_name; + } + } + else { + do { + found = safeGetBBDomainInfo(domain, &bbd); + } while (!found && domain.chopOff()); + } if(!found) { if(mustlog)