]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix the case where nghttp2 is available but DoH is disabled
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 17 Oct 2023 08:58:27 +0000 (10:58 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 17 Oct 2023 09:28:11 +0000 (11:28 +0200)
13 files changed:
pdns/dnsdist-lua-inspection.cc
pdns/dnsdist-lua.cc
pdns/dnsdist-tcp.cc
pdns/dnsdist.cc
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/configure.ac
pdns/dnsdistdist/dnsdist-backend.cc
pdns/dnsdistdist/dnsdist-healthchecks.cc
pdns/dnsdistdist/dnsdist-nghttp2-in.cc
pdns/dnsdistdist/dnsdist-nghttp2-in.hh
pdns/dnsdistdist/dnsdist-nghttp2.cc
pdns/dnsdistdist/test-dnsdistnghttp2-in_cc.cc
pdns/dnsdistdist/test-dnsdistnghttp2_cc.cc

index f778a492ddedaacbc2dd303107bcd0e41d8144bb..4b317808c4c6b8263eab6ecdcfcec006c111217f 100644 (file)
@@ -728,7 +728,9 @@ void setupLuaInspection(LuaContext& luaCtx)
 
   luaCtx.writeFunction("requestDoHStatesDump", [] {
     setLuaNoSideEffect();
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
     g_dohStatesDumpRequested += g_dohClientThreads->getThreadsCount();
+#endif
   });
 
   luaCtx.writeFunction("dumpStats", [] {
index e39748e8c2ad2f735fefec183891e322390bc86b..e324d759a6e5c504a97fcdd287c4716c5c275e12 100644 (file)
@@ -544,7 +544,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
                            tlsCtx = getTLSContext(config.d_tlsParams);
 
                            if (getOptionalValue<std::string>(vars, "dohPath", valueStr) > 0) {
-#ifndef HAVE_NGHTTP2
+#if !defined(HAVE_DNS_OVER_HTTPS) || !defined(HAVE_NGHTTP2)
                              throw std::runtime_error("Outgoing DNS over HTTPS support requested (via 'dohPath' on newServer()) but nghttp2 support is not available");
 #endif
 
@@ -1332,6 +1332,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     setTCPDownstreamMaxIdleConnectionsPerBackend(max);
   });
 
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   luaCtx.writeFunction("setMaxIdleDoHConnectionsPerDownstream", [](uint64_t max) {
     setDoHDownstreamMaxIdleConnectionsPerBackend(max);
   });
@@ -1342,6 +1343,7 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     }
     g_outgoingDoHWorkerThreads = workers;
   });
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 
   luaCtx.writeFunction("setOutgoingTLSSessionsCacheMaxTicketsPerBackend", [](uint64_t max) {
     if (!checkConfigurationTime("setOutgoingTLSSessionsCacheMaxTicketsPerBackend")) {
@@ -2120,11 +2122,13 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     setTCPDownstreamCleanupInterval(interval);
   });
 
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   luaCtx.writeFunction("setDoHDownstreamCleanupInterval", [](uint64_t interval) {
     setLuaSideEffect();
     checkParameterBound("setDoHDownstreamCleanupInterval", interval);
     setDoHDownstreamCleanupInterval(interval);
   });
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 
   luaCtx.writeFunction("setTCPDownstreamMaxIdleTime", [](uint64_t max) {
     setLuaSideEffect();
@@ -2132,11 +2136,13 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
     setTCPDownstreamMaxIdleTime(max);
   });
 
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   luaCtx.writeFunction("setDoHDownstreamMaxIdleTime", [](uint64_t max) {
     setLuaSideEffect();
     checkParameterBound("setDoHDownstreamMaxIdleTime", max);
     setDoHDownstreamMaxIdleTime(max);
   });
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 
   luaCtx.writeFunction("setConsoleConnectionsLogging", [](bool enabled) {
     g_logConsoleConnections = enabled;
index 7b94e00e51092fe321c16bfb70c8701c045f3112..5a4bead7d0056816a73adc09b808d798ae3cbc1f 100644 (file)
@@ -1242,10 +1242,10 @@ static void handleIncomingTCPQuery(int pipefd, FDMultiplexer::funcparam_t& param
   gettimeofday(&now, nullptr);
 
   if (citmp->cs->dohFrontend) {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
     auto state = std::make_shared<IncomingHTTP2Connection>(std::move(*citmp), *threadData, now);
     state->handleIO();
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
   }
   else {
     auto state = std::make_shared<IncomingTCPConnectionState>(std::move(*citmp), *threadData, now);
@@ -1396,7 +1396,7 @@ static void tcpClientThread(pdns::channel::Receiver<ConnectionInfo>&& queryRecei
                 state->handleTimeout(state, false);
               }
             }
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
             else if (cbData.second.type() == typeid(std::shared_ptr<IncomingHTTP2Connection>)) {
               auto state = boost::any_cast<std::shared_ptr<IncomingHTTP2Connection>>(cbData.second);
               if (cbData.first == state->d_handler.getDescriptor()) {
@@ -1405,7 +1405,7 @@ static void tcpClientThread(pdns::channel::Receiver<ConnectionInfo>&& queryRecei
                 state->handleTimeout(parentState, false);
               }
             }
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
             else if (cbData.second.type() == typeid(std::shared_ptr<TCPConnectionToBackend>)) {
               auto conn = boost::any_cast<std::shared_ptr<TCPConnectionToBackend>>(cbData.second);
               vinfolog("Timeout (read) from remote backend %s", conn->getBackendName());
@@ -1422,7 +1422,7 @@ static void tcpClientThread(pdns::channel::Receiver<ConnectionInfo>&& queryRecei
                 state->handleTimeout(state, true);
               }
             }
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
             else if (cbData.second.type() == typeid(std::shared_ptr<IncomingHTTP2Connection>)) {
               auto state = boost::any_cast<std::shared_ptr<IncomingHTTP2Connection>>(cbData.second);
               if (cbData.first == state->d_handler.getDescriptor()) {
@@ -1431,7 +1431,7 @@ static void tcpClientThread(pdns::channel::Receiver<ConnectionInfo>&& queryRecei
                 state->handleTimeout(parentState, true);
               }
             }
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
             else if (cbData.second.type() == typeid(std::shared_ptr<TCPConnectionToBackend>)) {
               auto conn = boost::any_cast<std::shared_ptr<TCPConnectionToBackend>>(cbData.second);
               vinfolog("Timeout (write) from remote backend %s", conn->getBackendName());
@@ -1462,12 +1462,12 @@ static void tcpClientThread(pdns::channel::Receiver<ConnectionInfo>&& queryRecei
                   auto state = boost::any_cast<std::shared_ptr<IncomingTCPConnectionState>>(param);
                   infolog(" - %s", state->toString());
                 }
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
                 else if (param.type() == typeid(std::shared_ptr<IncomingHTTP2Connection>)) {
                   auto state = boost::any_cast<std::shared_ptr<IncomingHTTP2Connection>>(param);
                   infolog(" - %s", state->toString());
                 }
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
                 else if (param.type() == typeid(std::shared_ptr<TCPConnectionToBackend>)) {
                   auto conn = boost::any_cast<std::shared_ptr<TCPConnectionToBackend>>(param);
                   infolog(" - %s", conn->toString());
@@ -1567,10 +1567,10 @@ static void acceptNewConnection(const TCPAcceptorParam& param, TCPClientThreadDa
       gettimeofday(&now, nullptr);
 
       if (ci.cs->dohFrontend) {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
         auto state = std::make_shared<IncomingHTTP2Connection>(std::move(ci), *threadData, now);
         state->handleIO();
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
       }
       else {
         auto state = std::make_shared<IncomingTCPConnectionState>(std::move(ci), *threadData, now);
index 71955161dc380469ede056b6e317e72903a696ff..6798ef06ceeac59daa97938548e812da404f852d 100644 (file)
@@ -2916,7 +2916,9 @@ int main(int argc, char** argv)
     g_tcpclientthreads = std::make_unique<TCPClientCollection>(*g_maxTCPClientThreads, std::vector<ClientState*>());
 #endif
 
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
     initDoHWorkers();
+#endif
 
     for (auto& todoItem : todo) {
       todoItem();
index f9a7bc297bd10a5b96898f8f937fac995987cee2..c7e5ebd117fafd27b698103388299ed590c45b84 100644 (file)
@@ -185,8 +185,8 @@ dnsdist_SOURCES = \
        dnsdist-lua.cc dnsdist-lua.hh \
        dnsdist-mac-address.cc dnsdist-mac-address.hh \
        dnsdist-metrics.cc dnsdist-metrics.hh \
-       dnsdist-nghttp2-in.cc dnsdist-nghttp2-in.hh \
-       dnsdist-nghttp2.cc dnsdist-nghttp2.hh \
+       dnsdist-nghttp2-in.hh \
+       dnsdist-nghttp2.hh \
        dnsdist-prometheus.hh \
        dnsdist-protobuf.cc dnsdist-protobuf.hh \
        dnsdist-protocols.cc dnsdist-protocols.hh \
@@ -284,8 +284,8 @@ testrunner_SOURCES = \
        dnsdist-lua-vars.cc \
        dnsdist-mac-address.cc dnsdist-mac-address.hh \
        dnsdist-metrics.cc dnsdist-metrics.hh \
-       dnsdist-nghttp2-in.cc dnsdist-nghttp2-in.hh \
-       dnsdist-nghttp2.cc dnsdist-nghttp2.hh \
+       dnsdist-nghttp2-in.hh \
+       dnsdist-nghttp2.hh \
        dnsdist-protocols.cc dnsdist-protocols.hh \
        dnsdist-proxy-protocol.cc dnsdist-proxy-protocol.hh \
        dnsdist-random.cc dnsdist-random.hh \
@@ -339,8 +339,6 @@ testrunner_SOURCES = \
        test-dnsdistkvs_cc.cc \
        test-dnsdistlbpolicies_cc.cc \
        test-dnsdistluanetwork.cc \
-       test-dnsdistnghttp2-in_cc.cc \
-       test-dnsdistnghttp2_cc.cc \
        test-dnsdistnghttp2_common.hh \
        test-dnsdistpacketcache_cc.cc \
        test-dnsdistrings_cc.cc \
@@ -435,6 +433,17 @@ dnsdist_SOURCES += doh.cc
 dnsdist_LDADD += $(LIBH2OEVLOOP_LIBS)
 endif
 
+if HAVE_NGHTTP2
+dnsdist_SOURCES += dnsdist-nghttp2-in.cc
+dnsdist_SOURCES += dnsdist-nghttp2.cc
+testrunner_SOURCES += dnsdist-nghttp2-in.cc
+testrunner_SOURCES += dnsdist-nghttp2.cc
+testrunner_SOURCES += test-dnsdistnghttp2-in_cc.cc \
+       test-dnsdistnghttp2_cc.cc
+dnsdist_LDADD += $(NGHTTP2_LDFLAGS) $(NGHTTP2_LIBS)
+testrunner_LDADD += $(NGHTTP2_LDFLAGS) $(NGHTTP2_LIBS)
+endif
+
 endif
 
 if HAVE_DNS_OVER_QUIC
@@ -445,11 +454,6 @@ dnsdist_LDADD += $(QUICHE_LDFLAGS) $(QUICHE_LIBS)
 endif
 endif
 
-if HAVE_NGHTTP2
-dnsdist_LDADD += $(NGHTTP2_LDFLAGS) $(NGHTTP2_LIBS)
-testrunner_LDADD += $(NGHTTP2_LDFLAGS) $(NGHTTP2_LIBS)
-endif
-
 if !HAVE_LUA_HPP
 BUILT_SOURCES += lua.hpp
 nodist_dnsdist_SOURCES = lua.hpp
index 11495c3c7916d20ab8a480b4fd2c4aa0f99c9117..8de53ba3689ce2a5de80788ffe63d4cad26da96a 100644 (file)
@@ -113,7 +113,6 @@ AS_IF([test "x$enable_dns_over_quic" != "xno"], [
   ])
 ])
 
-PDNS_WITH_NGHTTP2
 DNSDIST_WITH_CDB
 PDNS_CHECK_LMDB
 PDNS_ENABLE_IPCIPHER
index 44b3d9c39dc4685cf041fb5261c797acc8200af5..d3d70abc843af4be42b3470d01ebb754adddb1b1 100644 (file)
 
 bool DownstreamState::passCrossProtocolQuery(std::unique_ptr<CrossProtocolQuery>&& cpq)
 {
-  if (d_config.d_dohPath.empty()) {
-    return g_tcpclientthreads && g_tcpclientthreads->passCrossProtocolQueryToThread(std::move(cpq));
-  }
-  else {
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
+  if (!d_config.d_dohPath.empty()) {
     return g_dohClientThreads && g_dohClientThreads->passCrossProtocolQueryToThread(std::move(cpq));
   }
+#endif
+  return g_tcpclientthreads && g_tcpclientthreads->passCrossProtocolQueryToThread(std::move(cpq));
 }
 
 bool DownstreamState::reconnect(bool initialAttempt)
index 37139e8661f418eca8422d2fa4c54a6dfce5bb96..36805573e7842624ecefe7ecc223e7270f92250a 100644 (file)
@@ -390,6 +390,7 @@ bool queueHealthCheck(std::unique_ptr<FDMultiplexer>& mplexer, const std::shared
 
       mplexer->addReadFD(data->d_udpSocket.getHandle(), &healthCheckUDPCallback, data, &data->d_ttd);
     }
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
     else if (downstream->isDoH()) {
       InternalQuery query(std::move(packet), InternalQueryState());
       query.d_proxyProtocolPayload = std::move(proxyProtocolPayload);
@@ -398,6 +399,7 @@ bool queueHealthCheck(std::unique_ptr<FDMultiplexer>& mplexer, const std::shared
         data->d_ds->submitHealthCheckResult(data->d_initial, false);
       }
     }
+#endif
     else {
       data->d_tcpHandler = std::make_unique<TCPIOHandler>(downstream->d_config.d_tlsSubjectName, downstream->d_config.d_tlsSubjectIsAddr, sock.releaseHandle(), timeval{downstream->d_config.checkTimeout, 0}, downstream->d_tlsCtx);
       data->d_ioState = std::make_unique<IOStateHandler>(*mplexer, data->d_tcpHandler->getDescriptor());
@@ -464,7 +466,9 @@ void handleQueuedHealthChecks(FDMultiplexer& mplexer, bool initial)
       continue;
     }
 
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
     handleH2Timeouts(mplexer, now);
+#endif
 
     auto timeouts = mplexer.getTimeouts(now);
     for (const auto& timeout : timeouts) {
index 7c7864466f1c2345711bd64f71fa260193ce4af8..3b01c47bc93cfaade261bc8af1661887db6ef3f7 100644 (file)
@@ -25,7 +25,7 @@
 #include "dnsdist-proxy-protocol.hh"
 #include "dnsparser.hh"
 
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
 
 #if 0
 class IncomingDoHCrossProtocolContext : public CrossProtocolContext
@@ -1228,4 +1228,4 @@ bool IncomingHTTP2Connection::active() const
   return !d_connectionDied && d_ioState != nullptr;
 }
 
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
index 020e1c26e312a9913d3c590a81cdba2b3f3e5337..a2e58a45a919bd6bc69569e8974024c2f7249dba 100644 (file)
@@ -22,7 +22,7 @@
 #pragma once
 
 #include "config.h"
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
 #include <nghttp2/nghttp2.h>
 
 #include "dnsdist-tcp-upstream.hh"
@@ -156,4 +156,4 @@ public:
   static void addCustomDynamicHeader(std::vector<nghttp2_nv>& headers, const std::string& name, const std::string_view& value);
 };
 
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
index 163d2df0925e58af8383c85aea5068ee55983a1e..0db65fb38a7749c07f7045be78c0fa7dea1465e9 100644 (file)
@@ -22,9 +22,9 @@
 
 #include "config.h"
 
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
 #include <nghttp2/nghttp2.h>
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 
 #include "dnsdist-nghttp2.hh"
 #include "dnsdist-nghttp2-in.hh"
@@ -45,7 +45,7 @@ std::atomic<uint64_t> g_dohStatesDumpRequested{0};
 std::unique_ptr<DoHClientCollection> g_dohClientThreads{nullptr};
 std::optional<uint16_t> g_outgoingDoHWorkerThreads{std::nullopt};
 
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
 class DoHConnectionToBackend : public ConnectionToBackend
 {
 public:
@@ -932,7 +932,7 @@ static bool select_next_proto_callback(unsigned char** out, unsigned char* outle
   return true;
 }
 
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 
 struct DoHClientCollection::DoHWorkerThread
 {
@@ -984,7 +984,7 @@ bool DoHClientCollection::passCrossProtocolQueryToThread(std::unique_ptr<CrossPr
 
 void DoHClientCollection::addThread()
 {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   try {
     auto [sender, receiver] = pdns::channel::createObjectQueue<CrossProtocolQuery>(pdns::channel::SenderBlockingMode::SenderNonBlocking, pdns::channel::ReceiverBlockingMode::ReceiverNonBlocking, g_tcpInternalPipeBufferSize);
 
@@ -1014,14 +1014,14 @@ void DoHClientCollection::addThread()
     errlog("Error creating the DoH channel: %s", e.what());
     return;
   }
-#else /* HAVE_NGHTTP2 */
+#else /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
   throw std::runtime_error("DoHClientCollection::addThread() called but nghttp2 support is not available");
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
 
 bool initDoHWorkers()
 {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   if (!g_outgoingDoHWorkerThreads) {
     /* Unless the value has been set to 0 explicitly, always start at least one outgoing DoH worker thread, in case a DoH backend
        is added at a later time. */
@@ -1037,7 +1037,7 @@ bool initDoHWorkers()
   return true;
 #else
   return false;
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
 
 bool setupDoHClientProtocolNegotiation(std::shared_ptr<TLSCtx>& ctx)
@@ -1045,20 +1045,20 @@ bool setupDoHClientProtocolNegotiation(std::shared_ptr<TLSCtx>& ctx)
   if (ctx == nullptr) {
     return false;
   }
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   /* we want to set the ALPN to h2, if only to mitigate the ALPACA attack */
   const std::vector<std::vector<uint8_t>> h2Alpns = {{'h', '2'}};
   ctx->setALPNProtos(h2Alpns);
   ctx->setNextProtocolSelectCallback(select_next_proto_callback);
   return true;
-#else /* HAVE_NGHTTP2 */
+#else /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
   return false;
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
 
 bool sendH2Query(const std::shared_ptr<DownstreamState>& ds, std::unique_ptr<FDMultiplexer>& mplexer, std::shared_ptr<TCPQuerySender>& sender, InternalQuery&& query, bool healthCheck)
 {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   struct timeval now
   {
     .tv_sec = 0, .tv_usec = 0
@@ -1077,24 +1077,24 @@ bool sendH2Query(const std::shared_ptr<DownstreamState>& ds, std::unique_ptr<FDM
   }
 
   return true;
-#else /* HAVE_NGHTTP2 */
+#else /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
   return false;
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
 
 size_t clearH2Connections()
 {
   size_t cleared = 0;
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   cleared = t_downstreamDoHConnectionsManager.clear();
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
   return cleared;
 }
 
 size_t handleH2Timeouts(FDMultiplexer& mplexer, const struct timeval& now)
 {
   size_t got = 0;
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   auto expiredReadConns = mplexer.getTimeouts(now, false);
   for (const auto& cbData : expiredReadConns) {
     if (cbData.second.type() == typeid(std::shared_ptr<DoHConnectionToBackend>)) {
@@ -1114,27 +1114,27 @@ size_t handleH2Timeouts(FDMultiplexer& mplexer, const struct timeval& now)
       ++got;
     }
   }
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
   return got;
 }
 
 void setDoHDownstreamCleanupInterval(uint16_t max)
 {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   DownstreamDoHConnectionsManager::setCleanupInterval(max);
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
 
 void setDoHDownstreamMaxIdleTime(uint16_t max)
 {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   DownstreamDoHConnectionsManager::setMaxIdleTime(max);
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
 
 void setDoHDownstreamMaxIdleConnectionsPerBackend(size_t max)
 {
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
   DownstreamDoHConnectionsManager::setMaxIdleConnectionsPerDownstream(max);
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
 }
index 2a479bf2be68a476b147fcc6177f54eb4da63c7c..27364fa3708bf38e0e967ba484fb2e98db52fc78 100644 (file)
@@ -29,7 +29,7 @@
 #include "dnsdist-proxy-protocol.hh"
 #include "dnsdist-nghttp2-in.hh"
 
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
 #include <nghttp2/nghttp2.h>
 
 extern std::function<ProcessQueryResult(DNSQuestion& dnsQuestion, std::shared_ptr<DownstreamState>& selectedBackend)> s_processQuery;
@@ -736,4 +736,4 @@ BOOST_FIXTURE_TEST_CASE(test_IncomingConnection_BackendTimeout, TestFixture)
 }
 
 BOOST_AUTO_TEST_SUITE_END();
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */
index b971e4ac15173018fe92fd70808cf5c24fe4ea76..858ce9e81fe8ded14c0b00631430d0175227b36a 100644 (file)
@@ -31,7 +31,7 @@
 #include "dnsdist-nghttp2.hh"
 #include "sstuff.hh"
 
-#ifdef HAVE_NGHTTP2
+#if defined(HAVE_DNS_OVER_HTTPS) && defined(HAVE_NGHTTP2)
 #include <nghttp2/nghttp2.h>
 
 BOOST_AUTO_TEST_SUITE(test_dnsdistnghttp2_cc)
@@ -1846,4 +1846,4 @@ BOOST_FIXTURE_TEST_CASE(test_ProxyProtocol, TestFixture)
 }
 
 BOOST_AUTO_TEST_SUITE_END();
-#endif /* HAVE_NGHTTP2 */
+#endif /* HAVE_DNS_OVER_HTTPS && HAVE_NGHTTP2 */