]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: warn if v3 block size is not large enough for defrag
authorJason Ish <jason.ish@oisf.net>
Wed, 12 Mar 2025 22:20:38 +0000 (16:20 -0600)
committerVictor Julien <vjulien@oisf.net>
Tue, 18 Mar 2025 10:02:32 +0000 (11:02 +0100)
If using tpacket-v3 and defrag, warn if the block size is not large
enough for a fully defragmented packet.

Ticket: #7458

src/runmode-af-packet.c

index 2f93a9b90121c54595920775baafc9e7321b92b6..6537435f65bdf88a997cce33b9fb3cd3ca88f3df 100644 (file)
@@ -764,6 +764,15 @@ finalize:
                 iface, MAX_PACKET_SIZE);
     }
 
+    /* For tpacket-v3, warn if defrag is enabled and block-block-size
+     * is less than max defragmented packet size. */
+    if ((aconf->flags & AFP_TPACKET_V3) && (aconf->cluster_type & PACKET_FANOUT_FLAG_DEFRAG) &&
+            (aconf->block_size < MAX_PACKET_SIZE)) {
+        SCLogWarning("%s: AF_PACKET block-size is not large enough for max fragmented IP packet "
+                     "size (%u)",
+                iface, MAX_PACKET_SIZE);
+    }
+
     return aconf;
 }