From: Doug Freed Date: Mon, 27 Dec 2021 17:00:37 +0000 (-0500) Subject: Test correct member in DynBlockRatioRule::warningRatioExceeded X-Git-Tag: auth-4.7.0-alpha1~97^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F11132%2Fhead;p=thirdparty%2Fpdns.git Test correct member in DynBlockRatioRule::warningRatioExceeded Also sprinkle in some more checks of d_enabled. Fixes #11131 --- 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; }