From: Bert Hubert Date: Fri, 6 Aug 2010 20:10:04 +0000 (+0000) Subject: Solve ticket 281, where we cache nxdomains longer than configured because of the... X-Git-Tag: rec-3.3~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=596aa4a166861cbc58e1aae761221ecab002e9d2;p=pdns Solve ticket 281, where we cache nxdomains longer than configured because of the packet cache. Also solved anomaly where SOA was initially the original length, and would decrease to the limited ttl on the second query git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1679 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 71878efe5..f1a667125 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -1005,16 +1005,19 @@ int SyncRes::doResolveAt(set nameservers, string auth, bool done=false, realreferral=false, negindic=false; string newauth, soaname, newtarget; - for(LWResult::res_t::const_iterator i=lwr.d_result.begin();i!=lwr.d_result.end();++i) { + for(LWResult::res_t::iterator i=lwr.d_result.begin();i!=lwr.d_result.end();++i) { if(i->d_place==DNSResourceRecord::AUTHORITY && dottedEndsOn(qname,i->qname) && i->qtype.getCode()==QType::SOA && lwr.d_rcode==RCode::NXDomain) { LOG<ttl = min(i->ttl, s_maxnegttl); + ret.push_back(*i); NegCacheEntry ne; ne.d_qname=i->qname; - ne.d_ttd=d_now.tv_sec + min(i->ttl, s_maxnegttl); // controversial + + ne.d_ttd=d_now.tv_sec + i->ttl; + ne.d_name=qname; ne.d_qtype=QType(0); // this encodes 'whole record' @@ -1057,10 +1060,11 @@ int SyncRes::doResolveAt(set nameservers, string auth, LOG< ttl = min(s_maxnegttl, i->ttl); ret.push_back(*i); NegCacheEntry ne; ne.d_qname=i->qname; - ne.d_ttd=d_now.tv_sec + min(s_maxnegttl, i->ttl); + ne.d_ttd=d_now.tv_sec + i->ttl; ne.d_name=qname; ne.d_qtype=qtype; if(qtype.getCode()) { // prevents us from blacking out a whole domain