From patchwork Thu Nov 30 13: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: 120185 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp657361qgn; Thu, 30 Nov 2017 05:17:48 -0800 (PST) X-Google-Smtp-Source: AGs4zMYsR+3brb8he5XQjDsIh3G4e100Uf7uCSXbJVJOYbDXDd2sYsPN5Aa+7neXOCuhYIMD57xe X-Received: by 10.237.59.22 with SMTP id p22mr3354569qte.34.1512047868291; Thu, 30 Nov 2017 05:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512047868; cv=none; d=google.com; s=arc-20160816; b=ihm0UTYVhG8bYJtqZwDmJOb6JXVyxXjOfRnihQkDalp8PW6rfoDjEEhsYbOEkz4Cgp 2KlQGnTnOdvDk8DraDjyCSSgs5BZSxyDllj5yMpfuuqhJBYTSf9PaQTdDYZUwUyQ+/I3 Ip8lPlwHNnpeccNplZcisFzUe4eXpDhnMGnV+8KYikCMsXEWHSdvtWiRKt8L9sPStm1e FMt1yyGjJLkB/nCaRDfX9Br/Hox+UZhDK5DnKcTWcSYV2Z/cP+rGlPH7gQEdP5wSCqI8 nwjFKzgnFeUED5+0UuAAHvvW2GAUYKHVJkxhZbbNQFuEnZclsb2jvASIQP9cRFQKo5jF P75Q== 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=RaU7wbhvxgZlxsgWSlWo+lIwb0w4vU8qRCNgYXIBEvk=; b=ya4KS+gopXXP29ZybqKFo4OpDXGZpf5RLny9t3dZfjlxiqUzg/bsTdcvADTexq2xzx wn5/OdeBalSoWjeGBtrG3I48kqCeNIBmwbuhWm0e515KXtW9ZruzoSy/HPAN20RilTyi j2bGJCGHuY4e9HVC20+4BXOrQNqnsR9/S09Q1ihzFDOhLrqcykATp1vAtGqUU9rhWX1v AO2ayiW6NgAkUqY2tQTjWX+zuAuJo8QDu73zcr6j1SjJx6N0TUeN9/2RyuTjaKsOFYFa rQT/nKbpQBwIqEDfDqKh62VoaBoqZPUwQG8FefXb5Cr42dbj2Z0WrtBCTfJnlBrthcPj mx8A== 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 l13si279083qtf.336.2017.11.30.05.17.48; Thu, 30 Nov 2017 05:17:48 -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 F33B860983; Thu, 30 Nov 2017 13:17:47 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 1EA5D6098D; Thu, 30 Nov 2017 13:02:03 +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 88AFE607EC; Thu, 30 Nov 2017 13:00:53 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id A5B31607EC for ; Thu, 30 Nov 2017 13:00:30 +0000 (UTC) Received: from mxback4g.mail.yandex.net (mxback4g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:165]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 95C385D8433A for ; Thu, 30 Nov 2017 16:00:29 +0300 (MSK) Received: from smtp3p.mail.yandex.net (smtp3p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:8]) by mxback4g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id tJiKibEfwK-0TYuEuKl; Thu, 30 Nov 2017 16:00:29 +0300 Received: by smtp3p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id nOB9mYWTNF-0TGmsjoS; Thu, 30 Nov 2017 16: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: Thu, 30 Nov 2017 16:00:14 +0300 Message-Id: <1512046815-10630-16-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512046815-10630-1-git-send-email-odpbot@yandex.ru> References: <1512046815-10630-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v8 15/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: 4cb02e1caccb9179575e95448fd46979e17d0905 ** Merge commit sha: 6f6906b608f0626d119b255b3733a4a0863aa8d1 **/ 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;