]> granicus.if.org Git - pdns/commitdiff
dnsdist: Fix an issue with self-answers and non-harvested source
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 8 Apr 2019 09:59:24 +0000 (11:59 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 8 Apr 2019 09:59:24 +0000 (11:59 +0200)
pdns/dnsdist.cc
pdns/iputils.cc

index 905ee4d4151e48638f3621f62ad02328bb02df83..f3ff6f4660d861669e0b91cb26a2dc71c7971766 100644 (file)
@@ -1536,7 +1536,8 @@ static void processUDPQuery(ClientState& cs, LocalHolders& holders, const struct
         return;
       }
 #endif /* defined(HAVE_RECVMMSG) && defined(HAVE_SENDMMSG) && defined(MSG_WAITFORONE) */
-      sendUDPResponse(cs.udpFD, reinterpret_cast<char*>(dq.dh), dq.len, dq.delayMsec, *dq.local, *dq.remote);
+      /* we use dest, always, because we don't want to use the listening address to send a response since it could be 0.0.0.0 */
+      sendUDPResponse(cs.udpFD, reinterpret_cast<char*>(dq.dh), dq.len, dq.delayMsec, dest, *dq.remote);
       return;
     }
 
index 88fd698131b2d0aaeeda4442f4a11c4763122527..8abe2873ededdeb31aeddbc1847a50f12ef0d20c 100644 (file)
@@ -300,10 +300,6 @@ size_t sendMsgWithTimeout(int fd, const char* buffer, size_t len, int idleTimeou
     addCMsgSrcAddr(&msgh, cbuf, local, localItf);
   }
 
-  if (localItf != 0 && local) {
-    addCMsgSrcAddr(&msgh, cbuf, local, localItf);
-  }
-
   iov.iov_base = reinterpret_cast<void*>(const_cast<char*>(buffer));
   iov.iov_len = len;
   msgh.msg_iov = &iov;