From: Otto Moerbeek Date: Tue, 19 Sep 2023 09:45:40 +0000 (+0200) Subject: Make unthrottle n a var (setting not done yet) X-Git-Tag: rec-5.0.0-alpha2~44^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fba6d594d5678d667e9aa350b127f6ac7095050;p=thirdparty%2Fpdns.git Make unthrottle n a var (setting not done yet) --- diff --git a/pdns/recursordist/syncres.cc b/pdns/recursordist/syncres.cc index 7b7f2b96fc..2fdf209df8 100644 --- a/pdns/recursordist/syncres.cc +++ b/pdns/recursordist/syncres.cc @@ -443,6 +443,7 @@ unsigned int SyncRes::s_packetcacheservfailttl; unsigned int SyncRes::s_packetcachenegativettl; unsigned int SyncRes::s_serverdownmaxfails; unsigned int SyncRes::s_serverdownthrottletime; +unsigned int SyncRes::s_unthrottle_n = 100; unsigned int SyncRes::s_nonresolvingnsmaxfails; unsigned int SyncRes::s_nonresolvingnsthrottletime; unsigned int SyncRes::s_ecscachelimitttl; @@ -1239,9 +1240,9 @@ bool SyncRes::isThrottled(time_t now, const ComboAddress& server, const DNSName& bool SyncRes::isThrottled(time_t now, const ComboAddress& server) { - // Give fully throttled servers a chance to be used, to avoid having one bad domain spoil the NS record for others - // If the NS answers, it will be unThrottled - if ((dns_random_uint32() & 0x7f) == 0) { + // Give fully throttled servers a chance to be used, to avoid having one bad domain spoil the NS record for others usingf the same NS + // If the NS answers, it will be unThrottled immediately + if (dns_random(s_unthrottle_n) == 0) { return false; } return s_throttle.lock()->shouldThrottle(now, std::tuple(server, g_rootdnsname, 0)); diff --git a/pdns/recursordist/syncres.hh b/pdns/recursordist/syncres.hh index 5688466401..9ae9297b87 100644 --- a/pdns/recursordist/syncres.hh +++ b/pdns/recursordist/syncres.hh @@ -526,6 +526,7 @@ public: static unsigned int s_serverdownthrottletime; static unsigned int s_nonresolvingnsmaxfails; static unsigned int s_nonresolvingnsthrottletime; + static unsigned int s_unthrottle_n; static unsigned int s_ecscachelimitttl; static uint8_t s_ecsipv4limit;