From a40b7b82d94c099d9d224bed7926bfdd42d28aa2 Mon Sep 17 00:00:00 2001 From: Trey Aspelund Date: Thu, 3 Oct 2024 17:03:50 -0600 Subject: [PATCH] Use proper path comparison during route path deletion Signed-off-by: Trey Aspelund --- rdb/src/db.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rdb/src/db.rs b/rdb/src/db.rs index ab84db3a..ee468b87 100644 --- a/rdb/src/db.rs +++ b/rdb/src/db.rs @@ -15,6 +15,7 @@ use crate::types::*; use chrono::Utc; use mg_common::{lock, read_lock, write_lock}; use slog::{error, Logger}; +use std::cmp::Ordering as CmpOrdering; use std::collections::{BTreeMap, BTreeSet}; use std::net::{IpAddr, Ipv6Addr}; use std::sync::atomic::{AtomicU64, Ordering}; @@ -524,7 +525,7 @@ impl Db { ) -> Result<(), Error> { let mut rib = lock!(self.rib_in); if let Some(paths) = rib.get_mut(&prefix) { - paths.retain(|x| x.nexthop != path.nexthop); + paths.retain(|x| x.cmp(&path) != CmpOrdering::Equal); if paths.is_empty() { rib.remove(&prefix); }