]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Unify non-terminal actions as SetXXXAction()
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 14 Jan 2021 15:34:28 +0000 (16:34 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 26 Jan 2021 09:11:36 +0000 (10:11 +0100)
13 files changed:
pdns/dnsdist-console.cc
pdns/dnsdist-lua-actions.cc
pdns/dnsdistdist/docs/advanced/ecs.rst
pdns/dnsdistdist/docs/advanced/proxyprotocol.rst
pdns/dnsdistdist/docs/advanced/qpslimits.rst
pdns/dnsdistdist/docs/rules-actions.rst
pdns/dnsdistdist/docs/upgrade_guide.rst
regression-tests.dnsdist/test_Advanced.py
regression-tests.dnsdist/test_Caching.py
regression-tests.dnsdist/test_EdnsClientSubnet.py
regression-tests.dnsdist/test_ProxyProtocol.py
regression-tests.dnsdist/test_TCPKeepAlive.py
regression-tests.dnsdist/test_Tags.py

index 8e63fab7d15cbaa940a89fcbe35bafb521300b33..c275e97f56547e636d3ccdf355ed04bce2578d74 100644 (file)
@@ -361,7 +361,6 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "addDynBlockSMT", true, "names, message[, seconds [, action]]", "block the set of names with message `msg`, for `seconds` seconds (10 by default), applying `action` (default to the one set with `setDynBlocksAction()`)" },
   { "addLocal", true, "addr [, {doTCP=true, reusePort=false, tcpFastOpenQueueSize=0, interface=\"\", cpus={}}]", "add `addr` to the list of addresses we listen on" },
   { "addCacheHitResponseAction", true, "DNS rule, DNS response action [, {uuid=\"UUID\", name=\"name\"}}]", "add a cache hit response rule" },
-  { "AddProxyProtocolValueAction", true, "type, value", "Add a Proxy Protocol TLV value of this type" },
   { "addResponseAction", true, "DNS rule, DNS response action [, {uuid=\"UUID\", name=\"name\"}}]", "add a response rule" },
   { "addSelfAnsweredResponseAction", true, "DNS rule, DNS response action [, {uuid=\"UUID\", name=\"name\"}}]", "add a self-answered response rule" },
   { "addTLSLocal", true, "addr, certFile(s), keyFile(s) [,params]", "listen to incoming DNS over TLS queries on the specified address using the specified certificate (or list of) and key (or list of). The last parameter is a table" },
@@ -380,8 +379,6 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "DelayAction", true, "milliseconds", "delay the response by the specified amount of milliseconds (UDP-only)" },
   { "DelayResponseAction", true, "milliseconds", "delay the response by the specified amount of milliseconds (UDP-only)" },
   { "delta", true, "", "shows all commands entered that changed the configuration" },
-  { "DisableECSAction", true, "", "Disable the sending of ECS to the backend. Subsequent rules are processed after this action." },
-  { "DisableValidationAction", true, "", "set the CD bit in the question, let it go through" },
   { "DNSSECRule", true, "", "matches queries with the DO bit set" },
   { "DnstapLogAction", true, "identity, FrameStreamLogger [, alterFunction]", "send the contents of this query to a FrameStreamLogger or RemoteLogger as dnstap. `alterFunction` is a callback, receiving a DNSQuestion and a DnstapMessage, that can be used to modify the dnstap message" },
   { "DnstapLogResponseAction", true, "identity, FrameStreamLogger [, alterFunction]", "send the contents of this response to a remote or FrameStreamLogger or RemoteLogger as dnstap. `alterFunction` is a callback, receiving a DNSResponse and a DnstapMessage, that can be used to modify the dnstap message" },
@@ -390,8 +387,6 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "DSTPortRule", true, "port", "matches questions received to the destination port specified" },
   { "dumpStats", true, "", "print all statistics we gather" },
   { "dynBlockRulesGroup", true, "", "return a new DynBlockRulesGroup object" },
-  { "ECSOverrideAction", true, "override", "Whether an existing EDNS Client Subnet value should be overridden (true) or not (false). Subsequent rules are processed after this action" },
-  { "ECSPrefixLengthAction", true, "v4, v6", "Set the ECS prefix length. Subsequent rules are processed after this action" },
   { "EDNSVersionRule", true, "version", "matches queries with the specified EDNS version" },
   { "EDNSOptionRule", true, "optcode", "matches queries with the specified EDNS0 option present" },
   { "ERCodeAction", true, "ercode", "Reply immediately by turning the query into a response with the specified EDNS extended rcode" },
@@ -449,7 +444,6 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "LuaFFIRule", true, "function", "Invoke a Lua FFI function that filters DNS questions" },
   { "LuaResponseAction", true, "function", "Invoke a Lua function that accepts a DNSResponse" },
   { "LuaRule", true, "function", "Invoke a Lua function that filters DNS questions" },
-  { "MacAddrAction", true, "option", "Add the source MAC address to the query as EDNS0 option option. This action is currently only supported on Linux. Subsequent rules are processed after this action" },
   { "makeIPCipherKey", true, "password", "generates a 16-byte key that can be used to pseudonymize IP addresses with IP cipher" },
   { "makeKey", true, "", "generate a new server access key, emit configuration line ready for pasting" },
   { "makeRule", true, "rule", "Make a NetmaskGroupRule() or a SuffixMatchNodeRule(), depending on how it is called" }  ,
@@ -485,8 +479,8 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "newServer", true, "{address=\"ip:port\", qps=1000, order=1, weight=10, pool=\"abuse\", retries=5, tcpConnectTimeout=5, tcpSendTimeout=30, tcpRecvTimeout=30, checkName=\"a.root-servers.net.\", checkType=\"A\", maxCheckFailures=1, mustResolve=false, useClientSubnet=true, source=\"address|interface name|address@interface\", sockets=1, reconnectOnUp=false}", "instantiate a server" },
   { "newServerPolicy", true, "name, function", "create a policy object from a Lua function" },
   { "newSuffixMatchNode", true, "", "returns a new SuffixMatchNode" },
+  { "NegativeAndSOAAction", true, "nxd, zone, ttl, mname, rname, serial, refresh, retry, expire, minimum [, options]", "Turn a query into a NXDomain or NoData answer and sets a SOA record in the additional section" },
   { "NoneAction", true, "", "Does nothing. Subsequent rules are processed after this action" },
-  { "NoRecurseAction", true, "", "strip RD bit from the question, let it go through" },
   { "NotRule", true, "selector", "Matches the traffic if the selector rule does not match" },
   { "OpcodeRule", true, "code", "Matches queries with opcode code. code can be directly specified as an integer, or one of the built-in DNSOpcodes" },
   { "OrRule", true, "selectors", "Matches the traffic if one or more of the the selectors rules does match" },
@@ -536,7 +530,6 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "setDynBlocksAction", true, "action", "set which action is performed when a query is blocked. Only DNSAction.Drop (the default) and DNSAction.Refused are supported" },
   { "setDynBlocksPurgeInterval", true, "sec", "set how often the expired dynamic block entries should be removed" },
   { "setDropEmptyQueries", true, "drop", "Whether to drop empty queries right away instead of sending a NOTIMP response" },
-  { "SetECSAction", true, "v4[, v6]", "Set the ECS prefix and prefix length sent to backends to an arbitrary value" },
   { "setECSOverride", true, "bool", "whether to override an existing EDNS Client Subnet value in the query" },
   { "setECSSourcePrefixV4", true, "prefix-length", "the EDNS Client Subnet prefix-length used for IPv4 queries" },
   { "setECSSourcePrefixV6", true, "prefix-length", "the EDNS Client Subnet prefix-length used for IPv6 queries" },
@@ -548,7 +541,6 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "setMaxTCPQueriesPerConnection", true, "n", "set the maximum number of queries in an incoming TCP connection. 0 means unlimited" },
   { "setMaxTCPQueuedConnections", true, "n", "set the maximum number of TCP connections queued (waiting to be picked up by a client thread)" },
   { "setMaxUDPOutstanding", true, "n", "set the maximum number of outstanding UDP queries to a given backend server. This can only be set at configuration time and defaults to 65535" },
-  { "SetNegativeAndSOAAction", true, "nxd, zone, ttl, mname, rname, serial, refresh, retry, expire, minimum [, options]", "Turn a query into a NXDomain or NoData answer and sets a SOA record in the additional section" },
   { "setPayloadSizeOnSelfGeneratedAnswers", true, "payloadSize", "set the UDP payload size advertised via EDNS on self-generated responses" },
   { "setPoolServerPolicy", true, "policy, pool", "set the server selection policy for this pool to that policy" },
   { "setPoolServerPolicyLua", true, "name, function, pool", "set the server selection policy for this pool to one named 'name' and provided by 'function'" },
@@ -605,24 +597,32 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "showTLSErrorCounters", true, "", "show metrics about TLS handshake failures" },
   { "showVersion", true, "", "show the current version" },
   { "shutdown", true, "", "shut down `dnsdist`" },
+  { "snmpAgent", true, "enableTraps [, daemonSocket]", "enable `SNMP` support. `enableTraps` is a boolean indicating whether traps should be sent and `daemonSocket` an optional string specifying how to connect to the daemon agent"},
+  { "SetAdditionalProxyProtocolValueAction", true, "type, value", "Add a Proxy Protocol TLV value of this type" },
+  { "SetDisableECSAction", true, "", "Disable the sending of ECS to the backend. Subsequent rules are processed after this action." },
+  { "SetDisableValidationAction", true, "", "set the CD bit in the question, let it go through" },
+  { "SetECSAction", true, "v4[, v6]", "Set the ECS prefix and prefix length sent to backends to an arbitrary value" },
+  { "SetECSOverrideAction", true, "override", "Whether an existing EDNS Client Subnet value should be overridden (true) or not (false). Subsequent rules are processed after this action" },
+  { "SetECSPrefixLengthAction", true, "v4, v6", "Set the ECS prefix length. Subsequent rules are processed after this action" },
+  { "SetMacAddrAction", true, "option", "Add the source MAC address to the query as EDNS0 option option. This action is currently only supported on Linux. Subsequent rules are processed after this action" },
+  { "SetNoRecurseAction", true, "", "strip RD bit from the question, let it go through" },
   { "SetProxyProtocolValuesAction", true, "values", "Set the Proxy-Protocol values for this queries to 'values'" },
-  { "SkipCacheAction", true, "", "Don’t lookup the cache for this query, don’t store the answer" },
-  { "SkipCacheResponseAction", true, "", "Don’t store this response into the cache" },
+  { "SetSkipCacheAction", true, "", "Don’t lookup the cache for this query, don’t store the answer" },
+  { "SetSkipCacheResponseAction", true, "", "Don’t store this response into the cache" },
+  { "SetTagAction", true, "name, value", "set the tag named 'name' to the given value" },
+  { "SetTagResponseAction", true, "name, value", "set the tag named 'name' to the given value" },
+  { "SetTempFailureCacheTTLAction", true, "ttl", "set packetcache TTL for temporary failure replies" },
   { "SNIRule", true, "name", "Create a rule which matches on the incoming TLS SNI value, if any (DoT or DoH)" },
-  { "snmpAgent", true, "enableTraps [, daemonSocket]", "enable `SNMP` support. `enableTraps` is a boolean indicating whether traps should be sent and `daemonSocket` an optional string specifying how to connect to the daemon agent"},
   { "SNMPTrapAction", true, "[reason]", "send an SNMP trap, adding the optional `reason` string as the query description"},
   { "SNMPTrapResponseAction", true, "[reason]", "send an SNMP trap, adding the optional `reason` string as the response description"},
   { "SpoofAction", true, "ip|list of ips [, options]", "forge a response with the specified IPv4 (for an A query) or IPv6 (for an AAAA). If you specify multiple addresses, all that match the query type (A, AAAA or ANY) will get spoofed in" },
   { "SpoofCNAMEAction", true, "cname [, options]", "Forge a response with the specified CNAME value" },
   { "SpoofRawAction", true, "raw [, options]", "Forge a response with the specified record data as raw bytes" },
   { "SuffixMatchNodeRule", true, "smn[, quiet]", "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" },
-  { "TagAction", true, "name, value", "set the tag named 'name' to the given value" },
-  { "TagResponseAction", true, "name, value", "set the tag named 'name' to the given value" },
   { "TagRule", true, "name [, value]", "matches if the tag named 'name' is present, with the given 'value' matching if any" },
   { "TCAction", true, "", "create answer to query with TC and RD bits set, to move to TCP" },
   { "TCPRule", true, "[tcp]", "Matches question received over TCP if tcp is true, over UDP otherwise" },
   { "TeeAction", true, "remote [, addECS]", "send copy of query to remote, optionally adding ECS info" },
-  { "TempFailureCacheTTLAction", true, "ttl", "set packetcache TTL for temporary failure replies" },
   { "testCrypto", true, "", "test of the crypto all works" },
   { "TimedIPSetRule", true, "", "Create a rule which matches a set of IP addresses which expire"}, 
   { "topBandwidth", true, "top", "show top-`top` clients that consume the most bandwidth over length of ringbuffer" },
index 4ae206fc72dab4ad74f198686c0ad0295814f164..de150f10f7a1df4d54b793b303127cd2dfe781fa 100644 (file)
@@ -69,6 +69,7 @@ public:
 class NoneAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
     return Action::None;
@@ -83,13 +84,16 @@ class QPSAction : public DNSAction
 {
 public:
   QPSAction(int limit) : d_qps(limit, limit)
-  {}
+  {
+  }
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
-    if(d_qps.check())
+    if (d_qps.check()) {
       return Action::None;
-    else
+    }
+    else {
       return Action::Drop;
+    }
   }
   std::string toString() const override
   {
@@ -103,10 +107,11 @@ class DelayAction : public DNSAction
 {
 public:
   DelayAction(int msec) : d_msec(msec)
-  {}
+  {
+  }
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
-    *ruleresult=std::to_string(d_msec);
+    *ruleresult = std::to_string(d_msec);
     return Action::Delay;
   }
   std::string toString() const override
@@ -117,10 +122,10 @@ private:
   int d_msec;
 };
 
-
 class TeeAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   TeeAction(const ComboAddress& ca, bool addECS=false);
   ~TeeAction() override;
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override;
@@ -132,7 +137,7 @@ private:
   std::thread d_worker;
   void worker();
 
-  int d_fd;
+  int d_fd{-1};
   mutable std::atomic<unsigned long> d_senderrors{0};
   unsigned long d_recverrors{0};
   mutable std::atomic<unsigned long> d_queries{0};
@@ -152,9 +157,17 @@ private:
 TeeAction::TeeAction(const ComboAddress& ca, bool addECS) : d_remote(ca), d_addECS(addECS)
 {
   d_fd=SSocket(d_remote.sin4.sin_family, SOCK_DGRAM, 0);
-  SConnect(d_fd, d_remote);
-  setNonBlocking(d_fd);
-  d_worker=std::thread(std::bind(&TeeAction::worker, this));
+  try {
+    SConnect(d_fd, d_remote);
+    setNonBlocking(d_fd);
+    d_worker=std::thread(std::bind(&TeeAction::worker, this));
+  }
+  catch (...) {
+    if (d_fd != -1) {
+      close(d_fd);
+    }
+    throw;
+  }
 }
 
 TeeAction::~TeeAction()
@@ -166,7 +179,7 @@ TeeAction::~TeeAction()
 
 DNSAction::Action TeeAction::operator()(DNSQuestion* dq, std::string* ruleresult) const
 {
-  if(dq->tcp) {
+  if (dq->tcp) {
     d_tcpdrops++;
   }
   else {
@@ -195,6 +208,7 @@ DNSAction::Action TeeAction::operator()(DNSQuestion* dq, std::string* ruleresult
       d_senderrors++;
     }
   }
+
   return DNSAction::Action::None;
 }
 
@@ -280,12 +294,13 @@ public:
   QPSPoolAction(unsigned int limit, const std::string& pool) : d_qps(limit, limit), d_pool(pool) {}
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
-    if(d_qps.check()) {
+    if (d_qps.check()) {
       *ruleresult=d_pool;
       return Action::Pool;
     }
-    else
+    else {
       return Action::None;
+    }
   }
   std::string toString() const override
   {
@@ -402,7 +417,7 @@ public:
     std::lock_guard<std::mutex> lock(g_luamutex);
     try {
       auto ret = d_func(dr);
-      if(ruleresult) {
+      if (ruleresult) {
         if (boost::optional<std::string> rule = std::get<1>(ret)) {
           *ruleresult = *rule;
         }
@@ -641,19 +656,22 @@ DNSAction::Action SpoofAction::operator()(DNSQuestion* dq, std::string* ruleresu
   return Action::HeaderModify;
 }
 
-class MacAddrAction : public DNSAction
+class SetMacAddrAction : public DNSAction
 {
 public:
-  MacAddrAction(uint16_t code) : d_code(code)
+  // this action does not stop the processing
+  SetMacAddrAction(uint16_t code) : d_code(code)
   {}
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
-    if(dq->getHeader()->arcount)
+    if (dq->getHeader()->arcount) {
       return Action::None;
+    }
 
     std::string mac = getMACAddress(*dq->remote);
-    if(mac.empty())
+    if (mac.empty()) {
       return Action::None;
+    }
 
     std::string optRData;
     generateEDNSOption(d_code, mac, optRData);
@@ -673,9 +691,10 @@ private:
   uint16_t d_code{3};
 };
 
-class NoRecurseAction : public DNSAction
+class SetNoRecurseAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
     dq->getHeader()->rd = false;
@@ -690,22 +709,31 @@ public:
 class LogAction : public DNSAction, public boost::noncopyable
 {
 public:
+  // this action does not stop the processing
   LogAction(): d_fp(nullptr, fclose)
   {
   }
 
   LogAction(const std::string& str, bool binary=true, bool append=false, bool buffered=true, bool verboseOnly=true, bool includeTimestamp=false): d_fname(str), d_binary(binary), d_verboseOnly(verboseOnly), d_includeTimestamp(includeTimestamp)
   {
-    if(str.empty())
+    if (str.empty()) {
       return;
-    if(append)
+    }
+
+    if(append) {
       d_fp = std::unique_ptr<FILE, int(*)(FILE*)>(fopen(str.c_str(), "a+"), fclose);
-    else
+    }
+    else {
       d_fp = std::unique_ptr<FILE, int(*)(FILE*)>(fopen(str.c_str(), "w"), fclose);
-    if(!d_fp)
+    }
+
+    if (!d_fp) {
       throw std::runtime_error("Unable to open file '"+str+"' for logging: "+stringerror());
-    if(!buffered)
+    }
+
+    if (!buffered) {
       setbuf(d_fp.get(), 0);
+    }
   }
 
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
@@ -778,16 +806,24 @@ public:
 
   LogResponseAction(const std::string& str, bool append=false, bool buffered=true, bool verboseOnly=true, bool includeTimestamp=false): d_fname(str), d_verboseOnly(verboseOnly), d_includeTimestamp(includeTimestamp)
   {
-    if(str.empty())
+    if (str.empty()) {
       return;
-    if(append)
+    }
+
+    if (append) {
       d_fp = std::unique_ptr<FILE, int(*)(FILE*)>(fopen(str.c_str(), "a+"), fclose);
-    else
+    }
+    else {
       d_fp = std::unique_ptr<FILE, int(*)(FILE*)>(fopen(str.c_str(), "w"), fclose);
-    if(!d_fp)
+    }
+
+    if (!d_fp) {
       throw std::runtime_error("Unable to open file '"+str+"' for logging: "+stringerror());
-    if(!buffered)
+    }
+
+    if (!buffered) {
       setbuf(d_fp.get(), 0);
+    }
   }
 
   DNSResponseAction::Action operator()(DNSResponse* dr, std::string* ruleresult) const override
@@ -828,9 +864,10 @@ private:
 };
 
 
-class DisableValidationAction : public DNSAction
+class SetDisableValidationAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
     dq->getHeader()->cd = true;
@@ -842,9 +879,10 @@ public:
   }
 };
 
-class SkipCacheAction : public DNSAction
+class SetSkipCacheAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
     dq->skipCache = true;
@@ -856,7 +894,7 @@ public:
   }
 };
 
-class SkipCacheResponseAction : public DNSResponseAction
+class SetSkipCacheResponseAction : public DNSResponseAction
 {
 public:
   DNSResponseAction::Action operator()(DNSResponse* dr, std::string* ruleresult) const override
@@ -870,12 +908,14 @@ public:
   }
 };
 
-class TempFailureCacheTTLAction : public DNSAction
+class SetTempFailureCacheTTLAction : public DNSAction
 {
 public:
-  TempFailureCacheTTLAction(uint32_t ttl) : d_ttl(ttl)
-  {}
-  TempFailureCacheTTLAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
+  // this action does not stop the processing
+  SetTempFailureCacheTTLAction(uint32_t ttl) : d_ttl(ttl)
+  {
+  }
+  DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
     dq->tempFailureTTL = d_ttl;
     return Action::None;
@@ -888,10 +928,11 @@ private:
   uint32_t d_ttl;
 };
 
-class ECSPrefixLengthAction : public DNSAction
+class SetECSPrefixLengthAction : public DNSAction
 {
 public:
-  ECSPrefixLengthAction(uint16_t v4Length, uint16_t v6Length) : d_v4PrefixLength(v4Length), d_v6PrefixLength(v6Length)
+  // this action does not stop the processing
+  SetECSPrefixLengthAction(uint16_t v4Length, uint16_t v6Length) : d_v4PrefixLength(v4Length), d_v6PrefixLength(v6Length)
   {
   }
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
@@ -908,10 +949,11 @@ private:
   uint16_t d_v6PrefixLength;
 };
 
-class ECSOverrideAction : public DNSAction
+class SetECSOverrideAction : public DNSAction
 {
 public:
-  ECSOverrideAction(bool ecsOverride) : d_ecsOverride(ecsOverride)
+  // this action does not stop the processing
+  SetECSOverrideAction(bool ecsOverride) : d_ecsOverride(ecsOverride)
   {
   }
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
@@ -928,9 +970,10 @@ private:
 };
 
 
-class DisableECSAction : public DNSAction
+class SetDisableECSAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
   {
     dq->useECS = false;
@@ -945,6 +988,7 @@ public:
 class SetECSAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   SetECSAction(const Netmask& v4): d_v4(v4), d_hasV6(false)
   {
   }
@@ -986,6 +1030,7 @@ private:
 class DnstapLogAction : public DNSAction, public boost::noncopyable
 {
 public:
+  // this action does not stop the processing
   DnstapLogAction(const std::string& identity, std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(DNSQuestion*, DnstapMessage*)> > alterFunc): d_identity(identity), d_logger(logger), d_alterFunc(alterFunc)
   {
   }
@@ -1019,6 +1064,7 @@ private:
 class RemoteLogAction : public DNSAction, public boost::noncopyable
 {
 public:
+  // this action does not stop the processing
   RemoteLogAction(std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(DNSQuestion*, DNSDistProtoBufMessage*)> > alterFunc, const std::string& serverID, const std::string& ipEncryptKey): d_logger(logger), d_alterFunc(alterFunc), d_serverID(serverID), d_ipEncryptKey(ipEncryptKey)
   {
   }
@@ -1066,6 +1112,7 @@ private:
 class SNMPTrapAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   SNMPTrapAction(const std::string& reason): d_reason(reason)
   {
   }
@@ -1085,10 +1132,11 @@ private:
   std::string d_reason;
 };
 
-class TagAction : public DNSAction
+class SetTagAction : public DNSAction
 {
 public:
-  TagAction(const std::string& tag, const std::string& value): d_tag(tag), d_value(value)
+  // this action does not stop the processing
+  SetTagAction(const std::string& tag, const std::string& value): d_tag(tag), d_value(value)
   {
   }
   DNSAction::Action operator()(DNSQuestion* dq, std::string* ruleresult) const override
@@ -1113,6 +1161,7 @@ private:
 class DnstapLogResponseAction : public DNSResponseAction, public boost::noncopyable
 {
 public:
+  // this action does not stop the processing
   DnstapLogResponseAction(const std::string& identity, std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(DNSResponse*, DnstapMessage*)> > alterFunc): d_identity(identity), d_logger(logger), d_alterFunc(alterFunc)
   {
   }
@@ -1148,6 +1197,7 @@ private:
 class RemoteLogResponseAction : public DNSResponseAction, public boost::noncopyable
 {
 public:
+  // this action does not stop the processing
   RemoteLogResponseAction(std::shared_ptr<RemoteLoggerInterface>& logger, boost::optional<std::function<void(DNSResponse*, DNSDistProtoBufMessage*)> > alterFunc, const std::string& serverID, const std::string& ipEncryptKey, bool includeCNAME): d_logger(logger), d_alterFunc(alterFunc), d_serverID(serverID), d_ipEncryptKey(ipEncryptKey), d_includeCNAME(includeCNAME)
   {
   }
@@ -1223,10 +1273,11 @@ class DelayResponseAction : public DNSResponseAction
 {
 public:
   DelayResponseAction(int msec) : d_msec(msec)
-  {}
+  {
+  }
   DNSResponseAction::Action operator()(DNSResponse* dr, std::string* ruleresult) const override
   {
-    *ruleresult=std::to_string(d_msec);
+    *ruleresult = std::to_string(d_msec);
     return Action::Delay;
   }
   std::string toString() const override
@@ -1240,6 +1291,7 @@ private:
 class SNMPTrapResponseAction : public DNSResponseAction
 {
 public:
+  // this action does not stop the processing
   SNMPTrapResponseAction(const std::string& reason): d_reason(reason)
   {
   }
@@ -1259,10 +1311,11 @@ private:
   std::string d_reason;
 };
 
-class TagResponseAction : public DNSResponseAction
+class SetTagResponseAction : public DNSResponseAction
 {
 public:
-  TagResponseAction(const std::string& tag, const std::string& value): d_tag(tag), d_value(value)
+  // this action does not stop the processing
+  SetTagResponseAction(const std::string& tag, const std::string& value): d_tag(tag), d_value(value)
   {
   }
   DNSResponseAction::Action operator()(DNSResponse* dr, std::string* ruleresult) const override
@@ -1287,6 +1340,7 @@ private:
 class ContinueAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   ContinueAction(std::shared_ptr<DNSAction>& action): d_action(action)
   {
   }
@@ -1355,6 +1409,7 @@ private:
 class KeyValueStoreLookupAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   KeyValueStoreLookupAction(std::shared_ptr<KeyValueStore>& kvs, std::shared_ptr<KeyValueLookupKey>& lookupKey, const std::string& destinationTag): d_kvs(kvs), d_key(lookupKey), d_tag(destinationTag)
   {
   }
@@ -1389,10 +1444,10 @@ private:
   std::string d_tag;
 };
 
-class SetNegativeAndSOAAction: public DNSAction
+class NegativeAndSOAAction: public DNSAction
 {
 public:
-  SetNegativeAndSOAAction(bool nxd, const DNSName& zone, uint32_t ttl, const DNSName& mname, const DNSName& rname, uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum): d_zone(zone), d_mname(mname), d_rname(rname), d_ttl(ttl), d_serial(serial), d_refresh(refresh), d_retry(retry), d_expire(expire), d_minimum(minimum), d_nxd(nxd)
+  NegativeAndSOAAction(bool nxd, const DNSName& zone, uint32_t ttl, const DNSName& mname, const DNSName& rname, uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum): d_zone(zone), d_mname(mname), d_rname(rname), d_ttl(ttl), d_serial(serial), d_refresh(refresh), d_retry(retry), d_expire(expire), d_minimum(minimum), d_nxd(nxd)
   {
   }
 
@@ -1430,6 +1485,7 @@ private:
 class SetProxyProtocolValuesAction : public DNSAction
 {
 public:
+  // this action does not stop the processing
   SetProxyProtocolValuesAction(const std::vector<std::pair<uint8_t, std::string>>& values)
   {
     d_values.reserve(values.size());
@@ -1458,10 +1514,11 @@ private:
   std::vector<ProxyProtocolValue> d_values;
 };
 
-class AddProxyProtocolValueAction : public DNSAction
+class SetAdditionalProxyProtocolValueAction : public DNSAction
 {
 public:
-  AddProxyProtocolValueAction(uint8_t type, const std::string& value): d_value(value), d_type(type)
+  // this action does not stop the processing
+  SetAdditionalProxyProtocolValueAction(uint8_t type, const std::string& value): d_value(value), d_type(type)
   {
   }
 
@@ -1618,12 +1675,22 @@ void setupLuaActions(LuaContext& luaCtx)
       return std::shared_ptr<DNSAction>(new LuaFFIAction(func));
     });
 
+  luaCtx.writeFunction("SetNoRecurseAction", []() {
+      return std::shared_ptr<DNSAction>(new SetNoRecurseAction);
+    });
+
   luaCtx.writeFunction("NoRecurseAction", []() {
-      return std::shared_ptr<DNSAction>(new NoRecurseAction);
+      warnlog("access to NoRecurseAction is deprecated, please use SetNoRecurseAction instead");
+      return std::shared_ptr<DNSAction>(new SetNoRecurseAction);
+    });
+
+  luaCtx.writeFunction("SetMacAddrAction", [](int code) {
+      return std::shared_ptr<DNSAction>(new SetMacAddrAction(code));
     });
 
   luaCtx.writeFunction("MacAddrAction", [](int code) {
-      return std::shared_ptr<DNSAction>(new MacAddrAction(code));
+      warnlog("access to MacAddrAction is deprecated, please use SetMacAddrAction instead");
+      return std::shared_ptr<DNSAction>(new SetMacAddrAction(code));
     });
 
   luaCtx.writeFunction("PoolAction", [](const std::string& a) {
@@ -1688,10 +1755,15 @@ void setupLuaActions(LuaContext& luaCtx)
       return std::shared_ptr<DNSAction>(new TCAction);
     });
 
-  luaCtx.writeFunction("DisableValidationAction", []() {
-      return std::shared_ptr<DNSAction>(new DisableValidationAction);
+  luaCtx.writeFunction("SetDisableValidationAction", []() {
+      return std::shared_ptr<DNSAction>(new SetDisableValidationAction);
     });
 
+  luaCtx.writeFunction("DisableValidationAction", []() {
+      warnlog("access to DisableValidationAction is deprecated, please use SetDisableValidationAction instead");
+      return std::shared_ptr<DNSAction>(new SetDisableValidationAction);
+  });
+
   luaCtx.writeFunction("LogAction", [](boost::optional<std::string> fname, boost::optional<bool> binary, boost::optional<bool> append, boost::optional<bool> buffered, boost::optional<bool> verboseOnly, boost::optional<bool> includeTimestamp) {
       return std::shared_ptr<DNSAction>(new LogAction(fname ? *fname : "", binary ? *binary : true, append ? *append : false, buffered ? *buffered : false, verboseOnly ? *verboseOnly : true, includeTimestamp ? *includeTimestamp : false));
     });
@@ -1714,16 +1786,26 @@ void setupLuaActions(LuaContext& luaCtx)
       return ret;
     });
 
+  luaCtx.writeFunction("SetSkipCacheAction", []() {
+      return std::shared_ptr<DNSAction>(new SetSkipCacheAction);
+    });
+
   luaCtx.writeFunction("SkipCacheAction", []() {
-      return std::shared_ptr<DNSAction>(new SkipCacheAction);
+      warnlog("access to SkipCacheAction is deprecated, please use SetSkipCacheAction instead");
+      return std::shared_ptr<DNSAction>(new SetSkipCacheAction);
     });
 
-  luaCtx.writeFunction("SkipCacheResponseAction", []() {
-      return std::shared_ptr<DNSResponseAction>(new SkipCacheResponseAction);
+  luaCtx.writeFunction("SetSkipCacheResponseAction", []() {
+      return std::shared_ptr<DNSResponseAction>(new SetSkipCacheResponseAction);
+    });
+
+  luaCtx.writeFunction("SetTempFailureCacheTTLAction", [](int maxTTL) {
+      return std::shared_ptr<DNSAction>(new SetTempFailureCacheTTLAction(maxTTL));
     });
 
   luaCtx.writeFunction("TempFailureCacheTTLAction", [](int maxTTL) {
-      return std::shared_ptr<DNSAction>(new TempFailureCacheTTLAction(maxTTL));
+      warnlog("access to TempFailureCacheTTLAction is deprecated, please use SetTempFailureCacheTTLAction instead");
+      return std::shared_ptr<DNSAction>(new SetTempFailureCacheTTLAction(maxTTL));
     });
 
   luaCtx.writeFunction("DropResponseAction", []() {
@@ -1808,16 +1890,31 @@ void setupLuaActions(LuaContext& luaCtx)
       return std::shared_ptr<DNSAction>(new TeeAction(ComboAddress(remote, 53), addECS ? *addECS : false));
     });
 
+  luaCtx.writeFunction("SetECSPrefixLengthAction", [](uint16_t v4PrefixLength, uint16_t v6PrefixLength) {
+      return std::shared_ptr<DNSAction>(new SetECSPrefixLengthAction(v4PrefixLength, v6PrefixLength));
+    });
+
   luaCtx.writeFunction("ECSPrefixLengthAction", [](uint16_t v4PrefixLength, uint16_t v6PrefixLength) {
-      return std::shared_ptr<DNSAction>(new ECSPrefixLengthAction(v4PrefixLength, v6PrefixLength));
+      warnlog("access to ECSPrefixLengthAction is deprecated, please use SetECSPrefixLengthAction instead");
+      return std::shared_ptr<DNSAction>(new SetECSPrefixLengthAction(v4PrefixLength, v6PrefixLength));
+    });
+
+  luaCtx.writeFunction("SetECSOverrideAction", [](bool ecsOverride) {
+      return std::shared_ptr<DNSAction>(new SetECSOverrideAction(ecsOverride));
     });
 
   luaCtx.writeFunction("ECSOverrideAction", [](bool ecsOverride) {
-      return std::shared_ptr<DNSAction>(new ECSOverrideAction(ecsOverride));
+      warnlog("access to ECSOverrideAction is deprecated, please use SetECSOverrideAction instead");
+      return std::shared_ptr<DNSAction>(new SetECSOverrideAction(ecsOverride));
+    });
+
+  luaCtx.writeFunction("SetDisableECSAction", []() {
+      return std::shared_ptr<DNSAction>(new SetDisableECSAction());
     });
 
   luaCtx.writeFunction("DisableECSAction", []() {
-      return std::shared_ptr<DNSAction>(new DisableECSAction());
+      warnlog("access to DisableECSAction is deprecated, please use SetDisableECSAction instead");
+      return std::shared_ptr<DNSAction>(new SetDisableECSAction());
     });
 
   luaCtx.writeFunction("SetECSAction", [](const std::string v4, boost::optional<std::string> v6) {
@@ -1843,12 +1940,22 @@ void setupLuaActions(LuaContext& luaCtx)
 #endif /* HAVE_NET_SNMP */
     });
 
+  luaCtx.writeFunction("SetTagAction", [](std::string tag, std::string value) {
+      return std::shared_ptr<DNSAction>(new SetTagAction(tag, value));
+    });
+
   luaCtx.writeFunction("TagAction", [](std::string tag, std::string value) {
-      return std::shared_ptr<DNSAction>(new TagAction(tag, value));
+      warnlog("access to TagAction is deprecated, please use SetTagAction instead");
+      return std::shared_ptr<DNSAction>(new SetTagAction(tag, value));
+    });
+
+  luaCtx.writeFunction("SetTagResponseAction", [](std::string tag, std::string value) {
+      return std::shared_ptr<DNSResponseAction>(new SetTagResponseAction(tag, value));
     });
 
   luaCtx.writeFunction("TagResponseAction", [](std::string tag, std::string value) {
-      return std::shared_ptr<DNSResponseAction>(new TagResponseAction(tag, value));
+      warnlog("access to TagResponseAction is deprecated, please use SetTagResponseAction instead");
+      return std::shared_ptr<DNSResponseAction>(new SetTagResponseAction(tag, value));
     });
 
   luaCtx.writeFunction("ContinueAction", [](std::shared_ptr<DNSAction> action) {
@@ -1868,9 +1975,17 @@ void setupLuaActions(LuaContext& luaCtx)
       return std::shared_ptr<DNSAction>(new KeyValueStoreLookupAction(kvs, lookupKey, destinationTag));
     });
 
+  luaCtx.writeFunction("NegativeAndSOAAction", [](bool nxd, const std::string& zone, uint32_t ttl, const std::string& mname, const std::string& rname, uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum, boost::optional<responseParams_t> vars) {
+      auto ret = std::shared_ptr<DNSAction>(new NegativeAndSOAAction(nxd, DNSName(zone), ttl, DNSName(mname), DNSName(rname), serial, refresh, retry, expire, minimum));
+      auto action = std::dynamic_pointer_cast<NegativeAndSOAAction>(ret);
+      parseResponseConfig(vars, action->d_responseConfig);
+      return ret;
+    });
+
   luaCtx.writeFunction("SetNegativeAndSOAAction", [](bool nxd, const std::string& zone, uint32_t ttl, const std::string& mname, const std::string& rname, uint32_t serial, uint32_t refresh, uint32_t retry, uint32_t expire, uint32_t minimum, boost::optional<responseParams_t> vars) {
-      auto ret = std::shared_ptr<DNSAction>(new SetNegativeAndSOAAction(nxd, DNSName(zone), ttl, DNSName(mname), DNSName(rname), serial, refresh, retry, expire, minimum));
-      auto action = std::dynamic_pointer_cast<SetNegativeAndSOAAction>(ret);
+      warnlog("access to SetNegativeAndSOAAction is deprecated, please use NegativeAndSOAAction instead");
+      auto ret = std::shared_ptr<DNSAction>(new NegativeAndSOAAction(nxd, DNSName(zone), ttl, DNSName(mname), DNSName(rname), serial, refresh, retry, expire, minimum));
+      auto action = std::dynamic_pointer_cast<NegativeAndSOAAction>(ret);
       parseResponseConfig(vars, action->d_responseConfig);
       return ret;
     });
@@ -1879,7 +1994,7 @@ void setupLuaActions(LuaContext& luaCtx)
       return std::shared_ptr<DNSAction>(new SetProxyProtocolValuesAction(values));
     });
 
-  luaCtx.writeFunction("AddProxyProtocolValueAction", [](uint8_t type, const std::string& value) {
-    return std::shared_ptr<DNSAction>(new AddProxyProtocolValueAction(type, value));
+  luaCtx.writeFunction("SetAdditionalProxyProtocolValueAction", [](uint8_t type, const std::string& value) {
+    return std::shared_ptr<DNSAction>(new SetAdditionalProxyProtocolValueAction(type, value));
   });
 }
index e424f5be6ce83f3a0660d675d5f7d1e49e83e5e3..c6aee687aaf95a9fe8bfa7a1d7209a8f1aacce1a 100644 (file)
@@ -9,10 +9,10 @@ This can be changed with :func:`setECSSourcePrefixV4` and :func:`setECSSourcePre
 
 In addition to the global settings, rules and Lua bindings can alter this behavior per query:
 
- * calling :func:`DisableECSAction` or setting ``dq.useECS`` to ``false`` prevents the sending of the ECS option.
- * calling :func:`ECSOverrideAction` or setting ``dq.ecsOverride`` will override the global :func:`setECSOverride` value.
- * calling :func:`ECSPrefixLengthAction(v4, v6)` or setting ``dq.ecsPrefixLength`` will override the global :func:`setECSSourcePrefixV4()` and :func:`setECSSourcePrefixV6()` values.
+ * calling :func:`SetDisableECSAction` or setting ``dq.useECS`` to ``false`` prevents the sending of the ECS option.
+ * calling :func:`SetECSOverrideAction` or setting ``dq.ecsOverride`` will override the global :func:`setECSOverride` value.
+ * calling :func:`SetECSPrefixLengthAction(v4, v6)` or setting ``dq.ecsPrefixLength`` will override the global :func:`setECSSourcePrefixV4()` and :func:`setECSSourcePrefixV6()` values.
 
-In effect this means that for the EDNS Client Subnet option to be added to the request, ``useClientSubnet`` should be set to ``true`` for the backend used (default to ``false``) and ECS should not have been disabled by calling :func:`DisableECSAction` or setting ``dq.useECS`` to ``false`` (default to true).
+In effect this means that for the EDNS Client Subnet option to be added to the request, ``useClientSubnet`` should be set to ``true`` for the backend used (default to ``false``) and ECS should not have been disabled by calling :func:`SetDisableECSAction` or setting ``dq.useECS`` to ``false`` (default to true).
 
 Note that any trailing data present in the incoming query is removed when an OPT (or XPF) record has to be inserted.
index 7c29c23e37281a1d3a335a00db6670c8921ecaaa..bb24b3fe9b205aa944d774da8a88e499d68f39d0 100644 (file)
@@ -6,7 +6,7 @@ This parameter indicates whether a Proxy Protocol version 2 (binary) header shou
 Such a Proxy Protocol header can also be passed from the client to dnsdist, using :func:`setProxyProtocolACL` to specify which clients to accept it from.
 If :func:`setProxyProtocolApplyACLToProxiedClients` is set (default is false), the general ACL will be applied to the source IP address as seen by dnsdist first, but also to the source IP address provided in the Proxy Protocol header.
 
-Custom values can be added to the header via :meth:`DNSQuestion:addProxyProtocolValue`, :meth:`DNSQuestion:setProxyProtocolValues`, :func:`AddProxyProtocolValueAction` and :func:`SetProxyProtocolValuesAction`.
+Custom values can be added to the header via :meth:`DNSQuestion:addProxyProtocolValue`, :meth:`DNSQuestion:setProxyProtocolValues`, :func:`SetAdditionalProxyProtocolValueAction` and :func:`SetProxyProtocolValuesAction`.
 Be careful that Proxy Protocol values are sent once at the beginning of the TCP connection for TCP and DoT queries.
 That means that values received on an incoming TCP connection will be inherited by subsequent queries received over the same incoming TCP connection, if any, but values set to a query will not be inherited by subsequent queries.
 Please also note that the maximum size of a Proxy Protocol header dnsdist is willing to accept is 512 bytes by default, although it can be set via :func:`setProxyProtocolMaximumPayloadSize`.
index 0a63305f4631809aae66b088554e7d65719348d6..2f18d39ee7ffee9b3495d82ead48d42255b84639 100644 (file)
@@ -13,7 +13,7 @@ As another example:
 
 .. code-block:: lua
 
-  addAction(MaxQPSIPRule(5), NoRecurseAction())
+  addAction(MaxQPSIPRule(5), SetNoRecurseAction())
 
 This strips the Recursion Desired (RD) bit from any traffic per IPv4 or IPv6 /64 that exceeds 5 qps. This means any those traffic bins is allowed to make a recursor do 'work' for only 5 qps.
 
index 930979e057471efa2639c982076742877ac242b8..62a4f68ce8dc02ed2d9b6adb1f8aac255b2f87de 100644 (file)
@@ -36,7 +36,7 @@ This measures traffic per IPv4 address and per /48 of IPv6, and if traffic for s
 
 As another example::
 
-  addAction(MaxQPSIPRule(5), NoRecurseAction())
+  addAction(MaxQPSIPRule(5), SetNoRecurseAction())
 
 This strips the Recursion Desired (RD) bit from any traffic per IPv4 or IPv6 /64 that exceeds 5 qps.
 This means any those traffic bins is allowed to make a recursor do 'work' for only 5 qps.
@@ -103,7 +103,7 @@ Rule Generators
   .. deprecated:: 1.2.0
 
   Set the CD (Checking Disabled) flag to 1 for all queries matching the DNSRule.
-  This function has been deprecated as of 1.2.0 and removed in 1.3.0. Please use the :func:`DisableValidationAction` action instead.
+  This function has been deprecated as of 1.2.0 and removed in 1.3.0. Please use the :func:`SetDisableValidationAction` action instead.
 
 .. function:: addDomainBlock(domain)
 
@@ -217,7 +217,7 @@ Rule Generators
   Clear the RD flag for all queries matching the rule.
   This function has been deprecated as of 1.2.0 and removed in 1.3.0, please use:
 
-    addAction(DNSRule, NoRecurseAction())
+    addAction(DNSRule, SetNoRecurseAction())
 
   :param DNSRule: match queries based on this rule
 
@@ -972,21 +972,19 @@ Actions
 -------
 
 :ref:`RulesIntro` need to be combined with an action for them to actually do something with the matched packets.
-Some actions allow further processing of rules, this is noted in their description.
-The following actions exist.
-
-.. function:: AddProxyProtocolValueAction(type, value)
-
-  .. versionadded:: 1.6.0
-
-  Add a Proxy-Protocol Type-Length value to be sent to the server along with this query. It does not replace any
-  existing value with the same type but adds a new value.
-  Be careful that Proxy Protocol values are sent once at the beginning of the TCP connection for TCP and DoT queries.
-  That means that values received on an incoming TCP connection will be inherited by subsequent queries received over
-  the same incoming TCP connection, if any, but values set to a query will not be inherited by subsequent queries.
+Some actions allow further processing of rules, this is noted in their description. Most of these start with 'Set' with a few exceptions, mostly for logging actions. These exceptions are:
+- :func:`KeyValueStoreLookupAction`
+- :func:`DnstapLogAction`
+- :func:`DnstapLogResponseAction`
+- :func:`LogAction`
+- :func:`NoneAction`
+- :func:`RemoteLogAction`
+- :func:`RemoteLogResponseAction`
+- :func:`SNMPTrapAction`
+- :func:`SNMPTrapResponseAction`
+- :func:`TeeAction`
 
-  :param int type: The type of the value to send, ranging from 0 to 255 (both included)
-  :param str value: The binary-safe value
+The following actions exist.
 
 .. function:: AllowAction()
 
@@ -1023,12 +1021,21 @@ The following actions exist.
 
 .. function:: DisableECSAction()
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetDisableECSAction` instead.
+
   Disable the sending of ECS to the backend.
   Subsequent rules are processed after this action.
 
 .. function:: DisableValidationAction()
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetDisableValidationAction` instead.
+
   Set the CD bit in the query and let it go through.
+  Subsequent rules are processed after this action.
 
 .. function:: DnstapLogAction(identity, logger[, alterFunction])
 
@@ -1064,6 +1071,10 @@ The following actions exist.
 
 .. function:: ECSOverrideAction(override)
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetECSOverrideAction` instead.
+
   Whether an existing EDNS Client Subnet value should be overridden (true) or not (false).
   Subsequent rules are processed after this action.
 
@@ -1071,13 +1082,16 @@ The following actions exist.
 
 .. function:: ECSPrefixLengthAction(v4, v6)
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetECSPrefixLengthAction` instead.
+
   Set the ECS prefix length.
   Subsequent rules are processed after this action.
 
   :param int v4: The IPv4 netmask length
   :param int v6: The IPv6 netmask length
 
-
 .. function:: ERCodeAction(rcode [, options])
 
   .. versionadded:: 1.4.0
@@ -1126,6 +1140,7 @@ The following actions exist.
   The store can be a CDB (:func:`newCDBKVStore`) or a LMDB database (:func:`newLMDBKVStore`).
   The key can be based on the qname (:func:`KeyValueLookupKeyQName` and :func:`KeyValueLookupKeySuffix`),
   source IP (:func:`KeyValueLookupKeySourceIP`) or the value of an existing tag (:func:`KeyValueLookupKeyTag`).
+  Subsequent rules are processed after this action.
 
   :param KeyValueStore kvs: The key value store to query
   :param KeyValueLookupKey lookupKey: The key to use for the lookup
@@ -1211,12 +1226,41 @@ The following actions exist.
 
 .. function:: MacAddrAction(option)
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetMacAddrAction` instead.
+
   Add the source MAC address to the query as EDNS0 option ``option``.
   This action is currently only supported on Linux.
   Subsequent rules are processed after this action.
 
   :param int option: The EDNS0 option number
 
+.. function:: NegativeAndSOAAction(nxd, zone, ttl, mname, rname, serial, refresh, retry, expire, minimum [, options])
+
+  .. versionadded:: 1.6.0
+
+  Turn a question into a response, either a NXDOMAIN or a NODATA one based on ''nxd'', setting the QR bit to 1 and adding a SOA record in the additional section.
+  Note that this function was called :func:`SetNegativeAndSOAAction` before 1.6.0.
+
+  :param bool nxd: Whether the answer is a NXDOMAIN (true) or a NODATA (false)
+  :param string zone: The owner name for the SOA record
+  :param int ttl: The TTL of the SOA record
+  :param string mname: The mname of the SOA record
+  :param string rname: The rname of the SOA record
+  :param int serial: The value of the serial field in the SOA record
+  :param int refresh: The value of the refresh field in the SOA record
+  :param int retry: The value of the retry field in the SOA record
+  :param int expire: The value of the expire field in the SOA record
+  :param int minimum: The value of the minimum field in the SOA record
+  :param table options: A table with key: value pairs with options
+
+  Options:
+
+  * ``aa``: bool - Set the AA bit to this value (true means the bit is set, false means it's cleared). Default is to clear it.
+  * ``ad``: bool - Set the AD bit to this value (true means the bit is set, false means it's cleared). Default is to clear it.
+  * ``ra``: bool - Set the RA bit to this value (true means the bit is set, false means it's cleared). Default is to copy the value of the RD bit from the incoming query.
+
 .. function:: NoneAction()
 
   Does nothing.
@@ -1224,6 +1268,10 @@ The following actions exist.
 
 .. function:: NoRecurseAction()
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`NoRecurseAction` instead.
+
   Strip RD bit from the question, let it go through.
   Subsequent rules are processed after this action.
 
@@ -1310,6 +1358,36 @@ The following actions exist.
   * ``serverID=""``: str - Set the Server Identity field.
   * ``ipEncryptKey=""``: str - A key, that can be generated via the :func:`makeIPCipherKey` function, to encrypt the IP address of the requestor for anonymization purposes. The encryption is done using ipcrypt for IPv4 and a 128-bit AES ECB operation for IPv6.
 
+.. function:: SetAdditionalProxyProtocolValueAction(type, value)
+
+  .. versionadded:: 1.6.0
+
+  Add a Proxy-Protocol Type-Length value to be sent to the server along with this query. It does not replace any
+  existing value with the same type but adds a new value.
+  Be careful that Proxy Protocol values are sent once at the beginning of the TCP connection for TCP and DoT queries.
+  That means that values received on an incoming TCP connection will be inherited by subsequent queries received over
+  the same incoming TCP connection, if any, but values set to a query will not be inherited by subsequent queries.
+  Subsequent rules are processed after this action.
+
+  :param int type: The type of the value to send, ranging from 0 to 255 (both included)
+  :param str value: The binary-safe value
+
+.. function:: SetDisableECSAction()
+
+  .. versionadded:: 1.6.0
+
+  Disable the sending of ECS to the backend.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`DisableECSAction` before 1.6.0.
+
+.. function:: SetDisableValidationAction()
+
+  .. versionadded:: 1.6.0
+
+  Set the CD bit in the query and let it go through.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`DisableValidationAction` before 1.6.0.
+
 .. function:: SetECSAction(v4 [, v6])
 
   .. versionadded:: 1.3.1
@@ -1323,10 +1401,54 @@ The following actions exist.
   :param string v4: The IPv4 netmask, for example "192.0.2.1/32"
   :param string v6: The IPv6 netmask, if any
 
+.. function:: SetECSOverrideAction(override)
+
+  .. versionadded:: 1.6.0
+
+  Whether an existing EDNS Client Subnet value should be overridden (true) or not (false).
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`ECSOverrideAction` before 1.6.0.
+
+  :param bool override: Whether or not to override ECS value
+
+.. function:: SetECSPrefixLengthAction(v4, v6)
+
+  .. versionadded:: 1.6.0
+
+  Set the ECS prefix length.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`ECSPrefixLengthAction` before 1.6.0.
+
+  :param int v4: The IPv4 netmask length
+  :param int v6: The IPv6 netmask length
+
+.. function:: SetMacAddrAction(option)
+
+  .. versionadded:: 1.6.0
+
+  Add the source MAC address to the query as EDNS0 option ``option``.
+  This action is currently only supported on Linux.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`MacAddrAction` before 1.6.0.
+
+  :param int option: The EDNS0 option number
+
+.. function:: SetNoRecurseAction()
+
+  .. versionadded:: 1.6.0
+
+  Strip RD bit from the question, let it go through.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`NoRecurseAction` before 1.6.0.
+
 .. function:: SetNegativeAndSOAAction(nxd, zone, ttl, mname, rname, serial, refresh, retry, expire, minimum [, options])
 
   .. versionadded:: 1.5.0
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`NegativeAndSOAAction` instead.
+
   Turn a question into a response, either a NXDOMAIN or a NODATA one based on ''nxd'', setting the QR bit to 1 and adding a SOA record in the additional section.
 
   :param bool nxd: Whether the answer is a NXDOMAIN (true) or a NODATA (false)
@@ -1352,18 +1474,65 @@ The following actions exist.
   .. versionadded:: 1.5.0
 
   Set the Proxy-Protocol Type-Length values to be sent to the server along with this query to ``values``.
+  Subsequent rules are processed after this action.
 
   :param table values: A table of types and values to send, for example: ``{ [0] = foo", [42] = "bar" }``
 
-.. function:: SkipCacheAction()
+.. function:: SetSkipCacheAction()
+
+  .. versionadded:: 1.6.0
 
   Don't lookup the cache for this query, don't store the answer.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`SkipCacheAction` before 1.6.0.
 
-.. function:: SkipCacheResponseAction()
+.. function:: SetSkipCacheResponseAction()
 
   .. versionadded:: 1.6.0
 
   Don't store this answer into the cache.
+  Subsequent rules are processed after this action.
+
+.. function:: SetTagAction(name, value)
+
+  .. versionadded:: 1.6.0
+
+  Associate a tag named ``name`` with a value of ``value`` to this query, that will be passed on to the response.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`TagAction` before 1.6.0.
+
+  :param string name: The name of the tag to set
+  :param string value: The value of the tag
+
+.. function:: SetTagResponseAction(name, value)
+
+  .. versionadded:: 1.6.0
+
+  Associate a tag named ``name`` with a value of ``value`` to this response.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`TagResponseAction` before 1.6.0.
+
+  :param string name: The name of the tag to set
+  :param string value: The value of the tag
+
+.. function:: SetTempFailureCacheTTLAction(ttl)
+
+  .. versionadded:: 1.6.0
+
+  Set the cache TTL to use for ServFail and Refused replies. TTL is not applied for successful replies.
+  Subsequent rules are processed after this action.
+  Note that this function was called :func:`TempFailureCacheTTLAction` before 1.6.0.
+
+  :param int ttl: Cache TTL for temporary failure replies
+
+.. function:: SkipCacheAction()
+
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetSkipAction` instead.
+
+  Don't lookup the cache for this query, don't store the answer.
+  Subsequent rules are processed after this action.
 
 .. function:: SNMPTrapAction([message])
 
@@ -1450,6 +1619,10 @@ The following actions exist.
 
   .. versionadded:: 1.3.0
 
+   .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetTagAction` instead.
+
   Associate a tag named ``name`` with a value of ``value`` to this query, that will be passed on to the response.
   Subsequent rules are processed after this action.
 
@@ -1460,6 +1633,10 @@ The following actions exist.
 
   .. versionadded:: 1.3.0
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetTagResponseAction` instead.
+
   Associate a tag named ``name`` with a value of ``value`` to this response.
   Subsequent rules are processed after this action.
 
@@ -1474,12 +1651,18 @@ The following actions exist.
 
   Send copy of query to ``remote``, keep stats on responses.
   If ``addECS`` is set to true, EDNS Client Subnet information will be added to the query.
+  Subsequent rules are processed after this action.
 
   :param string remote: An IP:PORT combination to send the copied queries to
   :param bool addECS: Whether or not to add ECS information. Default false
 
 .. function:: TempFailureCacheTTLAction(ttl)
 
+  .. deprecated:: 1.6.0
+
+  This function has been deprecated in 1.6.0, please use :func:`SetTempFailureCacheTTLAction` instead.
+
   Set the cache TTL to use for ServFail and Refused replies. TTL is not applied for successful replies.
+  Subsequent rules are processed after this action.
 
   :param int ttl: Cache TTL for temporary failure replies
index 7621691bb461baf17694b86d4f73459f0b5666c4..39063568ce5b0d15342a74b3e4501a64c504bbd7 100644 (file)
@@ -6,6 +6,19 @@ Upgrade Guide
 
 The packet cache no longer hashes EDNS Cookies by default, which means that two queries that are identical except for the content of their cookie will now be served the same answer. This only works if the backend is not returning any answer containing EDNS Cookies, otherwise the wrong cookie might be returned to a client. To prevent this, the ``cookieHashing=true`` parameter might be passed to :func:`newPacketCache` so that cookies are hashed, resulting in separate entries in the packet cache.
 
+Several actions have been renamed so that almost all actions that allow further processing of rules start with 'Set', to prevent mistakes:
+- ``DisableECSAction`` to :func:`SetDisableECSAction`
+- ``DisableValidationAction`` to :func:`SetDisableValidationAction`
+- ``ECSOverrideAction`` to :func:`SetECSOverrideAction`
+- ``ECSPrefixLengthAction`` to :func:`SetECSPrefixLengthAction`
+- ``MacAddrAction`` to :func:`SetMacAddrAction`
+- ``NoRecurseAction`` to :func:`SetTagResponseAction`
+- ``SkipCacheAction`` to :func:`SetTagResponseAction`
+- ``TagAction`` to :func:`SetTagResponseAction`
+- ``TagResponseAction`` to :func:`SetTagResponseAction`
+- ``TempFailureCacheTTLAction`` to :func:`SetAdditionalProxyProtocolValueAction`
+- ``SetNegativeAndSOAAction`` to :func:`NegativeAndSOAAction`
+
 1.4.x to 1.5.0
 --------------
 
index 943efa186b41ff7d5960afe2e2695128d61891a5..c4eb7c37360ba0db07b093484cbf2379d3c3a127 100644 (file)
@@ -98,7 +98,7 @@ class TestAdvancedFixupCase(DNSDistTest):
 class TestAdvancedRemoveRD(DNSDistTest):
 
     _config_template = """
-    addAction("norecurse.advanced.tests.powerdns.com.", NoRecurseAction())
+    addAction("norecurse.advanced.tests.powerdns.com.", SetNoRecurseAction())
     newServer{address="127.0.0.1:%s"}
     """
 
@@ -161,8 +161,8 @@ class TestAdvancedRemoveRD(DNSDistTest):
 class TestAdvancedAddCD(DNSDistTest):
 
     _config_template = """
-    addAction("setcd.advanced.tests.powerdns.com.", DisableValidationAction())
-    addAction(makeRule("setcdviaaction.advanced.tests.powerdns.com."), DisableValidationAction())
+    addAction("setcd.advanced.tests.powerdns.com.", SetDisableValidationAction())
+    addAction(makeRule("setcdviaaction.advanced.tests.powerdns.com."), SetDisableValidationAction())
     newServer{address="127.0.0.1:%s"}
     """
 
@@ -254,8 +254,8 @@ class TestAdvancedAddCD(DNSDistTest):
 class TestAdvancedClearRD(DNSDistTest):
 
     _config_template = """
-    addAction("clearrd.advanced.tests.powerdns.com.", NoRecurseAction())
-    addAction(makeRule("clearrdviaaction.advanced.tests.powerdns.com."), NoRecurseAction())
+    addAction("clearrd.advanced.tests.powerdns.com.", SetNoRecurseAction())
+    addAction(makeRule("clearrdviaaction.advanced.tests.powerdns.com."), SetNoRecurseAction())
     newServer{address="127.0.0.1:%s"}
     """
 
@@ -743,7 +743,7 @@ class TestAdvancedNonTerminalRule(DNSDistTest):
 
     _config_template = """
     newServer{address="127.0.0.1:%s", pool="real"}
-    addAction(AllRule(), DisableValidationAction())
+    addAction(AllRule(), SetDisableValidationAction())
     addAction(AllRule(), PoolAction("real"))
     addAction(AllRule(), DropAction())
     """
@@ -751,7 +751,7 @@ class TestAdvancedNonTerminalRule(DNSDistTest):
         """
         Advanced: Non terminal rules
 
-        We check that DisableValidationAction() is applied
+        We check that SetDisableValidationAction() is applied
         but does not stop the processing, then that
         PoolAction() is applied _and_ stop the processing.
         """
@@ -808,7 +808,7 @@ class TestAdvancedStringOnlyServer(DNSDistTest):
 class TestAdvancedRestoreFlagsOnSelfResponse(DNSDistTest):
 
     _config_template = """
-    addAction(AllRule(), DisableValidationAction())
+    addAction(AllRule(), SetDisableValidationAction())
     addAction(AllRule(), SpoofAction("192.0.2.1"))
     newServer{address="127.0.0.1:%s"}
     """
@@ -1799,7 +1799,7 @@ class TestAdvancedContinueAction(DNSDistTest):
     newServer{address="127.0.0.1:%s", pool="mypool"}
     addAction("nocontinue.continue-action.advanced.tests.powerdns.com.", PoolAction("mypool"))
     addAction("continue.continue-action.advanced.tests.powerdns.com.", ContinueAction(PoolAction("mypool")))
-    addAction(AllRule(), DisableValidationAction())
+    addAction(AllRule(), SetDisableValidationAction())
     """
 
     def testNoContinue(self):
@@ -1842,12 +1842,12 @@ class TestAdvancedContinueAction(DNSDistTest):
             self.assertEquals(receivedQuery, expectedQuery)
             self.assertEquals(receivedResponse, expectedResponse)
 
-class TestAdvancedSetNegativeAndSOA(DNSDistTest):
+class TestAdvancedNegativeAndSOA(DNSDistTest):
 
     _selfGeneratedPayloadSize = 1232
     _config_template = """
-    addAction("nxd.setnegativeandsoa.advanced.tests.powerdns.com.", SetNegativeAndSOAAction(true, "auth.", 42, "mname", "rname", 5, 4, 3, 2, 1))
-    addAction("nodata.setnegativeandsoa.advanced.tests.powerdns.com.", SetNegativeAndSOAAction(false, "another-auth.", 42, "mname", "rname", 1, 2, 3, 4, 5))
+    addAction("nxd.negativeandsoa.advanced.tests.powerdns.com.", NegativeAndSOAAction(true, "auth.", 42, "mname", "rname", 5, 4, 3, 2, 1))
+    addAction("nodata.negativeandsoa.advanced.tests.powerdns.com.", NegativeAndSOAAction(false, "another-auth.", 42, "mname", "rname", 1, 2, 3, 4, 5))
     setPayloadSizeOnSelfGeneratedAnswers(%d)
     newServer{address="127.0.0.1:%s"}
     """
@@ -1856,9 +1856,9 @@ class TestAdvancedSetNegativeAndSOA(DNSDistTest):
 
     def testAdvancedNegativeAndSOANXD(self):
         """
-        Advanced: SetNegativeAndSOAAction NXD
+        Advanced: NegativeAndSOAAction NXD
         """
-        name = 'nxd.setnegativeandsoa.advanced.tests.powerdns.com.'
+        name = 'nxd.negativeandsoa.advanced.tests.powerdns.com.'
         # no EDNS
         query = dns.message.make_query(name, 'A', 'IN', use_edns=False)
         query.flags &= ~dns.flags.RD
@@ -1895,9 +1895,9 @@ class TestAdvancedSetNegativeAndSOA(DNSDistTest):
 
     def testAdvancedNegativeAndSOANoData(self):
         """
-        Advanced: SetNegativeAndSOAAction NoData
+        Advanced: NegativeAndSOAAction NoData
         """
-        name = 'nodata.setnegativeandsoa.advanced.tests.powerdns.com.'
+        name = 'nodata.negativeandsoa.advanced.tests.powerdns.com.'
         # no EDNS
         query = dns.message.make_query(name, 'A', 'IN', use_edns=False)
         query.flags &= ~dns.flags.RD
@@ -1950,7 +1950,7 @@ class TestAdvancedLuaRule(DNSDistTest):
       return true
     end
 
-    addAction(AllRule(), TagAction('a-tag', 'a-value'))
+    addAction(AllRule(), SetTagAction('a-tag', 'a-value'))
     addAction(LuaRule(luarulefunction), RCodeAction(DNSRCode.NOTIMP))
     addAction(AllRule(), RCodeAction(DNSRCode.REFUSED))
     -- newServer{address="127.0.0.1:%s"}
index be9927d4c1cc29c53c074c418e63240e5caf96ef..5cdb1752a6ae3317eadfd3ab7d7fe5186c0cfa6b 100644 (file)
@@ -11,8 +11,8 @@ class TestCaching(DNSDistTest):
     _config_template = """
     pc = newPacketCache(100, {maxTTL=86400, minTTL=1})
     getPool(""):setCache(pc)
-    addAction(makeRule("nocache.cache.tests.powerdns.com."), SkipCacheAction())
-    addResponseAction(makeRule("nocache-response.cache.tests.powerdns.com."), SkipCacheResponseAction())
+    addAction(makeRule("nocache.cache.tests.powerdns.com."), SetSkipCacheAction())
+    addResponseAction(makeRule("nocache-response.cache.tests.powerdns.com."), SetSkipCacheResponseAction())
     function skipViaLua(dq)
         dq.skipCache = true
         return DNSAction.None, ""
@@ -139,7 +139,7 @@ class TestCaching(DNSDistTest):
 
     def testSkipCache(self):
         """
-        Cache: SkipCacheAction
+        Cache: SetSkipCacheAction
 
         dnsdist is configured to not cache entries for nocache.cache.tests.powerdns.com.
          we are sending several requests and checking that the backend get them all.
@@ -203,7 +203,7 @@ class TestCaching(DNSDistTest):
 
     def testSkipCacheResponse(self):
         """
-        Cache: SkipCacheResponseAction
+        Cache: SetSkipCacheResponseAction
 
         dnsdist is configured to not cache entries for answer matching nocache-response.cache.tests.powerdns.com.
          we are sending several requests and checking that the backend get them all.
@@ -811,7 +811,7 @@ class TestTempFailureCacheTTLAction(DNSDistTest):
     _config_template = """
     pc = newPacketCache(100, {maxTTL=86400, minTTL=1})
     getPool(""):setCache(pc)
-    addAction("servfail.cache.tests.powerdns.com.", TempFailureCacheTTLAction(1))
+    addAction("servfail.cache.tests.powerdns.com.", SetTempFailureCacheTTLAction(1))
     newServer{address="127.0.0.1:%d"}
     """
 
@@ -2289,7 +2289,7 @@ class TestCachingScopeZero(DNSDistTest):
     -- we will force the ECS value added to the query if RD is set (note that we need
     -- to unset it using rules before the first cache lookup)
     addAction(RDRule(), SetECSAction("192.0.2.1/32"))
-    addAction(RDRule(), NoRecurseAction())
+    addAction(RDRule(), SetNoRecurseAction())
     """
 
     def testScopeZero(self):
@@ -2477,7 +2477,7 @@ class TestCachingScopeZeroButNoSubnetcheck(DNSDistTest):
     -- we will force the ECS value added to the query if RD is set (note that we need
     -- to unset it using rules before the first cache lookup)
     addAction(RDRule(), SetECSAction("192.0.2.1/32"))
-    addAction(RDRule(), NoRecurseAction())
+    addAction(RDRule(), SetNoRecurseAction())
     """
 
     def testScopeZero(self):
index efa909df5c3f85c42cfe2dfbe2c52eb1459e6428..00bf1adb4341e38052894f99c9cf61c292535b40 100644 (file)
@@ -663,7 +663,7 @@ class TestEdnsClientSubnetOverride(DNSDistTest):
 class TestECSDisabledByRuleOrLua(DNSDistTest):
     """
     dnsdist is configured to add the EDNS0 Client Subnet
-    option, but we disable it via DisableECSAction()
+    option, but we disable it via SetDisableECSAction()
     or Lua.
     """
 
@@ -672,7 +672,7 @@ class TestECSDisabledByRuleOrLua(DNSDistTest):
     setECSSourcePrefixV4(16)
     setECSSourcePrefixV6(16)
     newServer{address="127.0.0.1:%s", useClientSubnet=true}
-    addAction(makeRule("disabled.ecsrules.tests.powerdns.com."), DisableECSAction())
+    addAction(makeRule("disabled.ecsrules.tests.powerdns.com."), SetDisableECSAction())
     function disableECSViaLua(dq)
         dq.useECS = false
         return DNSAction.None, ""
@@ -757,7 +757,7 @@ class TestECSOverrideSetByRuleOrLua(DNSDistTest):
     """
     dnsdist is configured to set the EDNS0 Client Subnet
     option without overriding an existing one, but we
-    force the overriding via ECSOverrideAction() or Lua.
+    force the overriding via SetECSOverrideAction() or Lua.
     """
 
     _config_template = """
@@ -765,7 +765,7 @@ class TestECSOverrideSetByRuleOrLua(DNSDistTest):
     setECSSourcePrefixV4(24)
     setECSSourcePrefixV6(56)
     newServer{address="127.0.0.1:%s", useClientSubnet=true}
-    addAction(makeRule("overridden.ecsrules.tests.powerdns.com."), ECSOverrideAction(true))
+    addAction(makeRule("overridden.ecsrules.tests.powerdns.com."), SetECSOverrideAction(true))
     function overrideECSViaLua(dq)
         dq.ecsOverride = true
         return DNSAction.None, ""
@@ -856,7 +856,7 @@ class TestECSPrefixLengthSetByRuleOrLua(DNSDistTest):
     """
     dnsdist is configured to set the EDNS0 Client Subnet
     option with a prefix length of 24 for IPv4 and 56 for IPv6,
-    but we override that to 32 and 128 via ECSPrefixLengthAction() or Lua.
+    but we override that to 32 and 128 via SetECSPrefixLengthAction() or Lua.
     """
 
     _config_template = """
@@ -864,7 +864,7 @@ class TestECSPrefixLengthSetByRuleOrLua(DNSDistTest):
     setECSSourcePrefixV4(24)
     setECSSourcePrefixV6(56)
     newServer{address="127.0.0.1:%s", useClientSubnet=true}
-    addAction(makeRule("overriddenprefixlength.ecsrules.tests.powerdns.com."), ECSPrefixLengthAction(32, 128))
+    addAction(makeRule("overriddenprefixlength.ecsrules.tests.powerdns.com."), SetECSPrefixLengthAction(32, 128))
     function overrideECSPrefixLengthViaLua(dq)
         dq.ecsPrefixLength = 32
         return DNSAction.None, ""
index 761caee597596a3a5743f2d69e9abfcb651472a7..48c56c83048801d3ce61a5c72b904ab6503cd298 100644 (file)
@@ -454,8 +454,8 @@ class TestProxyProtocolIncoming(ProxyProtocolTest):
 
     -- add these values for all queries
     addAction("proxy-protocol-incoming.tests.powerdns.com.", LuaAction(addValues))
-    addAction("proxy-protocol-incoming.tests.powerdns.com.", AddProxyProtocolValueAction(1, "dnsdist"))
-    addAction("proxy-protocol-incoming.tests.powerdns.com.", AddProxyProtocolValueAction(255, "proxy-protocol"))
+    addAction("proxy-protocol-incoming.tests.powerdns.com.", SetAdditionalProxyProtocolValueAction(1, "dnsdist"))
+    addAction("proxy-protocol-incoming.tests.powerdns.com.", SetAdditionalProxyProtocolValueAction(255, "proxy-protocol"))
 
     -- override all existing values
     addAction("override.proxy-protocol-incoming.tests.powerdns.com.", SetProxyProtocolValuesAction({["50"]="overridden"}))
index c0c8ebb675882aadf4dc1636092ab76f484344fc..20cfaf9a6fe9c32dd4aa01d3fe0ff99aef068e4f 100644 (file)
@@ -28,7 +28,7 @@ class TestTCPKeepAlive(DNSDistTest):
     setMaxTCPConnectionDuration(%s)
     pc = newPacketCache(100, {maxTTL=86400, minTTL=1})
     getPool(""):setCache(pc)
-    addAction("largernumberofconnections.tcpka.tests.powerdns.com.", SkipCacheAction())
+    addAction("largernumberofconnections.tcpka.tests.powerdns.com.", SetSkipCacheAction())
     addAction("refused.tcpka.tests.powerdns.com.", RCodeAction(DNSRCode.REFUSED))
     addAction("dropped.tcpka.tests.powerdns.com.", DropAction())
     addResponseAction("dropped-response.tcpka.tests.powerdns.com.", DropResponseAction())
index 246416f6201457c4e48d8c33c94d5fce9a38cd17..28e12bde86b5eb3edcb6bb9457ba968691d3e54e 100644 (file)
@@ -13,10 +13,10 @@ class TestTags(DNSDistTest):
     end
     addAction(AllRule(), LuaAction(lol))
 
-    addAction("tag-me-dns-1.tags.tests.powerdns.com.", TagAction("dns", "value1"))
-    addAction("tag-me-dns-2.tags.tests.powerdns.com.", TagAction("dns", "value2"))
-    addAction("tag-me-response-1.tags.tests.powerdns.com.", TagAction("response", "value1"))
-    addAction("tag-me-response-2.tags.tests.powerdns.com.", TagAction("response", "value2"))
+    addAction("tag-me-dns-1.tags.tests.powerdns.com.", SetTagAction("dns", "value1"))
+    addAction("tag-me-dns-2.tags.tests.powerdns.com.", SetTagAction("dns", "value2"))
+    addAction("tag-me-response-1.tags.tests.powerdns.com.", SetTagAction("response", "value1"))
+    addAction("tag-me-response-2.tags.tests.powerdns.com.", SetTagAction("response", "value2"))
 
     addAction(TagRule("not-dns"), SpoofAction("1.2.3.4"))
     addAction(TagRule("dns", "value1"), SpoofAction("1.2.3.50"))
@@ -36,7 +36,7 @@ class TestTags(DNSDistTest):
     addResponseAction(TagRule("response", "value1"), LuaResponseAction(responseHandlerSetTC))
     addResponseAction(TagRule("response", "no-match-value"), DropResponseAction())
 
-    addResponseAction("tag-me-response-3.tags.tests.powerdns.com.", TagResponseAction("response-tag", "value"))
+    addResponseAction("tag-me-response-3.tags.tests.powerdns.com.", SetTagResponseAction("response-tag", "value"))
     addResponseAction(TagRule("response-tag"), LuaResponseAction(responseHandlerUnsetQR))
     """