]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Better error when we cannot connect a backend socket 15046/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Jan 2025 15:30:50 +0000 (16:30 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 16 Jan 2025 15:30:50 +0000 (16:30 +0100)
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.

pdns/dnsdistdist/dnsdist-backend.cc

index d493d3f9aa1f68036fe345cb52746b28db82a5f2..e236ea1c74fb70fe7bb262a092200c1bc68b2ad9 100644 (file)
@@ -148,7 +148,12 @@ bool DownstreamState::reconnect(bool initialAttempt)
     }
     catch (const std::runtime_error& error) {
       if (initialAttempt || dnsdist::configuration::getCurrentRuntimeConfiguration().d_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;