From: Y7n05h Date: Mon, 4 Apr 2022 11:11:11 +0000 (+0800) Subject: dnsdist: Change the type of g_TCPFastOpenKey and related variables X-Git-Tag: rec-4.7.0-beta1~14^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=caaa8dbda5152eb0d61660223f42fa647fd10c9a;p=thirdparty%2Fpdns.git dnsdist: Change the type of g_TCPFastOpenKey and related variables Signed-off-by: Y7n05h --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 1ea0da2d68..a08b6d4ae3 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -20,8 +20,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include #include +#include // for OpenBSD, sys/socket.h needs to come before net/if.h #include @@ -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 g_TCPFastOpenKey; + extern vector g_TCPFastOpenKey; for (const auto i : key) { g_TCPFastOpenKey.push_back(i); } diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 5ac0cccf6d..f71d169fa1 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -22,6 +22,7 @@ #include "config.h" +#include #include #include #include @@ -111,7 +112,7 @@ std::vector > g_dynBPFFilters; std::vector> g_frontends; GlobalStateHolder g_pools; size_t g_udpVectorSize{1}; -std::vector g_TCPFastOpenKey; +std::vector 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.