From patchwork Wed Apr 1 18:39:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 67616 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4853FA057B; Wed, 1 Apr 2020 20:39:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0DD4B1C119; Wed, 1 Apr 2020 20:39:39 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 357F41C10E for ; Wed, 1 Apr 2020 20:39:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585766376; 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=fISeMhl21sbwz1XkFkRaBjofSvFPVtXXtm9FOLdLeCNSO1Nd1oiiJcv4av/iblm9QOto45 ObpMGNUznxin/vbwfegthCHdqcdnyXQTpuKkMp9UY3VygUdCyuLylw1GgbJPvMa5NiHwHf e0/ZgZYoWnqxLZCP2SI1QwalICUi6lY= 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-395-4DZvT-ymNXi4TAvKGgOzWw-1; Wed, 01 Apr 2020 14:39:33 -0400 X-MC-Unique: 4DZvT-ymNXi4TAvKGgOzWw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10EE818FF660; Wed, 1 Apr 2020 18:39:32 +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 E19755DA66; Wed, 1 Apr 2020 18:39:30 +0000 (UTC) From: Aaron Conole To: dev@dpdk.org Cc: Konstantin Ananyev , Sunil Kumar Kori , Anatoly Burakov , Chas Williams , Bruce Richardson , David Marchand Date: Wed, 1 Apr 2020 14:39:15 -0400 Message-Id: <20200401183917.3620845-3-aconole@redhat.com> In-Reply-To: <20200401183917.3620845-1-aconole@redhat.com> References: <20200401131849.2209336-1-aconole@redhat.com> <20200401183917.3620845-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH v3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Similar to v4, we should ensure that at least a minimum fragmentation length can be achieved. Signed-off-by: Aaron Conole --- 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_frag/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, uint16_t fragment_offset, frag_size; uint64_t frag_bytes_remaining; + /* + * The rules on ipv6 fragmentation means we need at least to be + * greater than the smallest fragment possible - ipv6hdr + frag header + * + min octets. We rely on the ipv6_extension_fragment header to + * include 'data' octets. + */ + if (unlikely(mtu_size < + (sizeof(struct rte_ipv6_hdr) + + sizeof(struct ipv6_extension_fragment)))) + return -EINVAL; + /* * Ensure the IP payload length of all fragments (except the * the last fragment) are a multiple of 8 bytes per RFC2460.