[PATCH] net: fix incorrect L2 length for GRE tunneling packet

Dengdui Huang huangdengdui at huawei.com
Wed Jul 23 12:47:10 CEST 2025


The meaning of L2_len in the parsing result of the rte_net_get_ptype()
is the same as the L2_len field in the mbuf. For tunnel packets,
the L2_len should include protocol header of tunnel packets.

Bugzilla ID: 1754
Fixes: d21d855464ff ("net: support GRE in software packet type parser")
Cc: stable at dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
---
 lib/net/rte_net.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 44fb6c0f51..c70b57fdc0 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -481,6 +481,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 
 		pkt_type |= ptype_tunnel_without_udp(&proto, m, &off);
 		hdr_lens->tunnel_len = off - prev_off;
+		hdr_lens->inner_l2_len = off - prev_off;
 	}
 
 	/* same job for inner header: we need to duplicate the code
-- 
2.33.0



More information about the dev mailing list