]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Punt fragmented UDP dgrams to the kernel in xdp-filter
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 2 Mar 2023 14:04:33 +0000 (15:04 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 23 Jan 2024 11:54:14 +0000 (12:54 +0100)
contrib/xdp-filter.ebpf.src

index 8de35a0445e03fcf6beadbde41210d10faf23b2b..786d9d75a355f1a7fbf9a32e0063a72bbada11e3 100644 (file)
@@ -195,6 +195,14 @@ static inline enum xdp_action parseIPV4(struct xdp_md* ctx, struct cursor* c)
     goto res;
   }
 
+  // ignore the DF flag
+  const uint16_t fragMask = htons(~(1 << 14));
+  uint16_t frag = ipv4->frag_off & fragMask;
+  if (frag != 0) {
+    // MF flag is set, or Fragment Offset is != 0
+    return XDP_PASS;
+  }
+
   if (dns) {
     value = check_qname(c);
   }