]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Apply Charles-Henri's suggestions (many thanks!)
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 14 Nov 2023 14:20:00 +0000 (15:20 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 14 Nov 2023 14:50:45 +0000 (15:50 +0100)
pdns/dnsdist-console.cc
pdns/dnsdist-dynblocks.hh
pdns/dnsdist-lua-inspection.cc
pdns/dnsdist-lua.cc
pdns/dnsdistdist/docs/reference/config.rst

index 0856ec9b88e5c037fc1c95fb5ecda839bed1b6d5..ac2d1a1aa8ca9d735b59a6c64fd9bafbe9cee9d2 100644 (file)
@@ -471,7 +471,7 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "addDNSCryptBind", true, "\"127.0.0.1:8443\", \"provider name\", \"/path/to/resolver.cert\", \"/path/to/resolver.key\", {reusePort=false, tcpFastOpenQueueSize=0, interface=\"\", cpus={}}", "listen to incoming DNSCrypt queries on 127.0.0.1 port 8443, with a provider name of `provider name`, using a resolver certificate and associated key stored respectively in the `resolver.cert` and `resolver.key` files. The fifth optional parameter is a table of parameters" },
   { "addDOHLocal", true, "addr, certFile, keyFile [, urls [, vars]]", "listen to incoming DNS over HTTPS queries on the specified address using the specified certificate and key. The last two parameters are tables" },
   { "addDOQLocal", true, "addr, certFile, keyFile [, vars]", "listen to incoming DNS over QUIC queries on the specified address using the specified certificate and key. The last parameter is a table" },
-  { "addDynamicBlock", true, "address, message[, action [, seconds [clientIPMask [, clientIPPortMask]]]]", "block the set of addresses with message `msg`, for `seconds` seconds (10 by default), applying `action` (default to the one set with `setDynBlocksAction()`)" },
+  { "addDynamicBlock", true, "address, message[, action [, seconds [clientIPMask [, clientIPPortMask]]]]", "block the set of addresses with message `msg`, for `seconds` seconds (10 by default), applying `action` (default to the one set with `setDynBlocksAction()`)" },
   { "addDynBlocks", true, "addresses, message[, seconds[, action]]", "block the set of addresses with message `msg`, for `seconds` seconds (10 by default), applying `action` (default to the one set with `setDynBlocksAction()`)" },
   { "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" },
@@ -525,7 +525,7 @@ const std::vector<ConsoleKeyword> g_consoleKeywords{
   { "getCacheInsertedResponseRule", true, "selector", "Return the cache-inserted response rule corresponding to the selector, if any" },
   { "getCurrentTime", true, "", "returns the current time" },
   { "getDynamicBlocks", true, "", "returns a table of the current network-based dynamic blocks" },
-  { "getSMTDynamicBlocks", true, "", "returns a table of the current suffix-based dynamic blocks" },
+  { "getDynamicBlocksSMT", true, "", "returns a table of the current suffix-based dynamic blocks" },
   { "getDNSCryptBind", true, "n", "return the `DNSCryptContext` object corresponding to the bind `n`" },
   { "getDNSCryptBindCount", true, "", "returns the number of DNSCrypt listeners" },
   { "getDOHFrontend", true, "n", "returns the DOH frontend with index n" },
index 65b036e9e6af72b908a9bb677802eede80d53cc0..29577068f06f047b2e1f5c2e21451151480508e3 100644 (file)
@@ -282,9 +282,9 @@ public:
     d_smtVisitorFFI = std::move(visitor);
   }
 
-  void setNewBlockHook(dnsdist_ffi_dynamic_block_inserted_hook& callback)
+  void setNewBlockHook(const dnsdist_ffi_dynamic_block_inserted_hook& callback)
   {
-    d_newBlockHook = std::move(callback);
+    d_newBlockHook = callback;
   }
 
   void setMasks(uint8_t v4, uint8_t v6, uint8_t port)
index 105d422ea8832cc02fe9ad64e6cdefe5d2e57e25..8ff1159ec57369fe1f6c2eb94a45ac3d7e5c972c 100644 (file)
@@ -860,7 +860,7 @@ void setupLuaInspection(LuaContext& luaCtx)
         group->setSuffixMatchRuleFFI(seconds, reason, blockDuration, action ? *action : DNSAction::Action::None, std::move(visitor));
       }
     });
-  luaCtx.registerFunction<void(std::shared_ptr<DynBlockRulesGroup>::*)(dnsdist_ffi_dynamic_block_inserted_hook)>("setNewBlockInsertedHook", [](std::shared_ptr<DynBlockRulesGroup>& group, dnsdist_ffi_dynamic_block_inserted_hook hook) {
+  luaCtx.registerFunction<void(std::shared_ptr<DynBlockRulesGroup>::*)(const dnsdist_ffi_dynamic_block_inserted_hook&)>("setNewBlockInsertedHook", [](std::shared_ptr<DynBlockRulesGroup>& group, const dnsdist_ffi_dynamic_block_inserted_hook& hook) {
       if (group) {
         group->setNewBlockHook(hook);
       }
index 6ed9b35190d55b7f6bdfda7f8fd899efa548b1a4..98ed3f09affe60c6b4f1da640118edfee28020a2 100644 (file)
@@ -1444,7 +1444,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     return entries;
   });
 
-  luaCtx.writeFunction("getSMTDynamicBlocks", []() {
+  luaCtx.writeFunction("getDynamicBlocksSMT", []() {
     setLuaNoSideEffect();
     struct timespec now
     {
index d264aed9298437ee334db19dae4cafd908f7daae..fbb80637701f11727f77a5a3b2ead0a89bc7a3cc 100644 (file)
@@ -1446,7 +1446,7 @@ Dynamic Blocks
 
   Return an associative table of active network-based dynamic blocks. The keys are the network IP or range that are blocked, the value are :class:`DynBlock` objects.
 
-.. function:: getSMTDynamicBlocks()
+.. function:: getDynamicBlocksSMT()
 
   .. versionadded:: 1.9.0