From: Remi Gacogne Date: Mon, 8 Apr 2019 09:59:24 +0000 (+0200) Subject: dnsdist: Fix an issue with self-answers and non-harvested source X-Git-Tag: dnsdist-1.4.0-alpha1~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d192f511736ed5e7b246f89b024f8900fb03841;p=thirdparty%2Fpdns.git dnsdist: Fix an issue with self-answers and non-harvested source --- diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 905ee4d415..f3ff6f4660 100644 --- a/pdns/dnsdist.cc +++ b/pdns/dnsdist.cc @@ -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(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(dq.dh), dq.len, dq.delayMsec, dest, *dq.remote); return; } diff --git a/pdns/iputils.cc b/pdns/iputils.cc index 88fd698131..8abe2873ed 100644 --- a/pdns/iputils.cc +++ b/pdns/iputils.cc @@ -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(const_cast(buffer)); iov.iov_len = len; msgh.msg_iov = &iov;