From 15e60f9f9567b643a68fc61e898506f49916e508 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 16 Oct 2018 16:23:19 +0200 Subject: [PATCH] dnsdist: Clarify that DynBlock's warning rates can't be used alone --- pdns/dnsdist-dynblocks.hh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pdns/dnsdist-dynblocks.hh b/pdns/dnsdist-dynblocks.hh index 091ffa553a..73d4af36d8 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; -- 2.47.2