From 32c99b3d14a3ef02e7fc30ce3855329bb8c56cf9 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Sun, 6 Dec 2015 19:38:42 +0100 Subject: [PATCH] log when adding a dynamic block --- pdns/dnsdist-lua2.cc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/pdns/dnsdist-lua2.cc b/pdns/dnsdist-lua2.cc index 21cf7f7ac..47bdd7de2 100644 --- a/pdns/dnsdist-lua2.cc +++ b/pdns/dnsdist-lua2.cc @@ -144,7 +144,8 @@ void moreLua() struct timespec until, now; clock_gettime(CLOCK_MONOTONIC, &now); until=now; - until.tv_sec += seconds ? *seconds : 10; + int actualSeconds = seconds ? *seconds : 10; + until.tv_sec += actualSeconds; for(const auto& capair : m) { unsigned int count; if(auto got = slow.lookup(Netmask(capair.first))) { @@ -155,23 +156,13 @@ void moreLua() } DynBlock db{msg,until}; db.blocks=count; + warnlog("Inserting dynamic block for %s for %d seconds: %s", capair.first.toString(), actualSeconds, msg); slow.insert(Netmask(capair.first)).second=db; } g_dynblockNMG.setState(slow); }); - - g_lua.registerFunction&, const std::string&, boost::optional)>("add", - [](nmts_t& s, const map& m, const std::string& msg, boost::optional seconds) { - struct timespec until; - clock_gettime(CLOCK_MONOTONIC, &until); - until.tv_sec += seconds ? *seconds : 10; - for(const auto& capair : m) - s.insert(Netmask(capair.first)).second={msg, until}; - }); - - g_lua.registerFunction("match", [](nmts_t& s, const ComboAddress& ca) { return s.match(ca); }); -- 2.40.0