From b1fd5841e92719049751836cce728b136aaddb4a Mon Sep 17 00:00:00 2001 From: Doug Freed Date: Mon, 27 Dec 2021 12:00:37 -0500 Subject: [PATCH] Test correct member in DynBlockRatioRule::warningRatioExceeded Also sprinkle in some more checks of d_enabled. Fixes #11131 --- pdns/dnsdist-dynblocks.hh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdist-dynblocks.hh b/pdns/dnsdist-dynblocks.hh index 2a817e13bf..7bd9d97e1d 100644 --- a/pdns/dnsdist-dynblocks.hh +++ b/pdns/dnsdist-dynblocks.hh @@ -108,6 +108,10 @@ private: bool warningRateExceeded(unsigned int count, const struct timespec& now) const { + if (!d_enabled) { + return false; + } + if (d_warningRate == 0) { return false; } @@ -177,7 +181,11 @@ private: bool warningRatioExceeded(unsigned int total, unsigned int count) const { - if (d_warningRate == 0) { + if (!d_enabled) { + return false; + } + + if (d_warningRatio == 0.0) { return false; } -- 2.47.2