[PATCH v3 0/5] pcapng: fixes for Windows and timestamps

Stephen Hemminger
2026-02-28T17:56:07Z

Fix pcapng test and library issues:

The test did not build on Windows because it used POSIX-only
APIs (clock_gettime, mkstemps, unlink). Add Windows wrappers
and use portable alternatives where possible.

The test timing was tied to TSC frequency which could make
it run excessively long on slow emulated platforms. Use a
fixed time bound instead.

The test was mixing stdout and stderr making CI log analysis
confusing. Consolidate on stdout and switch to UTC timestamps.

The library timestamp conversion produced bogus values if
rte_pcapng_copy() was called before rte_pcapng_fdopen(),
since the unsigned TSC delta wraps. Handle the case where
the packet TSC precedes the clock baseline.

Add a regression test for the pre-open timestamp fix.

v3 - improve test log output

Stephen Hemminger (5):
test: fix pcapng test to work on Windows
test: use fixed time length for write packet test
test: better logging for pcapng test
pcapng: handle packets copied before file open
test: add pcapng test for copy before open

app/test/test_pcapng.c | 224 ++++++++++++++++++++++++++++++++++------
lib/pcapng/rte_pcapng.c | 10 +-
2 files changed, 197 insertions(+), 37 deletions(-)

--
2.51.0