From db5fbb8654d162d88d108ef78b05c8cb30a54b45 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 26 Oct 2021 11:53:24 +0200 Subject: [PATCH] dnsdist: Do not create outgoing UDP sockets for TCP-only backends --- pdns/dnsdist-lua.cc | 7 ++-- pdns/dnsdist.hh | 5 +-- pdns/dnsdistdist/dnsdist-backend.cc | 17 ++++++---- pdns/dnsdistdist/docs/reference/config.rst | 2 +- pdns/dnsdistdist/test-dnsdistlbpolicies_cc.cc | 34 +++++++++---------- pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc | 28 +++++++-------- pdns/dnsdistdist/test-dnsdisttcp_cc.cc | 12 +++---- 7 files changed, 57 insertions(+), 48 deletions(-) diff --git a/pdns/dnsdist-lua.cc b/pdns/dnsdist-lua.cc index a38474e6ba..019aebc8f2 100644 --- a/pdns/dnsdist-lua.cc +++ b/pdns/dnsdist-lua.cc @@ -352,7 +352,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) } // create but don't connect the socket in client or check-config modes - auto ret = std::make_shared(serverAddr, sourceAddr, sourceItf, sourceItfName, numberOfSockets, !(client || configCheck)); + auto ret = std::make_shared(serverAddr, sourceAddr, sourceItf, sourceItfName); if (!(client || configCheck)) { infolog("Added downstream server %s", serverAddr.toStringWithPort()); } @@ -561,6 +561,9 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) if (!ret->isTCPOnly() && !(client || configCheck)) { ret->idStates.resize(g_maxOutstanding); + if (!IsAnyAddress(ret->remote)) { + ret->connectUDPSockets(numberOfSockets); + } } /* this needs to be done _AFTER_ the order has been set, @@ -896,7 +899,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck) luaCtx.writeFunction("getServer", [client](boost::variant i) { if (client) { - return std::make_shared(ComboAddress(), ComboAddress(), 0, std::string(), 1, false); + return std::make_shared(ComboAddress()); } auto states = g_dstates.getCopy(); if (auto str = boost::get(&i)) { diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index cc60aefdc3..b27d8c1007 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -686,9 +686,10 @@ struct DownstreamState { typedef std::function(const DNSName&, uint16_t, uint16_t, dnsheader*)> checkfunc_t; - DownstreamState(const ComboAddress& remote_, const ComboAddress& sourceAddr_, unsigned int sourceItf, const std::string& sourceItfName, size_t numberOfSockets, bool connect); - DownstreamState(const ComboAddress& remote_): DownstreamState(remote_, ComboAddress(), 0, std::string(), 1, true) {} + DownstreamState(const ComboAddress& remote_, const ComboAddress& sourceAddr_, unsigned int sourceItf, const std::string& sourceItfName); + DownstreamState(const ComboAddress& remote_): DownstreamState(remote_, ComboAddress(), 0, std::string()) {} ~DownstreamState(); + void connectUDPSockets(size_t numberOfSockets); stat_t sendErrors{0}; stat_t outstanding{0}; diff --git a/pdns/dnsdistdist/dnsdist-backend.cc b/pdns/dnsdistdist/dnsdist-backend.cc index d01980f361..7349bfffe8 100644 --- a/pdns/dnsdistdist/dnsdist-backend.cc +++ b/pdns/dnsdistdist/dnsdist-backend.cc @@ -164,22 +164,27 @@ void DownstreamState::setWeight(int newWeight) } } -DownstreamState::DownstreamState(const ComboAddress& remote_, const ComboAddress& sourceAddr_, unsigned int sourceItf_, const std::string& sourceItfName_, size_t numberOfSockets, bool connect): remote(remote_), sourceAddr(sourceAddr_), sourceItfName(sourceItfName_), name(remote_.toStringWithPort()), nameWithAddr(remote_.toStringWithPort()), sourceItf(sourceItf_) +DownstreamState::DownstreamState(const ComboAddress& remote_, const ComboAddress& sourceAddr_, unsigned int sourceItf_, const std::string& sourceItfName_): remote(remote_), sourceAddr(sourceAddr_), sourceItfName(sourceItfName_), name(remote_.toStringWithPort()), nameWithAddr(remote_.toStringWithPort()), sourceItf(sourceItf_) { id = getUniqueID(); threadStarted.clear(); - *(mplexer.lock()) = std::unique_ptr(FDMultiplexer::getMultiplexerSilent()); + sw.start(); +} +void DownstreamState::connectUDPSockets(size_t numberOfSockets) +{ sockets.resize(numberOfSockets); + + if (sockets.size() > 1) { + *(mplexer.lock()) = std::unique_ptr(FDMultiplexer::getMultiplexerSilent()); + } + for (auto& fd : sockets) { fd = -1; } - if (connect && !IsAnyAddress(remote)) { - reconnect(); - sw.start(); - } + reconnect(); } DownstreamState::~DownstreamState() diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index 27152c0d8c..2e3e2a1cee 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -545,7 +545,7 @@ Servers -- "address@interface", e.g. "192.0.2.2@eth0" addXPF=NUM, -- Add the client's IP address and port to the query, along with the original destination address and port, -- using the experimental XPF record from `draft-bellis-dnsop-xpf `_ and the specified option code. Default is disabled (0) - sockets=NUM, -- Number of sockets (and thus source ports) used toward the backend server, defaults to a single one. Note that for backends which are multithreaded, this setting will have an effect on the number of cores that will be used to process traffic from dnsdist. For example you may want to set 'sockets' to a number somewhat higher than the number of worker threads configured in the backend, particularly if the Linux kernel is being used to distribute traffic to multiple threads listening on the same socket (via `reuseport`). + sockets=NUM, -- Number of UDP sockets (and thus source ports) used toward the backend server, defaults to a single one. Note that for backends which are multithreaded, this setting will have an effect on the number of cores that will be used to process traffic from dnsdist. For example you may want to set 'sockets' to a number somewhat higher than the number of worker threads configured in the backend, particularly if the Linux kernel is being used to distribute traffic to multiple threads listening on the same socket (via `reuseport`). disableZeroScope=BOOL, -- Disable the EDNS Client Subnet 'zero scope' feature, which does a cache lookup for an answer valid for all subnets (ECS scope of 0) before adding ECS information to the query and doing the regular lookup. This requires the ``parseECS`` option of the corresponding cache to be set to true rise=NUM, -- Require NUM consecutive successful checks before declaring the backend up, default: 1 useProxyProtocol=BOOL, -- Add a proxy protocol header to the query, passing along the client's IP address and port along with the original destination address and port. Default is disabled. diff --git a/pdns/dnsdistdist/test-dnsdistlbpolicies_cc.cc b/pdns/dnsdistdist/test-dnsdistlbpolicies_cc.cc index 3f2de86571..d1f5080836 100644 --- a/pdns/dnsdistdist/test-dnsdistlbpolicies_cc.cc +++ b/pdns/dnsdistdist/test-dnsdistlbpolicies_cc.cc @@ -120,7 +120,7 @@ static void benchPolicy(const ServerPolicy& pol) } ServerPolicy::NumberedServerVector servers; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); servers.at(idx - 1).second->setUp(); /* we need to have a weight of at least 1000 to get an optimal repartition with the consistent hashing algo */ servers.at(idx - 1).second->setWeight(1000); @@ -157,7 +157,7 @@ BOOST_AUTO_TEST_CASE(test_firstAvailable) { ServerPolicy pol{"firstAvailable", firstAvailable, false}; ServerPolicy::NumberedServerVector servers; - servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53")) }); /* servers start as 'down' */ auto server = pol.getSelectedBackend(servers, dq); @@ -169,7 +169,7 @@ BOOST_AUTO_TEST_CASE(test_firstAvailable) { BOOST_CHECK(server != nullptr); /* add a second server, we should still get the first one */ - servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53")) }); server = pol.getSelectedBackend(servers, dq); BOOST_REQUIRE(server != nullptr); BOOST_CHECK(server == servers.at(0).second); @@ -190,8 +190,8 @@ BOOST_AUTO_TEST_CASE(test_firstAvailableWithOrderAndQPS) { ServerPolicy pol{"firstAvailable", firstAvailable, false}; ServerPolicy::NumberedServerVector servers; - servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53"), ComboAddress(), 0, std::string(), 1, false) }); - servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53")) }); + servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53")) }); /* Second server has a higher order, so most queries should be routed to the first (remember that we need to keep them ordered!). However the first server has a QPS limit at 10 qps, so any query above that should be routed @@ -232,7 +232,7 @@ BOOST_AUTO_TEST_CASE(test_roundRobin) { auto server = pol.getSelectedBackend(servers, dq); BOOST_CHECK(server == nullptr); - servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53")) }); /* servers start as 'down' but the RR policy returns a server unless g_roundrobinFailOnNoServer is set */ g_roundrobinFailOnNoServer = true; @@ -248,7 +248,7 @@ BOOST_AUTO_TEST_CASE(test_roundRobin) { BOOST_CHECK(server != nullptr); /* add a second server, we should get the first one then the second one */ - servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53")) }); servers.at(1).second->setUp(); server = pol.getSelectedBackend(servers, dq); BOOST_REQUIRE(server != nullptr); @@ -291,7 +291,7 @@ BOOST_AUTO_TEST_CASE(test_leastOutstanding) { ServerPolicy pol{"leastOutstanding", leastOutstanding, false}; ServerPolicy::NumberedServerVector servers; - servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 1, std::make_shared(ComboAddress("192.0.2.1:53")) }); /* servers start as 'down' */ auto server = pol.getSelectedBackend(servers, dq); @@ -303,7 +303,7 @@ BOOST_AUTO_TEST_CASE(test_leastOutstanding) { BOOST_CHECK(server != nullptr); /* add a second server, we should still get the first one */ - servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ 2, std::make_shared(ComboAddress("192.0.2.2:53")) }); server = pol.getSelectedBackend(servers, dq); BOOST_REQUIRE(server != nullptr); BOOST_CHECK(server == servers.at(0).second); @@ -333,7 +333,7 @@ BOOST_AUTO_TEST_CASE(test_wrandom) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); } @@ -399,7 +399,7 @@ BOOST_AUTO_TEST_CASE(test_whashed) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); } @@ -480,7 +480,7 @@ BOOST_AUTO_TEST_CASE(test_chashed) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); /* we need to have a weight of at least 1000 to get an optimal repartition with the consistent hashing algo */ @@ -580,7 +580,7 @@ BOOST_AUTO_TEST_CASE(test_lua) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); } @@ -640,7 +640,7 @@ BOOST_AUTO_TEST_CASE(test_lua_ffi_rr) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); } @@ -697,7 +697,7 @@ BOOST_AUTO_TEST_CASE(test_lua_ffi_hashed) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); } @@ -752,7 +752,7 @@ BOOST_AUTO_TEST_CASE(test_lua_ffi_whashed) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); } @@ -810,7 +810,7 @@ BOOST_AUTO_TEST_CASE(test_lua_ffi_chashed) { ServerPolicy::NumberedServerVector servers; std::map, uint64_t> serversMap; for (size_t idx = 1; idx <= 10; idx++) { - servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53"), ComboAddress(), 0, std::string(), 1, false) }); + servers.push_back({ idx, std::make_shared(ComboAddress("192.0.2." + std::to_string(idx) + ":53")) }); serversMap[servers.at(idx - 1).second] = 0; servers.at(idx - 1).second->setUp(); /* we need to have a weight of at least 1000 to get an optimal repartition with the consistent hashing algo */ diff --git a/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc b/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc index 7a75c02378..3f9b037d30 100644 --- a/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc +++ b/pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc @@ -717,7 +717,7 @@ BOOST_FIXTURE_TEST_CASE(test_SingleQuery, TestFixture) s_responses[counter] = {query, response}; - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -774,7 +774,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConcurrentQueries, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -863,7 +863,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConnectionReuse, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -992,7 +992,7 @@ BOOST_FIXTURE_TEST_CASE(test_InvalidDNSAnswer, TestFixture) response.resize(11); s_responses[counter] = {query, response}; - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1052,7 +1052,7 @@ BOOST_FIXTURE_TEST_CASE(test_TimeoutWhileWriting, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1139,7 +1139,7 @@ BOOST_FIXTURE_TEST_CASE(test_TimeoutWhileReading, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1226,7 +1226,7 @@ BOOST_FIXTURE_TEST_CASE(test_ShortWrite, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1313,7 +1313,7 @@ BOOST_FIXTURE_TEST_CASE(test_ShortRead, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1407,7 +1407,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConnectionClosedWhileReading, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1493,7 +1493,7 @@ BOOST_FIXTURE_TEST_CASE(test_ConnectionClosedWhileWriting, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1587,7 +1587,7 @@ BOOST_FIXTURE_TEST_CASE(test_GoAwayFromServer, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1698,7 +1698,7 @@ BOOST_FIXTURE_TEST_CASE(test_HTTP500FromServer, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1791,7 +1791,7 @@ BOOST_FIXTURE_TEST_CASE(test_WrongStreamID, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; @@ -1892,7 +1892,7 @@ BOOST_FIXTURE_TEST_CASE(test_ProxyProtocol, TestFixture) struct timeval now; gettimeofday(&now, nullptr); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; backend->d_tlsSubjectName = "backend.powerdns.com"; backend->d_dohPath = "/dns-query"; diff --git a/pdns/dnsdistdist/test-dnsdisttcp_cc.cc b/pdns/dnsdistdist/test-dnsdisttcp_cc.cc index 47560be1ac..a42f450613 100644 --- a/pdns/dnsdistdist/test-dnsdisttcp_cc.cc +++ b/pdns/dnsdistdist/test-dnsdisttcp_cc.cc @@ -872,7 +872,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnection_BackendNoOOOR) const uint8_t sizeBytes[] = { static_cast(querySize / 256), static_cast(querySize % 256) }; query.insert(query.begin(), sizeBytes, sizeBytes + 2); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; { @@ -1720,7 +1720,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) ConnectionInfo connInfo(&localCS); connInfo.remote = getBackendAddress("84", 4242); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; /* enable out-of-order on the backend side as well */ backend->d_maxInFlightQueriesPerConn = 65536; @@ -3122,7 +3122,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) s_readBuffer.insert(s_readBuffer.end(), queries.at(1).begin(), queries.at(1).end()); s_readBuffer.insert(s_readBuffer.end(), queries.at(2).begin(), queries.at(2).end()); - auto proxyEnabledBackend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto proxyEnabledBackend = std::make_shared(getBackendAddress("42", 53)); proxyEnabledBackend->d_tlsCtx = tlsCtx; /* enable out-of-order on the backend side as well */ proxyEnabledBackend->d_maxInFlightQueriesPerConn = 65536; @@ -3249,7 +3249,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) s_readBuffer.insert(s_readBuffer.end(), queries.at(1).begin(), queries.at(1).end()); s_readBuffer.insert(s_readBuffer.end(), queries.at(2).begin(), queries.at(2).end()); - auto proxyEnabledBackend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto proxyEnabledBackend = std::make_shared(getBackendAddress("42", 53)); proxyEnabledBackend->d_tlsCtx = tlsCtx; /* enable out-of-order on the backend side as well */ proxyEnabledBackend->d_maxInFlightQueriesPerConn = 65536; @@ -3431,7 +3431,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendOOOR) expectedWriteBuffer.insert(expectedWriteBuffer.end(), responses.at(4).begin(), responses.at(4).end()); expectedWriteBuffer.insert(expectedWriteBuffer.end(), responses.at(3).begin(), responses.at(3).end()); - auto backend1 = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend1 = std::make_shared(getBackendAddress("42", 53)); backend1->d_tlsCtx = tlsCtx; /* only two queries in flight! */ backend1->d_maxInFlightQueriesPerConn = 2; @@ -3683,7 +3683,7 @@ BOOST_AUTO_TEST_CASE(test_IncomingConnectionOOOR_BackendNotOOOR) auto tlsCtx = std::make_shared(); localCS.tlsFrontend = std::make_shared(tlsCtx); - auto backend = std::make_shared(getBackendAddress("42", 53), ComboAddress("0.0.0.0:0"), 0, std::string(), 1, false); + auto backend = std::make_shared(getBackendAddress("42", 53)); backend->d_tlsCtx = tlsCtx; /* shorter than the client one */ backend->tcpRecvTimeout = 1; -- 2.47.2