From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CE213A0562;
	Tue, 31 Mar 2020 18:07:53 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 8CC641C031;
	Tue, 31 Mar 2020 18:07:38 +0200 (CEST)
Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com
 [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 24CF41C02A
 for <dev@dpdk.org>; Tue, 31 Mar 2020 18:07:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1585670856;
 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:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=wb0D5HgZ66vFFP8s3SSRe6vjYfLc1IdHq3fIMPsHgZ0=;
 b=PpH90138WLQGD6jlWIwYXn6+cBlc+WvMRtEMy5x0xRhf3aBUVFijvNhaAljCKZnaBZkyEj
 z2ItPl+pA7MPoPqhfaYkY/xOBS189svJ2OKH66irb1dO6rekXTFMmUiaeRUrBsTNHr5iDe
 E19pIK8WvEkaPmecgz0wOPkUl1KJ/AU=
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-4-OvWyBIZYMJqlvS7V2UF-kw-1; Tue, 31 Mar 2020 12:07:32 -0400
X-MC-Unique: OvWyBIZYMJqlvS7V2UF-kw-1
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
 [10.5.11.15])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0FFEC805733;
 Tue, 31 Mar 2020 16:07:31 +0000 (UTC)
Received: from dhcp-25.97.bos.redhat.com (ovpn-116-136.phx2.redhat.com
 [10.3.116.136])
 by smtp.corp.redhat.com (Postfix) with ESMTP id EA188A63DB;
 Tue, 31 Mar 2020 16:07:27 +0000 (UTC)
From: Aaron Conole <aconole@redhat.com>
To: dev@dpdk.org
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>,
 Sunil Kumar Kori <skori@marvell.com>,
 Allain Legacy <allain.legacy@windriver.com>,
 Anatoly Burakov <anatoly.burakov@intel.com>, Chas Williams <chas3@att.com>,
 Piotr Azarewicz <piotrx.t.azarewicz@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>,
 David Marchand <david.marchand@redhat.com>
Date: Tue, 31 Mar 2020 12:07:12 -0400
Message-Id: <20200331160714.697790-3-aconole@redhat.com>
In-Reply-To: <20200331160714.697790-1-aconole@redhat.com>
References: <20200331160714.697790-1-aconole@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable
Subject: [dpdk-dev] [PATCH 2/4] ip_frag: ensure minimum v6 fragmentation
	length
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Similar to v4, we should ensure that at least a minimum fragmentation
length can be achieved.

Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 lib/librte_ip_frag/rte_ipv6_fragmentation.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_fr=
ag/rte_ipv6_fragmentation.c
index 43449970e5..820a5dc725 100644
--- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c
+++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c
@@ -79,6 +79,17 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
 =09uint16_t fragment_offset, frag_size;
 =09uint64_t frag_bytes_remaining;
=20
+=09/*
+=09 * The rules on ipv6 fragmentation means we need at least to be
+=09 * greater than the smallest fragment possible - ipv6hdr + frag header
+=09 * + min octets.  We rely on the ipv6_extension_fragment header to
+=09 * include 'data' octets.
+=09 */
+=09if (unlikely(mtu_size <
+=09=09     (sizeof(struct rte_ipv6_hdr) +
+=09=09      sizeof(struct ipv6_extension_fragment))))
+=09=09return -EINVAL;
+
 =09/*
 =09 * Ensure the IP payload length of all fragments (except the
 =09 * the last fragment) are a multiple of 8 bytes per RFC2460.
--=20
2.25.1