DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Sanford <rsanford2@gmail.com>
To: dev@dpdk.org
Cc: vladimir.medvedkin@intel.com,
	Robert Sanford <rsanford@akamai.com>,
	stable@dpdk.org
Subject: [PATCH v2 3/5] fib6: fix full table overwrite on address wraparound
Date: Tue, 27 Oct 2026 10:54:03 -0400	[thread overview]
Message-ID: <20261027145405.3454251-4-rsanford2@gmail.com> (raw)
In-Reply-To: <20261027145405.3454251-1-rsanford2@gmail.com>

From: Robert Sanford <rsanford@akamai.com>

When a prefix whose range ends at the top of the address space
(ffff:ffff:...:ffff) is added, deleted, or has its next hop changed,
modify_dp() walks the more-specific routes under it and installs the
next hop into the gaps. If the last of those routes starts exactly at
the current left edge and ends at the top of the address space, the
equal-edges branch advances ledge past it with get_nxt_net(), and
ledge wraps to ::. That branch has no wraparound check, so the loop
continues. With no more routes, the final branch computes redge,
which also wraps to ::. Its exception for an unspecified ledge, which
exists for a default route added as the first route, lets the call
through, and install_to_dp() with both edges at :: overwrites the
entire table. The call returns 0, so the corruption is silent.

For example, with ::/0, ::/1 and 8000::/1 installed, deleting ::/0
makes every lookup miss. With 2001:db8::/32 and two /121 routes at
ffff:...:ff00 and ffff:...:ff80 installed, adding their covering /120
makes every address, including 2001:db8::1, return the /120's next
hop.

The same commit added a wraparound check to the other branch only.
Add the same check to the equal-edges branch.

Fixes: fd66617c5774 ("fib6: fix adding default route as first route")
Cc: stable@dpdk.org

Signed-off-by: Robert Sanford <rsanford@akamai.com>
---
 lib/fib/trie.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/fib/trie.c b/lib/fib/trie.c
index 187360d1c8..59f043ce0e 100644
--- a/lib/fib/trie.c
+++ b/lib/fib/trie.c
@@ -506,6 +506,12 @@ modify_dp(struct rte_trie_tbl *dp, struct rte_rib6 *rib,
 			rte_rib6_get_ip(tmp, &redge);
 			if (rte_ipv6_addr_eq(&ledge, &redge)) {
 				get_nxt_net(&ledge, tmp_depth);
+				/*
+				 * we got to the end of address space
+				 * and wrapped around
+				 */
+				if (rte_ipv6_addr_is_unspec(&ledge))
+					break;
 				continue;
 			}
 			ret = install_to_dp(dp, &ledge, &redge, next_hop);
-- 
2.34.1


  parent reply	other threads:[~2026-10-27 14:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  0:14 [PATCH v1 0/4] fib: fix full table overwrite on address wraparound Robert Sanford
2026-10-27  0:14 ` [PATCH v1 1/4] " Robert Sanford
2026-10-27  0:14 ` [PATCH v1 2/4] fib6: " Robert Sanford
2026-10-27  0:14 ` [PATCH v1 3/4] test/fib: reproduce " Robert Sanford
2026-10-27  0:14 ` [PATCH v1 4/4] test/fib6: " Robert Sanford
2026-10-27 14:54 ` [PATCH v2 0/5] fib: fix full " Robert Sanford
2026-10-27 14:54   ` [PATCH v2 1/5] rib: fix undefined behavior in bit test Robert Sanford
2026-10-27 14:54   ` [PATCH v2 2/5] fib: fix full table overwrite on address wraparound Robert Sanford
2026-10-27 14:54   ` Robert Sanford [this message]
2026-10-27 14:54   ` [PATCH v2 4/5] test/fib: reproduce " Robert Sanford
2026-10-27 14:54   ` [PATCH v2 5/5] test/fib6: " Robert Sanford

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=20261027145405.3454251-4-rsanford2@gmail.com \
    --to=rsanford2@gmail.com \
    --cc=dev@dpdk.org \
    --cc=rsanford@akamai.com \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /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