Skip to content

Commit 2a1c841

Browse files
committed
dnsdist: Do not send UDP responses when the frontend is muted
We were not checking in various places (cache hits, self-answered responses). Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
1 parent 93ff5fb commit 2a1c841

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

pdns/dnsdistdist/dnsdist.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,9 @@ static void processUDPQuery(ClientState& clientState, const struct msghdr* msgh,
19901990

19911991
auto dnsCryptResponse = checkDNSCryptQuery(clientState, query, ids.dnsCryptQuery, ids.queryRealTime.d_start.tv_sec, false);
19921992
if (dnsCryptResponse) {
1993-
sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
1993+
if (!clientState.muted) {
1994+
sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
1995+
}
19941996
return;
19951997
}
19961998

@@ -2010,7 +2012,9 @@ static void processUDPQuery(ClientState& clientState, const struct msghdr* msgh,
20102012
return true;
20112013
});
20122014

2013-
sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
2015+
if (!clientState.muted) {
2016+
sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
2017+
}
20142018
return;
20152019
}
20162020
}
@@ -2063,7 +2067,9 @@ static void processUDPQuery(ClientState& clientState, const struct msghdr* msgh,
20632067
#endif /* defined(HAVE_RECVMMSG) && defined(HAVE_SENDMMSG) && defined(MSG_WAITFORONE) */
20642068
#endif /* DISABLE_RECVMMSG */
20652069
/* 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 */
2066-
sendUDPResponse(clientState.udpFD, query, dnsQuestion.ids.delayMsec, dest, remote);
2070+
if (!clientState.muted) {
2071+
sendUDPResponse(clientState.udpFD, query, dnsQuestion.ids.delayMsec, dest, remote);
2072+
}
20672073

20682074
handleResponseSent(std::move(dnsQuestion.ids.qname), dnsQuestion.ids.qtype, 0., remote, ComboAddress(), query.size(), *dnsHeader, dnsdist::Protocol::DoUDP, dnsdist::Protocol::DoUDP, false);
20692075
return;

0 commit comments

Comments
 (0)