]> granicus.if.org Git - pdns/commitdiff
dnsdist: Implement NoneAction()
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 6 Jul 2018 12:26:36 +0000 (14:26 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 6 Jul 2018 12:26:36 +0000 (14:26 +0200)
pdns/dnsdist-lua-actions.cc
regression-tests.dnsdist/test_Advanced.py

index 7df6aa8df6a63f599b65edc83e77043a8eefa192..ae4d534615dbb99c720d777455747e060e57e6e9 100644 (file)
@@ -57,6 +57,18 @@ public:
   }
 };
 
+class NoneAction : public DNSAction
+{
+public:
+  DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override
+  {
+    return Action::None;
+  }
+  string toString() const override
+  {
+    return "no op";
+  }
+};
 
 class QPSAction : public DNSAction
 {
@@ -1061,6 +1073,10 @@ void setupLuaActions()
       return std::shared_ptr<DNSAction>(new AllowAction);
     });
 
+  g_lua.writeFunction("NoneAction", []() {
+      return std::shared_ptr<DNSAction>(new NoneAction);
+    });
+
   g_lua.writeFunction("DelayAction", [](int msec) {
       return std::shared_ptr<DNSAction>(new DelayAction(msec));
     });
index c4ab74103d029f4146bc9fd8a6c76776d0f19760..aac6b474236d9cf4c0280185a0c1f1e3dfafcbfc 100644 (file)
@@ -10,6 +10,7 @@ from dnsdisttests import DNSDistTest
 class TestAdvancedAllow(DNSDistTest):
 
     _config_template = """
+    addAction(AllRule(), NoneAction())
     addAction(makeRule("allowed.advanced.tests.powerdns.com."), AllowAction())
     addAction(AllRule(), DropAction())
     newServer{address="127.0.0.1:%s"}