From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 981EBA0524 for ; Thu, 3 Dec 2020 13:55:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6CD97C9C4; Thu, 3 Dec 2020 13:55:00 +0100 (CET) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 49EA1C940; Thu, 3 Dec 2020 13:54:56 +0100 (CET) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CmwlQ1zPszhkw3; Thu, 3 Dec 2020 20:54:26 +0800 (CST) Received: from localhost (10.174.243.72) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Thu, 3 Dec 2020 20:54:45 +0800 From: Yicai Lu To: CC: , , , , , , , Yicai Lu , Date: Thu, 3 Dec 2020 20:54:37 +0800 Message-ID: <1607000077-30212-1-git-send-email-luyicai@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.243.72] X-CFilter-Loop: Reflected Subject: [dpdk-stable] [PATCH v3] ip_frag: recalculate data length of fragment X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" In some situations, we would get several ip fragments, which total data length is less than minimum frame(64) and padding with zeros. Examples: Second Fragment "a0a1 a2a3 a4a5 a6a7 0000 0000 ..." and Third Fragment "a8a9 aaab acad aeaf b0b1 b2b3 ...". Finally, we would reassemble Second and Third Fragment like this "a0a1 a2a3 a4a5 a6a7 0000 0000 ... a8a9 aaab acad aeaf b0b1 ...", which is not correct! So, we need recalculate data length of fragment to remove padings! Fixes: 7f0983ee331c ("ip_frag: check fragment length of incoming packet") Cc: stable@dpdk.org Signed-off-by: Yicai Lu --- v2 -> v3: Update the comments. --- lib/librte_ip_frag/rte_ipv4_reassembly.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 1dda8aca0..9a9fe3703 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -117,6 +117,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, ip_ofs *= RTE_IPV4_HDR_OFFSET_UNITS; ip_len = rte_be_to_cpu_16(ip_hdr->total_length) - mb->l3_len; + mb->data_len = ip_len + mb->l3_len + mb->l2_len; IP_FRAG_LOG(DEBUG, "%s:%d:\n" "mbuf: %p, tms: %" PRIu64 -- 2.28.0.windows.1