From: Bert Hubert Date: Wed, 11 Oct 2006 11:24:35 +0000 (+0000) Subject: narrow down NSSET invalidation to "flawed sets", remove some needless LOG processing X-Git-Tag: rec-3.1.4~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7305df82d881792cc8e58302ab026ae884ac98bc;p=pdns narrow down NSSET invalidation to "flawed sets", remove some needless LOG processing git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@901 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/config-recursor.h b/pdns/config-recursor.h index 8776b9f5d..aa1ff1166 100644 --- a/pdns/config-recursor.h +++ b/pdns/config-recursor.h @@ -1,6 +1,6 @@ #define SYSCONFDIR "/etc/powerdns/" #define LOCALSTATEDIR "/var/run/" -#define VERSION "3.1.3" +#define VERSION "3.1.4-snapshot" #define RECURSOR #ifndef WIN32 #define GCC_SKIP_LOCKING diff --git a/pdns/dist-recursor b/pdns/dist-recursor index 2586d9788..e3ce0696c 100755 --- a/pdns/dist-recursor +++ b/pdns/dist-recursor @@ -1,4 +1,4 @@ -VERSION=3.1.3 +VERSION=3.1.4-snapshot INCLUDES="iputils.hh arguments.hh base64.hh zoneparser-tng.hh \ rcpgenerator.hh lock.hh dnswriter.hh dnsrecords.hh dnsparser.hh utility.hh \ diff --git a/pdns/recursor_cache.cc b/pdns/recursor_cache.cc index e21d7f4e3..372351042 100644 --- a/pdns/recursor_cache.cc +++ b/pdns/recursor_cache.cc @@ -229,7 +229,7 @@ void MemRecursorCache::replace(time_t now, const string &qname, const QType& qt, if(!auth && ce.d_auth) { // unauth data came in, we have some auth data, but is it fresh? vector::iterator j; for(j = ce.d_records.begin() ; j != ce.d_records.end(); ++j) - if((time_t)j->d_ttd > now) + if((time_t)j->d_ttd > now) break; if(j != ce.d_records.end()) { // we still have valid data, ignore unauth data return; diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 6e5eb543c..79d749feb 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -238,8 +238,9 @@ int SyncRes::doResolve(const string &qname, const QType &qtype, vector nsset; + bool flawedNSSet=false; for(int tries=0;tries<2 && nsset.empty();++tries) { - subdomain=getBestNSNamesFromCache(subdomain,nsset,depth, beenthere); // pass beenthere to both occasions + subdomain=getBestNSNamesFromCache(subdomain, nsset, &flawedNSSet, depth, beenthere); // pass beenthere to both occasions if(nsset.empty()) { // must've lost root records LOG< SyncRes::getAs(const string &qname, int depth, set&bestns, int depth, set& beenthere) +void SyncRes::getBestNSFromCache(const string &qname, set&bestns, bool* flawedNSSet, int depth, set& beenthere) { string prefix, subdomain(qname); if(s_log) { @@ -317,6 +318,7 @@ void SyncRes::getBestNSFromCache(const string &qname, set&bes do { LOG< ns; + *flawedNSSet = false; if(RC.get(d_now.tv_sec, subdomain, QType(QType::NS), &ns) > 0) { for(set::const_iterator k=ns.begin();k!=ns.end();++k) { if(k->ttl > (unsigned int)d_now.tv_sec ) { @@ -336,8 +338,10 @@ void SyncRes::getBestNSFromCache(const string &qname, set&bes LOG<<", not in cache / did not look at cache"<content<<") which we miss or is expired"<&bes answer.qname=qname; answer.bestns=bestns; if(beenthere.count(answer)) { LOG<::const_iterator j=beenthere.begin();j!=beenthere.end();++j) - LOG<qname<<" ("<<(unsigned int)j->bestns.size()<<")"<::const_iterator j=beenthere.begin();j!=beenthere.end();++j) + LOG<qname<<" ("<<(unsigned int)j->bestns.size()<<")"<& nsset, int depth, set&beenthere) +string SyncRes::getBestNSNamesFromCache(const string &qname, set& nsset, bool* flawedNSSet, int depth, set&beenthere) { string subdomain(qname); @@ -385,7 +390,7 @@ string SyncRes::getBestNSNamesFromCache(const string &qname,set bestns; - getBestNSFromCache(subdomain, bestns, depth, beenthere); + getBestNSFromCache(subdomain, bestns, flawedNSSet, depth, beenthere); for(set::const_iterator k=bestns.begin();k!=bestns.end();++k) { nsset.insert(k->content); @@ -582,7 +587,7 @@ struct TCacheComp /** returns -1 in case of no results, rcode otherwise */ -int SyncRes::doResolveAt(set nameservers, string auth, const string &qname, const QType &qtype, +int SyncRes::doResolveAt(set nameservers, string auth, bool flawedNSSet, const string &qname, const QType &qtype, vector&ret, int depth, set&beenthere) { @@ -604,7 +609,7 @@ int SyncRes::doResolveAt(set nameservers, string auth, for(vector::const_iterator tns=rnameservers.begin();;++tns) { if(tns==rnameservers.end()) { LOG< nameservers, string auth, if(remoteIPs.empty()) { LOG<& ret) void SyncRes::addAuthorityRecords(const string& qname, vector& ret, int depth) { set bestns; - setbeenthere; - getBestNSFromCache(qname, bestns, depth,beenthere); + set beenthere; + bool dontcare; + getBestNSFromCache(qname, bestns, &dontcare, depth, beenthere); for(set::const_iterator k=bestns.begin();k!=bestns.end();++k) { DNSResourceRecord ns=*k; diff --git a/pdns/syncres.hh b/pdns/syncres.hh index 0d40cb6d1..16e49010e 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -346,16 +346,16 @@ public: static string s_serverID; private: struct GetBestNSAnswer; - int doResolveAt(set nameservers, string auth, const string &qname, const QType &qtype, vector&ret, + int doResolveAt(set nameservers, string auth, bool flawedNSSet, const string &qname, const QType &qtype, vector&ret, int depth, set&beenthere); int doResolve(const string &qname, const QType &qtype, vector&ret, int depth, set& beenthere); bool doOOBResolve(const string &qname, const QType &qtype, vector&ret, int depth, int &res); domainmap_t::const_iterator getBestAuthZone(string* qname); bool doCNAMECacheCheck(const string &qname, const QType &qtype, vector&ret, int depth, int &res); bool doCacheCheck(const string &qname, const QType &qtype, vector&ret, int depth, int &res); - void getBestNSFromCache(const string &qname, set&bestns, int depth, set& beenthere); + void getBestNSFromCache(const string &qname, set&bestns, bool* flawedNSSet, int depth, set& beenthere); void addCruft(const string &qname, vector& ret); - string getBestNSNamesFromCache(const string &qname,set& nsset, int depth, set&beenthere); + string getBestNSNamesFromCache(const string &qname,set& nsset, bool* flawedNSSet, int depth, set&beenthere); void addAuthorityRecords(const string& qname, vector& ret, int depth); inline vector shuffleInSpeedOrder(set &nameservers, const string &prefix);