]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Change the type of g_TCPFastOpenKey and related variables
authorY7n05h <Y7n05h@protonmail.com>
Mon, 4 Apr 2022 11:11:11 +0000 (19:11 +0800)
committerY7n05h <Y7n05h@protonmail.com>
Mon, 4 Apr 2022 11:43:30 +0000 (19:43 +0800)
Signed-off-by: Y7n05h <Y7n05h@protonmail.com>
pdns/dnsdist-lua.cc
pdns/dnsdist.cc

index 1ea0da2d6887e72345ea0f43e0f4de99f9968bb7..a08b6d4ae3259c054c8347a10de6db5c820d5939 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#include <cstdint>
 #include <dirent.h>
 #include <fstream>
+#include <cinttypes>
 
 // for OpenBSD, sys/socket.h needs to come before net/if.h
 #include <sys/socket.h>
@@ -1990,13 +1992,13 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
   luaCtx.writeFunction("setTCPInternalPipeBufferSize", [](uint64_t size) { g_tcpInternalPipeBufferSize = size; });
   luaCtx.writeFunction("setTCPFastOpenKey", [](const std::string& keyString) {
     setLuaSideEffect();
-    unsigned int key[4] = {};
-    auto ret = sscanf(keyString.c_str(), "%x-%x-%x-%x", &key[0], &key[1], &key[2], &key[3]);
+    uint32_t key[4] = {};
+    auto ret = sscanf(keyString.c_str(), "%" SCNx32 "%" SCNx32 "%" SCNx32 "%" SCNx32, &key[0], &key[1], &key[2], &key[3]);
     if (ret != 4) {
       g_outputBuffer = "Invalid value passed to setTCPFastOpenKey()!\n";
       return;
     }
-    extern vector<unsigned int> g_TCPFastOpenKey;
+    extern vector<uint32_t> g_TCPFastOpenKey;
     for (const auto i : key) {
       g_TCPFastOpenKey.push_back(i);
     }
index 5ac0cccf6d12209e381e67e6a9a63f4465c77adc..f71d169fa1003ca2c3e83917c57d697ff597c109 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "config.h"
 
+#include <cstdint>
 #include <fstream>
 #include <getopt.h>
 #include <grp.h>
@@ -111,7 +112,7 @@ std::vector<std::shared_ptr<DynBPFFilter> > g_dynBPFFilters;
 std::vector<std::unique_ptr<ClientState>> g_frontends;
 GlobalStateHolder<pools_t> g_pools;
 size_t g_udpVectorSize{1};
-std::vector<unsigned int> g_TCPFastOpenKey;
+std::vector<uint32_t> g_TCPFastOpenKey;
 /* UDP: the grand design. Per socket we listen on for incoming queries there is one thread.
    Then we have a bunch of connected sockets for talking to downstream servers.
    We send directly to those sockets.