Project

General

Profile

Bug #8667 » widener.patch

Shane Dugan, 06/17/2026 04:15 PM

View differences:

src/source-af-packet.c
{
int val;
/* TEST-ONLY: deterministic window widener for race reproduction.
*
* The startup race window is the interval between AFPPeersListReachedInc()
* (called right after bind(), before this function) and
* AFPSwitchState(AFP_STATE_UP) (called after this function returns).
* On a normal build with no memory pressure this window is very narrow
* and thread scheduling may not land inside it.
*
* Setting SURICATA_RING_SETUP_DELAY_US=N holds this window open for N
* microseconds, making the race fire deterministically.
*
* This is a NO-OP unless the env var is set. Never enable in production.
*/
const char *delay_env = getenv("SURICATA_RING_SETUP_DELAY_US");
if (delay_env != NULL) {
unsigned long delay_us = strtoul(delay_env, NULL, 10);
if (delay_us > 0) {
usleep((useconds_t)delay_us);
}
}
if (ptv->flags & AFP_TPACKET_V3) {
(4-4/4)