]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
log when adding a dynamic block
authorbert hubert <bert.hubert@netherlabs.nl>
Sun, 6 Dec 2015 18:38:42 +0000 (19:38 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Sun, 6 Dec 2015 18:39:03 +0000 (19:39 +0100)
pdns/dnsdist-lua2.cc

index 21cf7f7acee3888046e43cb27f092aa3221954d6..47bdd7de26bdfddfcafd03bdf880782ca855a81e 100644 (file)
@@ -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<void(nmts_t::*)(const map<ComboAddress,int>&, const std::string&, boost::optional<int>)>("add", 
-                                                                                           [](nmts_t& s, const map<ComboAddress,int>& m, const std::string& msg, boost::optional<int> 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<bool(nmts_t::*)(const ComboAddress&)>("match", 
                                                                     [](nmts_t& s, const ComboAddress& ca) { return s.match(ca); });