From patchwork Tue Dec 12 16:00:21 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: 121562 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4333462qgn; Tue, 12 Dec 2017 08:24:32 -0800 (PST) X-Google-Smtp-Source: ACJfBov9Ka/d2+uLlMkxo+Iqv7wlfC9326lx9unjQfkIdal1SEekp4lOvD0Z2O911I90P0qjTQ56 X-Received: by 10.55.106.131 with SMTP id f125mr5915479qkc.88.1513095872387; Tue, 12 Dec 2017 08:24:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513095872; cv=none; d=google.com; s=arc-20160816; b=AAGbydnFMdNe6/Sc/GPz3aIX7vaL812R5huXeo2XP/nvNRzAw89JWSK3CkiGDcm1X0 z+Vv4izcpdRtLQdvRHAVO6ssyyW1DHYRuOAfVxR2UWrmK9oEjQ5n1gRG3WAUGDuSGtXk f1MZ2+fKGlGyIp5HXFDq5jYDmrE7kzobqiLZZHoiPDp8RkVkdzbErD9bmCzkhxXMJPT+ fXHGogbW5sZb4x4Zm2B9EHQSsc3rpn2kFDXNtz6tolMzJFFU8Vni2gBIkXDVn35WgIlM Ox0/gpvFt5tLGwucAjf00COIrfdF0A8klbbjlHrvH1cylaFNH/qAgHENCKEFeCxT33Ti mTwQ== 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=ZaxjbeNmdxXGCtD4SnpGd8OO/R5dsLqzLyIiY+AnVss=; b=k6ZBc0zMRzNFfyatxPAd0fekuj7e1LGK3w1pJ8ZN4RUT+mrWq9K50F+cnGvp6QKvBz 8UPskxJT8+iZ2E1ACY0BIfWmMneBHPTcF3EDWBgKAXIC7mwo3IIt/sjNf6T3GlAWWC0x tVgNtxzEV93wlj+tJAN6mrK8XYjNKQrmbkBGwOm4083nKo8rKsUOG8nCvjM8Y+4Y9Nnh KHGNcw1eNqTK1BWSwoSFVfdekBEGt42vEx5t/5kWQJGupIijOR7epiBgEMjh0YONdXeZ mVHKnwD8e4W+1zyaAxBwP4qlvy9J65uAoKoxK552EWPG/Z5CrQsRHsWG1yLUlm50ykdF ehmA== 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 c67si787875qkf.208.2017.12.12.08.24.32; Tue, 12 Dec 2017 08:24:32 -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 0A5776088A; Tue, 12 Dec 2017 16:24:32 +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,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 8A0B16099C; Tue, 12 Dec 2017 16:05:53 +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 5213B608ED; Tue, 12 Dec 2017 16:05:43 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id DDB36608AC for ; Tue, 12 Dec 2017 16:00:41 +0000 (UTC) Received: from mxback11j.mail.yandex.net (mxback11j.mail.yandex.net [IPv6:2a02:6b8:0:1619::84]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 565C62A23BF0 for ; Tue, 12 Dec 2017 19:00:40 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback11j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 3a4YWH5NeI-0eSC7r6f; Tue, 12 Dec 2017 19:00:40 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id P8VUaNg7sx-0dFCOw1X; Tue, 12 Dec 2017 19:00:39 +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, 12 Dec 2017 19:00:21 +0300 Message-Id: <1513094423-671-15-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513094423-671-1-git-send-email-odpbot@yandex.ru> References: <1513094423-671-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v11 14/16] 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: 65d690fbcf03c6a4d5eb3f01bde36807833feaaa ** Merge commit sha: 2212038b2ceac423819d283ce07106fabe438631 **/ 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;