From: Remi Gacogne Date: Wed, 22 Jun 2022 11:36:04 +0000 (+0200) Subject: dnsdist: Only check if we want a specific interface if we actually support that X-Git-Tag: auth-4.8.0-alpha0~44^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c465546d6710d97ffe51cc3dde2fdf5b697b633;p=thirdparty%2Fpdns.git dnsdist: Only check if we want a specific interface if we actually support that --- diff --git a/pdns/dnsdistdist/dnsdist-healthchecks.cc b/pdns/dnsdistdist/dnsdist-healthchecks.cc index 5430555924..cceaa16bc5 100644 --- a/pdns/dnsdistdist/dnsdist-healthchecks.cc +++ b/pdns/dnsdistdist/dnsdist-healthchecks.cc @@ -368,14 +368,15 @@ bool queueHealthCheck(std::unique_ptr& mplexer, const std::shared Socket sock(ds->d_config.remote.sin4.sin_family, ds->doHealthcheckOverTCP() ? SOCK_STREAM : SOCK_DGRAM); sock.setNonBlocking(); - if (!ds->d_config.sourceItfName.empty()) { + #ifdef SO_BINDTODEVICE + if (!ds->d_config.sourceItfName.empty()) { int res = setsockopt(sock.getHandle(), SOL_SOCKET, SO_BINDTODEVICE, ds->d_config.sourceItfName.c_str(), ds->d_config.sourceItfName.length()); if (res != 0 && g_verboseHealthChecks) { infolog("Error setting SO_BINDTODEVICE on the health check socket for backend '%s': %s", ds->getNameWithAddr(), stringerror()); } -#endif } +#endif if (!IsAnyAddress(ds->d_config.sourceAddr)) { sock.setReuseAddr();