From 59ab9505d9cfe3ba2a3a4508d7c0c334f73fa375 Mon Sep 17 00:00:00 2001 From: Otto Date: Fri, 5 Mar 2021 16:09:29 +0100 Subject: [PATCH] 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. --- pdns/syncres.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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); -- 2.47.2