patch 'test/pcapng: fix for Windows' has been queued to stable release 25.11.1
Kevin Traynor
ktraynor at redhat.com
Thu Mar 19 11:03:09 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/23/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/6f5f7a5b1451b3154ed05cb2bf312bab2624340a
Thanks.
Kevin
---
>From 6f5f7a5b1451b3154ed05cb2bf312bab2624340a Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Sat, 28 Feb 2026 09:35:00 -0800
Subject: [PATCH] test/pcapng: fix for Windows
[ upstream commit 93efb28e67f8a39ddf171c43a9b2d079e1f8c30e ]
The pcapng test needs additional wrappers to be able to
build and run on Windows.
This is a pre-existing problem, only exposed when the
test was enabled on Windows builds, and when libpcap
is setup on Windows.
Fixes: 0edc1f408a8b ("test: enable subset of tests on Windows")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/test/test_pcapng.c | 65 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 61 insertions(+), 4 deletions(-)
diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c
index bcf99724fa..fe2680b77e 100644
--- a/app/test/test_pcapng.c
+++ b/app/test/test_pcapng.c
@@ -5,5 +5,14 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+
+#ifdef RTE_EXEC_ENV_WINDOWS
+#include <winsock2.h>
+#include <io.h>
+#include <fcntl.h>
+#include <windows.h>
+#else
#include <unistd.h>
+#endif
#include <rte_bus_vdev.h>
@@ -24,4 +33,50 @@
#include "test.h"
+#ifdef RTE_EXEC_ENV_WINDOWS
+static uint64_t
+current_timestamp(void)
+{
+ FILETIME ft;
+ ULARGE_INTEGER ul;
+
+ GetSystemTimeAsFileTime(&ft);
+ ul.LowPart = ft.dwLowDateTime;
+ ul.HighPart = ft.dwHighDateTime;
+ /* FILETIME is 100ns intervals since 1601-01-01, convert to ns since Unix epoch */
+ return (ul.QuadPart - 116444736000000000ULL) * 100;
+}
+
+/*
+ * Create temporary file with suffix for Windows.
+ * Returns file descriptor or -1 on failure.
+ */
+static int
+mkstemps(char *tmpl, int suffixlen)
+{
+ char temp_dir[MAX_PATH];
+ char temp_file[MAX_PATH];
+ DWORD ret;
+
+ ret = GetTempPathA(sizeof(temp_dir), temp_dir);
+ if (ret == 0 || ret > sizeof(temp_dir))
+ return -1;
+
+ if (GetTempFileNameA(temp_dir, "pcap", 0, temp_file) == 0)
+ return -1;
+
+ /*
+ * GetTempFileNameA with uUnique=0 creates the file to reserve the name.
+ * Remove it since we open a different name with the original suffix appended.
+ */
+ DeleteFileA(temp_file);
+
+ /* Append the original suffix (e.g. ".pcapng") to the temp file */
+ strlcat(temp_file, tmpl + strlen(tmpl) - suffixlen, sizeof(temp_file));
+ strlcpy(tmpl, temp_file, PATH_MAX);
+
+ return _open(tmpl, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, 0666);
+}
+#endif /* RTE_EXEC_ENV_WINDOWS */
+
#define PCAPNG_TEST_DEBUG 0
@@ -274,4 +329,5 @@ error:
}
+#ifndef RTE_EXEC_ENV_WINDOWS
static uint64_t
current_timestamp(void)
@@ -282,4 +338,5 @@ current_timestamp(void)
return rte_timespec_to_ns(&ts);
}
+#endif
/*
@@ -325,5 +382,5 @@ static int
test_add_interface(void)
{
- char file_name[] = "/tmp/pcapng_test_XXXXXX.pcapng";
+ char file_name[PATH_MAX] = "/tmp/pcapng_test_XXXXXX.pcapng";
static rte_pcapng_t *pcapng;
int ret, tmp_fd;
@@ -374,5 +431,5 @@ test_add_interface(void)
/* if test fails want to investigate the file */
if (ret == 0)
- unlink(file_name);
+ remove(file_name);
return ret;
@@ -386,5 +443,5 @@ static int
test_write_packets(void)
{
- char file_name[] = "/tmp/pcapng_test_XXXXXX.pcapng";
+ char file_name[PATH_MAX] = "/tmp/pcapng_test_XXXXXX.pcapng";
static rte_pcapng_t *pcapng;
int ret, tmp_fd, count;
@@ -431,5 +488,5 @@ test_write_packets(void)
/* if test fails want to investigate the file */
if (ret == 0)
- unlink(file_name);
+ remove(file_name);
return ret;
--
2.53.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-03-19 10:01:09.134398553 +0000
+++ 0071-test-pcapng-fix-for-Windows.patch 2026-03-19 10:01:07.128331260 +0000
@@ -1 +1 @@
-From 93efb28e67f8a39ddf171c43a9b2d079e1f8c30e Mon Sep 17 00:00:00 2001
+From 6f5f7a5b1451b3154ed05cb2bf312bab2624340a Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 93efb28e67f8a39ddf171c43a9b2d079e1f8c30e ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -22 +23 @@
-index ad9ad51f4c..f0faead728 100644
+index bcf99724fa..fe2680b77e 100644
@@ -91 +92 @@
-@@ -345,4 +400,5 @@ error:
+@@ -274,4 +329,5 @@ error:
@@ -97 +98 @@
-@@ -353,4 +409,5 @@ current_timestamp(void)
+@@ -282,4 +338,5 @@ current_timestamp(void)
@@ -103 +104 @@
-@@ -396,5 +453,5 @@ static int
+@@ -325,5 +382,5 @@ static int
@@ -110 +111 @@
-@@ -445,5 +502,5 @@ test_add_interface(void)
+@@ -374,5 +431,5 @@ test_add_interface(void)
@@ -117 +118 @@
-@@ -457,5 +514,5 @@ static int
+@@ -386,5 +443,5 @@ static int
@@ -122 +123 @@
- rte_pcapng_t *pcapng = NULL;
+ static rte_pcapng_t *pcapng;
@@ -124 +125 @@
-@@ -509,5 +566,5 @@ test_write_packets(void)
+@@ -431,5 +488,5 @@ test_write_packets(void)
More information about the stable
mailing list