From patchwork Thu Nov 30 12:00:15 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: 120161 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp593284qgn; Thu, 30 Nov 2017 04:19:49 -0800 (PST) X-Google-Smtp-Source: AGs4zMYxpdPIDd4+vZn150tgGl5jn51JZUjL2QHzKqQieeNATSw7R7Yo0Q9CF7kY+vfJ4hD18NKU X-Received: by 10.55.201.155 with SMTP id m27mr2249746qkl.299.1512044389075; Thu, 30 Nov 2017 04:19:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512044389; cv=none; d=google.com; s=arc-20160816; b=Em/r/6lLiKFUTVnz3AuefgsC67L3+CPlbtoSZEqLfved5xFBhQr2GH8AhujiNSY2CT 3pZFhvxIqRIgE5XrcsWkcugdCPeKnosqCr/gdJUK1IyJ2BPgVM8Jb7PX83izJdXiw3u3 aYcZK2Uyt3nGuwh3SjG5TT1UF962vth0/z+rc3TZkvY1cii64bo+z+Tl109VmNvawfnO Iu1kRX/DQcHhHL6MFszTkjnPp7zUo/R8MSJ7PR7AIOKUKuLQqbWRwcXC88bz81yGu0A3 7wBywt6kyNaPHBz9q9/9SRWPp5aN8jLepey5zHyUB62iegpxGItoMdzXXVhmZ0Pt9BVw vGjg== 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=QZUyr/HSgAXtXmWHoVu35X5Ufbgk/X9+ne1NfLkcMCk=; b=O4k3dsCGsMLyxoiOL7ROD7wLaIbsPfcDeBS/DqvEy2C4rt+NngX8KTYXdPW2PAZg/6 6+S9XzkWlaQi3Ofz6VGNySO8U/tn55PDjFcTROvnu0WQ9fqTxE1BBsYvMUFucSGzV2Ll 3k83xz/3frjj72Mr7bQTrxMhe08CH5NZmYBKRqSNjtBYUWZ+hasrYQ2mCtDaemmunwF4 81evSRcwI1P6pkiDT4ALMqsbZieaye7631XjkcIPZYnSKNG4CxmJHc6uqZ/NSkFLszGA w1+fEAUaV9PgqB/QAPG8m420dI1Fd+I5wFFvHXUojDU+FWPxufXV0XaZuqljhZ5clqBQ t4aw== 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 i79si4293998qkh.199.2017.11.30.04.19.48; Thu, 30 Nov 2017 04:19:49 -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 88D21609A5; Thu, 30 Nov 2017 12:19:48 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED 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 04BD2609C4; Thu, 30 Nov 2017 12:03:37 +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 4D8226090A; Thu, 30 Nov 2017 12:02:32 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id D7BEB60973 for ; Thu, 30 Nov 2017 12:00:45 +0000 (UTC) Received: from mxback3j.mail.yandex.net (mxback3j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10c]) by forward104p.mail.yandex.net (Yandex) with ESMTP id AF6F71869D1 for ; Thu, 30 Nov 2017 15:00:44 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback3j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dvRkaMKuGq-0i14XPVT; Thu, 30 Nov 2017 15:00:44 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LFgKy9hcr4-0h24rgeg; Thu, 30 Nov 2017 15:00:44 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 30 Nov 2017 15:00:15 +0300 Message-Id: <1512043220-8803-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512043220-8803-1-git-send-email-odpbot@yandex.ru> References: <1512043220-8803-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v7 10/15] 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: 32adfc64ec5b4cc2948ab55456aeba75ae6816ff **/ 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 2f4c69924..8bf4ced4c 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);