From 109af3067cb0026ba76c78f83830dd413cf3966e Mon Sep 17 00:00:00 2001 From: Mingwei Zhang Date: Mon, 25 Oct 2021 09:38:00 -0700 Subject: [PATCH] fix mrt to elems error for meta bgp messages meta messages such as Open, Notification, KeepAlive will be discarded when converting to BgpElem. --- Cargo.toml | 2 +- src/parser/mrt/messages/table_dump_v2_message.rs | 4 +++- src/parser/mrt/mrt_elem.rs | 13 ++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e3f5c6a..dd09a11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bgpkit-parser" -version = "0.4.0" +version = "0.4.1" authors = ["Mingwei Zhang "] edition = "2021" readme = "README.md" diff --git a/src/parser/mrt/messages/table_dump_v2_message.rs b/src/parser/mrt/messages/table_dump_v2_message.rs index ae9e6f9..5f0d320 100644 --- a/src/parser/mrt/messages/table_dump_v2_message.rs +++ b/src/parser/mrt/messages/table_dump_v2_message.rs @@ -25,7 +25,9 @@ pub fn parse_table_dump_v2_message( TableDumpV2Type::RibIpv6UnicastAddPath | TableDumpV2Type::RibIpv6MulticastAddPath => { TableDumpV2Message::RibAfiEntries(parse_rib_afi_entries(input, v2_type)?) }, - TableDumpV2Type::RibGeneric| TableDumpV2Type::RibGenericAddPath| TableDumpV2Type::GeoPeerTable => { todo!()} + TableDumpV2Type::RibGeneric| TableDumpV2Type::RibGenericAddPath| TableDumpV2Type::GeoPeerTable => { + return Err(ParserError::Unsupported("TableDumpV2 RibGeneric and GeoPeerTable is not currently supported".to_string())) + } }; Ok(msg) diff --git a/src/parser/mrt/mrt_elem.rs b/src/parser/mrt/mrt_elem.rs index c7ac8d1..345b1d0 100644 --- a/src/parser/mrt/mrt_elem.rs +++ b/src/parser/mrt/mrt_elem.rs @@ -14,6 +14,7 @@ use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::net::IpAddr; use itertools::Itertools; +use log::warn; /// Element type. /// @@ -304,7 +305,7 @@ impl Elementor { } } TableDumpV2Message::RibGenericEntries(_t) => { - todo!() + warn!("to_elem for TableDumpV2Message::RibGenericEntries not yet implemented"); } } } @@ -319,9 +320,6 @@ impl Elementor { let peer_ip = v.peer_ip.clone(); let peer_asn = v.peer_asn.clone(); match v.bgp_message { - BgpMessage::Open(_) => { - todo!() - } BgpMessage::Update(e) => { let ( as_path, @@ -442,11 +440,8 @@ impl Elementor { })); } } - BgpMessage::Notification(_) => { - todo!() - } - BgpMessage::KeepAlive(_) => { - todo!() + BgpMessage::Open(_) | BgpMessage::Notification(_) | BgpMessage::KeepAlive(_) => { + // ignore Open Notification, and KeepAlive messages } } }