patch 'app/dumpcap: fix handling of jumbo frames' has been queued to stable release 22.11.7
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Wed Oct 23 23:16:02 CEST 2024
Hi,
FYI, your patch has been queued to stable release 22.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 10/25/24. 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/65c229defe6b3bc0843bf34cf998718e317528d9
Thanks.
Luca Boccassi
---
>From 65c229defe6b3bc0843bf34cf998718e317528d9 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Thu, 3 Oct 2024 15:09:03 -0700
Subject: [PATCH] app/dumpcap: fix handling of jumbo frames
[ upstream commit 5c0f970c0d0e2a963a7a970a71cad4f4244414a5 ]
If dumpcap (in legacy pcap mode) tried to handle a large segmented
frame it would core dump because rte_pktmbuf_read() would return NULL.
Fix by using same logic as in pcap PMD.
Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")
Reported-by: Tianli Lai <laitianli at tom.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
app/dumpcap/main.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c
index 81c9d7d2f1..7e8aa5d76e 100644
--- a/app/dumpcap/main.c
+++ b/app/dumpcap/main.c
@@ -740,7 +740,7 @@ static ssize_t
pcap_write_packets(pcap_dumper_t *dumper,
struct rte_mbuf *pkts[], uint16_t n)
{
- uint8_t temp_data[snaplen];
+ uint8_t temp_data[RTE_ETHER_MAX_JUMBO_FRAME_LEN];
struct pcap_pkthdr header;
uint16_t i;
size_t total = 0;
@@ -749,14 +749,19 @@ pcap_write_packets(pcap_dumper_t *dumper,
for (i = 0; i < n; i++) {
struct rte_mbuf *m = pkts[i];
+ size_t len, caplen;
- header.len = rte_pktmbuf_pkt_len(m);
- header.caplen = RTE_MIN(header.len, snaplen);
+ len = caplen = rte_pktmbuf_pkt_len(m);
+ if (unlikely(!rte_pktmbuf_is_contiguous(m) && len > snaplen))
+ caplen = snaplen;
+
+ header.len = len;
+ header.caplen = caplen;
pcap_dump((u_char *)dumper, &header,
- rte_pktmbuf_read(m, 0, header.caplen, temp_data));
+ rte_pktmbuf_read(m, 0, caplen, temp_data));
- total += sizeof(header) + header.len;
+ total += sizeof(header) + caplen;
}
return total;
--
2.45.2
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-10-23 22:16:41.375045224 +0100
+++ 0022-app-dumpcap-fix-handling-of-jumbo-frames.patch 2024-10-23 22:16:40.455941029 +0100
@@ -1 +1 @@
-From 5c0f970c0d0e2a963a7a970a71cad4f4244414a5 Mon Sep 17 00:00:00 2001
+From 65c229defe6b3bc0843bf34cf998718e317528d9 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 5c0f970c0d0e2a963a7a970a71cad4f4244414a5 ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -20 +21 @@
-index 6feb8f5672..fcfaa19951 100644
+index 81c9d7d2f1..7e8aa5d76e 100644
@@ -23 +24 @@
-@@ -902,7 +902,7 @@ static ssize_t
+@@ -740,7 +740,7 @@ static ssize_t
@@ -27 +28 @@
-- uint8_t temp_data[RTE_MBUF_DEFAULT_BUF_SIZE];
+- uint8_t temp_data[snaplen];
@@ -32 +33 @@
-@@ -911,14 +911,19 @@ pcap_write_packets(pcap_dumper_t *dumper,
+@@ -749,14 +749,19 @@ pcap_write_packets(pcap_dumper_t *dumper,
@@ -39 +40 @@
-- header.caplen = RTE_MIN(header.len, sizeof(temp_data));
+- header.caplen = RTE_MIN(header.len, snaplen);
@@ -41,2 +42,2 @@
-+ if (unlikely(!rte_pktmbuf_is_contiguous(m) && len > sizeof(temp_data)))
-+ caplen = sizeof(temp_data);
++ if (unlikely(!rte_pktmbuf_is_contiguous(m) && len > snaplen))
++ caplen = snaplen;
More information about the stable
mailing list