DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function.
@ 2022-09-28 14:10 jiangheng (G)
  2023-10-31 18:55 ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: jiangheng (G) @ 2022-09-28 14:10 UTC (permalink / raw)
  To: dev

Hello:
In gro_tcp4_reassemble function, tcp data len is calculated:
tcp_dl = pkt->pkt_len - hdr_len;
https://github.com/DPDK/dpdk/blob/v22.07/lib/gro/gro_tcp4.c#L232

if packets < 60 bytes, pkt_len will contain padding bytes, tcp_dl is incorrectly calculated. this will result the wrong data length after gro.

diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c
index 7498c66141..cbba9fed5e 100644
--- a/lib/gro/gro_tcp4.c
+++ b/lib/gro/gro_tcp4.c
@@ -229,7 +229,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
         * Don't process the packet whose payload length is less than or
         * equal to 0.
         */
-       tcp_dl = pkt->pkt_len - hdr_len;
+       tcp_dl = rte_be_to_cpu_16(ipv4_hdr->total_length) - hdr_len;
        if (tcp_dl <= 0)
                return -1;

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

* Re: [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function.
  2022-09-28 14:10 [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function jiangheng (G)
@ 2023-10-31 18:55 ` Stephen Hemminger
  2023-11-01  1:12   ` 答复: " jiangheng (G)
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2023-10-31 18:55 UTC (permalink / raw)
  To: jiangheng (G); +Cc: dev

On Wed, 28 Sep 2022 14:10:52 +0000
"jiangheng (G)" <jiangheng14@huawei.com> wrote:

> Hello:
> In gro_tcp4_reassemble function, tcp data len is calculated:
> tcp_dl = pkt->pkt_len - hdr_len;
> https://github.com/DPDK/dpdk/blob/v22.07/lib/gro/gro_tcp4.c#L232
> 
> if packets < 60 bytes, pkt_len will contain padding bytes, tcp_dl is incorrectly calculated. this will result the wrong data length after gro.
> 
> diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c
> index 7498c66141..cbba9fed5e 100644
> --- a/lib/gro/gro_tcp4.c
> +++ b/lib/gro/gro_tcp4.c
> @@ -229,7 +229,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>          * Don't process the packet whose payload length is less than or
>          * equal to 0.
>          */
> -       tcp_dl = pkt->pkt_len - hdr_len;
> +       tcp_dl = rte_be_to_cpu_16(ipv4_hdr->total_length) - hdr_len;
>         if (tcp_dl <= 0)
>                 return -1;

Yes, this patch looks correct. But it is not formatted correctly as reported
by checkpatch.
	1. DPDK uses tab character for indent
	2. Commit messages are supposed to be wrapped and not long lines

Could you resubmit?

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

* 答复: [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function.
  2023-10-31 18:55 ` Stephen Hemminger
@ 2023-11-01  1:12   ` jiangheng (G)
  0 siblings, 0 replies; 3+ messages in thread
From: jiangheng (G) @ 2023-11-01  1:12 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

Hi:
This issue has been fixed:
https://github.com/DPDK/dpdk/commit/b8a55871d5af6f5b8694b1cb5eacbc629734e403 
https://github.com/DPDK/dpdk/commit/72f51b097a71fb9bdea13bdd254ff620b34c852e


-----邮件原件-----
发件人: Stephen Hemminger <stephen@networkplumber.org> 
发送时间: 2023年11月1日 2:56
收件人: jiangheng (G) <jiangheng14@huawei.com>
抄送: dev@dpdk.org
主题: Re: [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function.

On Wed, 28 Sep 2022 14:10:52 +0000
"jiangheng (G)" <jiangheng14@huawei.com> wrote:

> Hello:
> In gro_tcp4_reassemble function, tcp data len is calculated:
> tcp_dl = pkt->pkt_len - hdr_len;
> https://github.com/DPDK/dpdk/blob/v22.07/lib/gro/gro_tcp4.c#L232
> 
> if packets < 60 bytes, pkt_len will contain padding bytes, tcp_dl is incorrectly calculated. this will result the wrong data length after gro.
> 
> diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c index 
> 7498c66141..cbba9fed5e 100644
> --- a/lib/gro/gro_tcp4.c
> +++ b/lib/gro/gro_tcp4.c
> @@ -229,7 +229,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
>          * Don't process the packet whose payload length is less than or
>          * equal to 0.
>          */
> -       tcp_dl = pkt->pkt_len - hdr_len;
> +       tcp_dl = rte_be_to_cpu_16(ipv4_hdr->total_length) - hdr_len;
>         if (tcp_dl <= 0)
>                 return -1;

Yes, this patch looks correct. But it is not formatted correctly as reported by checkpatch.
	1. DPDK uses tab character for indent
	2. Commit messages are supposed to be wrapped and not long lines

Could you resubmit?


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

end of thread, other threads:[~2023-11-01  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 14:10 [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function jiangheng (G)
2023-10-31 18:55 ` Stephen Hemminger
2023-11-01  1:12   ` 答复: " jiangheng (G)

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