]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Give TCP thread for DoQ and DoH3
authorRon Lauren Hombre <118486316+ronhombre@users.noreply.github.com>
Sun, 5 Apr 2026 17:42:22 +0000 (01:42 +0800)
committerGitHub <noreply@github.com>
Sun, 5 Apr 2026 17:42:22 +0000 (01:42 +0800)
On OpenWRT, the dnsdist implementation isn't normally built with DoQ and DoH3 due to the lack of quiche support. However, when it is enabled and queried through QUIC, dnsdist sees that the connection we have is too big and goes out of its way to try to use TCP to make that request upstream when using PROXYv2.

This fixes that by checking if DoQ or DoH3 are enabled so that in certain configurations with only DoQ or DoH3 enabled, a TCP thread is given to the internal client.

Signed-off-by: Ron Lauren Hombre <118486316+ronhombre@users.noreply.github.com>
pdns/dnsdistdist/dnsdist.cc

index 5322c0df09311d0a09c4dccddb3de4e083ae4a42..25baf78f8e1bd354050a47cac5bf21aac4a0a8f2 100644 (file)
@@ -3540,7 +3540,17 @@ static void startFrontends()
     std::thread udpThreadHandle(udpClientThread, udpStates);
     udpThreadHandle.detach();
   }
-  if (!tcpStates.empty()) {
+     
+  /* Gives a TCP Thread to DoQ or DoH3 for cross-protocol communication when a request is too big for dnsdist to use UDP so it uses TCP instead */
+  bool needsTCP = !tcpStates.empty();
+  for (const auto& clientState : dnsdist::getFrontends()) {
+     if (clientState->doqFrontend != nullptr || clientState->doh3Frontend != nullptr) {
+        needsTCP = true;
+        break;
+     }
+  }
+     
+  if (needsTCP) {
     g_tcpclientthreads = std::make_unique<TCPClientCollection>(1, tcpStates);
   }
 #endif /* USE_SINGLE_ACCEPTOR_THREAD */