]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Ignore valid backend weight coming from YAML
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 May 2026 10:39:48 +0000 (12:39 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 18 May 2026 10:39:48 +0000 (12:39 +0200)
We do handle that in the Lua configuration already.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist-configuration-yaml.cc

index 518cf87270cc4e8de09a69346f7690b6c39e606e..27f74c1f3389a0932cac24bd5d0e95d79b6cd9e8 100644 (file)
@@ -458,7 +458,14 @@ static std::shared_ptr<DownstreamState> createBackendFromConfiguration(const Con
   backendConfig.d_numberOfSockets = config.sockets;
   backendConfig.d_qpsLimit = config.queries_per_second;
   backendConfig.order = config.order;
-  backendConfig.d_weight = config.weight;
+  if (config.weight < 1) {
+    SLOG(warnlog("Ignoring invalid weight on backend %s", std::string(config.address)),
+         context.logger->info(Logr::Warning, "Ignoring invalid weight on backend", "backend.address", Logging::Loggable(config.address)));
+  }
+  else {
+    backendConfig.d_weight = config.weight;
+  }
+
   backendConfig.d_maxInFlightQueriesPerConn = config.max_in_flight;
   backendConfig.d_maxUDPOutstanding = config.max_udp_outstanding;
   backendConfig.d_tcpConcurrentConnectionsLimit = config.max_concurrent_tcp_connections;