]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Disable eBPF filtering on QUIC (DoQ, DoH3) sockets
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 3 Oct 2024 07:10:09 +0000 (09:10 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 3 Oct 2024 08:22:54 +0000 (10:22 +0200)
The current eBPF code tries to parse the beginning of the DNS payload
to extract the qname for all UDP datagrams, which is not course
not working correctly for QUIC packets. I don't immediately see a way
to identify QUIC packets from our eBPF code, so for now this commit
disables the eBPF filtering feature on QUIC sockets.

(cherry picked from commit 093c0de7bcb357e877adc0993a7f7fe78f55add7)

pdns/dnsdist.cc
pdns/dnsdistdist/docs/advanced/ebpf.rst

index 95ebf6cf2f79b9eff48eb6150c87f422cb649fed..96ce8ac0d56ce518ed973e8f46447e5117cc89fa 100644 (file)
@@ -2602,7 +2602,10 @@ static void setupLocalSocket(ClientState& clientState, const ComboAddress& addr,
   }
 
 #ifdef HAVE_EBPF
-  if (g_defaultBPFFilter && !g_defaultBPFFilter->isExternal()) {
+  /* for now eBPF filtering is not enabled on QUIC sockets because the eBPF code tries
+     to parse the QNAME from the payload for all UDP datagrams, which obviously does not
+     work well for these. */
+  if (!isQUIC && g_defaultBPFFilter && !g_defaultBPFFilter->isExternal()) {
     clientState.attachFilter(g_defaultBPFFilter, socket);
     vinfolog("Attaching default BPF Filter to %s frontend %s", (!tcp ? std::string("UDP") : std::string("TCP")), addr.toStringWithPort());
   }
index 2905b95e96c9259f696ee44d87ea0a052a8178d6..ae70cfb92aeb59f66d0c8c367f80f68421ac1300 100644 (file)
@@ -15,6 +15,9 @@ eBPF Socket Filtering
 .. note::
    In addition to keeping the correct capability, large maps might require an increase of ``RLIMIT_MEMLOCK``, as mentioned below.
 
+.. warning::
+   As of 1.9.7, eBPF filtering is not supported for QUIC-based protocols, including DNS over QUIC and DNS over HTTP/3.
+
 This feature allows dnsdist to ask the kernel to discard incoming packets in kernel-space instead of them being copied to userspace just to be dropped, thus being a lot of faster. The current implementation supports dropping UDP and TCP queries based on the source IP and UDP datagrams on exact DNS names. We have not been able to implement suffix matching yet, due to a limit on the maximum number of EBPF instructions.
 
 The following figure show the CPU usage of dropping around 20k qps of traffic, first in userspace (34 to 36) then in kernel space with eBPF (37 to 39). The spikes are caused because the drops are triggered by dynamic rules, so the first spike is the abuse traffic before a rule is automatically inserted, and the second spike is because the rule expires automatically after 60s before being inserted again.