[v3,1/4] net: fix GTP packet parsing
Checks
Commit Message
After parsing the GTP packet header, the next protocol type should
be converted from RTE_GTP_TYPE_IPV4/IPV6 to RTE_ETHER_TYPE_IPV4/IPV6.
Otherwise, the next protocol cannot be parsed.
Bugzilla ID: 1672
Fixes: 64ed7f854cf4 ("net: add tunnel packet type parsing")
Cc: stable@dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Jie Hai <haijie1@huawei.com>
---
lib/net/rte_net.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
@@ -231,7 +231,13 @@ ptype_tunnel_with_udp(uint16_t *proto, const struct rte_mbuf *m,
*/
if (gh->msg_type == 0xff) {
ip_ver = *(const uint8_t *)((const char *)gh + gtp_len);
- *proto = (ip_ver) & 0xf0;
+ ip_ver = (ip_ver) & 0xf0;
+ if (ip_ver == RTE_GTP_TYPE_IPV4)
+ *proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
+ else if (ip_ver == RTE_GTP_TYPE_IPV6)
+ *proto = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+ else
+ *proto = 0;
} else {
*proto = 0;
}