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")

Details

Provenance
kpAuthored on Nov 2 2022, 10:55 AM
Parents
rGfd6b681e4507: Add myself (zlei) as a src committer and kp / melifaro as my mentors
Branches
Unknown
Tags
Unknown