]> granicus.if.org Git - pdns/commitdiff
dnsdist: Add SuffixMatchNodeRule() and RCodeAction()
authorRemi Gacogne <rgacogne-github@coredump.fr>
Mon, 28 Dec 2015 17:18:03 +0000 (18:18 +0100)
committerRemi Gacogne <rgacogne-github@coredump.fr>
Mon, 28 Dec 2015 17:18:03 +0000 (18:18 +0100)
I needed them for the regression tests, and unless there is a
cleaner way to do the same thing that I missed, they will be
useful.

pdns/dnsdist-lua.cc

index b88f7445cfc86cc044f595aab5fa8945fd95552e..932d5bfd4794ed625edc823634c85e9f7cee5419 100644 (file)
@@ -483,6 +483,9 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
       return std::shared_ptr<DNSAction>(new LogAction(fname));
     });
 
+  g_lua.writeFunction("RCodeAction", [](int rcode) {
+      return std::shared_ptr<DNSAction>(new RCodeAction(rcode));
+    });
 
   g_lua.writeFunction("MaxQPSIPRule", [](unsigned int qps, boost::optional<int> ipv4trunc, boost::optional<int> ipv6trunc) {
       return std::shared_ptr<DNSRule>(new MaxQPSIPRule(qps, ipv4trunc.get_value_or(32), ipv6trunc.get_value_or(64)));
@@ -501,6 +504,9 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
       return std::shared_ptr<DNSRule>(new RegexRule(str));
     });
 
+  g_lua.writeFunction("SuffixMatchNodeRule", [](const SuffixMatchNode& smn) {
+      return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn));
+    });
 
   g_lua.writeFunction("benchRule", [](std::shared_ptr<DNSRule> rule, boost::optional<int> times_, boost::optional<string> suffix_)  {
       setLuaNoSideEffect();