From 22d863193ff32c897f53ddeac55f73134e6ba7e6 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 7 Oct 2025 11:26:02 +0200 Subject: [PATCH] dnsdist: Do not use inverted logic for the pool's zero scope state Signed-off-by: Remi Gacogne --- pdns/dnsdistdist/dnsdist-backend.cc | 19 +++++++++---------- pdns/dnsdistdist/docs/reference/config.rst | 8 ++++---- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pdns/dnsdistdist/dnsdist-backend.cc b/pdns/dnsdistdist/dnsdist-backend.cc index 9bd23b966e..6217255294 100644 --- a/pdns/dnsdistdist/dnsdist-backend.cc +++ b/pdns/dnsdistdist/dnsdist-backend.cc @@ -1112,21 +1112,20 @@ void ServerPool::updateConsistency() useECS = server->d_config.useECS; tcpOnly = server->isTCPOnly(); zeroScope = !server->d_config.disableZeroScope; + continue; } - else { - if (consistent) { - if (server->d_config.useECS != useECS) { - consistent = false; - } - if (server->d_config.disableZeroScope == zeroScope) { - consistent = false; - } + if (consistent) { + if (server->d_config.useECS != useECS) { + consistent = false; } - if (server->isTCPOnly() != tcpOnly) { + if (server->d_config.disableZeroScope == zeroScope) { consistent = false; - tcpOnly = false; } } + if (server->isTCPOnly() != tcpOnly) { + consistent = false; + tcpOnly = false; + } } d_tcpOnly = tcpOnly; diff --git a/pdns/dnsdistdist/docs/reference/config.rst b/pdns/dnsdistdist/docs/reference/config.rst index 9a7c042986..d4b96db7d3 100644 --- a/pdns/dnsdistdist/docs/reference/config.rst +++ b/pdns/dnsdistdist/docs/reference/config.rst @@ -987,11 +987,11 @@ Servers that are not assigned to a specific pool get assigned to the default poo Returns the :class:`PacketCache` for this pool or nil. - .. method:: ServerPool:getDisableZeroScope() + .. method:: ServerPool:getZeroScope() .. versionadded:: 2.0.1 - Whether dnsdist will disable the EDNS Client Subnet :doc:`../advanced/zero-scope` feature when looking up into the cache, + Whether dnsdist will enable the EDNS Client Subnet :doc:`../advanced/zero-scope` feature when looking up into the cache, when all servers from this pool are down. .. method:: ServerPool:getECS() @@ -1005,11 +1005,11 @@ Servers that are not assigned to a specific pool get assigned to the default poo :param PacketCache cache: The new cache to add to the pool - .. method:: ServerPool:setDisableZeroScope(disable) + .. method:: ServerPool:setZeroScope(enabled) .. versionadded:: 2.0.1 - Set to true if dnsdist should disable the EDNS Client Subnet :doc:`../advanced/zero-scope` feature when looking up into the cache, + Set to false if dnsdist should disable the EDNS Client Subnet :doc:`../advanced/zero-scope` feature when looking up into the cache, when all servers from this pool are down. .. method:: ServerPool:setECS() -- 2.47.3