From: Remi Gacogne Date: Tue, 16 Oct 2018 14:23:19 +0000 (+0200) Subject: dnsdist: Clarify that DynBlock's warning rates can't be used alone X-Git-Tag: dnsdist-1.3.3~39^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=15e60f9f9567b643a68fc61e898506f49916e508;p=pdns dnsdist: Clarify that DynBlock's warning rates can't be used alone --- diff --git a/pdns/dnsdist-dynblocks.hh b/pdns/dnsdist-dynblocks.hh index 091ffa553..73d4af36d 100644 --- a/pdns/dnsdist-dynblocks.hh +++ b/pdns/dnsdist-dynblocks.hh @@ -44,9 +44,6 @@ private: DynBlockRule(const std::string& blockReason, unsigned int blockDuration, unsigned int rate, unsigned int warningRate, unsigned int seconds, DNSAction::Action action): d_blockReason(blockReason), d_blockDuration(blockDuration), d_rate(rate), d_warningRate(warningRate), d_seconds(seconds), d_action(action), d_enabled(true) { - if (d_warningRate > 0) { - d_warningEnabled = true; - } } bool matches(const struct timespec& when) @@ -79,7 +76,7 @@ private: bool warningRateExceeded(unsigned int count, const struct timespec& now) const { - if (!d_warningEnabled) { + if (d_warningRate == 0) { return false; } @@ -90,7 +87,7 @@ private: bool isEnabled() const { - return d_enabled || d_warningEnabled; + return d_enabled; } std::string toString() const @@ -120,7 +117,6 @@ private: unsigned int d_seconds{0}; DNSAction::Action d_action{DNSAction::Action::None}; bool d_enabled{false}; - bool d_warningEnabled{false}; }; typedef std::unordered_map counts_t;