From: Kees Monshouwer Date: Tue, 22 Sep 2015 15:17:48 +0000 (+0200) Subject: use d_negcache_ttl for negative caching X-Git-Tag: dnsdist-1.0.0-alpha1~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc1b7aab07456cc29e6888205a03f2d4401e77da;p=thirdparty%2Fpdns.git use d_negcache_ttl for negative caching --- diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index d91c7c8162..4358e79381 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -256,7 +256,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const DNSName &target) // If not special case of caching explicitly disabled (sd->db = -1), first // find the best match from the cache. If DS then we need to find parent so // dont bother with caching as it confuses matters. - if( sd->db != (DNSBackend *)-1 && d_cache_ttl ) { + if( sd->db != (DNSBackend *)-1 && (d_cache_ttl || d_negcache_ttl)) { DNSName subdomain(target); int cstat, loops = 0; do { @@ -266,7 +266,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const DNSName &target) cstat = cacheHas(d_question,d_answers); - if(cstat==1 && !d_answers.empty()) { + if(cstat==1 && !d_answers.empty() && d_cache_ttl) { fillSOAData(d_answers[0].content,*sd); sd->domain_id = d_answers[0].domain_id; sd->ttl = d_answers[0].ttl; @@ -283,7 +283,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const DNSName &target) if ( p->qtype != QType::DS || best_match_len < (int)target.countLabels()) break; - } else if (cstat==0) { + } else if (cstat==0 && d_negcache_ttl) { negCacheMap[subdomain]=1; } else negCacheMap[subdomain]=0;