patch 'net/pcap: reject non-Ethernet interfaces' has been queued to stable release 24.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 11 15:19:27 CEST 2026


Hi,

FYI, your patch has been queued to stable release 24.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/bba8e31a8063faee260032f86a20a4b24e167ce0

Thanks.

Luca Boccassi

---
>From bba8e31a8063faee260032f86a20a4b24e167ce0 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Sun, 19 Apr 2026 09:09:49 -0700
Subject: [PATCH] net/pcap: reject non-Ethernet interfaces

[ upstream commit 7f781c1a864da8f5977602b40ce439100de95632 ]

The pcap PMD sends and receives raw Ethernet frames. If used with
an interface that has a different link type, packets will be malformed.

On FreeBSD and macOS, the loopback interface uses DLT_NULL which expects
a 4-byte address family header instead of an Ethernet header. Sending
Ethernet frames to such interfaces causes kernel warnings like:
  looutput: af=-1 unexpected

Add a check after pcap_activate() to verify the interface uses
DLT_EN10MB (Ethernet) link type and reject others with a clear error.

Fixes: 4c173302c307 ("pcap: add new driver")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/pcap/pcap_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index 589b61e84f..df8d52fc87 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -532,6 +532,16 @@ open_iface_live(const char *iface, pcap_t **pcap) {
 		return -1;
 	}
 
+	/*
+	 * Verify interface supports Ethernet link type.
+	 * Loopback on FreeBSD/macOS uses DLT_NULL which expects a 4-byte
+	 * address family header instead of Ethernet, causing kernel warnings.
+	 */
+	if (pcap_datalink(*pcap) != DLT_EN10MB) {
+		PMD_LOG(ERR, "%s: not Ethernet (link type %d)",
+			iface, pcap_datalink(*pcap));
+	}
+
 	if (pcap_setnonblock(*pcap, 1, errbuf)) {
 		PMD_LOG(ERR, "Couldn't set non-blocking on %s: %s", iface, errbuf);
 		pcap_close(*pcap);
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-06-11 14:20:02.077062776 +0100
+++ 0018-net-pcap-reject-non-Ethernet-interfaces.patch	2026-06-11 14:20:01.182745205 +0100
@@ -1 +1 @@
-From 7f781c1a864da8f5977602b40ce439100de95632 Mon Sep 17 00:00:00 2001
+From bba8e31a8063faee260032f86a20a4b24e167ce0 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7f781c1a864da8f5977602b40ce439100de95632 ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -22,2 +23,2 @@
- drivers/net/pcap/pcap_ethdev.c | 11 +++++++++++
- 1 file changed, 11 insertions(+)
+ drivers/net/pcap/pcap_ethdev.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
@@ -26 +27 @@
-index 56f88f5b89..91d442504a 100644
+index 589b61e84f..df8d52fc87 100644
@@ -29,2 +30,2 @@
-@@ -664,6 +664,17 @@ open_iface_live(const char *iface, pcap_t **pcap)
- 		goto error;
+@@ -532,6 +532,16 @@ open_iface_live(const char *iface, pcap_t **pcap) {
+ 		return -1;
@@ -38 +39 @@
-+	if (pcap_datalink(pc) != DLT_EN10MB) {
++	if (pcap_datalink(*pcap) != DLT_EN10MB) {
@@ -40,2 +41 @@
-+			iface, pcap_datalink(pc));
-+		goto error;
++			iface, pcap_datalink(*pcap));
@@ -44 +44 @@
- 	if (pcap_setnonblock(pc, 1, errbuf)) {
+ 	if (pcap_setnonblock(*pcap, 1, errbuf)) {
@@ -46 +46 @@
- 		goto error;
+ 		pcap_close(*pcap);


More information about the stable mailing list