]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
implement a 'quiet' mode for SuffixMatchNodeRule() which prevents ShowRules() from... 3826/head
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 6 May 2016 07:43:11 +0000 (09:43 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 6 May 2016 07:43:11 +0000 (09:43 +0200)
pdns/README-dnsdist.md
pdns/dnsdist-lua.cc
pdns/dnsrulactions.hh

index aef60cf2a1b387ee84f873c028747fc2c4e0d8b6..9949e20f66c01c9b666c3e2a622099d599ebdd65 100644 (file)
@@ -1073,7 +1073,7 @@ instantiate a server with additional parameters
     * `QClassRule(qclass)`: matches queries with the specified qclass (numeric)
     * `QTypeRule(qtype)`: matches queries with the specified qtype
     * `RegexRule(regex)`: matches the query name against the supplied regex
-    * `SuffixMatchNodeRule()`: matches based on a group of domain suffixes for rapid testing of membership
+    * `SuffixMatchNodeRule(smn, [quiet-bool])`: matches based on a group of domain suffixes for rapid testing of membership. Pass `true` as second parameter to prevent listing of all domains matched.
     * `TCPRule(tcp)`: matches question received over TCP if `tcp` is true, over UDP otherwise
  * Rule management related:
     * `getAction(num)`: returns the Action associate with rule 'num'.
index 3322f6f6e412f6d8cb06ed5db8043218cdc138da..6154918159f9cc760881afe1fa5472c70cab6880 100644 (file)
@@ -714,8 +714,8 @@ vector<std::function<void(void)>> setupLua(bool client, const std::string& confi
     });
 #endif
 
-  g_lua.writeFunction("SuffixMatchNodeRule", [](const SuffixMatchNode& smn) {
-      return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn));
+  g_lua.writeFunction("SuffixMatchNodeRule", [](const SuffixMatchNode& smn, boost::optional<bool> quiet) {
+      return std::shared_ptr<DNSRule>(new SuffixMatchNodeRule(smn, quiet ? *quiet : false));
     });
 
   g_lua.writeFunction("NetmaskGroupRule", [](const NetmaskGroup& nmg) {
index 1a0578c952689fd371c6ed7149e4800e19e9e21b..5f60730d22ac293dc88efed36213890f1fc583a2 100644 (file)
@@ -254,7 +254,7 @@ private:
 class SuffixMatchNodeRule : public DNSRule
 {
 public:
-  SuffixMatchNodeRule(const SuffixMatchNode& smn) : d_smn(smn)
+  SuffixMatchNodeRule(const SuffixMatchNode& smn, bool quiet=false) : d_smn(smn), d_quiet(quiet)
   {
   }
   bool matches(const DNSQuestion* dq) const override
@@ -263,10 +263,14 @@ public:
   }
   string toString() const override
   {
-    return "qname=="+d_smn.toString();
+    if(d_quiet)
+      return "qname==in-set";
+    else
+      return "qname=="+d_smn.toString();
   }
 private:
   SuffixMatchNode d_smn;
+  bool d_quiet;
 };
 
 class QTypeRule : public DNSRule