]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Implement 'tcpOnly' backends
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 7 Jun 2021 14:12:18 +0000 (16:12 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 26 Aug 2021 14:30:27 +0000 (16:30 +0200)
pdns/dnsdist-lua.cc
pdns/dnsdist.hh
pdns/dnsdistdist/docs/reference/config.rst

index fddb268427c51337c48113e81f29fbb4570b3b76..989d6bab28aa804acc60d8ddf8f9affe0535b6f9 100644 (file)
@@ -499,6 +499,10 @@ static void setupLuaConfig(LuaContext& luaCtx, bool client, bool configCheck)
         }
       }
 
+      if (vars.count("tcpOnly")) {
+        ret->d_tcpOnly = boost::get<bool>(vars.at("tcpOnly"));
+      }
+
       if (vars.count("tls")) {
         TLSContextParameters tlsParams;
         std::string ciphers;
index 2d394ca5dedade1496544c7aaf5d38433584344c..85fa96ea2e066e5957c64fc3663ba41ce318aa66 100644 (file)
@@ -739,6 +739,7 @@ struct DownstreamState
   bool ipBindAddrNoPort{true};
   bool reconnectOnUp{false};
   bool d_tcpCheck{false};
+  bool d_tcpOnly{false};
 
   bool isUp() const
   {
@@ -814,12 +815,12 @@ struct DownstreamState
 
   bool doHealthcheckOverTCP() const
   {
-    return d_tcpCheck || d_tlsCtx != nullptr;
+    return d_tcpOnly || d_tcpCheck || d_tlsCtx != nullptr;
   }
 
   bool isTCPOnly() const
   {
-    return d_tlsCtx != nullptr;
+    return d_tcpOnly || d_tlsCtx != nullptr;
   }
 
 private:
index 29913fa6d63395f8b321668886c9223359da024d..cccf46a17f008f6678ba4d91d2d6750989cf1d99 100644 (file)
@@ -488,6 +488,9 @@ Servers
   .. versionchanged:: 1.6.0
     Added ``maxInFlight`` to server_table.
 
+  .. versionchanged:: 1.7.0
+    Added ``tcpOnly`` to server_table.
+
   Add a new backend server. Call this function with either a string::
 
     newServer(
@@ -533,7 +536,8 @@ Servers
       rise=NUM,              -- Require NUM consecutive successful checks before declaring the backend up, default: 1
       useProxyProtocol=BOOL, -- Add a proxy protocol header to the query, passing along the client's IP address and port along with the original destination address and port. Default is disabled.
       reconnectOnUp=BOOL,    -- Close and reopen the sockets when a server transits from Down to Up. This helps when an interface is missing when dnsdist is started. Default is disabled.
-      maxInFlight            -- Maximum number of in-flight queries. The default is 0, which disables out-of-order processing. It should only be enabled if the backend does support out-of-order processing. As of 1.6.0, out-of-order processing needs to be enabled on the frontend as well, via :func:`addLocal` and/or :func:`addTLSLocal`. Note that out-of-order is always enabled on DoH frontends.
+      maxInFlight=NUM,       -- Maximum number of in-flight queries. The default is 0, which disables out-of-order processing. It should only be enabled if the backend does support out-of-order processing. As of 1.6.0, out-of-order processing needs to be enabled on the frontend as well, via :func:`addLocal` and/or :func:`addTLSLocal`. Note that out-of-order is always enabled on DoH frontends.
+      tcpOnly=BOOL           -- Always forward queries to that backend over TCP, never over UDP. Defaut is false.
     })
 
   :param str server_string: A simple IP:PORT string.