]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: We need the regular, non-XSK threads as well!
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 15 Jan 2024 16:01:59 +0000 (17:01 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 23 Jan 2024 11:54:25 +0000 (12:54 +0100)
pdns/dnsdist.cc
pdns/dnsdist.hh
pdns/dnsdistdist/dnsdist-backend.cc
pdns/xsk.cc

index 358e970e52e4939947e7cc3d243cc582597ea45c..75f33d2eb4c744317cd68d106d9daad53b0158c3 100644 (file)
@@ -3104,7 +3104,6 @@ static void startFrontends()
         mapThreadToCPUList(xskCT.native_handle(), clientState->cpus);
       }
       xskCT.detach();
-      continue;
     }
 #endif /* HAVE_XSK */
 
index 1a92f25dab10487617d6c12768535bb024cc304c..32fdf9561f438cb3ff9a5a67f57b9dfafd6d453d 100644 (file)
@@ -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
index 49b47b8cdcca5acb07c36d05ed139f8d18459c0d..0138c6e3987a1751fd9cfe6ef14ded9fb9c67a06 100644 (file)
@@ -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();
   }
 }
index cfa6912419b71930116e3ad50a06d95a1f9273b2..66da6824002fb30a714e3d5d2e9d5d5745f2ccbf 100644 (file)
@@ -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. */