diff --git a/Cargo.toml b/Cargo.toml index aac65178..1a1b102d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ netlink-sys = "0.8" num-derive = "0.4" num-traits = "0.2" pickledb = "0.5" -prefix-trie = { version = "0.3", features = ["ipnetwork"] } +prefix-trie = { version = "0.4.1", features = ["ipnetwork"] } prost = "0.12" rand = "0.8.5" regex = "1.10" diff --git a/holo-bgp/src/northbound/state.rs b/holo-bgp/src/northbound/state.rs index 5e6655b8..4e1a4ddd 100644 --- a/holo-bgp/src/northbound/state.rs +++ b/holo-bgp/src/northbound/state.rs @@ -78,8 +78,8 @@ fn load_callbacks() -> Callbacks { let afi_safi = args.list_entry.as_global_afi_safi().unwrap(); let state = instance.state.as_ref().unwrap(); let total_prefixes = match afi_safi { - AfiSafi::Ipv4Unicast => state.rib.tables.ipv4_unicast.prefixes.iter().count(), - AfiSafi::Ipv6Unicast => state.rib.tables.ipv6_unicast.prefixes.iter().count(), + AfiSafi::Ipv4Unicast => state.rib.tables.ipv4_unicast.prefixes.len(), + AfiSafi::Ipv6Unicast => state.rib.tables.ipv6_unicast.prefixes.len(), }; Box::new(Statistics { // TODO @@ -92,8 +92,8 @@ fn load_callbacks() -> Callbacks { use bgp::global::statistics::Statistics; let mut total_prefixes = None; if let Some(state) = &instance.state { - let total_ipv4 = state.rib.tables.ipv4_unicast.prefixes.iter().count(); - let total_ipv6 = state.rib.tables.ipv6_unicast.prefixes.iter().count(); + let total_ipv4 = state.rib.tables.ipv4_unicast.prefixes.len(); + let total_ipv6 = state.rib.tables.ipv6_unicast.prefixes.len(); total_prefixes = Some(total_ipv4 as u32 + total_ipv6 as u32); } Box::new(Statistics {