Skip to content

Commit

Permalink
Merge pull request #10151 from omoerbeek/rec-non-resolving-followup
Browse files Browse the repository at this point in the history
rec: Only put a failing NS in the map if we actually went out and that produced no results
  • Loading branch information
omoerbeek authored Mar 5, 2021
2 parents 915f8ba + 59ab950 commit 65d5850
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pdns/syncres.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2284,7 +2284,7 @@ bool SyncRes::nameserverIPBlockedByRPZ(const DNSFilterEngine& dfe, const ComboAd
return false;
}

vector<ComboAddress> SyncRes::retrieveAddressesForNS(const std::string& prefix, const DNSName& qname, std::vector<std::pair<DNSName, float>>::const_iterator& tns, const unsigned int depth, set<GetBestNSAnswer>& beenthere, const vector<std::pair<DNSName, float>>& rnameservers, NsSet& nameservers, bool& sendRDQuery, bool& pierceDontQuery, bool& flawedNSSet, bool cacheOnly, unsigned int &retrieveAddressesForNS)
vector<ComboAddress> SyncRes::retrieveAddressesForNS(const std::string& prefix, const DNSName& qname, std::vector<std::pair<DNSName, float>>::const_iterator& tns, const unsigned int depth, set<GetBestNSAnswer>& beenthere, const vector<std::pair<DNSName, float>>& rnameservers, NsSet& nameservers, bool& sendRDQuery, bool& pierceDontQuery, bool& flawedNSSet, bool cacheOnly, unsigned int &nretrieveAddressesForNS)
{
vector<ComboAddress> result;

Expand All @@ -2296,20 +2296,21 @@ vector<ComboAddress> SyncRes::retrieveAddressesForNS(const std::string& prefix,
}

LOG(prefix<<qname<<": Trying to resolve NS '"<<tns->first<< "' ("<<1+tns-rnameservers.begin()<<"/"<<(unsigned int)rnameservers.size()<<")"<<endl);
const unsigned int oldnretrieveAddressesForNS = nretrieveAddressesForNS;
try {
result = getAddrs(tns->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);
}
}
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);
Expand Down

0 comments on commit 65d5850

Please sign in to comment.