From patchwork Tue Nov 28 12:00:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 119844 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1625205qgn; Tue, 28 Nov 2017 04:16:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMbbzum33L2LwlYcsl/ugttCLFCOheyjWH8X9YXaC5qbjeMOwR3Ae+zQcnudA16rdx+edg4q X-Received: by 10.202.46.69 with SMTP id u66mr18758177oiu.253.1511871361650; Tue, 28 Nov 2017 04:16:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511871361; cv=none; d=google.com; s=arc-20160816; b=LKKfkE81LCzZMDFyEiaVYQOoo8il1P5letemR4GtJ1YbvR6hOkm20xN77pYjIW364m tlqeKN+na79aiR1yeXpzblTuKWaXxwBZB6WLC5Tg/E+Bw1L1DJfCkRPMSMeMP0j0iOFM W3L0B0WFrOoMiAW/QwD8iw9kKHyfp7k9Xf1QcEOXnn+AltI39HSjIfVc8r6B72jN8XJl 4L6v/qqa3mmJr5BgMv1dispBxjKtIYOL9jMsFKUWsH3TEPZlu5rSxjtv+rdYKUVW1X5f nS9r0q0jO82TDHivgQDzCCS9oWH7MmwZmdruFeU+G+rHMg6n6mMildZQHjpt+z2Z4oo8 wtww== 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=7zB35jR0KuVNSd4J3I21rhlB5TWLdsOqzhDM2lPvDho=; b=saNw0QG/NvuuX+x/RxqONEzGYJQeMSS9BSHi2hEXTdjGY5BCFBVucq36SxJUjm/03k QHrX86OC6MQPSVflkRUvk+RNdebZSzXuEpBna1mg+8Bxb4L4dED9o0DxuuMiAgOEr8t2 7ziYCxZvtqjWl0PXj8euX1bzKcTXLeBJEKfl1OJ+roM6lc8pt9rSQL+oqXdKM2/NTcCl kJj8tLEr6pH2hVauT7+6vYFx0Wxn/eAEIh2f6VQcbN/idDLA+CYBn9EMz+c3rpPIKR06 em6OOIsFR+hKOsJqJLCFlEPIXMTT8CIeipS/eyu4L921c3tXFsbalJSbAFiitzp6BmzB AGKA== 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 f55si10934795ote.313.2017.11.28.04.16.01; Tue, 28 Nov 2017 04:16: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 E524760933; Tue, 28 Nov 2017 12:16:00 +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 1BB0E608E7; Tue, 28 Nov 2017 12:02:15 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C3DA260966; Tue, 28 Nov 2017 12:02:10 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 8DF58608ED for ; Tue, 28 Nov 2017 12:00:28 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 6F0D6134716F for ; Tue, 28 Nov 2017 15:00:27 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id P7DCdZmih5-0R14ICIk; Tue, 28 Nov 2017 15:00:27 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id FgUJjre9uY-0QeakXf2; Tue, 28 Nov 2017 15:00:26 +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: Tue, 28 Nov 2017 15:00:10 +0300 Message-Id: <1511870411-24507-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511870411-24507-1-git-send-email-odpbot@yandex.ru> References: <1511870411-24507-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v5 10/11] linux-gen: packet: add flag for UDP-encapsulated IPsec 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 304 (lumag:ipsec-ipv6-2) ** https://github.com/Linaro/odp/pull/304 ** Patch: https://github.com/Linaro/odp/pull/304.patch ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905 ** Merge commit sha: 38498451ec522810c4433d56c78af6c4be05a7c7 **/ platform/linux-generic/include/odp/api/plat/packet_types.h | 1 + platform/linux-generic/odp_ipsec.c | 2 +- platform/linux-generic/odp_packet.c | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index 82fc66e53..128e83148 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -151,6 +151,7 @@ typedef union { uint64_t l3_chksum_done:1; /**< L3 checksum validation done */ uint64_t l4_chksum_done:1; /**< L4 checksum validation done */ + uint64_t ipsec_udp:1; /**< UDP-encapsulated IPsec packet */ }; } _odp_packet_input_flags_t; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 0dffd98cf..31b5e687e 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -472,7 +472,7 @@ static int ipsec_in_esp_post(odp_packet_t pkt, ipsec_padding, esptrl.pad_len) != 0) return -1; - if (udp_encap) { + if (_ODP_IPPROTO_UDP == state->ip_next_hdr) { state->ip_hdr_len -= _ODP_UDPHDR_LEN; state->in.hdr_len += _ODP_UDPHDR_LEN; } diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bdcb482fa..167f8cbc6 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2141,6 +2141,17 @@ static inline void parse_udp(packet_parser_t *prs, if (odp_unlikely(udplen < sizeof(_odp_udphdr_t))) prs->error_flags.udp_err = 1; + if (odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port && + udplen > 4) { + uint32_t val; + + memcpy(&val, udp + 1, 4); + if (val != 0) { + prs->input_flags.ipsec = 1; + prs->input_flags.ipsec_udp = 1; + } + } + if (offset) *offset += sizeof(_odp_udphdr_t); *parseptr += sizeof(_odp_udphdr_t);