]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Only check if we want a specific interface if we actually support that
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 22 Jun 2022 11:36:04 +0000 (13:36 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 22 Jun 2022 11:36:04 +0000 (13:36 +0200)
pdns/dnsdistdist/dnsdist-healthchecks.cc

index 5430555924210b217eb363135975ec1aa3d864d3..cceaa16bc59e0a8ea6ea1d801b07384d3809b83b 100644 (file)
@@ -368,14 +368,15 @@ bool queueHealthCheck(std::unique_ptr<FDMultiplexer>& 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();