Expose method to fetch NoRoute subnets from router

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet committed 2025-04-24 14:23:15 +02:00
1 parent 532737148e
commit d6f8d804c0
2 files changed
+14 -2

No files matched your search

+7 -1
View File
@@ -7,7 +7,9 @@ use crate::{
packet::{ControlPacket, DataPacket},
peer::Peer,
router_id::RouterId,
routing_table::{QueriedSubnet, RouteEntry, RouteKey, RouteList, Routes, RoutingTable},
routing_table::{
NoRouteSubnet, QueriedSubnet, RouteEntry, RouteKey, RouteList, Routes, RoutingTable,
},
seqno_cache::{SeqnoCache, SeqnoRequestCacheKey},
sequence_number::SeqNo,
source_table::{FeasibilityDistance, SourceKey, SourceTable},
@@ -314,6 +316,10 @@ where
self.routing_table.read().iter_queries().collect()
}
pub fn load_no_route_entries(&self) -> Vec<NoRouteSubnet> {
self.routing_table.read().iter_no_route().collect()
}
/// Task which periodically checks for dead peers in the Router.
async fn check_for_dead_peers(self) {
loop {
+7 -1
View File
@@ -5,7 +5,7 @@ use std::{
};
use ip_network_table_deps_treebitmap::IpLookupTable;
use iter::RoutingTableQueryIter;
use iter::{RoutingTableNoRouteIter, RoutingTableQueryIter};
use subnet_entry::SubnetEntry;
use tokio::{select, sync::mpsc, time::Duration};
use tokio_util::sync::CancellationToken;
@@ -390,6 +390,12 @@ impl RoutingTableReadGuard<'_> {
pub fn iter_queries(&self) -> RoutingTableQueryIter {
RoutingTableQueryIter::new(self.guard.table.iter())
}
/// Create an iterator for all subnets which are currently marked as `NoRoute` in the routing
/// table.
pub fn iter_no_route(&self) -> RoutingTableNoRouteIter {
RoutingTableNoRouteIter::new(self.guard.table.iter())
}
}
impl WriteGuard<'_> {