[PATCH] net: fix tunnel parsing of non-IP packets

Andrey Mokrushin a.mokrushin at ideco.ru
Mon Nov 9 14:37:12 CET 2026


When the EtherType is neither IPv4 nor IPv6, rte_net_get_ptype()
skips the L3 parsing but then calls ptype_tunnel_without_udp() with
the EtherType still in proto. This function compares proto with IP
protocol numbers, so on little-endian EtherType 0x0400 (also an 802.3
length field), 0x2900 and 0x2F00 are taken as IPIP, IPv6 and GRE:
the packet is reported as an IP tunnel, and the data after the
Ethernet header is parsed as the inner packet.

Return after L2 for non-IP packets.

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

Signed-off-by: Andrey Mokrushin <a.mokrushin at ideco.ru>
---
 lib/net/rte_net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index 54bbafc..343eb88 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -464,6 +464,9 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m,
 			return pkt_type;
 		}
 		pkt_type |= ptype_l4(proto);
+	} else {
+		/* not an IP packet: there is no L4 header or tunnel to parse */
+		return pkt_type;
 	}
 
 	if ((pkt_type & RTE_PTYPE_L4_MASK) == RTE_PTYPE_L4_UDP) {
-- 
2.56.0




More information about the dev mailing list