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>
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 */