]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: YAML: Correct `enable_proxy_protocol` value for TCP/UDP binds
authorRobert Edmonds <edmonds@users.noreply.github.com>
Tue, 10 Jun 2025 03:15:15 +0000 (23:15 -0400)
committerRobert Edmonds <edmonds@users.noreply.github.com>
Tue, 10 Jun 2025 03:15:15 +0000 (23:15 -0400)
The YAML `enable_proxy_protocol` property of `BindConfiguration` is
documented as defaulting to "true", but is actually defined to default
to false. This commit redefines this property to default to "true",
which matches the documentation. It also matches the documentation of
the `enableProxyProtocol` option to the Lua `addLocal()` function.

However, when `loadBinds()` constructs the `ClientState` for a TCP
or UDP bind, it hardcodes the last parameter (`enableProxyProtocol`)
to false, i.e. it ignores the configured value. In this commit, the
`enableProxyProtocol` parameter to the `ClientState` constructor is
taken from the corresponding value loaded by the YAML parser.

pdns/dnsdistdist/dnsdist-configuration-yaml.cc
pdns/dnsdistdist/dnsdist-settings-definitions.yml

index 46c260915de8092bc52d4fd1b122389b680fbda3..d747f193494fd775880081c39c311199b91c82b1 100644 (file)
@@ -694,7 +694,7 @@ static void loadBinds(const ::rust::Vec<dnsdist::rust::settings::BindConfigurati
         std::shared_ptr<DNSCryptContext> dnsCryptContext;
 #endif /* defined(HAVE_DNSCRYPT) */
 
-        auto state = std::make_shared<ClientState>(listeningAddress, protocol != "doq" && protocol != "doh3", bind.reuseport, bind.tcp.fast_open_queue_size, std::string(bind.interface), cpus, false);
+        auto state = std::make_shared<ClientState>(listeningAddress, protocol != "doq" && protocol != "doh3", bind.reuseport, bind.tcp.fast_open_queue_size, std::string(bind.interface), cpus, bind.enable_proxy_protocol);
 
         if (bind.tcp.listen_queue_size > 0) {
           state->tcpListenQueueSize = bind.tcp.listen_queue_size;
@@ -738,7 +738,7 @@ static void loadBinds(const ::rust::Vec<dnsdist::rust::settings::BindConfigurati
         config.d_frontends.emplace_back(std::move(state));
         if (protocol == "do53" || protocol == "dnscrypt") {
           /* also create the UDP listener */
-          state = std::make_shared<ClientState>(ComboAddress(std::string(bind.listen_address), defaultPort), false, bind.reuseport, bind.tcp.fast_open_queue_size, std::string(bind.interface), cpus, false);
+          state = std::make_shared<ClientState>(ComboAddress(std::string(bind.listen_address), defaultPort), false, bind.reuseport, bind.tcp.fast_open_queue_size, std::string(bind.interface), cpus, bind.enable_proxy_protocol);
 #if defined(HAVE_DNSCRYPT)
           state->dnscryptCtx = std::move(dnsCryptContext);
 #endif /* defined(HAVE_DNSCRYPT) */
index 5af3b7cf4ba9304c523dd4bcffc9bd007abc053f..296cae61f39a9217c6431a363e5912da49b0bad5 100644 (file)
@@ -1100,7 +1100,7 @@ bind:
       description: "Set the CPU affinity for this listener thread, asking the scheduler to run it on a single CPU id, or a set of CPU ids. This parameter is only available if the OS provides the ``pthread_setaffinity_np()`` function"
     - name: "enable_proxy_protocol"
       type: "bool"
-      default: "false"
+      default: "true"
       description: "Whether to expect a proxy protocol v2 header in front of incoming queries coming from an address allowed by the ACL in :ref:`yaml-settings-ProxyProtocolConfiguration`. Default is ``true``, meaning that queries are expected to have a proxy protocol payload if they come from an address present in the proxy protocol ACL"
     - name: "tcp"
       type: "IncomingTcpConfiguration"