From: Otto Date: Fri, 5 Mar 2021 15:09:29 +0000 (+0100) Subject: Only put a failing NS in the map if we actually went out and that X-Git-Tag: rec-4.5.0-alpha3~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F10151%2Fhead;p=thirdparty%2Fpdns.git Only put a failing NS in the map if we actually went out and that produced no results. While there, rename a var to be different from the method name. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 8756b3e8a0..e1b1319596 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -2284,7 +2284,7 @@ bool SyncRes::nameserverIPBlockedByRPZ(const DNSFilterEngine& dfe, const ComboAd return false; } -vector SyncRes::retrieveAddressesForNS(const std::string& prefix, const DNSName& qname, std::vector>::const_iterator& tns, const unsigned int depth, set& beenthere, const vector>& rnameservers, NsSet& nameservers, bool& sendRDQuery, bool& pierceDontQuery, bool& flawedNSSet, bool cacheOnly, unsigned int &retrieveAddressesForNS) +vector SyncRes::retrieveAddressesForNS(const std::string& prefix, const DNSName& qname, std::vector>::const_iterator& tns, const unsigned int depth, set& beenthere, const vector>& rnameservers, NsSet& nameservers, bool& sendRDQuery, bool& pierceDontQuery, bool& flawedNSSet, bool cacheOnly, unsigned int &nretrieveAddressesForNS) { vector result; @@ -2296,12 +2296,13 @@ vector SyncRes::retrieveAddressesForNS(const std::string& prefix, } LOG(prefix<first<< "' ("<<1+tns-rnameservers.begin()<<"/"<<(unsigned int)rnameservers.size()<<")"<first, depth, beenthere, cacheOnly, retrieveAddressesForNS); + result = getAddrs(tns->first, depth, beenthere, cacheOnly, nretrieveAddressesForNS); } // Other exceptions should likely not throttle... catch (const ImmediateServFailException& ex) { - if (s_nonresolvingnsmaxfails > 0) { + if (s_nonresolvingnsmaxfails > 0 && nretrieveAddressesForNS > oldnretrieveAddressesForNS) { auto dontThrottleNames = g_dontThrottleNames.getLocal(); if (!dontThrottleNames->check(tns->first)) { t_sstorage.nonresolving.incr(tns->first, d_now); @@ -2309,7 +2310,7 @@ vector SyncRes::retrieveAddressesForNS(const std::string& prefix, } throw ex; } - if (s_nonresolvingnsmaxfails > 0 && result.empty()) { + if (s_nonresolvingnsmaxfails > 0 && result.empty() && nretrieveAddressesForNS > oldnretrieveAddressesForNS) { auto dontThrottleNames = g_dontThrottleNames.getLocal(); if (!dontThrottleNames->check(tns->first)) { t_sstorage.nonresolving.incr(tns->first, d_now);