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 40A2FA04DD; Wed, 18 Nov 2020 14:30:12 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D52FE5AA7; Wed, 18 Nov 2020 14:30:10 +0100 (CET) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 686655946 for ; Wed, 18 Nov 2020 14:30:08 +0100 (CET) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CbkFB5yd8zhcLN for ; Wed, 18 Nov 2020 21:29:50 +0800 (CST) Received: from localhost (10.174.243.72) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Wed, 18 Nov 2020 21:29:55 +0800 From: Yicai Lu To: CC: , , , , , , , Yicai Lu Date: Wed, 18 Nov 2020 21:29:53 +0800 Message-ID: <1605706193-17192-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; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.243.72] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH] ip_frag: recalculate data length of fragment X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 is "a0a1 a2a3 a4a5 a6a7 0000 0000 ..." and Third Fragment is "a8a9 aaab acad aeaf b0b1 b2b3 ...". And then, 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 the data length of fragment to remove invalid padings(zero)! Signed-off-by: Yicai Lu --- lib/librte_ip_frag/ip_frag_internal.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_ip_frag/ip_frag_internal.c b/lib/librte_ip_frag/ip_frag_internal.c index b436a4c93..7bdd98090 100644 --- a/lib/librte_ip_frag/ip_frag_internal.c +++ b/lib/librte_ip_frag/ip_frag_internal.c @@ -155,6 +155,7 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr, fp->frags[idx].ofs = ofs; fp->frags[idx].len = len; + mb->data_len = mb->l2_len + mb->l3_len + len; fp->frags[idx].mb = mb; mb = NULL; -- 2.28.0.windows.1