patch 'pcapng: chain additional mbuf when comment exceeds tailroom' has been queued to stable release 24.11.5

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 20 15:56:57 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.5

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

Thanks.

Luca Boccassi

---
>From 06cbd8ad204d7a127e470043953298b0a06b8434 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Mon, 16 Feb 2026 13:38:02 -0800
Subject: [PATCH] pcapng: chain additional mbuf when comment exceeds tailroom

[ upstream commit 2aae0e66b4ef84a0a7c310552714dcc92e27d260 ]

When rte_pcapng_copy() is called with a comment, the option data
may not fit in the mbuf's remaining tailroom, causing the append
to fail and the packet to be dropped.

Fix this by allocating and chaining an additional mbuf segment
when rte_pktmbuf_append() fails. This allows comments of any
length (up to UINT16_MAX) to be attached to captured packets.

Fixes: c1abd1e93dbd ("pcapng: support comment in enhanced packet block")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/pcapng/rte_pcapng.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index d5f4e86218..b44a56b522 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -544,11 +544,26 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,
 	if (comment)
 		optlen += pcapng_optlen(strlen(comment));
 
-	/* reserve trailing options and block length */
-	opt = (struct pcapng_option *)
-		rte_pktmbuf_append(mc, optlen + sizeof(uint32_t));
-	if (unlikely(opt == NULL))
-		goto fail;
+	/*
+	 * Try to put options at the end of this mbuf.
+	 * If not extend the mbuf by adding another segment.
+	 */
+	opt = (struct pcapng_option *)rte_pktmbuf_append(mc, optlen + sizeof(uint32_t));
+	if (unlikely(opt == NULL)) {
+		struct rte_mbuf *ml = rte_pktmbuf_alloc(mp);
+
+		if (unlikely(ml == NULL))
+			goto fail;	/* mbuf pool is empty */
+
+		if (unlikely(rte_pktmbuf_chain(mc, ml) != 0)) {
+			rte_pktmbuf_free(ml);
+			goto fail;	/* too many segments in the mbuf */
+		}
+
+		opt = (struct pcapng_option *)rte_pktmbuf_append(mc, optlen + sizeof(uint32_t));
+		if (unlikely(opt == NULL))
+			goto fail;	/* additional segment and still no space */
+	}
 
 	switch (direction) {
 	case RTE_PCAPNG_DIRECTION_IN:
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-02-20 14:55:47.579046499 +0000
+++ 0115-pcapng-chain-additional-mbuf-when-comment-exceeds-ta.patch	2026-02-20 14:55:43.376193990 +0000
@@ -1 +1 @@
-From 2aae0e66b4ef84a0a7c310552714dcc92e27d260 Mon Sep 17 00:00:00 2001
+From 06cbd8ad204d7a127e470043953298b0a06b8434 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2aae0e66b4ef84a0a7c310552714dcc92e27d260 ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -23 +24 @@
-index c99dbca09d..ee511c2972 100644
+index d5f4e86218..b44a56b522 100644
@@ -26 +27 @@
-@@ -567,11 +567,26 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,
+@@ -544,11 +544,26 @@ rte_pcapng_copy(uint16_t port_id, uint32_t queue,
@@ -28 +29 @@
- 		optlen += pcapng_optlen(strnlen(comment, PCAPNG_STR_MAX));
+ 		optlen += pcapng_optlen(strlen(comment));


More information about the stable mailing list