From: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [PATCH] fib: fix incorrect prefix addition handling
Date: Wed, 21 Jan 2026 17:57:01 +0000 [thread overview]
Message-ID: <20260121175701.41102-1-vladimir.medvedkin@intel.com> (raw)
When adding a prefix longer than /24 in FIB/FIB6 as a first prefix within
its corresponding /24 supernet with the same next hop as its parent, the
code would incorrectly skip incrementing the number of reserved TBL8 due
to an early return statement. This could lead to integer overflow in
'dp->rsvd_tbl8s'. This commit corrects the logic to ensure that the
reserved TBL8 count is properly incremented in such scenarios.
Bugzilla ID: 1731
Fixes: 7dc7868b200d ("fib: add DIR24-8 dataplane algorithm")
Fixes: c3e12e0f0354 ("fib: add dataplane algorithm for IPv6")
Cc: stable@dpdk.org
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
lib/fib/dir24_8.c | 3 ++-
lib/fib/trie.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/fib/dir24_8.c b/lib/fib/dir24_8.c
index 2ba7e93511..1d99c8b21f 100644
--- a/lib/fib/dir24_8.c
+++ b/lib/fib/dir24_8.c
@@ -495,13 +495,14 @@ dir24_8_modify(struct rte_fib *fib, uint32_t ip, uint8_t depth,
if (parent != NULL) {
rte_rib_get_nh(parent, &par_nh);
if (par_nh == next_hop)
- return 0;
+ goto successfully_added;
}
ret = modify_fib(dp, rib, ip, depth, next_hop);
if (ret != 0) {
rte_rib_remove(rib, ip, depth);
return ret;
}
+successfully_added:
if ((depth > 24) && (tmp == NULL))
dp->rsvd_tbl8s++;
return 0;
diff --git a/lib/fib/trie.c b/lib/fib/trie.c
index 24a08b827d..edb7442cb1 100644
--- a/lib/fib/trie.c
+++ b/lib/fib/trie.c
@@ -571,14 +571,14 @@ trie_modify(struct rte_fib6 *fib, const struct rte_ipv6_addr *ip,
if (parent != NULL) {
rte_rib6_get_nh(parent, &par_nh);
if (par_nh == next_hop)
- return 0;
+ goto successfully_added;
}
ret = modify_dp(dp, rib, &ip_masked, depth, next_hop);
if (ret != 0) {
rte_rib6_remove(rib, &ip_masked, depth);
return ret;
}
-
+successfully_added:
dp->rsvd_tbl8s += depth_diff;
return 0;
case RTE_FIB6_DEL:
--
2.43.0
next reply other threads:[~2026-01-21 17:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 17:57 Vladimir Medvedkin [this message]
2026-02-16 17:23 ` [PATCH] fib: fix incorrect prefix addition handling Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260121175701.41102-1-vladimir.medvedkin@intel.com \
--to=vladimir.medvedkin@intel.com \
--cc=dev@dpdk.org \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox