patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] fib: fix adding default route overwriting entire table
@ 2023-10-02 15:11 Vladimir Medvedkin
  2023-10-17 13:26 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Medvedkin @ 2023-10-02 15:11 UTC (permalink / raw)
  To: dev; +Cc: stable

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 <vladimir.medvedkin@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fib: fix adding default route overwriting entire table
  2023-10-02 15:11 [PATCH] fib: fix adding default route overwriting entire table Vladimir Medvedkin
@ 2023-10-17 13:26 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2023-10-17 13:26 UTC (permalink / raw)
  To: Vladimir Medvedkin; +Cc: dev, stable

02/10/2023 17:11, Vladimir Medvedkin:
> 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 <vladimir.medvedkin@intel.com>

Applied, thanks.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-17 13:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-02 15:11 [PATCH] fib: fix adding default route overwriting entire table Vladimir Medvedkin
2023-10-17 13:26 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).