From patchwork Wed Jan 31 15:00:18 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: 126365 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp815427ljc; Wed, 31 Jan 2018 07:07:48 -0800 (PST) X-Google-Smtp-Source: AH8x227rWStTQgxyahmwPaijOs7f329SmF1jfPzhcXsq4PVOUGJ4S4jeyLsfTDG2/WgXw0YCZbz5 X-Received: by 10.55.144.198 with SMTP id s189mr48547147qkd.168.1517411268056; Wed, 31 Jan 2018 07:07:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517411268; cv=none; d=google.com; s=arc-20160816; b=eVGvHuaGNxg2nPe71iKq7Ye6e7izthz/pfpbChXzd0B8McxSxgRhu+MUl9zDHvBp/s cw0xNMDUqFudkSmQJyW9YA90mozJmmtHjf7gK/V/BoeZYXnUj8UTUyOKToc6rT5LaI2M vCbh4tQkShhbq08m10lAvKYDJMXSZdpRFmATWARfFS8rRIllJIN1v943BFn7m9cl1Y2/ j8Y4Ece6gWbbIoiNqROSzwvdx/KXxZRU8QUqlkHi4Wx+zHOE36PO2vQ5IhygNWfD9uU6 O5Zikvs44LU5YKcWstbz7Mo7I9iN9ws/wZ59+EBcUg+OK587iubFFNqJwoQiBX51iRqn YK/g== 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=rFeGFQVYBLnyaIiurFm/mutsz5PqnGEoIUaaIIT7z6M=; b=hguHbnNSAzly1OV8tPZzzJQPF+QNfsqWlLdAc8o4asiqVxZOlcLpyqIyLznCUB/eNy Wszb+0YvJSLOWvRTlduFrPsaHTV729Nj9m+ojYdO2nvPlKqPGKML8b1iyInl5Ltq04Bl GQ84q1cBBNEOH4TMdJ2tG+OmaYOoKK3glJ4Gh51fSZKONMnU70bDO4EHv6tUTBCQw2q7 2fh9omfyE+HgDkZ7rkibRxfq7VmhCQSz0zkVoq5ExDtinsevM5WSy7UPGOW4vuFNawFk H7uy3CktKvg1RPxGI+jGEdGJ2MS1Dz4BuECS0HSyoKN5fEWmo/vz81erO4SvlSMe4mRn OXqQ== 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 f67si1443019qkj.94.2018.01.31.07.07.47; Wed, 31 Jan 2018 07:07:48 -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 B860B616D9; Wed, 31 Jan 2018 15:07:47 +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 8A6DE61731; Wed, 31 Jan 2018 15:01:08 +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 611366083D; Wed, 31 Jan 2018 15:00:38 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 2F11B60855 for ; Wed, 31 Jan 2018 15:00:25 +0000 (UTC) Received: from mxback11j.mail.yandex.net (mxback11j.mail.yandex.net [IPv6:2a02:6b8:0:1619::84]) by forward100j.mail.yandex.net (Yandex) with ESMTP id BE80D5D846EE for ; Wed, 31 Jan 2018 18:00:23 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback11j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dxAzAhERqp-0NeuvRFi; Wed, 31 Jan 2018 18:00:23 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id p8qYWNiSK1-0Nhm5nTQ; Wed, 31 Jan 2018 18:00:23 +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 18:00:18 +0300 Message-Id: <1517410819-24732-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517410819-24732-1-git-send-email-odpbot@yandex.ru> References: <1517410819-24732-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 403 Subject: [lng-odp] [PATCH API-NEXT v5 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: a8d85f63d9e1de7ba709e84b37a06e3482bdea1d **/ 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