From patchwork Wed Feb 21 16:59:54 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: 129103 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp836161ljc; Wed, 21 Feb 2018 09:00:30 -0800 (PST) X-Google-Smtp-Source: AH8x227r9qJHqPPhYlbLlR/ncKBDqPtUXdQM4065e9iKGLHMpTWJAQr7UbogTmQF9e+ovYNxy+ri X-Received: by 10.200.36.78 with SMTP id d14mr4044537qtd.329.1519232430033; Wed, 21 Feb 2018 09:00:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232430; cv=none; d=google.com; s=arc-20160816; b=Kyhcm3cAGauzL7ZNs+DhvtSdM2YVF9JhYvOHlukzBpJw9SIoh/fgsQfJ7CTA11w81Y tPtB37H4prYnoduUY6mvY2pI4uYOVYUcg5biT4tMhFZuDLBmafN7mibZtG1Va4THiXNY 5qlBDVAeeRf5ebz5eTf5s9/xHIhE66wPAj6ClBjJ0lnrdDN/tc5RhAmKkeiNr5pv9CgV kc3OKfe2aeLJ0BmaW39u/eDohxYiHx+fmaCMAB39DICNAUua0F9CiUgVsq5ZUkldl2eF hZqMQNcTfjmI62jI+/2vF5xwROV+ktwmJu0AKesb3Ocda3TMDrV6p8pN6XW5NcjSepQ2 3omA== 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=SfHjcwgoWDbVHts1WMAPXa1w8hHmZ4hMExm4tKJIp9w=; b=DjibnFrzsppfm2nuxj4wO/DQhZz77i9uI4RG84mkB1Md/xvBq70UobuGOWHGoFF8jm xFN69Vs3hMTSdEbjb3MfAy1LyceWpmg1tqytsQb8wqDkM6YV5ggJ/+d7yduwO+1P3Vu7 ns83n8OkQkUdwiRZqq4S63sckmuD8FSttqPfoi7S8fvkN2TAv9K9rDQkbNIrajMmvt/k zF43Aj22PhVa6OibvrIMqGj4xiJW2zhh3htohgmWW2MBzL6A9ZiRjIUVbECpqAG99vX4 kzUCUtLg1TAwJTHL4PLLoow5ZXcsfPD+0nnKTYbWIjpwQXtyRpQTRFW95dOHKXyUyXb0 y4Gg== 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 t129si2392336qkd.110.2018.02.21.09.00.28; Wed, 21 Feb 2018 09:00: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 B02EF60744; Wed, 21 Feb 2018 17:00: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 20CBF617AC; Wed, 21 Feb 2018 17:00:20 +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 3F2EA617A3; Wed, 21 Feb 2018 17:00:15 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id CAAA661777 for ; Wed, 21 Feb 2018 17:00:13 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 09FDE5D83BB9 for ; Wed, 21 Feb 2018 20:00:12 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id sHGjxQ8hef-0BkKlXcH; Wed, 21 Feb 2018 20:00:12 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0Bue9NjE; Wed, 21 Feb 2018 20:00: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 19:59:54 +0300 Message-Id: <1519232408-28445-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 16:59:55 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: 129108 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp841456ljc; Wed, 21 Feb 2018 09:04:39 -0800 (PST) X-Google-Smtp-Source: AG47ELtv+mZQuJW6hLIe8DlJghrTaL7TvSmHQJYy9TNoa2z+DfZ/tegH+mf2YHJDwVVXPzDvOavq X-Received: by 10.55.18.76 with SMTP id c73mr6200035qkh.206.1519232679115; Wed, 21 Feb 2018 09:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232679; cv=none; d=google.com; s=arc-20160816; b=pESJIugff7XkoMaHATOEz8DHxjrqk3GDgVlfq0IAK5NmJ8TjFK2Q7KD2MG1d2hNQat EcGGx0kpIrtKGjGx+GSudIvyVnG9UrcFjw+UldrgCldKlZ1kH1/lk4B4KBhqVh9aa3Rm ph3CCfUzg2HO+uF3yNznYRrkEtFQ8vBRpN6ORd5TZNFI4Bdl/YkSZNFYHEi56b9eB0dE R1DwewA4TLERJBEqs1MPBDOYiXATq2xXphNh0b3X927EBt5NOYXWeDS3MSqWpF7ygIGT wyqzCt6Ou6ZX0VmKNESJewbCN3wicvftFLXV0p/I0QfPgFi65sa47wF4u9Tx4HVuyQ8y q6RQ== 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=iNXiTpwAiCjXQri4D5RRhT541iEQXt1K1kQTAeV+aYk=; b=MFc/Qle5L8Gr4FKAKJ/3ZeTWusGckJdFTnaQasv8VoacAYy3xz5uHXvAd1zfTkWdXs z4grIrJyjqOsQtjyNxxoOnembfADkJfQ9srSc8n86HzpcW+5h+LnwWPZMaquKGqoHmSl M1PM0WImHwXJPngCbJkfV6i4j5otasn3Pp6/adXrq6AGezlvbfJgCPiEi+MjBMAFA0uJ ky0IuHZlWY0YZA1VGI2ZEPdcUz6VPjSXU0/o4L9T9HqzkxhFSdePK2hqd5M16V126EGn lG7j7S1eztA5VYg5B2HqjuJXHXsf+FVl8Yt+XRaHJINDVDv5eE73fynIROQSfC1DoSNO oLBQ== 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 c4si300908qtd.372.2018.02.21.09.04.38; Wed, 21 Feb 2018 09:04:39 -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 4784B617C3; Wed, 21 Feb 2018 17:04:38 +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 052F061777; Wed, 21 Feb 2018 17:00:38 +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 612F4617BA; Wed, 21 Feb 2018 17:00:22 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 2DB8361799 for ; Wed, 21 Feb 2018 17:00:14 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward103j.mail.yandex.net (Yandex) with ESMTP id DF6E034C557C for ; Wed, 21 Feb 2018 20:00:12 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Ihc0o6dPes-0CuKd1LO; Wed, 21 Feb 2018 20:00:12 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0CuquE3S; Wed, 21 Feb 2018 20:00: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 19:59:55 +0300 Message-Id: <1519232408-28445-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 16:59:56 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: 129105 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp839255ljc; Wed, 21 Feb 2018 09:02:41 -0800 (PST) X-Google-Smtp-Source: AH8x2248170wAYN09nKu3/j6U/ks0p21MVpa9NsVppnAbc9+5CYL1xFa3nONCRd1HwtnFa33B+Fj X-Received: by 2002:a25:248c:: with SMTP id k134-v6mr2790974ybk.23.1519232561444; Wed, 21 Feb 2018 09:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232561; cv=none; d=google.com; s=arc-20160816; b=VndUcsPV+9Tvv+CpkVb/5PaWCpekhaZHkZlPis0mO8A6+J4JvQH7e1ROOUJ2MZ1YeA i8R2kpklDS3rXvqKMJlNLfN2fqTug0+hL6NZvCMVReDd16N5oLQtVSJU3PcwZI7waPsO Qj56eiMqcXT/0Tgn43Sa5KaqXVdw+uPdgHfpk7gKOBX+ZnoLrTXpFzG5+DBWVeqQ743h SJWeDBpHgeqA345LSEk9OJrds1KAV7DdQPHDl7cELt+nRpJpujdVK9MSX3ydxQo/50tf hcrHkvWoreznxK+V+mwS2LGChX0MmEAokiPtSimzELCp7e47f0JFyN8qfB6FUeU62cn5 w5vg== 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=+Uze0THQFrHWXBexFx0Ayd8cT0jWwf7ZoEFoV6+VqwQ=; b=N5y1wqFSLji+SLZmXZK8+dFI079Mo4YdAtMlb7gAMoRgTk53/K/1MmtI6aGncYWz4N 4+smVsH9qES28lI/ggWFY4VELYS1IZ6qV644aBbgy9o7hzVE/cGFKc8vZuNQ5+z4JDdO CRmRa9tITh091l7MV/YsG4SmI270y+spTY4N80hmzmUzL/yL2XsHIUP2ovS+bm3Zwjah QpNgZlVOPRewidynjIEMSu0V924iS5nmbJcCYbBKdbiV/CW+RqQwme74RlWqYLg9XdWX RIr2bf8Q6aL5nDa7Lu/rvdbYy5fkjy1ZzPAQASY0A5Vw6nSEDdL3LtAqoY/PgiZ6R5Vy +F0w== 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 s187si436486yws.669.2018.02.21.09.02.36; Wed, 21 Feb 2018 09:02:41 -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 81E236180B; Wed, 21 Feb 2018 17:02:36 +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 21D15603C1; Wed, 21 Feb 2018 17:00:28 +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 3D543617AC; Wed, 21 Feb 2018 17:00:18 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id B89B86179A for ; Wed, 21 Feb 2018 17:00:14 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward100j.mail.yandex.net (Yandex) with ESMTP id B0FDD5D839FE for ; Wed, 21 Feb 2018 20:00:13 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9dwtBqsJRW-0D4W81K7; Wed, 21 Feb 2018 20:00:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0Cuq0fHL; Wed, 21 Feb 2018 20:00: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 19:59:56 +0300 Message-Id: <1519232408-28445-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 16: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: 129106 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp840217ljc; Wed, 21 Feb 2018 09:03:27 -0800 (PST) X-Google-Smtp-Source: AH8x2247JSfz8ZOXln29QYAzbAtQEHI7B9zbcMqFWCY9XN/BQnWvUEScsno/7SFbdkQvNmCTkcLY X-Received: by 10.200.49.108 with SMTP id h41mr5903832qtb.227.1519232607777; Wed, 21 Feb 2018 09:03:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232607; cv=none; d=google.com; s=arc-20160816; b=WBW048RBS2fhPVKY7zzgMa2EyU3+lTJiDT3QzX4Zh9zZn8GUzHSldTKGldOwsWTMZZ aaTMCqNG3yKsy5zBCKrvWYot3wQYTd4axHHGKheiTaBbozEnISDSJno8mN8wolNkB3HT wCZugFWJrg5lLwAtRcxzN7pLz1+gG8+9isHixYvXGtTiMKFAZ4C4qQb2l/GlW7DruMhW gihLbShuDllWbV831HN9rvGRj1MYfpK/hEbp24FoR975Z2rJG6D5/pOowRVVdMZgFgQ/ 4euzziAOHN1fOcilyX+b+J9qkcYgWyyW8Mt/egfpWFL27DtHoDjtzprHEHbbs35ePN8b VNMw== 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=X83oJGoFPAGrslyeqnhhQ1qcqtxtmEyB3Fpy1MfXBwA=; b=mM1ICX7fevVgIxbmx4HrgoF4eyt1eQVRiGF8ASKvUivoo4q5n3mnpxmmmviq4GshcC Urm1SGyPqXOVZ4AQwUJU09SY6Y8yxcYpkSyJjzNh6cwKCR0PTRh02S0GzuhurLfH+5Gz cZfv+FrDTIcZlEgzVdllI4lrKZXmJOkP1NuWJHXiGVIFh0zcz7tUKJ3jbOvPWogseAi1 WXXR30F47oG7peNdgGDFhgwAUrbD9s2E62dgvmzF0x2ffeCC9rPL3RUtOtD/J8JpaTWx SjfQmeVprzV63Y7EKYWPl4n7pyFCirfwr0lkkIrud+eYniN6HA8ycbIONvY7ti3lT40d xSEQ== 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 k64si234865qte.406.2018.02.21.09.03.20; Wed, 21 Feb 2018 09:03:27 -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 5B610617B5; Wed, 21 Feb 2018 17:03:20 +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 5D639609DB; Wed, 21 Feb 2018 17:00:32 +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 49DE86179A; Wed, 21 Feb 2018 17:00:18 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id A665161750 for ; Wed, 21 Feb 2018 17:00:15 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 38E324305C97 for ; Wed, 21 Feb 2018 20:00:14 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id VVBky2h53i-0EmaCvYL; Wed, 21 Feb 2018 20:00:14 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0Du4f2Pw; Wed, 21 Feb 2018 20:00:13 +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 19:59:57 +0300 Message-Id: <1519232408-28445-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 16: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: 129104 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp838223ljc; Wed, 21 Feb 2018 09:01:57 -0800 (PST) X-Google-Smtp-Source: AH8x225JHqtDA6PMzC8+E8JlxRg0skcX5BGt7PCBPI5bTYjh1OoOXGzqDHEN8q6l+BK5aXrf2WJ6 X-Received: by 2002:a25:a126:: with SMTP id z35-v6mr2651659ybh.482.1519232517301; Wed, 21 Feb 2018 09:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232517; cv=none; d=google.com; s=arc-20160816; b=V0DN8rFVU6oYHoH3l/LmuHF+1qgbZrSXQ/edL55T+Pp2jzPO6maRJi1qIaVtfToYX1 SpDlO7IyC1lv+tzba3ay1Lnwc/FcYp2IQsP+htilXC7d/6YPmOgpR1MeRXKJtMoQ6RPR WvpoBgG0ZSh7n/lsRF/hjbvwaoGA/mNIOIfBG7K2ZNMQPOyk25+iaBts4AaT2N2g3jOz CYh8IbUbaqyvukJ0UOVrazum7Ku63OL0cXYMkB54naNN5GYTti0RUXr/KnSCS/uT6xWC U4SO3Y7QM26aMP+ej3YGPuoLJiaLbjoj7w+uvH47A4J5BS45370s11RWnlrEn1ha1O5d BhpQ== 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=fnWOAKeBzll+M8mMJc0DwZQ83y196RdO1e39eBtcI1Q=; b=c5yTu58NUauODoXXRU2bH+29Ad0ojcUK4Yqj3YS9wb54uMzLxlUb4e38oe3SPSv5H7 3wx7TzofKr4wZzTzPib0X9X5g8P4G8FyekU+C0s9dyGN8jjXRYT11Gqf0buYSmjd4wh0 DpOrotrzliwpeh4AzcjYDWJn4T1cIWjVfHPku7pvSFpqqR3bLlIX1I4BCY8je30wgOty 3wW2v9o68xI0TKJTRbo3Ixqv++gJT2sWatl284BncX8JxOsbs5cMNVHSYdhElq5jluee ouG290p4mrE2/Shzt3V6rB1oXsU2BrbWiOQRmshKE/oi2lfi4sN8sXAetavT45E2kijP 7wXg== 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 d7si772254ybk.305.2018.02.21.09.01.56; Wed, 21 Feb 2018 09:01:57 -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 AF84B617E2; Wed, 21 Feb 2018 17:01:56 +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 DF4DD617BE; Wed, 21 Feb 2018 17:00:24 +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 03C5F617AD; Wed, 21 Feb 2018 17:00:18 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id E6CDE61777 for ; Wed, 21 Feb 2018 17:00:15 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward102p.mail.yandex.net (Yandex) with ESMTP id D3ACA4305C9E for ; Wed, 21 Feb 2018 20:00:14 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id ZcsZpztYW0-0EFK66dS; Wed, 21 Feb 2018 20:00:14 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0Eu4p2Ba; Wed, 21 Feb 2018 20:00:14 +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 19:59:58 +0300 Message-Id: <1519232408-28445-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 16: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: 129107 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp840825ljc; Wed, 21 Feb 2018 09:04:02 -0800 (PST) X-Google-Smtp-Source: AH8x227MpD+FWr1LaStH3cYNO0ncfuVjK17tJQ0fQiNPMV0aXY3S1kHN/P3rRdE4i2yZeFSBOQ6a X-Received: by 10.200.56.249 with SMTP id g54mr5879716qtc.245.1519232641924; Wed, 21 Feb 2018 09:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232641; cv=none; d=google.com; s=arc-20160816; b=tG8QJcBAeHmExXSyM3xuFC6Y7evD4pFHTuoZP3x+tscoja7D0IyF+ts5PfxOaRn2w9 wfEr20vfKcO5rA1LLrxlbW8kdzzZpNxnrk4pkqcr4wN9d2ZnqcyVIgFB2Zs+D/qzoGvh O9zOHmsVjYc1NSb1xW6kTA0cwp740QzZuVhtQx/yynXLy6QevEZhe0GDzui/chO605Y7 PSvw7xQxYhrNIa/3Xiuvsl4/7Wnu0V0tkNFZeiCIobpSASGc1HPHQ0ljOCI/2hEu0LNa pURVDT2m5DveaITowTC+sAmT82x/gVv0cvM5QKho6GUReDo+sbYOrmuMNe1i2YzPPPUY j8bw== 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=3mMQn8Bvg9/E05l4BZg5JILJewIZVN+gzoukc9/W1LE=; b=yhMXj+gPu1tyej3TvpPxlCgTmUBrtRvtbwWTl+3T5QUVGP+QDt5pYJ5Ejx8OYOiALL WT+TtblYht2Daaqr/vAKQdwbsRlsGn28PCuaJ77I2dLgOr5BzvTgfMJA7v9fSOnjvjJ4 ulDJ8L/Je3TPsNx2M8PTsjH7PHs42TdskkNoEayXSOhDlUWSVPGQa8ZcP+SuBg9h7dyp lNMN07D/rKPcsgW8q48pyzoJN32Eeczid6BtueTRgicstQS/JsynRnXX1TCBuUKApq1D 64apeV8Nj226fRxZDntQgo6W5maHjnwiTWgBFgq9e4WjcIwOdEYIlm57NuHz8pBXYn8Y AsAA== 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 o3si2044430qtc.7.2018.02.21.09.03.58; Wed, 21 Feb 2018 09:04:01 -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 3387E617B5; Wed, 21 Feb 2018 17:03:58 +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 A3FC461781; Wed, 21 Feb 2018 17:00:34 +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 E01F8617B7; Wed, 21 Feb 2018 17:00:20 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id EFED26179D for ; Wed, 21 Feb 2018 17:00:16 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 945271242BDF for ; Wed, 21 Feb 2018 20:00:15 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rLN1giSveG-0FOefslb; Wed, 21 Feb 2018 20:00:15 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0EuqeUpT; Wed, 21 Feb 2018 20:00:14 +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 19:59:59 +0300 Message-Id: <1519232408-28445-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 17: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: 129110 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp843098ljc; Wed, 21 Feb 2018 09:06:06 -0800 (PST) X-Google-Smtp-Source: AH8x224+DoluQtInpyrRQdDsJcrJ9i2grpPJNXeMcXR9AVUcbrnHMb+7jwgIC/pQ/Jx6Q7gVvHyc X-Received: by 10.200.64.91 with SMTP id j27mr6413780qtl.29.1519232765944; Wed, 21 Feb 2018 09:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232765; cv=none; d=google.com; s=arc-20160816; b=itsh+beQ5Lcm7U0ZdeSMHjp0L0l1ws09gJQZ4KnzTYWntbj7F6VRncvka3X+ZfFB1/ kQoda5lYqvcGgj7GRhBiSyNKVThb7fa23oC0svV43mlJ4zSP6ke+hLYgICC/7Bf+Kf5q piw0lGPi/e0Xd8IPA3nXnbSjT5QvKEPT873Xr21UaPHNnQAtgtXbX3UtCuxfNQ0IdoI5 t9/zwyKCzbZCOKE0U7SgsE6TFGTpwpzIHeEjMzmWSwG8CUOndsAOHDP/GIQnXi+THMLw B3LLMyfXu7/CYDQmgOsDT9i2oRc+aU9S+CAO1lIr8LoTGLhJvqihSg79qonSRpFV0ulQ TqVg== 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=jTkb+dsuluW78vy9RPReAqTeXTtAuU2zpM0QogvTq0c=; b=PSNlCtaiITdqlOmUr2TnPpzCeVmDLlRx3wX1C8UDkTqE2vptqAESAG+TrUGUVyQhwi va6e3OoVMd6DdF5rtrkRFf0kI5YXMcBNqBfKAGE0VPuGSjD4jJx065spjjq/ncmvrvMd sMkSrPwRHfZ13ah/NONQzmAaw0Gj9p9ie9xK0+++SfRtd37FHxEjX/0I/ug2x0RTvGtl KdyP6P/33NWNpQKsITdoAoiOgqksgmC50RzjhBySJJBAhfOsk4dM1BB4DPaEjxL03u7h SgV2PagUr4LBl+rpey2aFSX89KfjFimFNq5Z9OBjmayQLRVnLP/N06ZEb9BRVb8jzQfQ wyNA== 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 95si1861864qkx.203.2018.02.21.09.06.05; Wed, 21 Feb 2018 09:06: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 8924661705; Wed, 21 Feb 2018 17:06: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 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 74B81617D3; Wed, 21 Feb 2018 17:00:43 +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 8FB4A617C4; Wed, 21 Feb 2018 17:00:25 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 13864617A3 for ; Wed, 21 Feb 2018 17:00:17 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 08C984305C1D for ; Wed, 21 Feb 2018 20:00:16 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id OqZ7iLmxIe-0FMeXosY; Wed, 21 Feb 2018 20:00:15 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0FuGiieq; Wed, 21 Feb 2018 20:00:15 +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:00:00 +0300 Message-Id: <1519232408-28445-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 17: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: 129111 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp843926ljc; Wed, 21 Feb 2018 09:06:51 -0800 (PST) X-Google-Smtp-Source: AH8x225fH+QgE9ZU3N4ndtmsjy/cNdjng9ARU1NtMxTSPwoK+6kOXUg3q1eZmS2ESHyQ+k6bmXUa X-Received: by 10.55.132.67 with SMTP id g64mr6382911qkd.28.1519232811508; Wed, 21 Feb 2018 09:06:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232811; cv=none; d=google.com; s=arc-20160816; b=EAY22L8Diwl8XsyEQs+2gswYGfpje5nc4At3AsXAgNs4jq4oCkuHhsnSTdDlmWYfLc UOirL1bizhKp4iiwDWi5U7drvBPZDUQKBJoEIGGCusIN9qj4+OXBcb68+8UmfY4LDu5L mbewIwQayBXHh6g8TDT5yHq6eEL/SxbLdxwDmKPevGb6rbYDcq7wgdUK7WADsTXYvmTi 3Hyl3vsnqsVxjYDvmt2wE++yhv5QudOKL3jiYjoLx/3+RQSWnanviXyF7Nlrv0UVc9cY SMLC29bD+jSBSKvOpYh/CL4A97tuI+qwgS1GArotFCskckM8y7p/saguc0/mUy4isMKC TiCQ== 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=Adq3SdsExE+R8GCg8lCwgGLvSwToxX4DNMpOHjhTwtQ=; b=W0mKSGwxdot756spuJcOHbkPA3ti6mpnE7QmwUj/D7z5r99dW+2Ywua3p8p6ukqINC HGU7QIcK+DsApayUjIaDEcvQg3poN3UzOsAMimSw70C8M6RR5KkL0wh3maRzGraqCFQq SxISM75h9QINsdwQ18osu6x1tpotdXJds3bU17W7uDGfeEy2FuIWPiAPcqalasWZUt0y l2Qu7YDqT/fAzkd0oZiiMZ1xt/Xfa6SWtT83+lBWHlirT18wE7D3fGwVRltEUFjQY5wA EW+KOJE6CPJL3zQa9L9jWqicFLHC2QfYoEYxL+3iF9PODI4XorYuVVuhRMcHzQWXXJh8 byiQ== 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 27si3099982qkz.45.2018.02.21.09.06.51; Wed, 21 Feb 2018 09:06:51 -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 1D35F6171F; Wed, 21 Feb 2018 17:06:51 +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 C2410617D2; Wed, 21 Feb 2018 17:00:50 +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 77F5360865; Wed, 21 Feb 2018 17:00:29 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id EBE9D617A9 for ; Wed, 21 Feb 2018 17:00:17 +0000 (UTC) Received: from mxback7j.mail.yandex.net (mxback7j.mail.yandex.net [IPv6:2a02:6b8:0:1619::110]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 8DA8478224C for ; Wed, 21 Feb 2018 20:00:16 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback7j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dPWo4Dg1c0-0GpSnxFp; Wed, 21 Feb 2018 20:00:16 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0GuGdAiZ; Wed, 21 Feb 2018 20:00:16 +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:00:01 +0300 Message-Id: <1519232408-28445-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 17: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: 129109 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp842153ljc; Wed, 21 Feb 2018 09:05:17 -0800 (PST) X-Google-Smtp-Source: AH8x226F/C0hSne+RRNf17JEPPETxPF3drqc3Z9NH9sPlnBEgbHn3rlQHISt6HnmGMgkcHt0gL0s X-Received: by 10.237.53.98 with SMTP id b31mr6536964qte.230.1519232717846; Wed, 21 Feb 2018 09:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232717; cv=none; d=google.com; s=arc-20160816; b=1J+RXRWVCI/fgSzSP1U9esWvSVFCckbyFf3zofk+BoGNdYeX2+A3jSDDKD2kzT+cLD oVBisr/5a55XlGx6NVbWCknloYS1+wlRlLZ0SqRP/V3G82foZK3heQ4gLTvqsLRNKhRl FlkQc/0Vbrg4aXMCIOzJPhgGVz4srCMvkojaG4ylG/GzSPP8eQq2WCYWR+8F3767YJpK 8wy6elyNLpy801KCeBqW7paEa5HSa9qW6BUuh7wFq5xeRiOS2BZ9GUOg6a3JeDBiG4pu Etz39Ts5w6IwvFVXuA2jhfKoJsxag9La8wtKVV7o5A59duN8kYo/PkQTtpMebBON3aQh p6zA== 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=ZStB8cee2VsQi4zZeJhDh/T3cihhy78GLz/MFhmefAs=; b=dt44bDRUcXC7FGfXl4UxPRvBz8sGqSIebJtXVJCEW/upbP92oho5S3ajEFU1W4w4n4 LCLWrzIo/2A6vPlUCBBBeGoADYiJC4IEWUXf5GJd0tcCWDDmOfOIxeeBLw6crHEqGVsT sD6yCseFrhe7MaBj/VxiB1PUI45DzquxNx3FI2tvQVNlVZxIbx/MPn5RVHVElhhCoJVC fOOPwicnBdVw/dreSrzOJ3dop4qXV6Tt7lzduA3HdTo3iJ0wYDed+vQBieecVaxKsI22 BRkQIfDDIVMtjlJvdOP6k0VsMvV2eUgqo+SWAdvgbrsq362ZmgYXgyBjGkHv7QtbGYZZ lW4w== 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 128si228387qkl.47.2018.02.21.09.05.17; Wed, 21 Feb 2018 09:05: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 758CA617A9; Wed, 21 Feb 2018 17:05: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 3EF78617B1; Wed, 21 Feb 2018 17:00:41 +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 21B53617BF; Wed, 21 Feb 2018 17:00:23 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id CDED861750 for ; Wed, 21 Feb 2018 17:00:18 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 5C0431345676 for ; Wed, 21 Feb 2018 20:00:17 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9H72Uel4dq-0HkK3Q5Z; Wed, 21 Feb 2018 20:00:17 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0GuG0Zh9; Wed, 21 Feb 2018 20:00:16 +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:00:02 +0300 Message-Id: <1519232408-28445-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 17: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: 129117 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp850958ljc; Wed, 21 Feb 2018 09:13:29 -0800 (PST) X-Google-Smtp-Source: AH8x225GAUZiqmLuDJO0GXES+gf+CslKLcSNXmd0Wm/a9g3No4s8ZeI0CESK7E4fwLeSW48uWknQ X-Received: by 2002:a25:b326:: with SMTP id l38-v6mr2852892ybj.142.1519233209694; Wed, 21 Feb 2018 09:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519233209; cv=none; d=google.com; s=arc-20160816; b=NDgcZxb64HWUH0fZbRSCR+chAW37gsW5PLLA/NKPS1FcXZyCUJ3710NM0Hx8pxgbed 7ka+HWRZ+FsJDa+Ahg8rFbqBQWbr+l/dG4nRkCc85BGxWz7/gqtBphowXShhz4rzOX17 wx9nSlRhFcHOY6WAspWgH3Lk96xtcoFb/c8/anJ8DSZEkHEQ4o8IpIErSnGrKBrVuLWu pp3MQmyDGYv1heNidA4MSGbTneq+iQq8CkbAF85usxVr9A4O7MN7oIxhDXxGV8qx0Ek6 s6/VtMHZz6yk8yRKxerBH3n6OPnrlVGbCl6qZRoJhayrXbWFi2s81Nu9FDW9PzWpuSLs IEDA== 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=JKEOHFNDywJyT1E4Qg/SrrgJku0BW0DbuPgYEBsgIyU=; b=AAWmlp45CZ8Q6r8oOEZH3IZaL6M+fOyrWWqodamnFno+ZZfEPSAVpDIznWyoQsfc/c 9qPEsJUiDAn0dX9QLarmyOniZodubpvSXYtIVrMowDqQ0rDB+w7oJrN7YJU1YZT+HABr 5xoTKlmVgDLoDoA3Fisxlzw3/eQ1K9rHHPutDbwjQOPd/5oNq8a67bp3F82NNWy3qRFG PpuLMIn49DBRrtiKohWXX0VSBg3MOOxq7bkKNS/BRIbPQbkXA2NxC6y5ql7LRNityeOz GidcpmRuHp7hcTabWa+Vx8H5plY6lnEt5eA0mnj1Ix+x3JvDiBazScq0S/t0Qk9nRpsF 1oCQ== 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 a23si2244495qtn.37.2018.02.21.09.13.29; Wed, 21 Feb 2018 09:13: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 0A6D261756; Wed, 21 Feb 2018 17:13:29 +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 EF067608EF; Wed, 21 Feb 2018 17:02:03 +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 4C7A061801; Wed, 21 Feb 2018 17:01:58 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id BE35A6013C for ; Wed, 21 Feb 2018 17:00:29 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward103o.mail.yandex.net (Yandex) with ESMTP id D0B3C5882DE5 for ; Wed, 21 Feb 2018 20:00:17 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id soCD1rcZiI-0H9SlD3h; Wed, 21 Feb 2018 20:00:17 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0Hu4b6Mo; Wed, 21 Feb 2018 20:00:17 +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:00:03 +0300 Message-Id: <1519232408-28445-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 17: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: 129112 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp844765ljc; Wed, 21 Feb 2018 09:07:39 -0800 (PST) X-Google-Smtp-Source: AH8x2268RkeKmxQLOVL4yJqUNAxFW4YTmBnU5n994trzEiMe5pWyOohPXt2PDe+rLqXK0odaWhnc X-Received: by 10.237.61.145 with SMTP id i17mr3964076qtf.293.1519232859189; Wed, 21 Feb 2018 09:07:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232859; cv=none; d=google.com; s=arc-20160816; b=JKvfN3iq00V+72SyMn2wuFMchuvDWEuPIyL622Mza+HNdr1IfwWKL73sOWEiHYJbRL lccfg7ZqtDLLydWl62bINc/qTRwj0KTWiGowe9JfsV57NMAJ8kZwN/B+3l7DytEBXrbZ a2Y3BsY2XkdkU1hME6XHeKtr23z8YZqVjbAVoS5nIwT/+fqIBN8hlwNTTLTsM2pEdA5x a5Tev+KVleiRMoHLViSXpNdLMVFCHodRj0aOfefJin0DN0uIJ5fvSQEP8BpzekOsQthH ceFVB1AZcbXju1+W6Vpr+ihZdjbHm9KWWxY0/FOrtu4js9XI8CL18rTDYmGrf07H6dYN pRMw== 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=Kn0BSbcurxJxEFhuuE0841eaB8UEzk0JBX/4rOZ4B8c=; b=ths5BiRUXKpjxQIXJXgVUawe2Kvg1764zSBoMemqUxow+Sxb/dg5QvPxcfkH+Z0uoL 2xgfdnBxU2dDPCVgWOuJiKgvU0J0BGldhOvUCuRZCV4NjTB8OPyEXwe0n7IDjBMvVop9 ppMjqsTkl/iChf6FYh4422J6/mxwcPkNiE/kO2bHtgxCE0jGfMKDyRrbCVOejXSLiwHa FDIEcnaN7bj/i6EUYJKetwgkYBx3roG3Zfd4d6pGScPYdGd/yqttPK3Tw4JcEiVGY6DL CN0APKS7PYgB+8MIQ/ryJsxLzrAHwu70CVdZfR0YQc1+mF4XhswaszvrTwBzqINSU2VN XTqA== 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 i66si1877410qkc.376.2018.02.21.09.07.38; Wed, 21 Feb 2018 09:07:39 -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 B459D61756; Wed, 21 Feb 2018 17:07:38 +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 302F2617D1; Wed, 21 Feb 2018 17:01:02 +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 369AF617C6; Wed, 21 Feb 2018 17:00:37 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id F15EF61777 for ; Wed, 21 Feb 2018 17:00:19 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward104o.mail.yandex.net (Yandex) with ESMTP id A785870424D for ; Wed, 21 Feb 2018 20:00:18 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id e0lQHaqTTu-0IJaK3Xv; Wed, 21 Feb 2018 20:00:18 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0HuSJ529; Wed, 21 Feb 2018 20:00:17 +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:00:04 +0300 Message-Id: <1519232408-28445-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 17: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: 129114 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp848389ljc; Wed, 21 Feb 2018 09:11:10 -0800 (PST) X-Google-Smtp-Source: AG47ELt1P+fU6XhFemsuCsrVpGgEuuirXZA+hmQ1njWW6xlccEEBP5YmNNU2nNLyV3zhAF15jbQB X-Received: by 10.55.214.138 with SMTP id p10mr6088509qkl.188.1519233070564; Wed, 21 Feb 2018 09:11:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519233070; cv=none; d=google.com; s=arc-20160816; b=nj+xeCJFLTJ6H5GVyZ7i5XYrc18c1KVPxpAss4K9UEmRMdwc7s6v9bqotd7WTdZ7re jLE7kmNEk47qQxBZ82JjvWAGk3/YUnB2MNL74qwJahG5yrVXEa3DB3oY6zAINtGbhAHf ttKAOZF2F0NoBdSZ8wuya7OCZOG7v+E7YmrnCGxZQxAIIbd4RBdeki2Q+oOo1FQwAqFt FUVt2k0VEd6526cUswPP9rJoVnFHkXv3Ife36pBsNGaZE7u+kZ4Od84frsW5E8bDBU/M KS/R4bj5f+UEFnq7CjpiM1L0jIzxpgBfrj90VL5MxL6Kwl2P3Dz+nhgGe6aWxZTafy3H NZ8g== 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=ZKMUJFCvyQN4zWFd0VLtFcAspGKGL70qHxrCVcH4cJY=; b=afjn8czqGhVESlRwWm8e99pTCiP1Y+uK6ebDTJwfF0nRuckI/WH8N9DAUiHIVEvPX3 b2EUh/SCdkEXF33cPgs64FTKKyiJo7WM/96dlmlN2AmCaT/HIzlCptG8oYEfJFKiTUS2 NLl9ZEKmrhnjiz1a9NeiOCqnffiA04ZOjp8EL8KRaxG9ZobS118dMFjtstPKhzcGMGGw HkqLgrSv4xOJF3CqEH4lds6g+tYi4cWALj15GHaqE6rylgkFxNChe7MAibo0WAEbLLEA jgLXg8ssY3dIfLjG6Xgg6H11lpmUQIvUow0xFkIbbZ16QnF0N8q4R12OJ/ApEehHMH3o fwWw== 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 q63si2569339qki.5.2018.02.21.09.11.10; Wed, 21 Feb 2018 09:11: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 421BF60920; Wed, 21 Feb 2018 17:11: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 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 7A561617C5; Wed, 21 Feb 2018 17:01:25 +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 DBB85617B4; Wed, 21 Feb 2018 17:01:13 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 8C1FD617B2 for ; Wed, 21 Feb 2018 17:00:20 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 21DE05104386 for ; Wed, 21 Feb 2018 20:00:19 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id BbWCoSlaWE-0JmuI1Zr; Wed, 21 Feb 2018 20:00:19 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0IuGvp1t; Wed, 21 Feb 2018 20:00: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 20:00:05 +0300 Message-Id: <1519232408-28445-13-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ .../linux-generic/include/odp_ipsec_internal.h | 9 ++---- platform/linux-generic/odp_ipsec.c | 36 +++++++++++++--------- platform/linux-generic/odp_ipsec_sad.c | 20 ++++++++---- 3 files changed, 38 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..63c3bb49e 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,13 @@ 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 17: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: 129113 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp847576ljc; Wed, 21 Feb 2018 09:10:26 -0800 (PST) X-Google-Smtp-Source: AH8x2275OJao1PScbzU9BGZoV0jKQFMvJ1obMXWa353lD6L5S6G7EPms6OtOimlIA0HHiMZM3BXq X-Received: by 10.55.204.71 with SMTP id r68mr6256220qki.356.1519233026216; Wed, 21 Feb 2018 09:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519233026; cv=none; d=google.com; s=arc-20160816; b=za165G2ARVJCIVNlAmJg+uaH4ReiFFG3Is12Hu6uSlzGFkQBbYtsX6w9NJAPzc6zOP eubSO4SlE/bCM7zNkzn2o+pHk854J8yBk7EKgKbYZR9gjPVwnsf2nyt9ZMHj7+qjYnBe BJ6/IENOLgWCVqmX6tIFrLn0QCK50N51c7WhDmVdwPyu5cx0yhlxkrKfGvx0ceZ5cB6l nUrF4y1QqTZrQ3XBGnm35s6LlScnpYfU1Pq1sJutBCx7JdgOcpLf+Z4Pr/RX8/JVVsy6 2G/3NJUERgZsqqW0pn0I8Zvpc8eH0BeFFVuoEQ0KokR7j18p+CAgz6K0JRzdVtERpCTq PNfw== 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=N6awqiymuP3TLWyhEmzaKsCNWAXDQQact5gr/ttG96M=; b=MKuXG+gvwNOerqHCw8o+ikPiGyle57RcUiMky4gJnmkQQwhfy5JDAccn3CaZrqsEcN mQ4gBXYCqOpn2jCjpzIcWrSxz52OTzlZLNiAcaOGx47VyPgp4iMnMR7FPWEUC4vBhuuI NHfD4qL1CSorZMyqwCZAZmXwO2m6MAO1pmvG32Glo58zULb0h5/Ar/Sh3GI91DeChywD xcuj0jDwtQrKqXxu9jyJlBIhuqZoTKojg0lxjwt+noBEZZ7cMqTIj4L2Y90/suNMQTjK OFB58nw82yyvUYh9U/hXwqK9LMU1SZ76cYGCLFfU3kpPkv4PKCe9kiZ/teStTsia0ono Ev9A== 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 o64si8841874qkl.56.2018.02.21.09.10.25; Wed, 21 Feb 2018 09: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 C669B617CA; Wed, 21 Feb 2018 17: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 21871617E3; Wed, 21 Feb 2018 17:01:21 +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 2E1D0617B4; Wed, 21 Feb 2018 17:01:09 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id BA10F617B4 for ; Wed, 21 Feb 2018 17:00:20 +0000 (UTC) Received: from mxback3o.mail.yandex.net (mxback3o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1d]) by forward101o.mail.yandex.net (Yandex) with ESMTP id B25791345676 for ; Wed, 21 Feb 2018 20:00:19 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id f0kdb16ekG-0JFiWoeI; Wed, 21 Feb 2018 20:00:19 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0JuSw76i; Wed, 21 Feb 2018 20:00:19 +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:00:06 +0300 Message-Id: <1519232408-28445-14-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 63c3bb49e..c0b9cd2a7 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); @@ -1383,7 +1387,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 17: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: 129115 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp849292ljc; Wed, 21 Feb 2018 09:12:02 -0800 (PST) X-Google-Smtp-Source: AH8x2269LUnbguvZqqNA2L11lBsdeBaKQ9zOEIsrtsHUw/8kc9zv1+b7ASoxzVTIIKMFsWb79HGV X-Received: by 10.55.54.73 with SMTP id d70mr6355697qka.260.1519233121873; Wed, 21 Feb 2018 09:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519233121; cv=none; d=google.com; s=arc-20160816; b=WLFWSpfCY3l+r+ltnMBGdBm26GBmEnk3H0MMhO+JEL8/rqfWH22H0AJAh9iByMlBRd KZ13t7urPRwbhnN6GHoiwxrv484Nl+CcFLF9NkJ8xVs+50M/guwa6I4mwhDw5Q8D8ANF exL7wDchcL7LB8cfKAZXnu/GOyCjzjk8SV7DgX40/jXPOFiiiSM5qX6zoM7x0OgFDnnp xjudg9IXMopWBlPygSk9E3DV2w4rkoLhl117OwA+96vkr1PWeNN100GQtJ561/wkUNFN +kG3i4pVjNnyE857sRPlvEEgL34gOMqxCR5ZVv6NjN+iGKHRTMZVfnRDuaGrFaRs2Itc vuIQ== 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=RvsuTi9VetJ5I2Pbi+gEBZc/7x8g/7annaks9X/m51Q=; b=KXzEG8jz5f/eOOi5Pw5kPOvrJEJ1ue2fWgYY3M1j3gcF1NwSlok3tYCBugWywm3xCt LfpkoddcWfSkfWmZTp/aGM19Pwg5AdGmq7wNqibr9gYc6DdyFU78ok1FwVq4gkCSUu72 9A9BREgaMYlHLQiwCunqoNNspNnFt2AbZTJ+JoFS4vfJfJbSakaO2PZrEEw4ldQauEit gauIqx/AqLs5uacjALYwHRfCGOJHTaQfGwW9W4g64ORTmgpplriIcr/CORs6LtnViuAf pHRGpAF2oCwkstbpKf0hExNjB1xURwhWrjM/H47LpubK782XBcIMcvIdqHCA7yvw4brH BRSA== 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 f94si168593qtb.284.2018.02.21.09.12.01; Wed, 21 Feb 2018 09:12:01 -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 82AB76107F; Wed, 21 Feb 2018 17:12:01 +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 E2548617F7; Wed, 21 Feb 2018 17:01:31 +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 6EFD5617B2; Wed, 21 Feb 2018 17:01:15 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 684716179D for ; Wed, 21 Feb 2018 17:00:21 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 5920A134566A for ; Wed, 21 Feb 2018 20:00:20 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id EMUNrFVGAW-0KG4F2KB; Wed, 21 Feb 2018 20:00:20 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0JueJPb4; Wed, 21 Feb 2018 20:00:19 +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:00:07 +0300 Message-Id: <1519232408-28445-15-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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 c0b9cd2a7..a9680ba0e 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 17: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: 129116 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp849949ljc; Wed, 21 Feb 2018 09:12:39 -0800 (PST) X-Google-Smtp-Source: AG47ELsYBjffk4UO3TdGN/xADuvd6eswGWDbWMvf3PQqgfvPwuvnpJvmexbMkoBK753/XUln+KBx X-Received: by 10.55.148.69 with SMTP id w66mr6062978qkd.179.1519233159290; Wed, 21 Feb 2018 09:12:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519233159; cv=none; d=google.com; s=arc-20160816; b=C4C5WwacD41jqOrwKiiU5XmU44/LMQ5lc7cbXIMkirQU5M7kLo2g3rEESHDqJy5quR ZL5U4mNidF6k8QC8vB6YiQZ/bY6SdEzlu4OVzRZ53qMzVIRlTvnlVvcFw7QEsIgVarhM RfLdUHIn4VtKCM61UYtzZRYHBdjtKglcoCfz/Emf6RclvF6HrUKnqtLpkyXUQ8o+jn9Y 2YB5S5Pxeu1OuuZfgvXHY7gbqmjeiKxevGw25FHCYyzsWBM7Bcd7mJNEh63j5ALPWKvA DCTx2CbZrPVXQE9pfW04VLOPXe2MwHQgdJKY3GEPJBxS12CMpdiNXFdBFS7CyWG0kux0 oRsA== 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=CTE5drRJKExKgACRs9LxNKEtUWb6F7u3RDPpDPGB1jk=; b=WwgYK/47X0SY1Eapxc9xthUV++zvxUYK1Lclla7prWKirfzi8KL2+j67lbtK7IKuOW mF5uYQy/HeW/xjwYQ+hQ57wd5VglCV8jz0+yaJHSg+387iljymq9IAOmz0ZdLie4GNJa OV9Tg/WcDsl9DEo8OtW+eGvi5TC3bsMcw93WftJyyUDX00bRYbGYj6kM0i4jEMYmnR1x ujNwrYO9fPNCT8XizTU1tAlFnqVPIVBgWMuuUs6/0MbLG6klaMSqjf+oHIwvRYHOkqrf rBzS0ssHIHwQZZ1NhuWA0xQSYPBszAspgg392NNrWe85y9YjUXzONIEX/95V26lFaUdz sdCA== 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 d54si2366004qtk.21.2018.02.21.09.12.39; Wed, 21 Feb 2018 09:12:39 -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 F1BC861777; Wed, 21 Feb 2018 17:12:38 +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 644CF61803; Wed, 21 Feb 2018 17:01:36 +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 9951E617E3; Wed, 21 Feb 2018 17:01:17 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 19171617B5 for ; Wed, 21 Feb 2018 17:00:22 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 10614510434D for ; Wed, 21 Feb 2018 20:00:21 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id lQMOFAD8M6-0L9GBqNa; Wed, 21 Feb 2018 20:00:21 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0KueGlZi; Wed, 21 Feb 2018 20:00:20 +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:00:08 +0300 Message-Id: <1519232408-28445-16-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 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: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ 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, };