From: Remi Gacogne Date: Mon, 15 Jan 2024 16:01:59 +0000 (+0100) Subject: dnsdist: We need the regular, non-XSK threads as well! X-Git-Tag: dnsdist-1.9.0-rc1^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c9b2109e8a12ea3a925f17bbbf88fb9449ed16a;p=thirdparty%2Fpdns.git dnsdist: We need the regular, non-XSK threads as well! --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 358e970e52..75f33d2eb4 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -3104,7 +3104,6 @@ static void startFrontends() mapThreadToCPUList(xskCT.native_handle(), clientState->cpus); } xskCT.detach(); - continue; } #endif /* HAVE_XSK */ diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index 1a92f25dab..32fdf9561f 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -847,7 +847,6 @@ private: void removeXSKDestination(int fd); #endif /* HAVE_XSK */ - std::thread tid; std::mutex connectLock; std::condition_variable d_connectedWait; #ifdef HAVE_XSK diff --git a/pdns/dnsdistdist/dnsdist-backend.cc b/pdns/dnsdistdist/dnsdist-backend.cc index 49b47b8cdc..0138c6e398 100644 --- a/pdns/dnsdistdist/dnsdist-backend.cc +++ b/pdns/dnsdistdist/dnsdist-backend.cc @@ -330,19 +330,18 @@ void DownstreamState::start() if (connected && !threadStarted.test_and_set()) { #ifdef HAVE_XSK if (xskInfo != nullptr) { - tid = std::thread(dnsdist::xsk::XskResponderThread, shared_from_this()); - } - else { - tid = std::thread(responderThread, shared_from_this()); + auto xskResponderThread = std::thread(dnsdist::xsk::XskResponderThread, shared_from_this()); + if (!d_config.d_cpus.empty()) { + mapThreadToCPUList(xskResponderThread.native_handle(), d_config.d_cpus); + } + xskResponderThread.detach(); } -#else - tid = std::thread(responderThread, shared_from_this()); #endif /* HAVE_XSK */ + auto tid = std::thread(responderThread, shared_from_this()); if (!d_config.d_cpus.empty()) { mapThreadToCPUList(tid.native_handle(), d_config.d_cpus); } - tid.detach(); } } diff --git a/pdns/xsk.cc b/pdns/xsk.cc index cfa6912419..66da682400 100644 --- a/pdns/xsk.cc +++ b/pdns/xsk.cc @@ -1009,7 +1009,7 @@ void XskPacket::rewrite() noexcept uint32_t words[3]; }; }; - struct ipv4_pseudo_header_t pseudo_header{}; + ipv4_pseudo_header_t pseudo_header{}; static_assert(sizeof(pseudo_header) == 12, "IPv4 pseudo-header size is incorrect"); /* Fill in the pseudo-header. */ @@ -1043,7 +1043,7 @@ void XskPacket::rewrite() noexcept uint32_t words[10]; }; }; - struct ipv6_pseudo_header_t pseudo_header{}; + ipv6_pseudo_header_t pseudo_header{}; static_assert(sizeof(pseudo_header) == 40, "IPv6 pseudo-header size is incorrect"); /* Fill in the pseudo-header. */