From: Kees Monshouwer Date: Tue, 22 Sep 2015 15:17:48 +0000 (+0200) Subject: use d_negcache_ttl for negative caching X-Git-Tag: auth-3.4.7~8^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b998fc067aea7094633fb5e430f6a56502984b58;p=pdns use d_negcache_ttl for negative caching --- diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 0a3d4f2ca..a2aa6657b 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -283,7 +283,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int // 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)) { string subdomain(target); int cstat, loops = 0; do { @@ -293,7 +293,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int 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; @@ -310,7 +310,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int if ( p->qtype != QType::DS || best_match_len < (int)target.length()) break; - } else if (cstat==0) { + } else if (cstat==0 && d_negcache_ttl) { negCacheMap[subdomain]=1; } else negCacheMap[subdomain]=0; @@ -332,7 +332,7 @@ bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int } } - if( sd->db != (DNSBackend *)-1 && d_cache_ttl) { + if( sd->db != (DNSBackend *)-1 && d_negcache_ttl) { string shorter(target); d_question.qtype=QType::SOA;