From patchwork Wed Feb 21 17:59:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129118 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp896171ljc; Wed, 21 Feb 2018 10:02:31 -0800 (PST) X-Google-Smtp-Source: AH8x227jWKp9dUk3TeZniAn3HQsfmeWTP+s2ukFm98v9Qx6d/skj6YPI6Y0ux8rv4cNzeUpZyUCg X-Received: by 10.55.74.2 with SMTP id x2mr6199323qka.314.1519236150977; Wed, 21 Feb 2018 10:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236150; cv=none; d=google.com; s=arc-20160816; b=p5wp7HAvPOQyWxurJwrql/OuN064fZvWr8s8w088LwRIwNUA9HTrNtnLEtpWia6U8d FpdTXvNVgSmiryZRnodKe7belStUSLl5ppX2jUvkA3fTU5/g25ngIXl3kfaxjWdLe3DU U241ov7FOfkNr9urOZlglAui8WXzRavoAzab4HG8JcmguKb6C16nsVFL5mwDIGX7Ufbp /IQbzKhhF8i6EOEkiPHQoRQbPL6EyygVmnP5ChW+xjHubwrbWLHwiGm7U0sAwNN7tN+Q xE4G9jUYkr7kDmCrgQZ5Wk8LYpk86v4rt3Yga8RTaBwXtG0ksNz3gXgbZdDYDqyVVGmd hsVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=5t1jUFjElEQr5yb2VlSl9fjTPi6cg3yHQNH913RWhww=; b=YhP4J+rLPY8BDsqeyh3kFa3SMh2ugv06iWRHH71o7W4uI61ypHiOow/jF80bWlRF2e rQbMiydCltJ/n9UsHHR/U3kOIuGeerZnTV+o2Na0R1RcqENiic9yYwyi66dc1hfc20mr 2DJTYGWIEWc9LhpjOKr2LF3t5XsuYyXNw+Jkv8HATNUfPti5H7s1IoffTrRfs5pyQmbZ xJjVH4CztPvoBY7kWJpb0QTgVR7ZTE9e/NF42snKQfAhYFalpgNOKeWf3zd/LF1NwHjY JaTaXaGKeCzLgo/Om2RdpAjRCunuSojMw1MqM9EwuHD+GFR8IqcPUZx40ISOlq36l42Y dPgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id i66si982442qkb.459.2018.02.21.10.02.30; Wed, 21 Feb 2018 10:02:30 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 303BC617E2; Wed, 21 Feb 2018 18:02:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id A7E946107F; Wed, 21 Feb 2018 18:01:37 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3D5C260B04; Wed, 21 Feb 2018 18:01:32 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id E36606090F for ; Wed, 21 Feb 2018 18:00:43 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 5D8EE1242FB7 for ; Wed, 21 Feb 2018 21:00:42 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 13MY6cOuRK-0g9qDk4A; Wed, 21 Feb 2018 21:00:42 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-0Z946vwf; Wed, 21 Feb 2018 21:00:35 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 20:59:57 +0300 Message-Id: <1519236011-14987-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 1/15] api: don't create special case for the tunnel-dummy packets X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Do not create special case for IPsec packet contents. It is easier to always use odp_packet_len() - odp_packet_l3_offset() + tfc_pad_len as the transformation length, rather than hardcoding special case. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ include/odp/api/spec/ipsec.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 2d1c4d9ba..474055c0c 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -1346,9 +1346,7 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in, * and content of packet data before the IP header is undefined. Use outbound * operation parameters to specify the amount of TFC padding appended to * the packet during IPSEC transformation. Options can be used also to create - * TFC dummy packets. Packet data content is ignored in tunnel mode TFC dummy - * packet creation as tfc_pad_len option defines solely the packet length. - * In all other cases, payload length for the IPSEC transformation is specified + * TFC dummy packets. Payload length for the IPSEC transformation is specified * by odp_packet_len() minus odp_packet_l3_offset() plus tfc_pad_len option. * * Each successfully transformed packet has a valid value for these metadata: From patchwork Wed Feb 21 17:59:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129119 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp896797ljc; Wed, 21 Feb 2018 10:03:06 -0800 (PST) X-Google-Smtp-Source: AG47ELtynFuBgWqy6SeldBnHZBUvSFXZjTVUCGh3lkmGu+Z6J+nDbJk+85fXYT3LW1XWaFvNs8b7 X-Received: by 10.55.42.229 with SMTP id q98mr6140992qkq.150.1519236185862; Wed, 21 Feb 2018 10:03:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236185; cv=none; d=google.com; s=arc-20160816; b=uat7U+fhIr0RnrQUA93uAwZMzgUwbaAUV/YoH0TVkopJBqrlrJRA+J4XRT3ncx6owO xhplKU09ADE3vNu8kz1aItoIpPxNus9NYNOmvie31yX/p/ZSMNB7Tu1Kkirw+ezbcP/c h/uQ9zbCi5TZ1t5iL+G3I+IFBsZsgMuiZKewlewo8YditTptGfkctMdCuEKfdrD/q5N5 UtljQn7QSbEDZaqOrfD1OnDC3AOdrpVBixFVeBbwAroCNYPlE6Xyg8U2c86PVyBekIwT WmB49YVSqEMEEaXFv002xQ11rp9eccIqep4TLa+Lnyi5/xY0eLCAAa1k6y9AiAWT+fIl 3qog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=LyISxuistg8Z7b1Jl9QYBkrviEVM+QK7a6ILSf9hHCM=; b=xCnbh0JZmR6ks4Mb8UHhT46RCNDxRwI6yyNkzRHAm8m4ddE5dsgbZdJWuMoNDQvO27 on6Djt8wvH2FQR2ltaw2HG897aYCiIMUjjb8+HJPuT3IbROraqMWhEDceIvtewVCyKNC irYyCfCdjuPqmctTXboHMPjjGEU8k+bG4uWRJ5zNSgS3Qh9R2JMsvOB0uigeUR95h2TB MOXPG7hbUkkklpOj9umE3cyYlKvxRMmpMMlHAltoXdwFeP81hxyljzpGMnUrEtJq14vJ kYK9UsQAuiXSAlb/rNy39cta3MA0iI1MTr0ivT8d2wG5Q9EwX0BGg4x+p6iF3XhEEifi I6oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id h126si889507qkf.282.2018.02.21.10.03.02; Wed, 21 Feb 2018 10:03:05 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id A0860617E3; Wed, 21 Feb 2018 18:03:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 0CEF761769; Wed, 21 Feb 2018 18:01:40 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3F83861764; Wed, 21 Feb 2018 18:01:34 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 5C79C61709 for ; Wed, 21 Feb 2018 18:01:07 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward102j.mail.yandex.net (Yandex) with ESMTP id EAD145602839 for ; Wed, 21 Feb 2018 21:01:05 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SdGGZZGiee-15LCiAev; Wed, 21 Feb 2018 21:01:05 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-0g941Tku; Wed, 21 Feb 2018 21:00:42 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 20:59:58 +0300 Message-Id: <1519236011-14987-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 2/15] linux-gen: packet: add odp_packet_l2_type() implementation X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_packet.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 46b11cba1..6fc5f2206 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2506,6 +2506,16 @@ int odp_packet_has_ref(odp_packet_t pkt) return 0; } +odp_proto_l2_type_t odp_packet_l2_type(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (pkt_hdr->p.input_flags.eth) + return ODP_PROTO_L2_TYPE_ETH; + + return ODP_PROTO_L2_TYPE_NONE; +} + odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); From patchwork Wed Feb 21 17:59:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129121 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp898289ljc; Wed, 21 Feb 2018 10:04:29 -0800 (PST) X-Google-Smtp-Source: AH8x227DgxKaxhRzv8JCml4CmeaU4KyPl72F0JRkw+D5kHTg86ZN2ELgwdttExq0abaJgU8Gu87h X-Received: by 10.237.58.168 with SMTP id o37mr6925362qte.334.1519236269725; Wed, 21 Feb 2018 10:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236269; cv=none; d=google.com; s=arc-20160816; b=tB1xKBOM72clewnfAFaYgS1vmoS3BtZAUKwrqfv6SnqWGy0s7Y+kU1XBYVFLE5rnc1 UgLgg2V4G1+JWKlRl3xWbM29BrsbTuIN1xkfFTjLjYWDngW8Jh8YBPDVN4NbEjj6NeXC l5OjJrSfHNny5CrYHRMm0ckzJ4i85f2KaU4RfNjb0J4YW2G3q3OIbHbOcj8orK0b7YyR aotHPnXipBtD77MSzs/tx4RgmfXpgl2bwtnn5dLJk5JBAu/wDwpbFDqw/4qjvjsvDYUL wNYahHbX1YmIodG4kBvgixjV1jtuozGZ6CKCVuKUY0LClMLHExvh8t8dODCnC5/YCbwF 1kdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=DQybxRurfULcS4m0Z+EkdCh8L4bQ1c8Fuos6jnnyvWQ=; b=FUkDHHqqcyC2cS22L+7nwuQ2btWoy6AGdeLNH9hsxzIyHqD6hvaq15gHJgVGGdaIdn 6/ucsoFqtGxdPN8LKKei21IH5HYbKNTDj78VlWgg2WBqrXdP4cN/DkQL26e3ANLiW6Ih zj6VzEtMDQ8rL/IwIWI7ftjJz60obXE/ZHgc7FSoGPq6ODQkvaXE8hPhUZ7gJ4584aEd 8PkKBfytYXKP94e0nvVg6bchls8AuMe7TRoobAE5aVRdDzVj1swC+vlcu4lVTftT/ZBd NOewToS6el94v+pon8/xYbKNwCl9eVdXtue7hywr2HbX+iwFD69v9dxsnc2LUkPvtFH5 jt9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n6si212559qtk.85.2018.02.21.10.04.27; Wed, 21 Feb 2018 10:04:29 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 6B9A06180E; Wed, 21 Feb 2018 18:04:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B31EE617B9; Wed, 21 Feb 2018 18:01:51 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3EE5D6107F; Wed, 21 Feb 2018 18:01:37 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 0B39B6175B for ; Wed, 21 Feb 2018 18:01:14 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 5A6F678258A for ; Wed, 21 Feb 2018 21:01:12 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rtlEqx74LV-1CMmhQjK; Wed, 21 Feb 2018 21:01:12 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-159uVWil; Wed, 21 Feb 2018 21:01:05 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 20:59:59 +0300 Message-Id: <1519236011-14987-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 3/15] linux-gen; packet: allow offsets to be set after packet end X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Allow special case of setting offset just after packet end, as it simplifies handling of packets. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_packet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 6fc5f2206..187580085 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1286,7 +1286,7 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - if (offset >= pkt_hdr->frame_len) + if (offset > pkt_hdr->frame_len) return -1; packet_hdr_has_l2_set(pkt_hdr, 1); @@ -1298,7 +1298,7 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - if (offset >= pkt_hdr->frame_len) + if (offset > pkt_hdr->frame_len) return -1; pkt_hdr->p.l3_offset = offset; @@ -1309,7 +1309,7 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - if (offset >= pkt_hdr->frame_len) + if (offset > pkt_hdr->frame_len) return -1; pkt_hdr->p.l4_offset = offset; From patchwork Wed Feb 21 18:00:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129120 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp897498ljc; Wed, 21 Feb 2018 10:03:45 -0800 (PST) X-Google-Smtp-Source: AH8x224sbNiRa6Po62wMBwRLMbmq8kNPZPemFpHfPSg2MHJvYH53uYvT9wvx8Y0EyDkZAomgNYHM X-Received: by 2002:a25:4e89:: with SMTP id c131-v6mr2869737ybb.37.1519236224855; Wed, 21 Feb 2018 10:03:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236224; cv=none; d=google.com; s=arc-20160816; b=CQDmhC/IzDUQWPxBbNX8JdRfSSleVXzI8bT+1GDYBMhLCM1WUF6UBXxZA9iCXcj64P DjdPnbJdb5X3OASnH2fYbqL6RvtjRAg5BJ0gibwZG0WQwoz0yK0jbztfTTk3yzBFQVmx 6Fw9VVfw+mdPSODJTmMv4jWlPywo+itoXz1GBzF9tSm8S7QS/Hgaf2NRJsm9lxP+OlcL AYgNaILzb8Ty4mbmYIins3ShRSbMT0n/bujFFbJTZ+HzUtFqahVFfIeyKYJULtjgpHPB aOIZNuVbuE8xYrFpqLImC8p48XdR7nHRkGn+iT/PEjs+LBTcJkLrCRsgUegP5CP4Pl4L 6c5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=4M+61JVKsMW3RH7sctBvELZ+KIBEJa0SmzjamDydLa0=; b=Wn+Oltc9qQFWKK1HQK/Wj+LFr2zI4V1IytUtOAMo/XnJl2uHvd6wZ6OMceeTr5VwpL 2bmq8qypztR99cGufPIvjGjXE9QU4iCcwWgC629IwdwOhtXt+fVi24e632iCjsra1oPg 9gjyr4F+7lBGKK2PTSCEWOUvSFiFM1kGhI9n15jGKBHPV2mAo6RrGt27U3xyTQLZMbeX jQg9ctdc+uITSOzr+Go5yqn4Do4OZuDqzsnAn6uOAxxrXeNOzfKfnaJ7wBgX5A28tpfB aELUFr0f0Mfry4dPK1dqkzAlq1rnq31jTMw7y/p/GoTcM984ffI020EcF4keOUsymdvt IBIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id w7si454743qkc.223.2018.02.21.10.03.41; Wed, 21 Feb 2018 10:03:44 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 904AC617F4; Wed, 21 Feb 2018 18:03:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 68972616E4; Wed, 21 Feb 2018 18:01:44 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A0B1161709; Wed, 21 Feb 2018 18:01:36 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 7C11D6171B for ; Wed, 21 Feb 2018 18:01:22 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward102o.mail.yandex.net (Yandex) with ESMTP id CE0235A03536 for ; Wed, 21 Feb 2018 21:01:18 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DdcwW8pHfI-1IWmhA7p; Wed, 21 Feb 2018 21:01:18 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1C98d2lG; Wed, 21 Feb 2018 21:01:12 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:00 +0300 Message-Id: <1519236011-14987-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 4/15] validation: packet: verify odp_packet_l2_type() X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ test/validation/api/packet/packet.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index f829d0cb1..91e69204e 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2552,6 +2552,8 @@ void packet_test_parse(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV4); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), @@ -2620,6 +2622,8 @@ void packet_test_parse(void) CU_ASSERT(odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_udp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV4); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), @@ -2655,6 +2659,8 @@ void packet_test_parse(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV6); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), @@ -2690,6 +2696,8 @@ void packet_test_parse(void) CU_ASSERT(odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); CU_ASSERT(!odp_packet_has_udp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV6); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), From patchwork Wed Feb 21 18:00:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129122 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp898915ljc; Wed, 21 Feb 2018 10:05:05 -0800 (PST) X-Google-Smtp-Source: AH8x226xWAncpv1G4rNfMyvcH8OTfaSAsKIuyU0CndGpE0ax85El5VYuVsRxuETf7PthZi+7RXW3 X-Received: by 10.237.55.33 with SMTP id i30mr6697764qtb.202.1519236305547; Wed, 21 Feb 2018 10:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236305; cv=none; d=google.com; s=arc-20160816; b=wT8bJByYQjqWeK8WXc0+MAK2hroC0cwB+GjY8XGoDQsWlRBOwBB2xFJ8btG9BB6mRs lJ/6rFON1Iwfpyod0ztx8xZOt6n4M9bZCTeBV5GKB+wMtQ5kVH71l2iAIpaY4Dnn4zps vnT0b52u66gD1hKMUkMo//zN3pyDOPq7I2iIsbUYTVgF+4sEubtepRZtAbM/ozdYIjmA N4FsS3bJTgvXBFhoRD1w0ma1Y71rsyt/ueJEksYK1UQvYM36O3PqAFYZj1u2b6RyS5du XIgQX9C+O5DwdEBct+WVHbW7ho1f34GxS8KNyOTERUuWnTkEf7SgEzDtYTXCnAkR0Hpd SXBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=7j0YQadsr5FqlbYrxbaB9Eq9bVHbueKvjhQC/g2s/T0=; b=uHa5p/PiKJR7yK0GVdM9uEHGmDnu4IegkCvNemaYV/IaG7l70nmbQ2N4DmW3vEM7Tw nHSTA5f+NIalzVyif/R8TWtCTo13fyVWKjGSThjsxv1YxPLYxjpVlzCi6FKQj2FRsIOn 8hb7njR2ZBNv9VcR9HE2Z/YKq0NEluNu096t8iXVM2GU/m6Z3S+hpQZ5AdmNJnU7CBiq sGPP1R9Yp/llUBZD/AZjUHOlcyU7kNTDhORRDRGTwmw0jj/XOZkEhZImCd+G2Fgx7Ilq ajDgmYfWgb1IeCuzgzU+ZvTNL1ySsJkdCD3/zSXmDcGG2p4lhWNMr8NOVqCT2WGSKQR6 wWGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id c39si1406867qta.272.2018.02.21.10.05.05; Wed, 21 Feb 2018 10:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 25B58617BA; Wed, 21 Feb 2018 18:05:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 049A6617C6; Wed, 21 Feb 2018 18:01:53 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1908761703; Wed, 21 Feb 2018 18:01:41 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 8A7BE616E8 for ; Wed, 21 Feb 2018 18:01:26 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 36B2E5D83968 for ; Wed, 21 Feb 2018 21:01:25 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id jmXBZLxXY4-1PMC1dwW; Wed, 21 Feb 2018 21:01:25 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1I94O3SV; Wed, 21 Feb 2018 21:01:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:01 +0300 Message-Id: <1519236011-14987-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 5/15] validation: ipsec: set frag_mode flag X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ test/validation/api/ipsec/ipsec_test_out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 2850ddfa4..911987388 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -572,7 +572,8 @@ static void test_out_ipv4_ah_sha256_frag_check(void) ipsec_test_part test2 = { .pkt_in = &pkt_ipv4_icmp_0, .num_opt = 1, - .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, + .opt = { .flag.frag_mode = 1, + .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, .out_pkt = 1, .out = { { .status.warn.all = 0, @@ -665,7 +666,8 @@ static void test_out_ipv4_esp_null_sha256_frag_check(void) ipsec_test_part test2 = { .pkt_in = &pkt_ipv4_icmp_0, .num_opt = 1, - .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, + .opt = { .flag.frag_mode = 1, + .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, .out_pkt = 1, .out = { { .status.warn.all = 0, From patchwork Wed Feb 21 18:00:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129123 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp900160ljc; Wed, 21 Feb 2018 10:06:17 -0800 (PST) X-Google-Smtp-Source: AH8x2246ZHG32YWVm4rS8z0sQ2z+KLtsokplK533fdQsyCNwmEZWmij/pRBOEGnjfRQJMEhS9ziq X-Received: by 10.200.16.19 with SMTP id z19mr6870543qti.10.1519236377500; Wed, 21 Feb 2018 10:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236377; cv=none; d=google.com; s=arc-20160816; b=yZ0wvIG6laWKidA1wByP5A4yEm4gBpCNnNgXldmd6k9L7bH1g5CTylW9TCZVGyFTnA 975+AYYKubER1m/rBbb0daR2fkIIND4LWb6CSaaDt7QaoEXTsUrVaBWPlmjpquqAY1dI h0pFG389UCLUjMbLYYY/66HojZeVFwRBJ3uk4h1zni1g9VpI7Zav1l6k7sO1UlFAySoB enkznGSKq6EeCLMPl/T/wWzBUQjrvK/OWiGlYkh3C7mAmqmQ7rxIC+exoUmvH5P7Gclx dRNd4NkpjNCy1ZlfIgAwtKjQw0VE6o1i74gmnmVvL0APIVrBPcDWY+xBlhwnVru7T9u5 fyFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=O7owrAyHk47xzsYJ54/OfxgFsyWFKm8oUwAfGULHg/8=; b=C+sIk95duheaCqaKocQi+DS7XT025WZbZYu5IbEhFUdxkSzUUK/KFFsK+/1vOgAuze cc038w5I8UrxNHjbKkXArGbjPAtg7jdzDfA6u6Pa4OWS3+hJIevdPyDNpUgbTRGHUOJD KDkWmlmqbZoKaT4WSfc7TyXM8EsFv1yjqwKlKXRpRLIoOPlqP76OSfdc7LFWXdpMtnBj d8A9RpmjGt5CyBoblgniVyJrBIlYMiI8L9b/yesNQAuDmbUJsNitQ193JEbC5ROr404F ou17ttRh0SUWbU516E/gmKUaJnAFPupVLuohKCtrwYI4dVU2VnlDZKyeXmvUTbjx0es0 FT8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id q17si240720qkq.255.2018.02.21.10.06.17; Wed, 21 Feb 2018 10:06:17 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 162E961705; Wed, 21 Feb 2018 18:06:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 0304D60BDB; Wed, 21 Feb 2018 18:02:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BBC6760BDB; Wed, 21 Feb 2018 18:02:22 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 9D3666174E for ; Wed, 21 Feb 2018 18:01:33 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward105o.mail.yandex.net (Yandex) with ESMTP id DE0A344456BE for ; Wed, 21 Feb 2018 21:01:31 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GlRZUDIWfZ-1V4etLPH; Wed, 21 Feb 2018 21:01:31 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1P9K5n6s; Wed, 21 Feb 2018 21:01:25 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:02 +0300 Message-Id: <1519236011-14987-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 6/15] linux-gen: ipsec: provide global init/term functions X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/include/odp_internal.h | 4 ++++ platform/linux-generic/odp_init.c | 13 +++++++++++++ platform/linux-generic/odp_ipsec.c | 13 +++++++++++++ 3 files changed, 30 insertions(+) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index 444e1163b..fcf7d1109 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -76,6 +76,7 @@ enum init_stage { NAME_TABLE_INIT, IPSEC_EVENTS_INIT, IPSEC_SAD_INIT, + IPSEC_INIT, ALL_INIT /* All init stages completed */ }; @@ -136,6 +137,9 @@ int _odp_ishm_init_local(void); int _odp_ishm_term_global(void); int _odp_ishm_term_local(void); +int _odp_ipsec_init_global(void); +int _odp_ipsec_term_global(void); + int _odp_ipsec_sad_init_global(void); int _odp_ipsec_sad_term_global(void); diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index a2d9d52ff..0da1a5d11 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -150,6 +150,12 @@ int odp_init_global(odp_instance_t *instance, } stage = IPSEC_SAD_INIT; + if (_odp_ipsec_init_global()) { + ODP_ERR("ODP IPsec init failed.\n"); + goto init_failed; + } + stage = IPSEC_INIT; + *instance = (odp_instance_t)odp_global_data.main_pid; return 0; @@ -174,6 +180,13 @@ int _odp_term_global(enum init_stage stage) switch (stage) { case ALL_INIT: + case IPSEC_INIT: + if (_odp_ipsec_term_global()) { + ODP_ERR("ODP IPsec term failed.\n"); + rc = -1; + } + /* Fall through */ + case IPSEC_SAD_INIT: if (_odp_ipsec_sad_term_global()) { ODP_ERR("ODP IPsec SAD term failed.\n"); diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 3e6a80987..8c3d6cd63 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -1796,3 +1796,16 @@ odp_event_t odp_ipsec_packet_to_event(odp_packet_t pkt) { return odp_packet_to_event(pkt); } + +int _odp_ipsec_init_global(void) +{ + odp_ipsec_config_init(&ipsec_config); + + return 0; +} + +int _odp_ipsec_term_global(void) +{ + /* Do nothing for now */ + return 0; +} From patchwork Wed Feb 21 18:00:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129124 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp900814ljc; Wed, 21 Feb 2018 10:07:00 -0800 (PST) X-Google-Smtp-Source: AH8x22577rxsNCgptCftEsvx89YAjySYcLEDApt0rDSDnEMbcrVE90/QHDLod//aLsFY+JApigTq X-Received: by 10.13.225.18 with SMTP id k18mr901703ywe.512.1519236420452; Wed, 21 Feb 2018 10:07:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236420; cv=none; d=google.com; s=arc-20160816; b=pbR/Na8+QmmhIH6mCoC9ZA+xfwUpd05+sJ3LRlath0YLNZMu3k4xKhq7zvoMKa8Mqm CrjATblbIg7nBwVWNzIHbScnH8gLfguCdEJQ/zIhZcH6fhvNsMHti31ZtSu0x2EBALn2 gYLGU4NiIah5lkkxmX3bXYymdQJD6/gQKO4Mr7RWBW4qZY6BHyTLBKctuGEFjjA8MAV6 JilQb1nvZSlGvuwFofEbu/RnEGwXihIhz/E5K7LPf1INneIOgKAeUSN2yrAF12edKZv4 yqJtl9VgZF4u3fykpzW9+zU1mc4syU0xIdC6nniI5bW8OrAdVOkx0m08wOefJQiYF/yg WLXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=HPwTcvhJ7WB+ZISzYLr3KMBuwORXq4ytCHfmolzmGPU=; b=dkZwdmmNLYTPJaZQGSHY0kttIVwPIPNHwtIcj4VfEqMJyrCG5oa8ouykeBhhH3LlpY PTdGDtYeEBzD189wXhC55CTeMLBP7444ZX+cDISEMYtJxwO/5Qduw8xpK/8hX2+/f1yr qlNnGICXoqLB7XTXqt7H19zlkjofcY9XITJuLjYZklJnnINeqRcAxTKtRNXBBcldVa98 fgHw8XsqBDb3D/J/ids3YE18W2ZxccV8rYkq30ekE4ses+M3W0qwIF/3nKEzbCSy0gGF U52WQKHY12McAfQhucy4qUHhc7J4mu6xOCk8AHG2cBpyY7tFDFLfja0NkD4Q/l0H3hnF SKWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n29si13056578qtl.172.2018.02.21.10.06.59; Wed, 21 Feb 2018 10:07:00 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id DA187616E4; Wed, 21 Feb 2018 18:06:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D2546617B4; Wed, 21 Feb 2018 18:02:51 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8E822617AC; Wed, 21 Feb 2018 18:02:47 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id DB57C6175B for ; Wed, 21 Feb 2018 18:01:39 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 8C1C951029E6 for ; Wed, 21 Feb 2018 21:01:38 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NJKI4jNP5B-1c4iHEeb; Wed, 21 Feb 2018 21:01:38 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1V9iAdtl; Wed, 21 Feb 2018 21:01:31 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:03 +0300 Message-Id: <1519236011-14987-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 7/15] linux-gen: ipsec: take ipsec_out_opt flags into account X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Only override frag_mode if respective flag is set. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_ipsec.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 8c3d6cd63..cfdfa9dc9 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -1296,6 +1296,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, int rc; odp_crypto_packet_result_t crypto; /**< Crypto operation result */ odp_packet_hdr_t *pkt_hdr; + odp_ipsec_frag_mode_t frag_mode; uint32_t mtu; state.ip_offset = odp_packet_l3_offset(pkt); @@ -1307,8 +1308,10 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, ipsec_sa = _odp_ipsec_sa_use(sa); ODP_ASSERT(NULL != ipsec_sa); - if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) || - (!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK)) + frag_mode = ipsec_sa->out.frag_mode; + if (opt->flag.frag_mode) + frag_mode = opt->frag_mode; + if (frag_mode == ODP_IPSEC_FRAG_CHECK) mtu = ipsec_sa->out.mtu; else mtu = UINT32_MAX; @@ -1467,6 +1470,8 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in, return in_pkt; } +static odp_ipsec_out_opt_t default_out_opt; + int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, odp_packet_t pkt_out[], int *num_out, const odp_ipsec_out_param_t *param) @@ -1495,7 +1500,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); if (0 == param->num_opt) - opt = NULL; + opt = &default_out_opt; else opt = ¶m->opt[opt_idx]; @@ -1602,7 +1607,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int num_in, ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); if (0 == param->num_opt) - opt = NULL; + opt = &default_out_opt; else opt = ¶m->opt[opt_idx]; @@ -1697,7 +1702,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, } if (0 == param->num_opt) - opt = NULL; + opt = &default_out_opt; else opt = ¶m->opt[opt_idx]; @@ -1801,6 +1806,8 @@ int _odp_ipsec_init_global(void) { odp_ipsec_config_init(&ipsec_config); + memset(&default_out_opt, 0, sizeof(default_out_opt)); + return 0; } From patchwork Wed Feb 21 18:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129125 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp901557ljc; Wed, 21 Feb 2018 10:07:45 -0800 (PST) X-Google-Smtp-Source: AH8x227pmXtfZYiBsyvX/FS5N2tC96R+MxcJCXkweLvl1xMCviOxuAD6wCceOFHqgpVS9d9pWIXu X-Received: by 10.200.4.159 with SMTP id s31mr6663246qtg.144.1519236464970; Wed, 21 Feb 2018 10:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236464; cv=none; d=google.com; s=arc-20160816; b=Q40qSJRpiu/c1vHwcum4rbslMlVkX/W1IyXULkeGwvWJL6Co5EncUXqu7RDvkiEUYZ 9pLl5FfGbbdKiZ4PcDZ6gwhlYcoNTPSB8Du2xDy56hCTn7VT5b9Rgo2vg79mxOOZULId GIvoKcfv9neR/XN5vnVh8SGdlNjOs1e7sngbFlllbp+NR2lDaJefaeqVJ+Hy1nP9UXx3 LyiuThnloDlW+m3IRrPtxC7Q5Yay5C3zKVkTEHBwv1RLzXW2St3941K4KOzVbU7ajRZb Rp7X+fzCwSvj+GzwWM1btXRDyiCNNKirqfzLDXxPXMq6BZf/gteOKg4/8QJpvFpBOjjY hlDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=i8YpjJsH34takA13ihiUUGEfvS7E4OkddK+m+dtHcyE=; b=T/WJ0OXDUQz9Sv65Hc2OHL7Rj3dt6TRZd+FG+Cm7/5N8FFvTNDad6F6aPDnSuvCLlS 3P6mFff+fn4LeLKe+pVmg28nnTP7K4rbuLR85hAi2nAps1j1CtXSC2ggwHEIbPRdEcm3 S7mMJzVbPEadu4FqpFsA4J9K4pLDrOsK3Mly3o48jWG+HxCdGcyRmvt7Ol5lkfmpvO0I pOombM+XrYYTzxlHZRp6I7XujH8b17T2Jr2cyAGVa8hnddQCPAuqp9L2as47JBVFv4Kl hCML/UcUz98AT0B63T3a0cSzui+82JnDlrrnFNzvm2AQl0V2JisbgXXIu+m5JPYm2ZFZ Citw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id w19si2485766qkg.469.2018.02.21.10.07.44; Wed, 21 Feb 2018 10:07:44 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 8C51B617B2; Wed, 21 Feb 2018 18:07:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 4DE62617AC; Wed, 21 Feb 2018 18:02:57 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 152CF617E0; Wed, 21 Feb 2018 18:02:53 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 8066B616E8 for ; Wed, 21 Feb 2018 18:01:46 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 238952A24A23 for ; Wed, 21 Feb 2018 21:01:45 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id O4boVLZbjJ-1jnKKbMH; Wed, 21 Feb 2018 21:01:45 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1c9W91j1; Wed, 21 Feb 2018 21:01:38 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:04 +0300 Message-Id: <1519236011-14987-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 8/15] linux-gen: packet: support L4 type No Next Header X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/include/odp/api/plat/packet_inline_types.h | 1 + platform/linux-generic/include/protocols/ip.h | 1 + platform/linux-generic/odp_packet.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 2e8efecb6..4b88d3517 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -90,6 +90,7 @@ typedef union { uint64_t tcp:1; /* TCP */ uint64_t sctp:1; /* SCTP */ uint64_t icmp:1; /* ICMP */ + uint64_t no_next_hdr:1; /* No Next Header */ uint64_t color:2; /* Packet color for traffic mgmt */ uint64_t nodrop:1; /* Drop eligibility status */ diff --git a/platform/linux-generic/include/protocols/ip.h b/platform/linux-generic/include/protocols/ip.h index f02980693..19aef3dcc 100644 --- a/platform/linux-generic/include/protocols/ip.h +++ b/platform/linux-generic/include/protocols/ip.h @@ -167,6 +167,7 @@ typedef struct ODP_PACKED { #define _ODP_IPPROTO_AH 0x33 /**< Authentication Header (51) */ #define _ODP_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ #define _ODP_IPPROTO_ICMPV6 0x3A /**< Internet Control Message Protocol (58) */ +#define _ODP_IPPROTO_NO_NEXT 0x3B /**< No Next Header (59) */ #define _ODP_IPPROTO_DEST 0x3C /**< IPv6 Destination header (60) */ #define _ODP_IPPROTO_SCTP 0x84 /**< Stream Control Transmission protocol (132) */ diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 187580085..7caeb9889 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2229,6 +2229,10 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, prs->input_flags.sctp = 1; break; + case _ODP_IPPROTO_NO_NEXT: + prs->input_flags.no_next_hdr = 1; + break; + default: prs->input_flags.l4 = 0; break; @@ -2550,6 +2554,8 @@ odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt) else if (pkt_hdr->p.input_flags.icmp && pkt_hdr->p.input_flags.ipv6) return ODP_PROTO_L4_TYPE_ICMPV6; + else if (pkt_hdr->p.input_flags.no_next_hdr) + return ODP_PROTO_L4_TYPE_NO_NEXT; return ODP_PROTO_L4_TYPE_NONE; } From patchwork Wed Feb 21 18:00:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129126 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp902221ljc; Wed, 21 Feb 2018 10:08:28 -0800 (PST) X-Google-Smtp-Source: AH8x225jXgOClP3qqkbnqVFSthlVA4C7QgUnct71C0cdqX/+pVbeahTPNZIKO14e1vc2YvBPS8FO X-Received: by 2002:a25:42c2:: with SMTP id p185-v6mr2950236yba.236.1519236508377; Wed, 21 Feb 2018 10:08:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236508; cv=none; d=google.com; s=arc-20160816; b=LTIs7LKwBMwfBREeqbh4SUBVgMlKbl5iyHTu81gH0JpxYJH5C+Wa6tOgP9UsAyT/j7 XldIMQWqhdnVxFxaaBRlExNB17k5jZbN1o4Ndf/DCNry3+4wtWlFmMHHCXioLryhEduX OCy2IxU1xMcYDBSOjDYXWtPY//ySzjVjXWrXgGw6r3PsntuWOtF45DVlBPpXkS4nmR1b juy/VJtGwjN1eyKzi6z1btnZOinXmp3eElIK/xboxAGMbJcwoTLi4JuV/ruW4q2/7ia2 xZHLTQ+96QH5OgjHdBlkvIk3scC7zik9+AI90Ftb44LHHRyGCTX7PiPBp8x7pTPnZNtr ul+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=f8fIUX6fDV8ZaajhWY+T3wHmOLUDCXoT+1yZNUb3rLM=; b=ymFzBrLT03oyXU3T9AUOkPNE2QIuDgbnEWAOsbyoAznLryf88Ms59OPJeIFb0gbUYY FgtgSkxIlfcghBGQfJGExe/mNXxeIsuuvOFfXHIaO6bQ45lRiv0N9yJtVVeoNh3BCA4m EPRR8HYkyoZMAoDftIh8PFqnzyewpSuSwmYIddghBtLfL5jKNivevvvErokWp2jr1/fx IMUId/rKu9q0zj6SVjHMugiF9C5BgjQvdUzs+5vRFGXWuGiBtNcZ0Pyx+VDzBd67mZs0 VkNz29H/NQPxfeOwrPAiZTwan3Aw0fZ6SfJt4a9/V4ByjtPCTBnU6fThRS+Vzbj2XTGu ukOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id q14si240618qke.105.2018.02.21.10.08.28; Wed, 21 Feb 2018 10:08:28 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 0D486617AF; Wed, 21 Feb 2018 18:08:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id DEF9561750; Wed, 21 Feb 2018 18:03:15 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 91633617E3; Wed, 21 Feb 2018 18:03:11 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id BDE56617BF for ; Wed, 21 Feb 2018 18:01:52 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward102j.mail.yandex.net (Yandex) with ESMTP id B7F4E5602699 for ; Wed, 21 Feb 2018 21:01:51 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id LXHdGqVXjx-1pXCDj9q; Wed, 21 Feb 2018 21:01:51 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1j98N5sg; Wed, 21 Feb 2018 21:01:45 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:05 +0300 Message-Id: <1519236011-14987-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 9/15] linux-gen: ipsec: separate ipv4/ipv6 flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_ipsec.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index cfdfa9dc9..55beb382e 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -269,6 +269,7 @@ typedef struct { uint16_t ip_next_hdr_offset; uint8_t ip_next_hdr; unsigned is_ipv4 : 1; + unsigned is_ipv6 : 1; union { struct { uint32_t ip_flabel; @@ -669,10 +670,13 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, * state.is_ipv4 = odp_packet_has_ipv4(pkt); */ state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; + state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; if (state.is_ipv4) rc = ipsec_parse_ipv4(&state, pkt); - else + else if (state.is_ipv6) rc = ipsec_parse_ipv6(&state, pkt); + else + rc = -1; if (rc < 0 || state.ip_tot_len + state.ip_offset > odp_packet_len(pkt)) { status->error.alg = 1; @@ -776,8 +780,10 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, state.ip_tot_len -= state.ip_hdr_len + state.in.hdr_len; if (_ODP_IPPROTO_IPIP == state.ip_next_hdr) { state.is_ipv4 = 1; + state.is_ipv6 = 0; } else if (_ODP_IPPROTO_IPV6 == state.ip_next_hdr) { state.is_ipv4 = 0; + state.is_ipv6 = 1; } else { status->error.proto = 1; goto err; @@ -802,7 +808,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, else ipv4hdr->ttl -= ipsec_sa->dec_ttl; _odp_ipv4_csum_update(pkt); - } else if (!state.is_ipv4 && odp_packet_len(pkt) > _ODP_IPV6HDR_LEN) { + } else if (state.is_ipv6 && odp_packet_len(pkt) > _ODP_IPV6HDR_LEN) { _odp_ipv6hdr_t *ipv6hdr = odp_packet_l3_ptr(pkt, NULL); if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) @@ -816,9 +822,9 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, goto err; } - parse_param.proto = state.is_ipv4 ? - ODP_PROTO_IPV4 : - ODP_PROTO_IPV6; + parse_param.proto = state.is_ipv4 ? ODP_PROTO_IPV4 : + state.is_ipv6 ? ODP_PROTO_IPV6 : + ODP_PROTO_NONE; parse_param.last_layer = ipsec_config.inbound.parse_level; parse_param.chksums = ipsec_config.inbound.chksums; @@ -934,6 +940,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, _ODP_IPV4HDR_PROTO_OFFSET; state->is_ipv4 = 1; + state->is_ipv6 = 0; return 0; } @@ -990,6 +997,7 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV6HDR_NHDR_OFFSET; state->is_ipv4 = 0; + state->is_ipv6 = 1; return 0; } @@ -1320,20 +1328,25 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, memset(¶m, 0, sizeof(param)); state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; + state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) { if (state.is_ipv4) rc = ipsec_parse_ipv4(&state, pkt); - else + else if (state.is_ipv6) rc = ipsec_parse_ipv6(&state, pkt); + else + rc = -1; if (state.ip_tot_len + state.ip_offset != odp_packet_len(pkt)) rc = -1; } else { if (state.is_ipv4) rc = ipsec_out_tunnel_parse_ipv4(&state, ipsec_sa); - else + else if (state.is_ipv6) rc = ipsec_out_tunnel_parse_ipv6(&state, ipsec_sa); + else + rc = -1; if (rc < 0) { status->error.alg = 1; goto err; From patchwork Wed Feb 21 18:00:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129127 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp902265ljc; Wed, 21 Feb 2018 10:08:31 -0800 (PST) X-Google-Smtp-Source: AG47ELswdjB3yzMAZXcOvk7xJB8JFcrkNeM+1A7eL3oGDdn2V7N1X+ZtRW+9K/3jWmMKM5/n8JG7 X-Received: by 10.55.122.135 with SMTP id v129mr6438119qkc.108.1519236511416; Wed, 21 Feb 2018 10:08:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236511; cv=none; d=google.com; s=arc-20160816; b=Nn3mq7/BwonKE2QpvHjvsDSreNophI7vtte6LuF9bzIT4DeCJVBNSU3sWHpw9e5oC/ J2lc5dhKKgQGyEerwkhQbr7ckhRrVVsm8pLKP+X5zCI2IyCWRyDdVCaLZ46FHr7ilUeN qPO39Lokse6HwEuHLEkthV9Ddg9KUwcfhuXfOhRP4b8q+7Xnsdp6kuDdZqCVbFx50m2g YqG1ORHVeSAjWTiE9lT7X0tdwgiOvjmU5QfwImrfFuZsprKKNhm/FnAfQlGRCxPjLKC7 ejlZXheORcrzShc+vZJUd4LcVoOqAGYOzeMQmbfZgR40ovq/I5HVNK08qd/1qDv06SCW aCIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=HSviioaHMsRvvH0FkTW48dpQr3ie8cITAku0imTpe9M=; b=fIrsorhWeWIqMesVRXg+6nL0dkztV0mMBv97I1AlU0b9Asic/KgPUKO4snGFEoWmbJ JJDI1MwNAEjiNnQIW/N6mNWQGrlmVy9uQsGIJbTQZkqdi6LmWuvE30bdcjHmTBzxqY3p Lu4qJo6ZxvRckd7l9Y5bNdh309SgVpaqxjr56/1oIeGLEgsX4DenN1y7wHDdz/7/sA+S NnAYlVNxd7o+y3Dfl3vx8n8rFWs4gWcZVKiUbfUw5mbeh5O5WzGljbvM73DwCWY6iaKz 3EFjW2vP8V9BnmAIcAUEb6Sc2VBU/3OjWrHCFTSSkLK1Xv5PYwAwUbs1uCnuArH0K5WZ XXoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id r186si166000qkc.94.2018.02.21.10.08.31; Wed, 21 Feb 2018 10:08:31 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 1A700617AF; Wed, 21 Feb 2018 18:08:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 6807B617EA; Wed, 21 Feb 2018 18:03:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3880B617F4; Wed, 21 Feb 2018 18:03:20 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id B842B617D0 for ; Wed, 21 Feb 2018 18:01:59 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 41E7A183A7E for ; Wed, 21 Feb 2018 21:01:58 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id lFJNdMkFBu-1wBWNLhe; Wed, 21 Feb 2018 21:01:58 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1p98Nl7T; Wed, 21 Feb 2018 21:01:51 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:06 +0300 Message-Id: <1519236011-14987-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 10/15] linux-gen: ipsec: support inbound TFC dummy packets X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_ipsec.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 55beb382e..855b504e5 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -651,7 +651,6 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, odp_crypto_packet_op_param_t param; int rc; odp_crypto_packet_result_t crypto; /**< Crypto operation result */ - odp_packet_parse_param_t parse_param; odp_packet_hdr_t *pkt_hdr; state.ip_offset = odp_packet_l3_offset(pkt); @@ -784,6 +783,9 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, } else if (_ODP_IPPROTO_IPV6 == state.ip_next_hdr) { state.is_ipv4 = 0; state.is_ipv6 = 1; + } else if (_ODP_IPPROTO_NO_NEXT == state.ip_next_hdr) { + state.is_ipv4 = 0; + state.is_ipv6 = 0; } else { status->error.proto = 1; goto err; @@ -817,20 +819,30 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, _ODP_IPV6HDR_LEN); else ipv6hdr->hop_limit -= ipsec_sa->dec_ttl; - } else { + } else if (state.ip_next_hdr != _ODP_IPPROTO_NO_NEXT) { status->error.proto = 1; goto err; } - parse_param.proto = state.is_ipv4 ? ODP_PROTO_IPV4 : - state.is_ipv6 ? ODP_PROTO_IPV6 : - ODP_PROTO_NONE; - parse_param.last_layer = ipsec_config.inbound.parse_level; - parse_param.chksums = ipsec_config.inbound.chksums; + if (_ODP_IPPROTO_NO_NEXT == state.ip_next_hdr && + ODP_IPSEC_MODE_TUNNEL == ipsec_sa->mode) { + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - /* We do not care about return code here. - * Parsing error should not result in IPsec error. */ - odp_packet_parse(pkt, state.ip_offset, &parse_param); + packet_parse_reset(pkt_hdr); + pkt_hdr->p.l3_offset = state.ip_offset; + } else { + odp_packet_parse_param_t parse_param; + + parse_param.proto = state.is_ipv4 ? ODP_PROTO_IPV4 : + state.is_ipv6 ? ODP_PROTO_IPV6 : + ODP_PROTO_NONE; + parse_param.last_layer = ipsec_config.inbound.parse_level; + parse_param.chksums = ipsec_config.inbound.chksums; + + /* We do not care about return code here. + * Parsing error should not result in IPsec error. */ + odp_packet_parse(pkt, state.ip_offset, &parse_param); + } *pkt_out = pkt; From patchwork Wed Feb 21 18:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129129 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp904223ljc; Wed, 21 Feb 2018 10:10:27 -0800 (PST) X-Google-Smtp-Source: AG47ELvtaWqpbkGCfLH4Efq0mpRlbso/YABHCtF+y5DRRXSco1Sf4E42hqZy4hU5FnduyR1LcHoP X-Received: by 10.55.245.9 with SMTP id l9mr6676079qkk.301.1519236626712; Wed, 21 Feb 2018 10:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236626; cv=none; d=google.com; s=arc-20160816; b=eO2arpgLA31NtNUWk8lp0+two0/cW+/xIpbGuf7hq6HAgj2uBzSZNWSBhNxOHjxTqI mNyuJVB+gKeNXr7YbNqnRGL6jts9/YoXuD5wunwCEtcLzrFJzrGwPG8FpVkb+11Ff24f 7ThH8mtZRaHX3lZHk5oriqlktd8LpVdWeUJ7ie2vl6y+u96CyYvFR+tDA65UtrSuT7Hi Cvid3i8c9euOddauE6/+cUtNzr7TIifTUJy1Z6dURL+c4Vg5oYz5Ek+iGvpHge6zFZ5k wBHzuqzPs268dwtHQvLbdQkgVG2xElYcxss58BuvKQor0LFz9tPOGHSvkOhbEIU24osd y9+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=uydlxxjBDF4jOOFugf1e4X0Dsevd/ZefZGwPM4mVsB8=; b=yroAXl9373xUGgAAgT44trqn5Btjfx6NLjk4IINZ9NU6gQ2G++hKX5WdYh/xeNYKNa /TPWaNDkfCw7U6Aig1YJs25AWv5b4kOvnkIk2+c/boWoVyVv+32qfMAsnO7mHfpl+yfG gob8d+ZTXt3I4wyX4xvL1F7RCno0J/WNVpl65GNw8t+RzUliEbjcGVdEmpmYy/YXSo5Z 6lZNkLrpASe1QrgGPC3ghou2MS9A/2Ieyzi8/EgBobsxzUYnQSHTGd/rYbfdzoR6i/72 MI4l+bCav35sZZiYwXSX1ZP5va0hYa3IZEUUGkmeIubjLutAzcCK/zDnkUh+9TR3l7FH Ujtg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id l2si837934qki.445.2018.02.21.10.10.26; Wed, 21 Feb 2018 10:10:26 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id DAC74617CC; Wed, 21 Feb 2018 18:10:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 456C4617F4; Wed, 21 Feb 2018 18:03:59 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EA80B617D2; Wed, 21 Feb 2018 18:03:50 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id B0505617D7 for ; Wed, 21 Feb 2018 18:02:15 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 02652408174C for ; Wed, 21 Feb 2018 21:02:05 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id zvpHmBlklY-24uqnZpw; Wed, 21 Feb 2018 21:02:04 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-1w94tkbw; Wed, 21 Feb 2018 21:01:58 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:07 +0300 Message-Id: <1519236011-14987-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 11/15] validation: ipsec: add L3/L4 types validation X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ test/validation/api/ipsec/ipsec.c | 8 ++ test/validation/api/ipsec/ipsec.h | 5 ++ test/validation/api/ipsec/ipsec_test_in.c | 128 ++++++++++++++++++++++++++++- test/validation/api/ipsec/ipsec_test_out.c | 10 +++ test/validation/api/ipsec/test_vectors.h | 19 ++++- 5 files changed, 165 insertions(+), 5 deletions(-) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 31bd557fe..6043debf9 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -689,6 +689,14 @@ void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa) } ipsec_check_packet(part->out[i].pkt_out, pkto[i]); + if (part->out[i].pkt_out != NULL && + part->out[i].l3_type != _ODP_PROTO_L3_TYPE_UNDEF) + CU_ASSERT_EQUAL(part->out[i].l3_type, + odp_packet_l3_type(pkto[i])); + if (part->out[i].pkt_out != NULL && + part->out[i].l4_type != _ODP_PROTO_L4_TYPE_UNDEF) + CU_ASSERT_EQUAL(part->out[i].l4_type, + odp_packet_l4_type(pkto[i])); odp_packet_free(pkto[i]); } } diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h index 7ba9ef10e..b2d6df698 100644 --- a/test/validation/api/ipsec/ipsec.h +++ b/test/validation/api/ipsec/ipsec.h @@ -42,6 +42,9 @@ typedef struct { uint8_t data[256]; } ipsec_test_packet; +#define _ODP_PROTO_L3_TYPE_UNDEF ((odp_proto_l3_type_t)-1) +#define _ODP_PROTO_L4_TYPE_UNDEF ((odp_proto_l4_type_t)-1) + typedef struct { const ipsec_test_packet *pkt_in; odp_bool_t lookup; @@ -51,6 +54,8 @@ typedef struct { struct { odp_ipsec_op_status_t status; const ipsec_test_packet *pkt_out; + odp_proto_l3_type_t l3_type; + odp_proto_l4_type_t l4_type; } out[1]; } ipsec_test_part; diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index 8138defb5..9c1112004 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -31,6 +31,8 @@ static void test_in_ipv4_ah_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -62,6 +64,8 @@ static void test_in_ipv4_ah_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -93,6 +97,8 @@ static void test_in_ipv4_ah_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -123,6 +129,9 @@ static void test_in_ipv4_ah_sha256_tun_ipv4_notun(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + /* It is L4_TYPE_IPV4 */ + .l4_type = _ODP_PROTO_L4_TYPE_UNDEF, .pkt_out = &pkt_ipv4_icmp_0_ipip }, }, }; @@ -153,6 +162,8 @@ static void test_in_ipv4_esp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -183,6 +194,8 @@ static void test_in_ipv4_esp_aes_cbc_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -213,6 +226,8 @@ static void test_in_ipv4_esp_aes_cbc_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -243,6 +258,8 @@ static void test_in_ipv4_esp_aes_ctr_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -274,6 +291,8 @@ static void test_in_ipv4_ah_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -305,6 +324,8 @@ static void test_in_ipv4_esp_null_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -336,6 +357,8 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -367,6 +390,8 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -398,6 +423,8 @@ static void test_in_ipv4_esp_udp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -430,6 +457,8 @@ static void test_in_ipv4_esp_udp_null_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -461,6 +490,8 @@ static void test_in_ipv4_ah_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -471,6 +502,8 @@ static void test_in_ipv4_ah_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -505,6 +538,8 @@ static void test_in_ipv4_ah_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -525,6 +560,8 @@ static void test_in_ipv4_ah_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -559,6 +596,8 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -569,6 +608,8 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -603,6 +644,8 @@ static void test_in_ipv4_esp_null_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -623,6 +666,8 @@ static void test_in_ipv4_esp_null_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -878,6 +923,8 @@ static void test_in_ipv4_rfc3602_5_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_5 }, }, }; @@ -908,6 +955,8 @@ static void test_in_ipv4_rfc3602_6_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_6 }, }, }; @@ -939,6 +988,8 @@ static void test_in_ipv4_rfc3602_7_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_7 }, }, }; @@ -970,6 +1021,8 @@ static void test_in_ipv4_rfc3602_8_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_8 }, }, }; @@ -1001,6 +1054,8 @@ static void test_in_ipv4_mcgrew_gcm_2_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_UDP, .pkt_out = &pkt_mcgrew_gcm_test_2}, }, }; @@ -1032,6 +1087,8 @@ static void test_in_ipv4_mcgrew_gcm_3_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = _ODP_PROTO_L4_TYPE_UNDEF, .pkt_out = &pkt_mcgrew_gcm_test_3}, }, }; @@ -1063,6 +1120,8 @@ static void test_in_ipv4_mcgrew_gcm_4_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_mcgrew_gcm_test_4}, }, }; @@ -1072,13 +1131,17 @@ static void test_in_ipv4_mcgrew_gcm_4_esp(void) ipsec_sa_destroy(sa); } -#if 0 static void test_in_ipv4_mcgrew_gcm_12_esp(void) { odp_ipsec_tunnel_param_t tunnel = {}; odp_ipsec_sa_param_t param; odp_ipsec_sa_t sa; + /* This test will not work properly inbound inline mode. + * Packet might be dropped and we will not check for that. */ + if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE) + return; + ipsec_sa_param_fill(¶m, true, false, 0x335467ae, &tunnel, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12, @@ -1095,6 +1158,8 @@ static void test_in_ipv4_mcgrew_gcm_12_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_NONE, + .l4_type = _ODP_PROTO_L4_TYPE_UNDEF, .pkt_out = &pkt_mcgrew_gcm_test_12}, }, }; @@ -1103,7 +1168,38 @@ static void test_in_ipv4_mcgrew_gcm_12_esp(void) ipsec_sa_destroy(sa); } -#endif + +static void test_in_ipv4_mcgrew_gcm_12_esp_notun(void) +{ + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + + ipsec_sa_param_fill(¶m, + true, false, 0x335467ae, NULL, + ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12, + ODP_AUTH_ALG_AES_GCM, NULL, + &key_mcgrew_gcm_salt_12); + + sa = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa); + + ipsec_test_part test = { + .pkt_in = &pkt_mcgrew_gcm_test_12_esp, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_NO_NEXT, + .pkt_out = &pkt_mcgrew_gcm_test_12_notun }, + }, + }; + + ipsec_check_in_one(&test, sa); + + ipsec_sa_destroy(sa); +} static void test_in_ipv4_mcgrew_gcm_15_esp(void) { @@ -1127,6 +1223,8 @@ static void test_in_ipv4_mcgrew_gcm_15_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_mcgrew_gcm_test_15}, }, }; @@ -1158,6 +1256,8 @@ static void test_in_ipv4_rfc7634_chacha(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_rfc7634}, }, }; @@ -1188,6 +1288,8 @@ static void test_in_ipv4_ah_aes_gmac_128(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -1218,6 +1320,8 @@ static void test_in_ipv4_esp_null_aes_gmac_128(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -1248,6 +1352,8 @@ static void test_in_ipv6_ah_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1279,6 +1385,8 @@ static void test_in_ipv6_ah_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1310,6 +1418,8 @@ static void test_in_ipv6_ah_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1340,6 +1450,8 @@ static void test_in_ipv6_esp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1371,6 +1483,8 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1402,6 +1516,8 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1433,6 +1549,8 @@ static void test_in_ipv6_esp_udp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1465,6 +1583,8 @@ static void test_in_ipv6_esp_udp_null_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1499,10 +1619,10 @@ odp_testinfo_t ipsec_in_suite[] = { ipsec_check_esp_aes_gcm_256), ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_4_esp, ipsec_check_esp_aes_gcm_128), -#if 0 ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_12_esp, ipsec_check_esp_aes_gcm_128), -#endif + ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_12_esp_notun, + ipsec_check_esp_aes_gcm_128), ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_15_esp, ipsec_check_esp_null_aes_gmac_128), ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_rfc7634_chacha, diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 911987388..3db553b60 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -273,6 +273,8 @@ static void test_out_ipv4_esp_aes_cbc_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -346,6 +348,8 @@ static void test_out_ipv4_esp_aes_cbc_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -388,6 +392,8 @@ static void test_out_ipv4_esp_aes_ctr_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -430,6 +436,8 @@ static void test_out_ipv4_esp_aes_gcm128(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -532,6 +540,8 @@ static void test_out_ipv4_esp_chacha20_poly1305(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h index f14fdb2b3..4d5ab3bdc 100644 --- a/test/validation/api/ipsec/test_vectors.h +++ b/test/validation/api/ipsec/test_vectors.h @@ -1641,7 +1641,7 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_4_esp = { static const ipsec_test_packet pkt_mcgrew_gcm_test_12 = { .len = 14, .l2_offset = 0, - .l3_offset = ODP_PACKET_OFFSET_INVALID, + .l3_offset = 14, .l4_offset = ODP_PACKET_OFFSET_INVALID, .data = { /* ETH - not a part of RFC, added for simplicity */ @@ -1650,6 +1650,23 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_12 = { }, }; +static const ipsec_test_packet pkt_mcgrew_gcm_test_12_notun = { + .len = 34, + .l2_offset = 0, + .l3_offset = 14, + .l4_offset = 34, + .data = { + /* ETH - not a part of RFC, added for simplicity */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00, + + /* IP - not a part of RFC, added for simplicity */ + 0x45, 0x00, 0x00, 0x14, 0x69, 0x8f, 0x00, 0x00, + 0x80, 0x3b, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02, + 0xc0, 0xa8, 0x01, 0x01, + }, +}; + static const ipsec_test_packet pkt_mcgrew_gcm_test_12_esp = { .len = 70, .l2_offset = 0, From patchwork Wed Feb 21 18:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129131 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp906198ljc; Wed, 21 Feb 2018 10:12:29 -0800 (PST) X-Google-Smtp-Source: AH8x2247VLuJR04DuQnJ8yvWQemnMLXg57VYABDjWJtYax6SKZ5yzvlVmNldh2wHUq+ioLmSFa13 X-Received: by 10.237.53.195 with SMTP id d3mr6209912qte.276.1519236749234; Wed, 21 Feb 2018 10:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236749; cv=none; d=google.com; s=arc-20160816; b=yjwxtcSkhjcqACAIcu8LOk0aeTHmeOMjFOuH9WjdPVcBbeTX+ZxEnBXSuPIhr5m+JU JyfRhv+9rXyA8ej6PideAehSfICHpNEgqXM5kXMG/ObPOR9l+tYepTC4ixFf3Ig+9s9s sIdWtFZv1Zr3RsTQTRcYsOMGTslVU3SvcjnOd+SCx7UuaTdPELQOaGC04KLF/PA16eZ0 IToE7WFDbGmDy0NJgtV1UCn+b4NoeVjL4id1FetOhgjJ0M1xqPHWDk+R9gtHH2vBVSEp GBytL5UXQY46Cpsh5dhkAyQE0djG0N695EVw8C63ReQQOEn4fUh1mIFwruNwZQ4yte77 vQPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=H4g/Izpn3Mc0Psm/E3S2/QLZKE1GWeXx/KUDAIoBAkg=; b=Y5hcwHkIqgZE4FDczNCQqGVL0QRRahDvzSSq+KvQ8yuBJRYmcwqc2bQFaggytimEvp VNKiNvUiCqFhFDyhuNk3QRjazGyayg8dHeHXPtp08rYBfHxkg7B8j7LeBdP/3Zyf2h6l rYisIxSVwdlBWoMsHSI7MPpKdDTsWG3pUtaP9ExyNuLC62gcc3fdNRUXJCGcJBp+CLpi UrkdpSCES8xjccLtuJdR5Dm60cuItWS2+6WwkJzlEcQvTQUrjiSAbY3V88JiapwPalKX X0u/GhgHSS1z8isW0BpJ/lfNvroHID2Qq/kOd9vOmd34BBt+1Nrtya7ZVga74PUVygnf 8w+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id r64si476675qkf.331.2018.02.21.10.12.28; Wed, 21 Feb 2018 10:12:29 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id E1DB361790; Wed, 21 Feb 2018 18:12:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 9D3FF617D2; Wed, 21 Feb 2018 18:04:14 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0950861800; Wed, 21 Feb 2018 18:04:07 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 42ABA616F9 for ; Wed, 21 Feb 2018 18:02:34 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 791B213408B3 for ; Wed, 21 Feb 2018 21:02:11 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id aWRfGh3eUJ-2BLuwnJk; Wed, 21 Feb 2018 21:02:11 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-259GA0g7; Wed, 21 Feb 2018 21:02:05 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:08 +0300 Message-Id: <1519236011-14987-13-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 12/15] linux-gen: ipsec: take output ip_param into account X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Allow per-packet override of IP parameters. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ .../linux-generic/include/odp_ipsec_internal.h | 9 ++--- platform/linux-generic/odp_ipsec.c | 38 ++++++++++++++-------- platform/linux-generic/odp_ipsec_sad.c | 20 ++++++++---- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/platform/linux-generic/include/odp_ipsec_internal.h b/platform/linux-generic/include/odp_ipsec_internal.h index a449462ab..dfde4d574 100644 --- a/platform/linux-generic/include/odp_ipsec_internal.h +++ b/platform/linux-generic/include/odp_ipsec_internal.h @@ -161,22 +161,17 @@ struct ipsec_sa_s { union { struct { + odp_ipsec_ipv4_param_t param; odp_u32be_t src_ip; odp_u32be_t dst_ip; /* 32-bit from which low 16 are used */ odp_atomic_u32_t hdr_id; - - uint8_t ttl; - uint8_t dscp; - uint8_t df; } tun_ipv4; struct { + odp_ipsec_ipv6_param_t param; uint8_t src_ip[_ODP_IPV6ADDR_LEN]; uint8_t dst_ip[_ODP_IPV6ADDR_LEN]; - uint8_t hlimit; - uint8_t dscp; - uint32_t flabel; } tun_ipv6; }; } out; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 855b504e5..37226cede 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -900,7 +900,8 @@ static int ipsec_out_tunnel_parse_ipv6(ipsec_state_t *state, static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, ipsec_state_t *state, - ipsec_sa_t *ipsec_sa) + ipsec_sa_t *ipsec_sa, + const odp_ipsec_ipv4_param_t *ipv4_param) { _odp_ipv4hdr_t out_ip; uint16_t flags; @@ -911,7 +912,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, else out_ip.tos = (state->out_tunnel.ip_tos & ~_ODP_IP_TOS_DSCP_MASK) | - (ipsec_sa->out.tun_ipv4.dscp << + (ipv4_param->dscp << _ODP_IP_TOS_DSCP_SHIFT); state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset; state->ip_tot_len += _ODP_IPV4HDR_LEN; @@ -923,13 +924,15 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, if (ipsec_sa->copy_df) flags = state->out_tunnel.ip_df; else - flags = ((uint16_t)ipsec_sa->out.tun_ipv4.df) << 14; + flags = ((uint16_t)ipv4_param->df) << 14; out_ip.frag_offset = _odp_cpu_to_be_16(flags); - out_ip.ttl = ipsec_sa->out.tun_ipv4.ttl; + out_ip.ttl = ipv4_param->ttl; /* Will be filled later by packet checksum update */ out_ip.chksum = 0; - out_ip.src_addr = ipsec_sa->out.tun_ipv4.src_ip; - out_ip.dst_addr = ipsec_sa->out.tun_ipv4.dst_ip; + memcpy(&out_ip.src_addr, ipv4_param->src_addr, + _ODP_IPV4ADDR_LEN); + memcpy(&out_ip.dst_addr, ipv4_param->dst_addr, + _ODP_IPV4ADDR_LEN); if (odp_packet_extend_head(pkt, _ODP_IPV4HDR_LEN, NULL, NULL) < 0) @@ -959,7 +962,8 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, ipsec_state_t *state, - ipsec_sa_t *ipsec_sa) + ipsec_sa_t *ipsec_sa, + const odp_ipsec_ipv6_param_t *ipv6_param) { _odp_ipv6hdr_t out_ip; uint32_t ver; @@ -970,23 +974,23 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, else ver |= ((state->out_tunnel.ip_tos & ~_ODP_IP_TOS_DSCP_MASK) | - (ipsec_sa->out.tun_ipv6.dscp << + (ipv6_param->dscp << _ODP_IP_TOS_DSCP_SHIFT)) << _ODP_IPV6HDR_TC_SHIFT; if (ipsec_sa->copy_flabel) ver |= state->out_tunnel.ip_flabel; else - ver |= ipsec_sa->out.tun_ipv6.flabel; + ver |= ipv6_param->flabel; out_ip.ver_tc_flow = odp_cpu_to_be_32(ver); state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset; out_ip.payload_len = _odp_cpu_to_be_16(state->ip_tot_len); state->ip_tot_len += _ODP_IPV6HDR_LEN; - out_ip.hop_limit = ipsec_sa->out.tun_ipv6.hlimit; - memcpy(&out_ip.src_addr, ipsec_sa->out.tun_ipv6.src_ip, + out_ip.hop_limit = ipv6_param->hlimit; + memcpy(&out_ip.src_addr, ipv6_param->src_addr, _ODP_IPV6ADDR_LEN); - memcpy(&out_ip.dst_addr, ipsec_sa->out.tun_ipv6.dst_ip, + memcpy(&out_ip.dst_addr, ipv6_param->dst_addr, _ODP_IPV6ADDR_LEN); if (odp_packet_extend_head(pkt, _ODP_IPV6HDR_LEN, @@ -1365,9 +1369,15 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, } if (ipsec_sa->tun_ipv4) - rc = ipsec_out_tunnel_ipv4(&pkt, &state, ipsec_sa); + rc = ipsec_out_tunnel_ipv4(&pkt, &state, ipsec_sa, + opt->flag.ip_param ? + &opt->ipv4 : + &ipsec_sa->out.tun_ipv4.param); else - rc = ipsec_out_tunnel_ipv6(&pkt, &state, ipsec_sa); + rc = ipsec_out_tunnel_ipv6(&pkt, &state, ipsec_sa, + opt->flag.ip_param ? + &opt->ipv6 : + &ipsec_sa->out.tun_ipv6.param); } if (rc < 0) { status->error.alg = 1; diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 3ac8c49c3..05865eb3a 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -326,11 +326,15 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) param->outbound.tunnel.ipv4.dst_addr, sizeof(ipsec_sa->out.tun_ipv4.dst_ip)); odp_atomic_init_u32(&ipsec_sa->out.tun_ipv4.hdr_id, 0); - ipsec_sa->out.tun_ipv4.ttl = + ipsec_sa->out.tun_ipv4.param.src_addr = + &ipsec_sa->out.tun_ipv4.src_ip; + ipsec_sa->out.tun_ipv4.param.dst_addr = + &ipsec_sa->out.tun_ipv4.dst_ip; + ipsec_sa->out.tun_ipv4.param.ttl = param->outbound.tunnel.ipv4.ttl; - ipsec_sa->out.tun_ipv4.dscp = + ipsec_sa->out.tun_ipv4.param.dscp = param->outbound.tunnel.ipv4.dscp; - ipsec_sa->out.tun_ipv4.df = + ipsec_sa->out.tun_ipv4.param.df = param->outbound.tunnel.ipv4.df; } else { ipsec_sa->tun_ipv4 = 0; @@ -340,11 +344,15 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) memcpy(&ipsec_sa->out.tun_ipv6.dst_ip, param->outbound.tunnel.ipv6.dst_addr, sizeof(ipsec_sa->out.tun_ipv6.dst_ip)); - ipsec_sa->out.tun_ipv6.hlimit = + ipsec_sa->out.tun_ipv4.param.src_addr = + &ipsec_sa->out.tun_ipv6.src_ip; + ipsec_sa->out.tun_ipv4.param.dst_addr = + &ipsec_sa->out.tun_ipv6.dst_ip; + ipsec_sa->out.tun_ipv6.param.hlimit = param->outbound.tunnel.ipv6.hlimit; - ipsec_sa->out.tun_ipv6.dscp = + ipsec_sa->out.tun_ipv6.param.dscp = param->outbound.tunnel.ipv6.dscp; - ipsec_sa->out.tun_ipv6.flabel = + ipsec_sa->out.tun_ipv6.param.flabel = param->outbound.tunnel.ipv6.flabel; } } From patchwork Wed Feb 21 18:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129130 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp904366ljc; Wed, 21 Feb 2018 10:10:35 -0800 (PST) X-Google-Smtp-Source: AH8x227fuvJpiVegvs6LyJY8DPNnotxLNfp0h+rzh87NFq6wCWF//5tGDKEzjGFeLGder1mInZDP X-Received: by 10.55.178.196 with SMTP id b187mr909339qkf.276.1519236634636; Wed, 21 Feb 2018 10:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236634; cv=none; d=google.com; s=arc-20160816; b=Jnj75t8lukABUeNWnIhQND/gfKIt/AUuyoa/4euc87a37+GVkGYxRnPoaTDGuz98ou RnPr2lqnBzspukA2W3wtANLx4rrNh7lU9/2wSMOXFJe73f9tD8XosWHSMD9MiclfX0v/ OliYYjAfleZvgqtJXumXHC9FHcux0EAdBb3NSojFFGu2t+DE+JVxy+tGgJsVq5psq7MX rxkFZBdAkRQDPFczSLxhTsSFtzBiZ0SjiF69C7JKaHWQ/YGs2K0SZ1pkjSwL6XvfTFqB 1XvAGuKeffzObUTvTubY8fufcFX04eDqW1+W/zclRJfJgutQF2ASVCwaPrPAHksST08R B18g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=t8U/B/nVqdLCJ1U0Zc0w2he1vfnOprhKM/Y5JMK+K4Q=; b=ujFSs+C7TLIkUHlNulRdRNNDWuruL7Ist0gElVemuRxhn+6xgR0hKTGc1shkWTs4f1 p2glfb8UNe6ushMZi+x2u9a3B5UgGzKZMVUH01Mxe8RWaynae4bXfZ2jAtIfHkMmNOSS Wx+UuGwFSDr/C4lgir1RHsIEQ5E9pd8lZiAldkDs8M9K/rWJpoNl6Ku5e7Z12SUYyh/u HRaMyiYeP9e4H1D4ITd1Cy4B1IjFjHe+b0VFR4Ng4mPjdcU1DB+iXCk2Edk2jm65Lzvl BkTaSD9eG0E6uJKZIU8CrBEkr9/G7wbTVuNQEb3db3FIIjVWxDz/gFPkx47F/VPIby1N PlaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n13si1633151qki.173.2018.02.21.10.10.33; Wed, 21 Feb 2018 10:10:34 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 6150B607BE; Wed, 21 Feb 2018 18:10:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id C8781617BE; Wed, 21 Feb 2018 18:04:04 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D4C75617D2; Wed, 21 Feb 2018 18:03:51 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 91771617BE for ; Wed, 21 Feb 2018 18:02:20 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward103o.mail.yandex.net (Yandex) with ESMTP id E316658821A1 for ; Wed, 21 Feb 2018 21:02:17 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id zdPGsVPtbz-2HVm6HST; Wed, 21 Feb 2018 21:02:17 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-2B9iAIkP; Wed, 21 Feb 2018 21:02:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:09 +0300 Message-Id: <1519236011-14987-14-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 13/15] linux-gen: ipsec: support tfc_pad_len IPsec option X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_ipsec.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 37226cede..9caf94903 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -1061,7 +1061,8 @@ static int ipsec_out_esp(odp_packet_t *pkt, ipsec_sa_t *ipsec_sa, odp_crypto_packet_op_param_t *param, odp_ipsec_op_status_t *status, - uint32_t mtu) + uint32_t mtu, + const odp_ipsec_out_opt_t *opt) { _odp_esphdr_t esp; _odp_esptrl_t esptrl; @@ -1069,6 +1070,7 @@ static int ipsec_out_esp(odp_packet_t *pkt, uint32_t encrypt_len; uint16_t ip_data_len = state->ip_tot_len - state->ip_hdr_len; + uint16_t tfc_len = opt->flag.tfc_pad ? opt->tfc_pad_len : 0; uint32_t pad_block = ipsec_sa->esp_block_len; uint16_t ipsec_offset = state->ip_offset + state->ip_hdr_len; unsigned hdr_len; @@ -1079,7 +1081,7 @@ static int ipsec_out_esp(odp_packet_t *pkt, if (pad_block < 4) pad_block = 4; - encrypt_len = IPSEC_PAD_LEN(ip_data_len + _ODP_ESPTRL_LEN, + encrypt_len = IPSEC_PAD_LEN(ip_data_len + tfc_len + _ODP_ESPTRL_LEN, pad_block); hdr_len = _ODP_ESPHDR_LEN + ipsec_sa->esp_iv_len; @@ -1120,7 +1122,7 @@ static int ipsec_out_esp(odp_packet_t *pkt, param->aad_ptr = (uint8_t *)&state->esp.aad; memset(&esptrl, 0, sizeof(esptrl)); - esptrl.pad_len = encrypt_len - ip_data_len - _ODP_ESPTRL_LEN; + esptrl.pad_len = encrypt_len - ip_data_len - tfc_len - _ODP_ESPTRL_LEN; esptrl.next_header = state->ip_next_hdr; odp_packet_copy_from_mem(*pkt, state->ip_next_hdr_offset, 1, &proto); @@ -1165,6 +1167,8 @@ static int ipsec_out_esp(odp_packet_t *pkt, ipsec_offset + _ODP_ESPHDR_LEN, ipsec_sa->esp_iv_len, state->iv + ipsec_sa->salt_length); + _odp_packet_set_data(*pkt, esptrl_offset - esptrl.pad_len - tfc_len, + 0xa5, tfc_len); odp_packet_copy_from_mem(*pkt, esptrl_offset - esptrl.pad_len, esptrl.pad_len, ipsec_padding); @@ -1385,7 +1389,8 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, } if (ODP_IPSEC_ESP == ipsec_sa->proto) { - rc = ipsec_out_esp(&pkt, &state, ipsec_sa, ¶m, status, mtu); + rc = ipsec_out_esp(&pkt, &state, ipsec_sa, ¶m, status, mtu, + opt); } else if (ODP_IPSEC_AH == ipsec_sa->proto) { rc = ipsec_out_ah(&pkt, &state, ipsec_sa, ¶m, status, mtu); } else { From patchwork Wed Feb 21 18:00:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129132 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp907499ljc; Wed, 21 Feb 2018 10:14:03 -0800 (PST) X-Google-Smtp-Source: AH8x224LBrqgfqyD5GfEI9kv1xFQ+Cnr8tDu8S0tM4kdmReygG0g09Aw/eBD4PpupKH25NYov1un X-Received: by 10.237.35.10 with SMTP id h10mr6767605qtc.147.1519236843242; Wed, 21 Feb 2018 10:14:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236843; cv=none; d=google.com; s=arc-20160816; b=se2xoCDpFc2tLtNySWiyD2i/RP/jxqk9I/RJpb10/yOQid5P9em1X0FB5VVfJ6ECzm pANI4mzABOxPtKFTP77mFIkIhNfvOwPoKG9zgn3Ajh5fLf02VgIHmx+DICFtLGcTp3RH 0rRrnboZfUJjdbDbv8UIw9fQ/g/oDFl23ZqETeI54L8adtVdR8SZV32J0XluAvQtI4hn KZ5yk8BCZqmZ7Z1zE04M1CS6cqZMuAkAV9T/FavShFGI0+LQJjYFWXAINj/07rDIfJHq 0fBsjmvLyJiDoHISCDa49k1aEPF8ipUUc2e/iUvRSlT1QhVk4S8Khy0b9ltkwz5t4A/1 JxZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=vP8tNXCJCDDNgaWNN+N3dUTpFKznsTefRZUh82yMCFI=; b=Q118zzF5ggZg4th08Qsb6jpU8w6nekBrauhcpwk6HrqlFzGGEFDB0ZjKd6SiYUDWUX UoAuOye0Hf1ozGzb9hR0gcjcQDR1IQPgipfTuEAZDV0VtMK67kk7xYBb32VOgMdCSdga TH7B8cjnZAIPn1Y7bUGD5ogYd8TjsO5D2JlrshnrmyBpT8GDAXsGgY0oLwgzOjaG+b41 Pa313G4hH6CPBVB9vaII0fZWAB58hhVGS4LAmH5CzSc17BkVBxA7oHReRtCi0SGuYRGd HGJgIRQLDuA6aRhMaeYpX6B7bCyyiHx7pc1nCDmBA9eyRIrwqf3DD6Aba/uKwovkYjVO 8z3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 1si146170qtt.279.2018.02.21.10.14.02; Wed, 21 Feb 2018 10:14:03 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id A3D77617C4; Wed, 21 Feb 2018 18:14:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 657ED61806; Wed, 21 Feb 2018 18:04:22 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BA34161806; Wed, 21 Feb 2018 18:04:16 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 8DE8E617DA for ; Wed, 21 Feb 2018 18:02:42 +0000 (UTC) Received: from mxback7g.mail.yandex.net (mxback7g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:168]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 8A17B18549C for ; Wed, 21 Feb 2018 21:02:41 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback7g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id wSkESaMJW1-2fdCsaBG; Wed, 21 Feb 2018 21:02:41 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-2H94cXkP; Wed, 21 Feb 2018 21:02:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:10 +0300 Message-Id: <1519236011-14987-15-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 14/15] linux-gen: ipsec: support TFC dummy packet generation X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ platform/linux-generic/odp_ipsec.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 9caf94903..20bd1f88f 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -949,8 +949,10 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, state->ip_hdr_len = _ODP_IPV4HDR_LEN; if (state->is_ipv4) state->ip_next_hdr = _ODP_IPPROTO_IPIP; - else + else if (state->is_ipv6) state->ip_next_hdr = _ODP_IPPROTO_IPV6; + else + state->ip_next_hdr = _ODP_IPPROTO_NO_NEXT; state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV4HDR_PROTO_OFFSET; @@ -1008,8 +1010,10 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, state->ip_hdr_len = _ODP_IPV6HDR_LEN; if (state->is_ipv4) state->ip_next_hdr = _ODP_IPPROTO_IPIP; - else + else if (state->is_ipv6) state->ip_next_hdr = _ODP_IPPROTO_IPV6; + else + state->ip_next_hdr = _ODP_IPPROTO_NO_NEXT; state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV6HDR_NHDR_OFFSET; state->is_ipv4 = 0; @@ -1330,8 +1334,17 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, state.ip_offset = odp_packet_l3_offset(pkt); ODP_ASSERT(ODP_PACKET_OFFSET_INVALID != state.ip_offset); - state.ip = odp_packet_l3_ptr(pkt, NULL); - ODP_ASSERT(NULL != state.ip); + if (opt->flag.tfc_dummy) { + state.ip = NULL; + state.is_ipv4 = 0; + state.is_ipv6 = 0; + } else { + state.ip = odp_packet_l3_ptr(pkt, NULL); + ODP_ASSERT(NULL != state.ip); + + state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; + state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; + } ipsec_sa = _odp_ipsec_sa_use(sa); ODP_ASSERT(NULL != ipsec_sa); @@ -1347,9 +1360,6 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, /* Initialize parameters block */ memset(¶m, 0, sizeof(param)); - state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; - state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; - if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) { if (state.is_ipv4) rc = ipsec_parse_ipv4(&state, pkt); @@ -1365,7 +1375,12 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, rc = ipsec_out_tunnel_parse_ipv4(&state, ipsec_sa); else if (state.is_ipv6) rc = ipsec_out_tunnel_parse_ipv6(&state, ipsec_sa); - else + else if (opt->flag.tfc_dummy) { + state.out_tunnel.ip_tos = 0; + state.out_tunnel.ip_df = 0; + state.out_tunnel.ip_flabel = 0; + rc = 0; + } else rc = -1; if (rc < 0) { status->error.alg = 1; From patchwork Wed Feb 21 18:00:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129133 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp907595ljc; Wed, 21 Feb 2018 10:14:10 -0800 (PST) X-Google-Smtp-Source: AH8x2279axbs/VmkWJ87hyTnnRxYqjjKp0vUhXYuch8U3WHsPBS9BZ4noglpzV2PVuhmSbDpbcmm X-Received: by 10.55.166.210 with SMTP id p201mr6568438qke.128.1519236850177; Wed, 21 Feb 2018 10:14:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519236850; cv=none; d=google.com; s=arc-20160816; b=snsNCR3gtyJ26PnF02S4GAXv0AI18ZmBFY9SAE7ywgSqZK4mVhcYNLD2YGN71wgEjO NJuRE2bkAlFmqiv4XKjZgqWeF8zyZ+S0DM7RCEw4Nw4Iwkiq78WnJZEtDGnS24ShyBI9 hxMAID3lt1SwTlzJKapUVWDl9s6Y3byK8tQT+NWuYNObU4LqjNAU94+r7bOGyBcHCWz0 5M2Z9bjh0qv+bSZ/8n2BNW/uMVlwh4Q7KtqNJu6NWFYn94t3f4DgorqdJKZMxTKfFuHQ bWbPTqHBsGjOWBcX5i7blFz3A1t/MqNS2i/rppqu9V4y7KgEweb/lF74l5tGFcSdGRew vXIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=cOSlAVJY0LLh7N7TK5eBA1zfTobihKiDoCMWyKvvMLc=; b=k93AtasKkZAJCQnv3bNyBwemU7lSdR4U96OoV7QzDZJCQJU8y7G2/S2KP3yovFHdKb oVqb6S7JsQr+KJsNIUtwJM+9JZlcdsVHADMx2A+wGSiEXv9maxNXP/tvwlcI9z4lalKS RsrwO3U1IRV3Kv7kooCERnZLI7B1LH3bBzg8eCK4ey6WsAJ4xAMuyzLFwM0IuB8eRJ6H IXBZhEc7Cg49reVehuOP7biw5zFnZLoStXXa4PJDJiV6O9bHdYmzh1u7+bQJnt7dHS5v LNB5gNfSYlwpwYWjwaTLxzz3V3xGIw9QHemkFVqWrEV3b+YXhDhDhieSaLmol/nvdzyU P2mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o6si238028qtm.138.2018.02.21.10.14.09; Wed, 21 Feb 2018 10:14:10 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id D3A10617CA; Wed, 21 Feb 2018 18:14:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 1A677617B9; Wed, 21 Feb 2018 18:04:39 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E2F9E6175B; Wed, 21 Feb 2018 18:04:35 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id BA2DB616E8 for ; Wed, 21 Feb 2018 18:02:56 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward103o.mail.yandex.net (Yandex) with ESMTP id B210958835FD for ; Wed, 21 Feb 2018 21:02:48 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 7PyiCjLRM6-2mBC78iV; Wed, 21 Feb 2018 21:02:48 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id pTqHAnOINC-2f9e3wg8; Wed, 21 Feb 2018 21:02:41 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 21:00:11 +0300 Message-Id: <1519236011-14987-16-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> References: <1519236011-14987-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v2 15/15] validation: ipsec: verify TFC dummy packet generation X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 0b6ae2680a00027c3958ebcafbbcf92642a68f5e **/ test/validation/api/ipsec/ipsec_test_out.c | 132 +++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 3db553b60..8f7a41c77 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -997,6 +997,134 @@ static void test_out_ipv6_esp_udp_null_sha256(void) ipsec_sa_destroy(sa); } +static void test_out_dummy_esp_null_sha256_tun_ipv4(void) +{ + uint32_t src = IPV4ADDR(10, 0, 111, 2); + uint32_t dst = IPV4ADDR(10, 0, 222, 2); + odp_ipsec_tunnel_param_t tunnel = { + .type = ODP_IPSEC_TUNNEL_IPV4, + .ipv4.src_addr = &src, + .ipv4.dst_addr = &dst, + .ipv4.ttl = 64, + }; + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + odp_ipsec_sa_t sa2; + + /* This test will not work properly inbound inline mode. + * Packet might be dropped and we will not check for that. */ + if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE) + return; + + ipsec_sa_param_fill(¶m, + false, false, 123, &tunnel, + ODP_CIPHER_ALG_NULL, NULL, + ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, + NULL); + + sa = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa); + + ipsec_sa_param_fill(¶m, + true, false, 123, &tunnel, + ODP_CIPHER_ALG_NULL, NULL, + ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, + NULL); + + sa2 = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa2); + + ipsec_test_part test = { + .pkt_in = &pkt_mcgrew_gcm_test_12, + .num_opt = 1, + .opt = { .flag.tfc_dummy = 1, + .flag.tfc_pad = 1, + .tfc_pad_len = 16, }, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_NO_NEXT, + .pkt_out = NULL }, + }, + }; + + ipsec_check_out_in_one(&test, sa, sa2); + + ipsec_sa_destroy(sa2); + ipsec_sa_destroy(sa); +} + +static void test_out_dummy_esp_null_sha256_tun_ipv6(void) +{ + uint8_t src[16] = { + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x11, 0x43, 0xff, 0xfe, 0x4a, 0xd7, 0x0a, + }; + uint8_t dst[16] = { + 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, + }; + odp_ipsec_tunnel_param_t tunnel = { + .type = ODP_IPSEC_TUNNEL_IPV6, + .ipv6.src_addr = src, + .ipv6.dst_addr = dst, + .ipv6.hlimit = 64, + }; + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + odp_ipsec_sa_t sa2; + + /* This test will not work properly inbound inline mode. + * Packet might be dropped and we will not check for that. */ + if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE) + return; + + ipsec_sa_param_fill(¶m, + false, false, 123, &tunnel, + ODP_CIPHER_ALG_NULL, NULL, + ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, + NULL); + + sa = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa); + + ipsec_sa_param_fill(¶m, + true, false, 123, &tunnel, + ODP_CIPHER_ALG_NULL, NULL, + ODP_AUTH_ALG_SHA256_HMAC, &key_5a_256, + NULL); + + sa2 = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa2); + + ipsec_test_part test = { + .pkt_in = &pkt_mcgrew_gcm_test_12, + .num_opt = 1, + .opt = { .flag.tfc_dummy = 1, + .flag.tfc_pad = 1, + .tfc_pad_len = 16, }, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_NO_NEXT, + .pkt_out = NULL }, + }, + }; + + ipsec_check_out_in_one(&test, sa, sa2); + + ipsec_sa_destroy(sa2); + ipsec_sa_destroy(sa); +} + static void ipsec_test_capability(void) { odp_ipsec_capability_t capa; @@ -1056,5 +1184,9 @@ odp_testinfo_t ipsec_out_suite[] = { ipsec_check_esp_null_sha256), ODP_TEST_INFO_CONDITIONAL(test_out_ipv6_esp_udp_null_sha256, ipsec_check_esp_null_sha256), + ODP_TEST_INFO_CONDITIONAL(test_out_dummy_esp_null_sha256_tun_ipv4, + ipsec_check_esp_null_sha256), + ODP_TEST_INFO_CONDITIONAL(test_out_dummy_esp_null_sha256_tun_ipv6, + ipsec_check_esp_null_sha256), ODP_TEST_INFO_NULL, };