]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Do not send UDP responses when the frontend is muted 17461/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 22 May 2026 12:44:00 +0000 (14:44 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Fri, 22 May 2026 12:44:00 +0000 (14:44 +0200)
We were not checking in various places (cache hits, self-answered responses).

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
pdns/dnsdistdist/dnsdist.cc

index d498c0fc1ec5476d27ba51055c0f6debcafb86c2..396c860f5c4a5e0e29e18907338c4df855223ba4 100644 (file)
@@ -1990,7 +1990,9 @@ static void processUDPQuery(ClientState& clientState, const struct msghdr* msgh,
 
     auto dnsCryptResponse = checkDNSCryptQuery(clientState, query, ids.dnsCryptQuery, ids.queryRealTime.d_start.tv_sec, false);
     if (dnsCryptResponse) {
-      sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
+      if (!clientState.muted) {
+        sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
+      }
       return;
     }
 
@@ -2010,7 +2012,9 @@ static void processUDPQuery(ClientState& clientState, const struct msghdr* msgh,
           return true;
         });
 
-        sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
+        if (!clientState.muted) {
+          sendUDPResponse(clientState.udpFD, query, 0, dest, remote);
+        }
         return;
       }
     }
@@ -2063,7 +2067,9 @@ static void processUDPQuery(ClientState& clientState, const struct msghdr* msgh,
 #endif /* defined(HAVE_RECVMMSG) && defined(HAVE_SENDMMSG) && defined(MSG_WAITFORONE) */
 #endif /* DISABLE_RECVMMSG */
       /* 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(clientState.udpFD, query, dnsQuestion.ids.delayMsec, dest, remote);
+      if (!clientState.muted) {
+        sendUDPResponse(clientState.udpFD, query, dnsQuestion.ids.delayMsec, dest, remote);
+      }
 
       handleResponseSent(std::move(dnsQuestion.ids.qname), dnsQuestion.ids.qtype, 0., remote, ComboAddress(), query.size(), *dnsHeader, dnsdist::Protocol::DoUDP, dnsdist::Protocol::DoUDP, false);
       return;