From patchwork Thu Jan 25 15:00:17 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: 125862 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1172174ljf; Thu, 25 Jan 2018 07:04:10 -0800 (PST) X-Google-Smtp-Source: AH8x22435T8oOsN/9adLoehWwEeLbKXBkNSBBpzh9rkS92dq/rbb/0KCOs3UIRe35eFiS2sXYVBs X-Received: by 10.129.116.8 with SMTP id p8mr8800148ywc.386.1516892650705; Thu, 25 Jan 2018 07:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516892650; cv=none; d=google.com; s=arc-20160816; b=LqdObMrJzQRP0nheXiGWL9aP3T+jvaTVrsIL0dOQnvcUuATWBDR5SQbhR+mMU2SNGN l1O+zTxd/yqZj5Vv9WS4OjVNfE7QGovoRKHk9FJkQ6v8Fyl87ryVmX9CBOZjR0Nywqwy Ui2g+q+o7BUnl7CW2LcV6J4GFmnWOBG4uXopI6StfeP94p0o2gspw3i0/mLz8hU2DQgF o1BIak1ORd9axY8MzE8mBqfZBk3WY2QmXT2BW5dyEDD10B61WLywetEs9qjpHeftAF8V JC8VKjWcnHpmE2WSrkWjFpedsBZ+zsMp16zQyfRYbhpqf9vp5qZcBxErRH/qH4dXdYxg xLwQ== 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=/BqFVrmU+t1u2u5ccSlOMoneVnxKTSBCLi/IgKHxX+I=; b=Hpnk++tyMXSZnfRFhuSlL30pX46uWqy+EMy0LOqwl+3fecDi0WLgjtfzvX/EcGW0TD 5S/mU+4yOaNGeRkOmrfulgp3I8j8+h/LEMNg75V89QbNsQ29iz5gV+DkY0H9BkgdvcQd LXHz5iq1DA/ZBP+whGHGeFyqqCrYgqE4FcyhXzEYpGCbLdghBwtIOnpCkKNeVEmmt4JH /JkcPds777Xv620wI33WZ/L9qBZ1argVqBRLh6PGVAfH+q7x3V0sGcBZH86OT8JHVp8/ e5t6HrxfYxAWHfrSDAVbvnd+xrE88OLPOz8qHh9CvZDmqjDh2vsTCD5wyLib4iakFQnS 05fw== 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 a8si3206889ybl.62.2018.01.25.07.04.10; Thu, 25 Jan 2018 07:04: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 4833F61785; Thu, 25 Jan 2018 15:04:10 +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 4C78E6176D; Thu, 25 Jan 2018 15:01:00 +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 06BA861518; Thu, 25 Jan 2018 15:00:28 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 9EB7C6068C for ; Thu, 25 Jan 2018 15:00:24 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward103j.mail.yandex.net (Yandex) with ESMTP id C4C3434C1C9B for ; Thu, 25 Jan 2018 18:00:22 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0tTEGE0xJa-0MfKITOZ; Thu, 25 Jan 2018 18:00:22 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id tNrAE6Xzdv-0MDWUdQJ; Thu, 25 Jan 2018 18:00:22 +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: Thu, 25 Jan 2018 18:00:17 +0300 Message-Id: <1516892418-5660-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516892418-5660-1-git-send-email-odpbot@yandex.ru> References: <1516892418-5660-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 403 Subject: [lng-odp] [PATCH API-NEXT v3 5/6] 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: 44974a09b01c79adb9637a5dff38539598a76737 ** Merge commit sha: acecf073764f87bfadb64c598703458d344b39f4 **/ 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 e88f46e90..d1cbfe352 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; /** @@ -1298,7 +1334,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