]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Test correct member in DynBlockRatioRule::warningRatioExceeded 11132/head
authorDoug Freed <dwfreed@mtu.edu>
Mon, 27 Dec 2021 17:00:37 +0000 (12:00 -0500)
committerGitHub <noreply@github.com>
Mon, 27 Dec 2021 17:00:37 +0000 (12:00 -0500)
Also sprinkle in some more checks of d_enabled.

Fixes #11131

pdns/dnsdist-dynblocks.hh

index 2a817e13bfe799854a695db178e806825beea5c8..7bd9d97e1d4a03e7fbac13af200931712cdd5484 100644 (file)
@@ -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;
       }