DPDK patches and discussions
 help / color / mirror / Atom feed
From: "jiangheng (G)" <jiangheng14@huawei.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Subject: [PATCH] TCP data length is incorrectly calculated in the gro_tcp4_reassemble function.
Date: Wed, 28 Sep 2022 14:10:52 +0000	[thread overview]
Message-ID: <1c1df455cdb640c9889d359186d38637@huawei.com> (raw)

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;

             reply	other threads:[~2022-09-28 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 14:10 jiangheng (G) [this message]
2023-10-31 18:55 ` Stephen Hemminger
2023-11-01  1:12   ` 答复: " jiangheng (G)

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=1c1df455cdb640c9889d359186d38637@huawei.com \
    --to=jiangheng14@huawei.com \
    --cc=dev@dpdk.org \
    /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).