From patchwork Tue Dec 12 23:00:26 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: 121682 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4752660qgn; Tue, 12 Dec 2017 15:22:07 -0800 (PST) X-Google-Smtp-Source: ACJfBot/g+HFn7zpFTn/2yoT2eMS565GpkNzyzlqAbrISCbOQWc8wmZiyGJAjyDPV1JRvd2dzEz/ X-Received: by 10.55.16.162 with SMTP id 34mr8236234qkq.78.1513120927636; Tue, 12 Dec 2017 15:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513120927; cv=none; d=google.com; s=arc-20160816; b=NFCqqaB9rYmbdBdu8u9PBT15WjGI8g7G7ro2wePoIaLHs4tcgY7GGqCBrEpSaYckEa g/Ui3ogeZ/F9qhS4xcm+OtV2nZIJMujCHxlZfv1VKZUfkr8izHd+0VuZH1YXDuN9rw0r BWWMA9NWVU8BPQTEAaDwO7Wh0WzkGSE2rd63Es1dLzzmzUEmNQcfm0qvFucqL5DuY4eK WlHBpRhiUQf4vHvoOsGVrsxUwKNDc4uii+W1D5M5uGOCxoKx9iiitlubgZT8uPprY+ij e1fAa9ChTh3W3BdiXbJrvn5Fz8s5rdcw7emaZojFJHbc2RMeIRGMmWGVwZJljDiWg3Jr kcaA== 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=abIRrNl88n/SLJODJNzydAOk0g8wRy6BaERmqgGdeo0=; b=dL92kDnFxUU46QzBYqLbkKzw1kSCU3211r1FQu+IS3z0xXLVmsKtoW6cBD8H8Q7o37 CU355ks/6YUSlbI1ahM5hGfVJkgdbXd0vt+CTKUwSLCAwIn3TkWea2D2Iy12expAFDPA 8z54SKCDYt3F1gbii7dwQj38UCE39AN9KP9YtrznkfSD9eUVI4ngWnL5XWnELFDosBFZ EEgxw9xTU1c1KdZpJyBpgR03WPWzwgGIl9An/J6jUpvkbrNeEo9aPViHolsF4fuoVYfa +4c+luXXUkfT8YzPHYp8sSsNhYEDGnmYpkR+WFvsML97cIRdWDWQj9/DNNW8KmK4rk0T 8wQw== 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 l12si396687qkl.161.2017.12.12.15.22.07; Tue, 12 Dec 2017 15:22:07 -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 34E8E60950; Tue, 12 Dec 2017 23:22:07 +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 0D8B6609D2; Tue, 12 Dec 2017 23:02:48 +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 7025160922; Tue, 12 Dec 2017 23:02:31 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id D2C9E608F7 for ; Tue, 12 Dec 2017 23:01:00 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward100o.mail.yandex.net (Yandex) with ESMTP id D3FF52A23991 for ; Wed, 13 Dec 2017 02:00:40 +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 ZcQnf21Leh-0etCrkZM; Wed, 13 Dec 2017 02:00:40 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3wAtrviM64-0e0Cdrs3; Wed, 13 Dec 2017 02:00:40 +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, 13 Dec 2017 02:00:26 +0300 Message-Id: <1513119632-28755-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513119632-28755-1-git-send-email-odpbot@yandex.ru> References: <1513119632-28755-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v14 10/16] 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: d96a8207591fbcaac25b79286d7d72a537354c1f ** Merge commit sha: 832a79461bc8bd90e572c396fa081e162e1dacb6 **/ 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 f2130fc49..43fbafd5d 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 5b5a9827c..cf76df72c 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2185,6 +2185,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);