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 B3ED5A0561; Mon, 20 Apr 2020 21:25:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 958251C1D8; Mon, 20 Apr 2020 21:25:42 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id B1F571C1B3 for ; Mon, 20 Apr 2020 21:25:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587410734; 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=eXjWk6GlzS0+6XGKQuBFO6SqxhK9+YfFGMPoh2DfjG8=; b=D4Kvrf6zyFyVkXNS/Hgdj9ZDBZbHK20O+cm5LereTCnSFpkwfRfPHAwIOBCoFwZqFWnLH9 5mOViP3MZeUMb9of4B+6tR5Th21Oe2OupTUPvw6S8fldHhknBqKyfhYRfAyCSIFRGo6pNg VBgoeBpr25SQajF63fyK2r9K0zjVBSo= 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-348-ssegE6g6MWSoAFlDYJ4nHw-1; Mon, 20 Apr 2020 15:25:32 -0400 X-MC-Unique: ssegE6g6MWSoAFlDYJ4nHw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1426B1084430; Mon, 20 Apr 2020 19:25:31 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (ovpn-114-167.rdu2.redhat.com [10.10.114.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C3F35C1BB; Mon, 20 Apr 2020 19:25:30 +0000 (UTC) From: Aaron Conole To: dev@dpdk.org Cc: Pavan Nikhilesh , Bruce Richardson , David Marchand , Ferruh Yigit , Anatoly Burakov , Lukasz Wojciechowski Date: Mon, 20 Apr 2020 15:25:22 -0400 Message-Id: <20200420192523.2546909-3-aconole@redhat.com> In-Reply-To: <20200420192523.2546909-1-aconole@redhat.com> References: <20200417131410.1343135-1-aconole@redhat.com> <20200420192523.2546909-1-aconole@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 v6 2/3] 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" In addition, do a formal parameter check. Acked-by: Konstantin Ananyev Acked-by: Lukasz Wojciechowski Signed-off-by: Aaron Conole --- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 9 +++++++++ lib/librte_net/rte_ip.h | 2 ++ 2 files 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..5d67336f2d 100644 --- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c @@ -79,6 +79,15 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, =09uint16_t fragment_offset, frag_size; =09uint64_t frag_bytes_remaining; =20 +=09/* +=09 * Formal parameter checking. +=09 */ +=09if (unlikely(pkt_in =3D=3D NULL) || unlikely(pkts_out =3D=3D NULL) || +=09 unlikely(nb_pkts_out =3D=3D 0) || +=09 unlikely(pool_direct =3D=3D NULL) || unlikely(pool_indirect =3D=3D = NULL) || +=09 unlikely(mtu_size < RTE_IPV6_MIN_MTU)) +=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. diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 1ceb7b7931..d50edec572 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -371,6 +371,8 @@ struct rte_ipv6_hdr { #define RTE_IPV6_HDR_ECN_MASK=09(0x03 << RTE_IPV6_HDR_TC_SHIFT) #define RTE_IPV6_HDR_ECN_CE=09RTE_IPV6_HDR_ECN_MASK =20 +#define RTE_IPV6_MIN_MTU 1280 /**< Minimum MTU for IPv6, see RFC 8200. */ + /** * Process the pseudo-header checksum of an IPv6 header. * --=20 2.25.1