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 AADC0A050B; Fri, 15 Apr 2022 04:29:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8629340140; Fri, 15 Apr 2022 04:29:33 +0200 (CEST) Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mails.dpdk.org (Postfix) with ESMTP id 9707D4003C for ; Fri, 15 Apr 2022 04:29:32 +0200 (CEST) Received: by mail-pf1-f180.google.com with SMTP id n22so6002409pfa.0 for ; Thu, 14 Apr 2022 19:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dPJFgoUEr2vGQ/OfuVgHuThvpmSb3o7vwgUa1pndtIA=; b=nUS1Ghb0I+TRBPxxveS6fn8WEaLZH2nXF/QkjMLtB3TQso9XV616e6O1Pk0gyxelDG Hg2ldqmHU0UolbfCoh3srcZcqE29eClhgGHAKwIgZV9u1Sw+LsNjo2RogmQGflybZ4G/ Gc6jIkddKj7WqGIyYBTIcZAenBMp9VDsPyACBrFXLmOzwDZwXGwLZu6YJu/HPAikNZCC d2mDK4RmYg6fngOUWdGS2JF7CKAasBs/9YbWz23epd52JGt1eSkIVDsX5ZFAdkFDSUed /k93uF46/RyiD3fxjZpH1NNE6Xb9n3va+YhRAstpUm3dMnTn1Ne8b8pmYMBVqjC0I4Ty 494w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dPJFgoUEr2vGQ/OfuVgHuThvpmSb3o7vwgUa1pndtIA=; b=R34ISfSTFWIj15fQswEiSDXTGEts5hm7CoVTWCIwBNywVSYJePIef638UkRA4/nv20 Ea4pgYLIyB5jVccFNThlVjCzv9snw5+HqnXhsUsRZ6YqySvFxlWdfnXgVZVxTm4FjmNQ pDPMhJ4xBVCk7V0Bvkp6OgGGWu6gCjBZIwSKMiGfHV3pls99yxFGZtLotqVp9MFMG4yt cqDXcCfq1bz97ADzWx1oapgCA4PsMcYRP4+jWMWCTFUwjjArDdTAKRbfOjxw6uIh0qvg 0R/wMJMRV75Ma6s1llrwdpNDhD0p7lr9IPYqAsdnJlh7ESDgBUY1RYcCahxz2Y/QoCwV 0QvA== X-Gm-Message-State: AOAM532bUzTSubmYHfO8+Db0kfE/GJfMaMhD73nuQzeHSraOWU4MBikE hvFKpncNc5n4+QkVogu01rDiop3vOz4d0Q== X-Google-Smtp-Source: ABdhPJyfHBYVXujNa/SlChXfCrAGe9rGs6H8k5FpAWZdepWPZYrQDc3+B5UK211p0+GoBpYMmWyfnw== X-Received: by 2002:a63:b24c:0:b0:398:9594:a140 with SMTP id t12-20020a63b24c000000b003989594a140mr4723174pgo.292.1649989771322; Thu, 14 Apr 2022 19:29:31 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id y8-20020aa78f28000000b00508225493ddsm1133272pfr.80.2022.04.14.19.29.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 19:29:30 -0700 (PDT) Date: Thu, 14 Apr 2022 19:29:27 -0700 From: Stephen Hemminger To: dev@dpdk.org Cc: Vladimir Medvedkin Subject: Re: [PATCH] rib: fix traversal with /32 route Message-ID: <20220414192927.516675a3@hermes.local> In-Reply-To: <20220414200104.245071-1-stephen@networkplumber.org> References: <20220414200104.245071-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, 14 Apr 2022 13:01:04 -0700 Stephen Hemminger wrote: > If a /32 route is entered in the RIB the code to traverse > will not see that a a end of the tree. This is due to trying > to do a negative shift which is an undefined in C. > > Fix by checking for max depth as is already done in rib6. > > Signed-off-by: Stephen Hemminger > --- > lib/rib/rte_rib.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c > index cd9e823068d2..0603980cabd2 100644 > --- a/lib/rib/rte_rib.c > +++ b/lib/rib/rte_rib.c > @@ -71,6 +71,8 @@ is_covered(uint32_t ip1, uint32_t ip2, uint8_t depth) > static inline struct rte_rib_node * > get_nxt_node(struct rte_rib_node *node, uint32_t ip) > { > + if (node->depth == RIB_MAXDEPTH) > + return NULL; > return (ip & (1 << (31 - node->depth))) ? node->right : node->left; > } Fixes: 5a5793a5ffa2 ("rib: add RIB library")