From patchwork Wed Jan 6 11:33:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 59235 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp6523234lbb; Wed, 6 Jan 2016 03:34:17 -0800 (PST) X-Received: by 10.140.128.8 with SMTP id 8mr110215333qha.54.1452080057174; Wed, 06 Jan 2016 03:34:17 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s67si9619201qhs.12.2016.01.06.03.34.16; Wed, 06 Jan 2016 03:34:17 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 6FBF0618DD; Wed, 6 Jan 2016 11:34:16 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=VbtNdBNg; dkim-adsp=none (unprotected policy); dkim-atps=neutral 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, 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 6F6A7615E3; Wed, 6 Jan 2016 11:34: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 E496160455; Wed, 6 Jan 2016 11:34:10 +0000 (UTC) Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by lists.linaro.org (Postfix) with ESMTPS id 139A560455 for ; Wed, 6 Jan 2016 11:34:10 +0000 (UTC) Received: by mail-wm0-f44.google.com with SMTP id l65so55938015wmf.1 for ; Wed, 06 Jan 2016 03:34:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=+ymuIlOgv86O/xLFWWqHxrbvOZHhxmmhdrjv+4KKW3o=; b=VbtNdBNgTYdyTNj1s9FGXqLwgTzfX3D7V+wr4DHh6oqiyr3TfuK7WEn8cjFRkc5KCD Hk5Lmx5LLfNT0gccKhBZlsy4Gk+WNev1Ce98JuCVRF10qGEawBpSUo1belsnA6KoPqhy uxPNO0EW+5OEpRF40NeWCA3skPrq6OXEEVVqA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=+ymuIlOgv86O/xLFWWqHxrbvOZHhxmmhdrjv+4KKW3o=; b=C/QgL4s5XmaonLvyxwBtCyU2S+tQPjGf61zxESEFwJUsup7gT2T4jn2MKEaHua2xeD TBFaV+x7Ih4/AuD/G8LZ8m6HXbMjP7MyB8j9xO6I9U35YSv9mRdzkBfV6XQAR/fo7Y8/ owA1Gy3zU3F54IvPnipOcV90yG00AOGCDVJLuBejEa3GdAy8aHqaQgLM43T5o04Q1plt VqcnGjs2gfxVlG8OLw//LLEuxHHUzsLZKuq/CAMqSeCUaKn/dIyQVTXHtV9NZscUDxZX vM2M4Mb/h/H50MgllLEpXojdp0J60iwdhY4ZhauNx8WVe7HbnDbQJ3QWI4D2ALoExwCP dJ2w== X-Gm-Message-State: ALoCoQkEbmp2FFj/b16EY7aH6YX2yfns+iGjAJdpZhXb1mtE1fu3dXWeT0GtJALww7IJqmwvmuJs58ffkgt8b1QW5IpR7CqcpQ== X-Received: by 10.28.187.198 with SMTP id l189mr10058726wmf.89.1452080049237; Wed, 06 Jan 2016 03:34:09 -0800 (PST) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id a126sm8261873wmh.0.2016.01.06.03.34.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Jan 2016 03:34:05 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Wed, 6 Jan 2016 11:33:38 +0000 Message-Id: <1452080019-25124-1-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 X-Topics: patch Subject: [lng-odp] [PATCH 1/2] example: ipsec: fix endianness of IP address checks 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: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Convert IP addresses in packet header from network to CPU byte order before comparing with policy cache. Signed-off-by: Stuart Haslam Reviewed-by: Bill Fischofer --- example/ipsec/odp_ipsec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index fab1035..45892f9 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -771,8 +771,8 @@ pkt_disposition_e do_ipsec_in_finish(odp_packet_t pkt, ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL); /* Check inbound policy */ - if ((ip->src_addr != ctx->ipsec.src_ip || - ip->dst_addr != ctx->ipsec.dst_ip)) + if ((odp_be_to_cpu_32(ip->src_addr) != ctx->ipsec.src_ip || + odp_be_to_cpu_32(ip->dst_addr) != ctx->ipsec.dst_ip)) return PKT_DROP; return PKT_CONTINUE;