From: Otto Moerbeek Date: Thu, 11 Aug 2022 12:30:48 +0000 (+0200) Subject: Also check qperq limit if throttling happened, as it increases counters. X-Git-Tag: rec-4.8.0-alpha1~44^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11848%2Fhead;p=thirdparty%2Fpdns.git Also check qperq limit if throttling happened, as it increases counters. This condition would be caught when going out previously, so is an optimisation, not a behaviour difference. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 2e37749d3d..c9d3c5fa3f 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -3339,6 +3339,13 @@ vector SyncRes::retrieveAddressesForNS(const std::string& prefix, return result; } +void SyncRes::checkMaxQperQ(const DNSName& qname) const +{ + if (d_outqueries + d_throttledqueries > s_maxqperq) { + throw ImmediateServFailException("more than " + std::to_string(s_maxqperq) + " (max-qperq) queries sent or throttled while resolving " + qname.toLogString()); + } +} + bool SyncRes::throttledOrBlocked(const std::string& prefix, const ComboAddress& remoteIP, const DNSName& qname, const QType qtype, bool pierceDontQuery) { if (isThrottled(d_now.tv_sec, remoteIP)) { @@ -5067,10 +5074,7 @@ bool SyncRes::doResolveAtThisIP(const std::string& prefix, const DNSName& qname, LWResult::Result resolveret = LWResult::Result::Success; s_outqueries++; d_outqueries++; - - if(d_outqueries + d_throttledqueries > s_maxqperq) { - throw ImmediateServFailException("more than "+std::to_string(s_maxqperq)+" (max-qperq) queries sent while resolving "+qname.toLogString()); - } + checkMaxQperQ(qname); if(s_maxtotusec && d_totUsec > s_maxtotusec) { throw ImmediateServFailException("Too much time waiting for "+qname.toLogString()+"|"+qtype.toString()+", timeouts: "+std::to_string(d_timeouts) +", throttles: "+std::to_string(d_throttledqueries) + ", queries: "+std::to_string(d_outqueries)+", "+std::to_string(d_totUsec/1000)+"msec"); @@ -5581,6 +5585,8 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con LOG(prefix<toStringWithPort() <<", asking '"< retrieveAddressesForNS(const std::string& prefix, const DNSName& qname, 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& addressQueriesForNS);