From 515f0470e86eed0faff6675c2f63dea8d95feac5 Mon Sep 17 00:00:00 2001 From: Lee Smet Date: Mon, 25 Mar 2024 14:02:36 +0100 Subject: [PATCH] Update source table only on seqno increase The previous condition updated the source table unconditionally if the new seqno was not less than the existing source key seqno. This is not correct however, as it also updates the source key if the seqno is the same, thus allowing the source key metric to increase for the same seqno. This allows for loops to be created, as an update could increase the metric, after which a loop update could eronously be accepted. Fixes #176 Signed-off-by: Lee Smet --- src/router.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/router.rs b/src/router.rs index 5bcbae8..00f65b3 100644 --- a/src/router.rs +++ b/src/router.rs @@ -1228,10 +1228,9 @@ impl RouterInner { let source_key = SourceKey::new(subnet, router_id); - // Nothing to do on route retraction. if let Some(source_entry) = source_table.get(&source_key) { // if seqno of the update is greater than the seqno in the source table, update the source table - if !seqno.lt(&source_entry.seqno()) { + if seqno.gt(&source_entry.seqno()) { source_table.insert( source_key, FeasibilityDistance::new(metric, seqno),