From 6d192f511736ed5e7b246f89b024f8900fb03841 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 8 Apr 2019 11:59:24 +0200 Subject: [PATCH] dnsdist: Fix an issue with self-answers and non-harvested source --- pdns/dnsdist.cc | 3 ++- pdns/iputils.cc | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pdns/dnsdist.cc b/pdns/dnsdist.cc index 905ee4d41..f3ff6f466 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 88fd69813..8abe2873e 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; -- 2.40.0