[dpdk-dev] [PATCH] gro: fix an error when packet is IPv6
yang_y_yi at 163.com
yang_y_yi at 163.com
Wed Nov 4 05:22:36 CET 2020
From: Yi Yang <yangyi01 at inspur.com>
Current code will think IPv6 packet as IPv4 packet
if inner header is IPv6 and outer header is IPv4,
the result is rte_gro_reassemble() will handle it
as if inner header also is IPv4, so IPv6 can't
be handled correctly as one of unprocess_pkts.
Fixes: e2d811063673 ("gro: support VXLAN UDP/IPv4")
Fixes: 1ca5e6740852 ("gro: support UDP/IPv4")
Fixes: 9e0b9d2ec0f4 ("gro: support VxLAN GRO")
Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4")
Signed-off-by: Yi Yang <yangyi01 at inspur.com>
---
lib/librte_gro/rte_gro.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/lib/librte_gro/rte_gro.c b/lib/librte_gro/rte_gro.c
index e56bd20..4347267 100644
--- a/lib/librte_gro/rte_gro.c
+++ b/lib/librte_gro/rte_gro.c
@@ -32,32 +32,38 @@
NULL};
#define IS_IPV4_TCP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
- ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP))
+ ((ptype & RTE_PTYPE_L4_TCP) == RTE_PTYPE_L4_TCP) && \
+ ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
#define IS_IPV4_UDP_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
- ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP))
+ ((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
+ ((ptype & RTE_PTYPE_TUNNEL_VXLAN) == 0))
#define IS_IPV4_VXLAN_TCP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
- ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
- RTE_PTYPE_INNER_L4_TCP) && \
- (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
- (RTE_PTYPE_INNER_L3_IPV4 | \
- RTE_PTYPE_INNER_L3_IPV4_EXT | \
- RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
+ ((ptype & RTE_PTYPE_INNER_L4_TCP) == \
+ RTE_PTYPE_INNER_L4_TCP) && \
+ (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
#define IS_IPV4_VXLAN_UDP4_PKT(ptype) (RTE_ETH_IS_IPV4_HDR(ptype) && \
((ptype & RTE_PTYPE_L4_UDP) == RTE_PTYPE_L4_UDP) && \
((ptype & RTE_PTYPE_TUNNEL_VXLAN) == \
RTE_PTYPE_TUNNEL_VXLAN) && \
- ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
- RTE_PTYPE_INNER_L4_UDP) && \
- (((ptype & RTE_PTYPE_INNER_L3_MASK) & \
- (RTE_PTYPE_INNER_L3_IPV4 | \
- RTE_PTYPE_INNER_L3_IPV4_EXT | \
- RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)) != 0))
+ ((ptype & RTE_PTYPE_INNER_L4_UDP) == \
+ RTE_PTYPE_INNER_L4_UDP) && \
+ (((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT) || \
+ ((ptype & RTE_PTYPE_INNER_L3_MASK) == \
+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN)))
/*
* GRO context structure. It keeps the table structures, which are
--
1.8.3.1
More information about the dev
mailing list