Skip to content

Commit

Permalink
Use proper path comparison during route path deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Trey Aspelund <[email protected]>
  • Loading branch information
taspelund committed Oct 18, 2024
1 parent 082ff27 commit a40b7b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rdb/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a40b7b8

Please sign in to comment.