From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67CCD426A4 for ; Mon, 2 Oct 2023 17:11:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55DD5402E1; Mon, 2 Oct 2023 17:11:59 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 59E3A4003C; Mon, 2 Oct 2023 17:11:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696259516; x=1727795516; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=fiApclkrDHaLTbwIDEhwqppIyc9ju5B88mdf9XgbrOY=; b=bdQPk3f2kprpEZA85lJqP/l3j76fU5KxiFeIEf6zXqg1MDkVgPzpelQ3 T59q/rQvac6kKIzfKh/Q/07IzTGEDHVsku0lJ3TX11f68yNLtdMRpHuET 3tOgVQ3HR30081B3yypFdst/y6djrhsdVZKYfE/NgJgPtekdIFg8v7l8E +wOHmpLFwwHfZe28OQ74Jg+IYLaK0nF0cFKYfNz5Wh+IV0JAqlv8cS7ay iKZFrVV6ic74aKuUMzcTn0T87lUcyC2e1rPx4XtL7gclbOdH00kzAlpck jsTr37Wg39YwJgsG0OZH4FLqma/4YG8n6F/1288drdpQwBRY+Xtjk/aZ9 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="367717978" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="367717978" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 08:11:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10851"; a="727297267" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="727297267" Received: from silpixa00400072.ir.intel.com (HELO silpixa00400072.ger.corp.intel.com) ([10.237.222.194]) by orsmga006.jf.intel.com with ESMTP; 02 Oct 2023 08:11:54 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: stable@dpdk.org Subject: [PATCH] fib: fix adding default route overwriting entire table Date: Mon, 2 Oct 2023 15:11:48 +0000 Message-Id: <20231002151148.675857-1-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org When FIB contains any route covering last ip address (255.255.255.255), upon adding a new default route the entire fib table will be overwritten with corresponding default route next hop. Previous fix added check for ledge against 0 for case if default route is added as a first route, however this check was also erroneously triggered in case when ledge was wrapped around the address space (this would happen if FIB contains any route covering last possible address - 255.255.255.255). This fix prevents wrap around from happening. Fixes: 880bc2b5f3bd ("fib: fix adding default route") Cc: stable@dpdk.org Signed-off-by: Vladimir Medvedkin --- lib/fib/dir24_8.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/fib/dir24_8.c b/lib/fib/dir24_8.c index 3efdcb533c..5f73b8a7f0 100644 --- a/lib/fib/dir24_8.c +++ b/lib/fib/dir24_8.c @@ -388,6 +388,12 @@ modify_fib(struct dir24_8_tbl *dp, struct rte_rib *rib, uint32_t ip, return ret; ledge = redge + (uint32_t)(1ULL << (32 - tmp_depth)); + /* + * we got to the end of address space + * and wrapped around + */ + if (ledge == 0) + break; } else { redge = ip + (uint32_t)(1ULL << (32 - depth)); if (ledge == redge && ledge != 0) -- 2.34.1