From patchwork Wed Jan 31 14:00:33 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: 126353 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp779195ljc; Wed, 31 Jan 2018 06:26:00 -0800 (PST) X-Google-Smtp-Source: AH8x227udN1W/qZv9+JuIEsy3mbnQEWM7rOks8pCkQ+5piCBUD9GCSqiYTdzY23XuI/o4AHG35YR X-Received: by 10.129.78.16 with SMTP id c16mr21368270ywb.98.1517408760354; Wed, 31 Jan 2018 06:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408760; cv=none; d=google.com; s=arc-20160816; b=VLm3avDVi3VN5ortg4/EighN1zdZ9EkJS5gCu809Lq3LjgAzQqVN/Al5xGy6an+JPd smIOai0ZiyiHo5Bh2rISBorBanw4KDSL0qwDy05ry/Dk309aF+tKuRM/pXzpCIZLIDAt 16vUYPlX1+jfEdte0Up768sv8HKuOLJDvl6Yx09ApJnifMeLFgroKY+uhOSmh62lkdkH CqKcqz0R4HREhaxqWu8M6MRCNafwYzQMajJQHoIryiOOxGDGY9NDDOUbRW5HNQf6NAml u2F+L/LTaZ/zjmLbZ3xTg54BOY4SKsZaMfHjPsuFW1xT1AJhe/rzDqq0t1tga0UF4lpn zHvA== 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=k7xC+es+9kSRZfK/JnfedsuKg1i4MyUDKpp9XKHMIRo=; b=Uzyn9Fu8cj6KymiDK7u8uG6ZFMKP8eFyri+bwbuwW+/MK6f5SeQPlubCuduuEyWwns FC0VWwZcnodiD9LqwNl8Ivd0tXJwslBgH+Tz0ej5g2h/YzoGKUN3tGXuMjJ6ExdbbryD rRiYRqZNpRx3BBC3c3IC+lYp5/jLG+C+Ra9TY5XWXpyO0pNWAZCLWvntlYFbkpoqfF+Q eqlP8DOOlxt9olhWuE0epHRjfleRY9lsPZGl7P0udXDQgVAv5w7OVVl5B2toyfia1Vq/ MGsUo7/jRw/Y1jqx6Hq7G7aKJk2J92i4kBxnQWxIA98TOgbhJ6E3TNYOV245h5ZbOfOl fnEQ== 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 r6si3818289qti.330.2018.01.31.06.26.00; Wed, 31 Jan 2018 06:26: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 ECFD7617DD; Wed, 31 Jan 2018 14:25: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 1C44B61813; Wed, 31 Jan 2018 14:07:17 +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 CB0C161813; Wed, 31 Jan 2018 14:07:07 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id CA6BB617CC for ; Wed, 31 Jan 2018 14:01:46 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 83311185AAE for ; Wed, 31 Jan 2018 17:00:39 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rDz5J4DLYR-0d2CIx0B; Wed, 31 Jan 2018 17:00:39 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Tps9JIjLUO-0cq8eMFE; Wed, 31 Jan 2018 17:00: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, 31 Jan 2018 17:00:33 +0300 Message-Id: <1517407234-19273-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> References: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 403 Subject: [lng-odp] [PATCH API-NEXT v4 6/7] api: ipsec: outbound TFC padding and 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: Petri Savolainen Specify how application can request TFC padding and dummy packet creation at output. Application can use odp_ipsec_out_opt_t options to reguest addition of TFC padding, or creation of a TFC dummy packet (next header = 59). IP parameter override options are needed for tunnel mode dummy packet creation as there's no IP header to copy e.g. DSCP or flow label values to tunnel IP header. Signed-off-by: Petri Savolainen --- /** Email created from pull request 403 (psavol:next-ipsec-tfc) ** https://github.com/Linaro/odp/pull/403 ** Patch: https://github.com/Linaro/odp/pull/403.patch ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de **/ include/odp/api/spec/ipsec.h | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 721f96856..665dc07bc 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -991,6 +991,22 @@ typedef struct odp_ipsec_out_opt_t { /** Use fragmentation mode option */ uint32_t frag_mode: 1; + /** Use TFC padding length option */ + uint32_t tfc_pad: 1; + + /** Tunnel mode TFC dummy packet. This can be used only + * in tunnel mode. When the flag is set, packet length + * and content is ignored and instead a TFC dummy + * packet is created during IPSEC operation. The dummy + * packet length is defined by 'tfc_pad_len' option. + * If the SA is configured to copy IP header fields + * from inner IP packet, those fields must be passed + * with IP parameters option. */ + uint32_t tfc_dummy: 1; + + /** Use IP parameters option */ + uint32_t ip_param: 1; + } flag; /** All flag bits */ @@ -1000,6 +1016,26 @@ typedef struct odp_ipsec_out_opt_t { /** Fragmentation mode */ odp_ipsec_frag_mode_t frag_mode; + /** TFC padding length + * + * Number of TFC padding bytes added to the packet during IPSEC + * processing. Resulting packet should not exceed the maximum packet + * length of the pool, otherwise IPSEC operation may fail. + * Implementation guarantees that the padding does not contain any + * confidential information. */ + uint32_t tfc_pad_len; + + /** Union of IP parameters */ + union { + /** Override IPv4 parameters in outer header creation. + * IP addresses are ignored. */ + odp_ipsec_ipv4_param_t ipv4; + + /** Override IPv6 parameters in outer header creation. + * IP addresses are ignored. */ + odp_ipsec_ipv6_param_t ipv6; + }; + } odp_ipsec_out_opt_t; /** @@ -1302,7 +1338,13 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in, * The operation does packet transformation according to IPSEC standards (see * e.g. RFC 4302 and 4303). Resulting packets are well formed IP packets * with IPSEC, etc headers constructed according to the standards. The amount - * and content of packet data before the IP header is undefined. + * 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 + * 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: * - L3 offset: Offset to the first byte of the (outmost) IP header