HomeFreeBSD

tests: make sniffer more robust

Description

tests: make sniffer more robust

The Sniffer class is often used by test tools such as pft_ping to verify
that packets actually get sent where they're expected.

It starts a background thread to capture packets, but this thread needs
some time to start, leading to intermittent test failures when the
capture doesn't start before the relevant packet is sent.

Add a semaphore to ensure the Sniffer constructor doesn't return until
the capture is actually running.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 67557372dfef87eb94681a97a4157198efe21992)

Details

Provenance
kpAuthored on Nov 2 2022, 10:55 AM
Parents
rGf2a6d07a4e49: netgraph/ng_bridge: add missing array terminator
Branches
Unknown
Tags
Unknown