1 Star 0 Fork 75

sky/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0020-pdump-fix-pcap_dump-coredump-caused-by-incorrect-pkt_len.patch 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
From c02e48b92050856389403518be8bb70a4fdda551 Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Thu, 8 Jun 2023 20:59:15 +0800
Subject: [PATCH] pdump: fix pcap_dump coredump caused by incorrect pkt_len
---
drivers/net/pcap/pcap_ethdev.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index ec29fd6..40ad166 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -408,8 +408,13 @@ eth_pcap_tx_dumper(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
* in the mbuf (when the mbuf is contiguous) or, otherwise,
* a pointer to temp_data after copying into it.
*/
- pcap_dump((u_char *)dumper, &header,
- rte_pktmbuf_read(mbuf, 0, caplen, temp_data));
+ const void *sp = rte_pktmbuf_read(mbuf, 0, caplen, temp_data);
+ if (sp == NULL) {
+ rte_pktmbuf_free(mbuf);
+ continue;
+ } else {
+ pcap_dump((u_char *)dumper, &header, sp);
+ }
num_tx++;
tx_bytes += caplen;
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/dpdk.git
git@gitee.com:nlgwcy/dpdk.git
nlgwcy
dpdk
dpdk
master

搜索帮助