From patchwork Thu Sep 29 01:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bugzilla@dpdk.org X-Patchwork-Id: 117088 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9E3DA00C4; Thu, 29 Sep 2022 03:40:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 942D140E5A; Thu, 29 Sep 2022 03:40:27 +0200 (CEST) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id 7A27B40DDC for ; Thu, 29 Sep 2022 03:40:26 +0200 (CEST) Received: by inbox.dpdk.org (Postfix, from userid 33) id 58857A00C5; Thu, 29 Sep 2022 03:40:26 +0200 (CEST) From: bugzilla@dpdk.org To: dev@dpdk.org Subject: [Bug 1087] [Bug] tcp data len is incorrectly calculated in gro_tcp4_reassemble function Date: Thu, 29 Sep 2022 01:40:26 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: other X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: 853048484@qq.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org https://bugs.dpdk.org/show_bug.cgi?id=1087 Bug ID: 1087 Summary: [Bug] tcp data len is incorrectly calculated in gro_tcp4_reassemble function Product: DPDK Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: Normal Component: other Assignee: dev@dpdk.org Reporter: 853048484@qq.com Target Milestone: --- 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;