From patchwork Fri Dec 1 00:00:18 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: 120299 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp474778qgn; Thu, 30 Nov 2017 16:23:49 -0800 (PST) X-Google-Smtp-Source: AGs4zMZEhJ8LJAeorz50YiyljOfNBUNwPHutx+M//i3bIQj5r8ruZx4F+bIZcZtRD828m+IDpGwG X-Received: by 10.55.120.199 with SMTP id t190mr5498085qkc.63.1512087829628; Thu, 30 Nov 2017 16:23:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512087829; cv=none; d=google.com; s=arc-20160816; b=xrJXXk/vRpV2BJ0gmsG2QW6utEuwbT59fd3c2ZdHc/lsleHnkijJEPjATYqa6zqcbA n4QHrKtFCtmteTN77VxcjzGpT0hGP/4u5OH4wk+BMO7818MdE2ublmI75Xdq6Xp57ywi c9HNhjHRt7vH8zbF7zBxfaTeQ6aOnaTn6Y36/NwKbdTaVi0T3g4drETACnTw+AzNZQ/A j2Fd5dJ0V5S+FXTSIsigs55YYDmUutrEq/t2PubKmk/LWb7zVzW6HraVVqAp55tTzyP+ 9WsFS+Kewpym/NokSbrn8hM9OO5Md4IzpqoLa+CkAHH41vj/cDrIhPzRvLPckpbCgtta FzPg== 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=eV+r1UsMUOWk0bLCPhnraWONcDcfZMcABIUccA5D43A=; b=K0VQvXaupxG3nND4D7U0Ne5tDWaGYklqIkAFnJEmY0WdjaXIRRaNkz7BmJhOPkZLHi CtvE8i9ACFGhMCQNt7A9khuQYJlxduCq+szP/Bw+UYYsHMsCfqOv8hmP/PcfAXO4X+nl MjM5kUZw+JId7HtTUGXKC3KabAVZKkELi78JAxPuTiHtQpXNevH3sdnb4LWyzMHQjHKX 3CzKwYdtlEOU4Q4vE74sxl+hENjsXupKGpbHYcg6i6xJUIenPKTZnVVSCvk9fIKA25+n Z/SKqUfNgMj9SlLOGDmBRb6LVpXrF5eFpLTZmNJdAX+eBb3e/djqWTA9afWWOW4HcuSi 3IZg== 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 r62si225994qkh.90.2017.11.30.16.23.49; Thu, 30 Nov 2017 16:23: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 4A30D6099E; Fri, 1 Dec 2017 00:23:49 +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,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 ABC9960A0B; Fri, 1 Dec 2017 00:04:12 +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 7C5EF60A0E; Fri, 1 Dec 2017 00:04:04 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 5ABA660985 for ; Fri, 1 Dec 2017 00:00:33 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 5222F56075CF for ; Fri, 1 Dec 2017 03:00:32 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Utb8T0jwI3-0WHuw7Z1; Fri, 01 Dec 2017 03:00:32 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id aHHHtahweJ-0VHqUBxI; Fri, 01 Dec 2017 03:00:31 +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:18 +0300 Message-Id: <1512086419-25786-15-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 14/15] validation: ipsec: fix out inline with NULL pkt_out 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 pkt_out can be NULL if we expect an error. IPsec outbound inline needs proper outer header to function. Pass L2 header from inbound packet if outbound packet is NULL. 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 **/ test/validation/api/ipsec/ipsec.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 7b39c2c5a..aa46a236e 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -583,10 +583,18 @@ static int ipsec_send_out_one(const ipsec_test_part *part, } else { struct odp_ipsec_out_inline_param_t inline_param; odp_queue_t queue; - uint32_t hdr_len = part->out[0].pkt_out->l3_offset; - uint8_t hdr[hdr_len]; + uint32_t hdr_len; + uint8_t hdr[32]; - memcpy(hdr, part->out[0].pkt_out->data, hdr_len); + if (NULL != part->out[0].pkt_out) { + hdr_len = part->out[0].pkt_out->l3_offset; + CU_ASSERT_FATAL(hdr_len <= sizeof(hdr)); + memcpy(hdr, part->out[0].pkt_out->data, hdr_len); + } else { + hdr_len = part->pkt_in->l3_offset; + CU_ASSERT_FATAL(hdr_len <= sizeof(hdr)); + memcpy(hdr, part->pkt_in->data, hdr_len); + } inline_param.pktio = suite_context.pktio; inline_param.outer_hdr.ptr = hdr; inline_param.outer_hdr.len = hdr_len;