From b0691fdeafe49d7d3c06ddf8a1a94f73ddd2d1a9 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Thu, 16 Jan 2025 16:30:50 +0100 Subject: [PATCH] dnsdist: Better error when we cannot connect a backend socket Let the user know if we are using a specific interface or source address to contact the backend, as it is quite helpful to pinpoint the issue. (cherry picked from commit 199a3433672d358a53cbb4cad7d9459cf9ed4551) --- pdns/dnsdistdist/dnsdist-backend.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pdns/dnsdistdist/dnsdist-backend.cc b/pdns/dnsdistdist/dnsdist-backend.cc index d59a5df0dc..08bbfc52bc 100644 --- a/pdns/dnsdistdist/dnsdist-backend.cc +++ b/pdns/dnsdistdist/dnsdist-backend.cc @@ -144,7 +144,12 @@ bool DownstreamState::reconnect(bool initialAttempt) } catch (const std::runtime_error& error) { if (initialAttempt || g_verbose) { - infolog("Error connecting to new server with address %s: %s", d_config.remote.toStringWithPort(), error.what()); + if (!IsAnyAddress(d_config.sourceAddr) || !d_config.sourceItfName.empty()) { + infolog("Error connecting to new server with address %s (source address: %s, source interface: %s): %s", d_config.remote.toStringWithPort(), IsAnyAddress(d_config.sourceAddr) ? "not set" : d_config.sourceAddr.toString(), d_config.sourceItfName.empty() ? "not set" : d_config.sourceItfName, error.what()); + } + else { + infolog("Error connecting to new server with address %s: %s", d_config.remote.toStringWithPort(), error.what()); + } } connected = false; break; -- 2.47.2