DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net: fix GTP packet parsing
@ 2025-04-11  8:43 Dengdui Huang
  2025-04-11  9:54 ` Jie Hai
  0 siblings, 1 reply; 2+ messages in thread
From: Dengdui Huang @ 2025-04-11  8:43 UTC (permalink / raw)
  To: dev
  Cc: jasvinder.singh, stephen, thomas, mb, lihuisong, fengchengwen,
	haijie1, liuyonglong

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.

Fixes: 64ed7f854cf4 ("net: add tunnel packet type parsing")
Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: fix GTP packet parsing
  2025-04-11  8:43 [PATCH] net: fix GTP packet parsing Dengdui Huang
@ 2025-04-11  9:54 ` Jie Hai
  0 siblings, 0 replies; 2+ messages in thread
From: Jie Hai @ 2025-04-11  9:54 UTC (permalink / raw)
  To: Dengdui Huang, dev
  Cc: jasvinder.singh, stephen, thomas, mb, lihuisong, fengchengwen,
	liuyonglong

Good job!

Acked-by: Jie Hai <haijie1@huawei.com>

On 2025/4/11 16:43, Dengdui Huang wrote:
> 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.
> 
> Fixes: 64ed7f854cf4 ("net: add tunnel packet type parsing")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dengdui Huang <huangdengdui@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;
>   		}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-11  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-11  8:43 [PATCH] net: fix GTP packet parsing Dengdui Huang
2025-04-11  9:54 ` Jie Hai

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).