From e126e7ddfba324414f34c4826b8704645dc42355 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 2 Feb 2016 22:29:15 +0100 Subject: [PATCH] make sure we log if we refresh an expired dynamic rule. Closes #3323 --- pdns/dnsdist-lua2.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pdns/dnsdist-lua2.cc b/pdns/dnsdist-lua2.cc index 3c2c06f0d..9b52a4ad1 100644 --- a/pdns/dnsdist-lua2.cc +++ b/pdns/dnsdist-lua2.cc @@ -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; } -- 2.40.0