From patchwork Tue Dec 12 17:00:45 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: 121603 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4400205qgn; Tue, 12 Dec 2017 09:24:18 -0800 (PST) X-Google-Smtp-Source: ACJfBouIe0tfFTDXkbsHIRlFyzWQWQCZOeBRJ/AS1oTdbVevJ3BpVCFyXMrsGQiOwLvaU6cGr5qb X-Received: by 10.200.25.207 with SMTP id s15mr6478360qtk.94.1513099458524; Tue, 12 Dec 2017 09:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513099458; cv=none; d=google.com; s=arc-20160816; b=yjoGErG0p8ozUa7b1udoElW/Kk9YoLa6Czpbbhgg5n5UGbPDWGVW+aorGG+zCmB2Jo zYXJmn02ASj87sV6YNx/UddFTSaK5n1uO05eI0EwuFc5iCP++3bJDhjPQDX9M44qjbhy qQ8tbCEaW4IaAVAKONfY6PicEab18aAbVc8NFJbdloGg1JwitoKZSY8Z+s0VgaQJCA9v Cok09MeecS2Y30tJYfzRbx6V8edzcBjRRWJ79g8dSRdOaAqAMiNmXbyY43RupffMFJfP dfAYT0V1mHCtbWy75rEeuDrkxdF6WpvVZItr2CXword8zWpHN1xzlw63f1VHqJBjF5/t sifA== 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=u6EMfavceIOrAW1do5qX23NazJ7/iTGyXZsD/kn/SD0=; b=HoNdwmM52htkTq9ZGhI1A9QZGQcy1PKf/e1yIkHltwBl2093Lj+K4JtImRROemYn0W po3w7oRzT0LA+aAy2eWsURy1k35ICAS889vnkIzjrw3pDZo0+ms6YHF73AA6E9eKQRQs kn1fxuhiMKnCvFinskcar1kAIImtQR9mBtYsWZUaVnijpgLS/c8/UE2ey7kRS/ax2+vW bc+OGJHOSSzhUBmExobTlG4K86wkqACBPLpO9/iCkqpKAHC49ogeSKeXpntmcfk2+gxR mP9Gwm8VtkiUJW39tlFgxyWp814p4f9Keb+yJOmPh7NmoJPCLO5/Ti7QvrnYAjCdp7st H6XQ== 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 e185si12610794qkc.351.2017.12.12.09.24.18; Tue, 12 Dec 2017 09:24:18 -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 15A796084F; Tue, 12 Dec 2017 17:24:18 +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 09B9060993; Tue, 12 Dec 2017 17: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 16A226097F; Tue, 12 Dec 2017 17:03:19 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 2A33D608EE for ; Tue, 12 Dec 2017 17:01:11 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward103j.mail.yandex.net (Yandex) with ESMTP id B7A2534C1A2C for ; Tue, 12 Dec 2017 20:01:09 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id PhdMbr4EO9-13FSqxps; Tue, 12 Dec 2017 20:01:03 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id O5YE7TQVzQ-139C8UBT; Tue, 12 Dec 2017 20:01:03 +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 20:00:45 +0300 Message-Id: <1513098047-19804-15-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513098047-19804-1-git-send-email-odpbot@yandex.ru> References: <1513098047-19804-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v13 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: a17bf2b46352969fad4fbaf801dc8b5da0de7a78 **/ 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;