From: Dengdui Huang <huangdengdui@huawei.com>
To: <dev@dpdk.org>
Cc: <jasvinder.singh@intel.com>, <thomas@monjalon.net>,
<mb@smartsharesystems.com>, <lihuisong@huawei.com>,
<fengchengwen@huawei.com>, <liuyonglong@huawei.com>
Subject: [PATCH v2] net: fix GTP packet parsing
Date: Thu, 17 Apr 2025 20:37:39 +0800 [thread overview]
Message-ID: <20250417123739.2291519-1-huangdengdui@huawei.com> (raw)
In-Reply-To: <20250411084303.770040-1-huangdengdui@huawei.com>
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(-)
diff --git a/lib/net/rte_net.c b/lib/net/rte_net.c
index be24690fdf..1771588a09 100644
--- a/lib/net/rte_net.c
+++ b/lib/net/rte_net.c
@@ -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;
}
--
2.33.0
prev parent reply other threads:[~2025-04-17 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 8:43 [PATCH] " Dengdui Huang
2025-04-11 9:54 ` Jie Hai
2025-04-17 12:37 ` Dengdui Huang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250417123739.2291519-1-huangdengdui@huawei.com \
--to=huangdengdui@huawei.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=jasvinder.singh@intel.com \
--cc=lihuisong@huawei.com \
--cc=liuyonglong@huawei.com \
--cc=mb@smartsharesystems.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).