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 5F932A0524 for ; Thu, 3 Dec 2020 17:13:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28290F72; Thu, 3 Dec 2020 17:13:56 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id D54C5F72 for ; Thu, 3 Dec 2020 17:13:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607012032; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5DUGo/Bx+MgROTHMykgh+gyTeKkyjnCz2+Lnsdby3fs=; b=TceEmeTDmUmFE7O0kfGfch1NvisK2PeaCFsZ+/0Z+J4o8we7XA1PkK3GZGBNRwEu3Wwbyw OAUxYGj0a9m5KA/0F+WerdQfZH2lwGlCjyb/2ufw7qk0eg1+I7h7gdFbJWjXoRMAAIt2T9 HAiGIKWQZ34zvr69XqUBsbKNxY3E76c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-NXmGGfVTM96uv-HLecSZ2g-1; Thu, 03 Dec 2020 11:13:48 -0500 X-MC-Unique: NXmGGfVTM96uv-HLecSZ2g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1EBB802B4A; Thu, 3 Dec 2020 16:13:46 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-114-232.rdu2.redhat.com [10.10.114.232]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E910860BFA; Thu, 3 Dec 2020 16:13:44 +0000 (UTC) From: Aaron Conole To: Yicai Lu Cc: , , , , , , , , References: <1607000077-30212-1-git-send-email-luyicai@huawei.com> Date: Thu, 03 Dec 2020 11:13:44 -0500 In-Reply-To: <1607000077-30212-1-git-send-email-luyicai@huawei.com> (Yicai Lu's message of "Thu, 3 Dec 2020 20:54:37 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=aconole@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Subject: Re: [dpdk-stable] [dpdk-dev] [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" Yicai Lu writes: > 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 > --- Sorry for coming late to the party. Are you saying that we have fragments which are less than min ip_len for anything other than the final fragment? Or the total data length after all fragments are reassembled is < min_ip_len ? like: frag1, len = 48 frag2, len = 10 something like that? Can you put some concrete examples in the commit message (or even better, include a test case in the ipv4_frag test suite that shows this)? > 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