]> granicus.if.org Git - pdns/commitdiff
make sure we log if we refresh an expired dynamic rule. Closes #3323
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 2 Feb 2016 21:29:15 +0000 (22:29 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 2 Feb 2016 21:29:15 +0000 (22:29 +0100)
pdns/dnsdist-lua2.cc

index 3c2c06f0dd0ab03fc575bc60234029be67ce09a6..9b52a4ad1652f1ca9daa7e7b51b19a0660d38118 100644 (file)
@@ -166,15 +166,18 @@ void moreLua()
                           for(const auto& capair : m) {
                             unsigned int count = 0;
                              auto got = slow.lookup(Netmask(capair.first));
+                             bool expired=false;
                             if(got) {
                               if(until < got->second.until) // had a longer policy
                                 continue;
-                              if(now < got->second.until) // don't inherit count on expired entry
+                              if(now < got->second.until) // only inherit count on fresh query we are extending
                                 count=got->second.blocks;
+                               else
+                                 expired=true;
                             }
                             DynBlock db{msg,until};
                             db.blocks=count;
-                             if(!got)
+                             if(!got || expired)
                                warnlog("Inserting dynamic block for %s for %d seconds: %s", capair.first.toString(), actualSeconds, msg);
                             slow.insert(Netmask(capair.first)).second=db;
                           }