From patchwork Mon Sep 11 14:57:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 28584 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBFF96D45; Mon, 11 Sep 2017 16:57:35 +0200 (CEST) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 23A6B6841 for ; Mon, 11 Sep 2017 16:57:34 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 20D1FCF310 for ; Mon, 11 Sep 2017 16:53:40 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org Date: Mon, 11 Sep 2017 16:57:22 +0200 Message-Id: <20170911145722.4833-1-olivier.matz@6wind.com> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH] net: fix inner L2 length in software ptype parser X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The inner L2 length returned by rte_net_get_ptype() is not properly initialized. If the caller does not zero the header lengths structure, the inner_l2 field will be undefined. Fix it by initializing inner_l2 to 0 when parsing a inner layer. Fixes: 2c15c5377da2 ("net: support NVGRE in software packet type parser") Signed-off-by: Olivier Matz --- lib/librte_net/rte_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_net/rte_net.c b/lib/librte_net/rte_net.c index a8c7aff9c..a3ca04032 100644 --- a/lib/librte_net/rte_net.c +++ b/lib/librte_net/rte_net.c @@ -396,6 +396,7 @@ uint32_t rte_net_get_ptype(const struct rte_mbuf *m, if ((layers & RTE_PTYPE_INNER_L2_MASK) == 0) return pkt_type; + hdr_lens->inner_l2_len = 0; if (proto == rte_cpu_to_be_16(ETHER_TYPE_TEB)) { eh = rte_pktmbuf_read(m, off, sizeof(*eh), &eh_copy); if (unlikely(eh == NULL))