From patchwork Tue Dec 12 23:00:30 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: 121674 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4748166qgn; Tue, 12 Dec 2017 15:17:12 -0800 (PST) X-Google-Smtp-Source: ACJfBosqKRB2x4QvB+WAI+cFp2RpbelDTmZioc+PBJtcTc0g5OIkRLXQA2LiLgQxTAYvrUdkyBlM X-Received: by 10.55.212.129 with SMTP id s1mr3709016qks.106.1513120632024; Tue, 12 Dec 2017 15:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513120632; cv=none; d=google.com; s=arc-20160816; b=u+8IFZtyLwHuympGi1BUVVHtR21M3AC6814mAGppRD/We9CoCmkXZCNqPaEqV00XWl I+qrEn09RiSd3bzi1vNnkFAzWm59+S8mlnCWMESsfYkdzA3whOu2ZMx+FfsGhahId2gS JuVwY+DwkQK/65TYT+nel+S576fKLLx4xcdFFmJUiruJtV9gLP5OX7ywM/D9Bx0/YW3l OHs/cIKuMNOHVBgHWuRp9BvYdmLW9ZHMapm6vV1Dm81m4lIXSJOxq431YrhZIPee1hN4 RpmeKtTHkaXbpoSDLrhRxKIvLVO/ihgyJmV6QnDZOiom47MKEDx3J33+F5mdPq95l1pe skFw== 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=pMn0WVhHW+TWcpMQty2FmKuc9kn8jG6kcmkgjf4Wo9c=; b=iCBMy/fFXka9BscKfqOJ+fBfk5RFgHtxhpG8cRTf1IKJfGuhYh27AiFYcp048b+Nzd xqlUomJMUtC/KpdxFpxx7POPQJfTEGuVewoF7kHiN7ubQq5FpnUmWL+bIK0XSlw9Xh0H UJJGsX5ZPKtRPlrhEhvG7wv5cYwRzJc8Z5vnNBA4wUTFWAx9jdURHXOApzLlLihLn6uw 5q2eNtEVB/J547I94fALCryv9Zn/Hyjvn/QWXwcXbIRcO3MO9IiaeO9Ch3IKNC/akTz1 Oj3jv7tZGEM5IVUziVsDkUqH6sErjMFupIEa+MvPgP3HMWGfm1FcXfIVFu1HNdemFX8g 5e7Q== 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 j24si370899qtk.9.2017.12.12.15.17.11; Tue, 12 Dec 2017 15:17:11 -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 802C16093D; Tue, 12 Dec 2017 23:17:11 +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 BDA5B6096D; Tue, 12 Dec 2017 23:02:16 +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 9DF7160841; Tue, 12 Dec 2017 23:01:44 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id DF74660902 for ; Tue, 12 Dec 2017 23:00:43 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward101j.mail.yandex.net (Yandex) with ESMTP id C53911245FC4 for ; Wed, 13 Dec 2017 02:00:42 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id M8Ad6Bgfnu-0gbiY99u; Wed, 13 Dec 2017 02:00:42 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3wAtrviM64-0g0uI3fu; Wed, 13 Dec 2017 02:00:42 +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:30 +0300 Message-Id: <1513119632-28755-15-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 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: d96a8207591fbcaac25b79286d7d72a537354c1f ** Merge commit sha: 832a79461bc8bd90e572c396fa081e162e1dacb6 **/ 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;