From patchwork Fri Dec 1 00:00:14 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: 120294 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp469961qgn; Thu, 30 Nov 2017 16:17:53 -0800 (PST) X-Google-Smtp-Source: AGs4zMYAZS2TpGBduT263nZ8d/xgjlCactCVS2CEtwPKUDztTf1EkVtcGJ+hcbTPV29nxAXUPn5w X-Received: by 10.237.35.207 with SMTP id k15mr6528018qtc.95.1512087473298; Thu, 30 Nov 2017 16:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512087473; cv=none; d=google.com; s=arc-20160816; b=uN1yTFUcCDzLeMFee539EvP2W7jx4FN9EHjSjosD4y2w1UXvT5Sch9AOCU/NsWGN4N ElN8crLnZcVWnfZLqAxfwNgI8Lvebcqd2aDOFFRJ7O2C/s2vhPhvBqIjJYcV2JIi9Wfp 4nzZTJWPxK3Ly4Lcn2X+ilXSsd0KFwWPFyt2mSWBJcQqOPE81f2YfbXqifWWtKZzYjHL ChBdqPlKpQiBW1XdRSblXzD3sbQ6tGTvA0cpeqH0cCpK/uWCRNvBta/IRnDKVZ6vJP0E XMkWz45vpAzTbCEPR/HkkQwlH6gBGjqQAUq5GSqYm1LpjOIO+PsczpadabKJ1WT9SKei RnIw== 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=uY3X2qp8hkNTC6OnEewLpYIIzb8s+a9pUgGKE8UIaBM=; b=dZoDYVg5EpuXyrFPWCueJeLPY6jhlZ12unVIoI6wD77xZONUBsd/AT0KiSG5K4/0ql XQ7ikInZVuJNEiSBxWlDGK2tlyBWxPOQIgmG6Ojf/tv/jBpbx1dKeQkge6YUzMyXIB1X aYUk23R3GIVPemaBFzp9o0COxQL0hqYFutzkzTREbYvuZ39PbXqfn8UNpMcahTVS/I0y HBShZ72yyzrUM/xh+4F8FjRwycD6SNK2/hY75w2Mvix80ZZ6TUzQIZ+a0/JlrR+z6Zij XNnn9HkGO8dfx3jtDzOpbobj1TvWuaioshFG0YaeCVRjHl73u2HQO+hzrAo1+XFuHgSW iCYQ== 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 z7si5624860qta.265.2017.11.30.16.17.53; Thu, 30 Nov 2017 16:17:53 -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 D987560977; Fri, 1 Dec 2017 00:17:52 +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 43629609C6; Fri, 1 Dec 2017 00:03: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 4420F60958; Fri, 1 Dec 2017 00:02:57 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 378B560988 for ; Fri, 1 Dec 2017 00:00:31 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward101p.mail.yandex.net (Yandex) with ESMTP id C05936A86FC8 for ; Fri, 1 Dec 2017 03:00:29 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bDXaBdpNNL-0TgWHwk2; Fri, 01 Dec 2017 03:00:29 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id aHHHtahweJ-0THO2rKN; Fri, 01 Dec 2017 03:00:29 +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: Fri, 1 Dec 2017 03:00:14 +0300 Message-Id: <1512086419-25786-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512086419-25786-1-git-send-email-odpbot@yandex.ru> References: <1512086419-25786-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v9 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: bdb7cbf620ada8682c89b5ae5a97cb84f16c0ed0 ** Merge commit sha: f0a7b395adeff8e67fc86f5ee4ed6edfbe3fabaf **/ 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 20031bddc..3c539b515 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);