From: Remi Gacogne Date: Mon, 20 Nov 2023 16:23:43 +0000 (+0100) Subject: dnsdist: Fix a few clang-tidy warnings X-Git-Tag: dnsdist-1.9.0-alpha4~14^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c114cd18d8c925c80a260245f3db3ed8318f350e;p=thirdparty%2Fpdns.git dnsdist: Fix a few clang-tidy warnings --- diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index 44469c4b23..135b681961 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -1651,25 +1651,25 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) auto ctx = std::make_shared(providerName, certKeys); /* UDP */ - auto cs = std::make_unique(ComboAddress(addr, 443), false, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); - cs->dnscryptCtx = ctx; + auto clientState = std::make_unique(ComboAddress(addr, 443), false, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); + clientState->dnscryptCtx = ctx; g_dnsCryptLocals.push_back(ctx); - g_frontends.push_back(std::move(cs)); + g_frontends.push_back(std::move(clientState)); /* TCP */ - cs = std::make_unique(ComboAddress(addr, 443), true, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); - cs->dnscryptCtx = std::move(ctx); + clientState = std::make_unique(ComboAddress(addr, 443), true, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); + clientState->dnscryptCtx = std::move(ctx); if (tcpListenQueueSize > 0) { - cs->tcpListenQueueSize = tcpListenQueueSize; + clientState->tcpListenQueueSize = tcpListenQueueSize; } if (maxInFlightQueriesPerConn > 0) { - cs->d_maxInFlightQueriesPerConn = maxInFlightQueriesPerConn; + clientState->d_maxInFlightQueriesPerConn = maxInFlightQueriesPerConn; } if (tcpMaxConcurrentConnections > 0) { - cs->d_tcpConcurrentConnectionsLimit = tcpMaxConcurrentConnections; + clientState->d_tcpConcurrentConnectionsLimit = tcpMaxConcurrentConnections; } - g_frontends.push_back(std::move(cs)); + g_frontends.push_back(std::move(clientState)); } catch (const std::exception& e) { errlog("Error during addDNSCryptBind() processing: %s", e.what()); @@ -2574,17 +2574,17 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } g_dohlocals.push_back(frontend); - auto cs = std::make_unique(frontend->d_tlsContext.d_addr, true, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); - cs->dohFrontend = std::move(frontend); - cs->d_additionalAddresses = std::move(additionalAddresses); + auto clientState = std::make_unique(frontend->d_tlsContext.d_addr, true, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); + clientState->dohFrontend = std::move(frontend); + clientState->d_additionalAddresses = std::move(additionalAddresses); if (tcpListenQueueSize > 0) { - cs->tcpListenQueueSize = tcpListenQueueSize; + clientState->tcpListenQueueSize = tcpListenQueueSize; } if (tcpMaxConcurrentConnections > 0) { - cs->d_tcpConcurrentConnectionsLimit = tcpMaxConcurrentConnections; + clientState->d_tcpConcurrentConnectionsLimit = tcpMaxConcurrentConnections; } - g_frontends.push_back(std::move(cs)); + g_frontends.push_back(std::move(clientState)); #else /* HAVE_DNS_OVER_HTTPS */ throw std::runtime_error("addDOHLocal() called but DNS over HTTPS support is not present!"); #endif /* HAVE_DNS_OVER_HTTPS */ @@ -2655,11 +2655,11 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) checkAllParametersConsumed("addDOQLocal", vars); } g_doqlocals.push_back(frontend); - auto cs = std::make_unique(frontend->d_local, false, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); - cs->doqFrontend = std::move(frontend); - cs->d_additionalAddresses = std::move(additionalAddresses); + auto clientState = std::make_unique(frontend->d_local, false, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); + clientState->doqFrontend = std::move(frontend); + clientState->d_additionalAddresses = std::move(additionalAddresses); - g_frontends.push_back(std::move(cs)); + g_frontends.push_back(std::move(clientState)); #else throw std::runtime_error("addDOQLocal() called but DNS over QUIC support is not present!"); #endif @@ -2896,21 +2896,21 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) vinfolog("Loading default TLS provider '%s'", provider); } // only works pre-startup, so no sync necessary - auto cs = std::make_unique(frontend->d_addr, true, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); - cs->tlsFrontend = frontend; - cs->d_additionalAddresses = std::move(additionalAddresses); + auto clientState = std::make_unique(frontend->d_addr, true, reusePort, tcpFastOpenQueueSize, interface, cpus, allowProxyProtocol); + clientState->tlsFrontend = frontend; + clientState->d_additionalAddresses = std::move(additionalAddresses); if (tcpListenQueueSize > 0) { - cs->tcpListenQueueSize = tcpListenQueueSize; + clientState->tcpListenQueueSize = tcpListenQueueSize; } if (maxInFlightQueriesPerConn > 0) { - cs->d_maxInFlightQueriesPerConn = maxInFlightQueriesPerConn; + clientState->d_maxInFlightQueriesPerConn = maxInFlightQueriesPerConn; } if (tcpMaxConcurrentConns > 0) { - cs->d_tcpConcurrentConnectionsLimit = tcpMaxConcurrentConns; + clientState->d_tcpConcurrentConnectionsLimit = tcpMaxConcurrentConns; } - g_tlslocals.push_back(cs->tlsFrontend); - g_frontends.push_back(std::move(cs)); + g_tlslocals.push_back(clientState->tlsFrontend); + g_frontends.push_back(std::move(clientState)); } catch (const std::exception& e) { g_outputBuffer = "Error: " + string(e.what()) + "\n"; diff --git a/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc b/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc index b5aa47e816..98c37243e3 100644 --- a/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc +++ b/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc @@ -557,7 +557,7 @@ struct TestFixture BOOST_FIXTURE_TEST_CASE(test_SingleQuery, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -633,7 +633,7 @@ BOOST_FIXTURE_TEST_CASE(test_SingleQuery, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ConcurrentQueries, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -722,7 +722,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConcurrentQueries, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ConnectionReuse, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -830,7 +830,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConnectionReuse, TestFixture) BOOST_FIXTURE_TEST_CASE(test_InvalidDNSAnswer, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -911,7 +911,7 @@ BOOST_FIXTURE_TEST_CASE(test_InvalidDNSAnswer, TestFixture) BOOST_FIXTURE_TEST_CASE(test_TimeoutWhileWriting, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -998,7 +998,7 @@ BOOST_FIXTURE_TEST_CASE(test_TimeoutWhileWriting, TestFixture) BOOST_FIXTURE_TEST_CASE(test_TimeoutWhileReading, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1085,7 +1085,7 @@ BOOST_FIXTURE_TEST_CASE(test_TimeoutWhileReading, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ShortWrite, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1172,7 +1172,7 @@ BOOST_FIXTURE_TEST_CASE(test_ShortWrite, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ShortRead, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1266,7 +1266,7 @@ BOOST_FIXTURE_TEST_CASE(test_ShortRead, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ConnectionClosedWhileReading, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1352,7 +1352,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConnectionClosedWhileReading, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ConnectionClosedWhileWriting, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1446,7 +1446,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConnectionClosedWhileWriting, TestFixture) BOOST_FIXTURE_TEST_CASE(test_GoAwayFromServer, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1557,7 +1557,7 @@ BOOST_FIXTURE_TEST_CASE(test_GoAwayFromServer, TestFixture) BOOST_FIXTURE_TEST_CASE(test_HTTP500FromServer, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1650,7 +1650,7 @@ BOOST_FIXTURE_TEST_CASE(test_HTTP500FromServer, TestFixture) BOOST_FIXTURE_TEST_CASE(test_WrongStreamID, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1750,7 +1750,7 @@ BOOST_FIXTURE_TEST_CASE(test_WrongStreamID, TestFixture) BOOST_FIXTURE_TEST_CASE(test_ProxyProtocol, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); tlsCtx->d_needProxyProtocol = true; localCS.tlsFrontend = std::make_shared(tlsCtx); diff --git a/pdns/dnsdistdist/test-dnsdisttcp_cc.cc b/pdns/dnsdistdist/test-dnsdisttcp_cc.cc index d4d6089c77..a4c887aeef 100644 --- a/pdns/dnsdistdist/test-dnsdisttcp_cc.cc +++ b/pdns/dnsdistdist/test-dnsdisttcp_cc.cc @@ -488,7 +488,7 @@ static void testInit(const std::string& name, TCPClientThreadData& threadData) BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_SelfAnswered, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -735,7 +735,7 @@ BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_SelfAnswered, TestFixture) BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -865,7 +865,7 @@ BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionWithProxyProtocol_SelfAnswered, T BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_BackendNoOOOR, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); @@ -1765,7 +1765,7 @@ BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_BackendNoOOOR, TestFixture) BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); /* enable out-of-order on the front side */ localCS.d_maxInFlightQueriesPerConn = 65536; @@ -3905,7 +3905,7 @@ BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR, TestFixture) BOOST_FIXTURE_TEST_CASE(test_IncomingConnectionOOOR_BackendNotOOOR, TestFixture) { auto local = getBackendAddress("1", 80); - ClientState localCS(local, true, false, false, "", {}, true); + ClientState localCS(local, true, false, 0, "", {}, true); /* enable out-of-order on the front side */ localCS.d_maxInFlightQueriesPerConn = 65536;