From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id AEC0A9A8F for ; Tue, 7 Jun 2016 13:22:52 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 07 Jun 2016 04:22:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,432,1459839600"; d="scan'208";a="982477822" Received: from gklab-246-019.igk.intel.com (HELO intel.com) ([10.217.246.19]) by fmsmga001.fm.intel.com with SMTP; 07 Jun 2016 04:22:49 -0700 Received: by intel.com (sSMTP sendmail emulation); Tue, 07 Jun 2016 14:22:50 +0200 From: Slawomir Mrozowicz To: sergio.gonzalez.monroy@intel.com Cc: dev@dpdk.org, Slawomir Mrozowicz Date: Tue, 7 Jun 2016 14:17:14 +0200 Message-Id: <1465301834-5477-1-git-send-email-slawomirx.mrozowicz@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [dpdk-dev] [PATCH] examples/ipsec-secgw: wrong spi read from packet X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2016 11:22:53 -0000 In ipsec-secgw wrong SPI number is read from incoming ESP packet. The problem exist inside function inbound_sa_lookup(). The SPI is read from mbuf where the information is stored in big-endian. In low-endian environment the value is erroneous. Fixed by add conversion rte_be_to_cpu_32(). Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Signed-off-by: Slawomir Mrozowicz --- examples/ipsec-secgw/sa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index b6260ed..503e345 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -416,8 +416,8 @@ inbound_sa_lookup(struct sa_ctx *sa_ctx, struct rte_mbuf *pkts[], uint32_t *src, spi; for (i = 0; i < nb_pkts; i++) { - spi = rte_pktmbuf_mtod_offset(pkts[i], struct esp_hdr *, - sizeof(struct ip))->spi; + spi = rte_be_to_cpu_32(rte_pktmbuf_mtod_offset(pkts[i], + struct esp_hdr *, sizeof(struct ip))->spi); if (spi == INVALID_SPI) continue; -- 1.9.1