Skip to content

Commit a41821b

Browse files
committed
fix insufficient RFC9609 multi-protocol check
1 parent 28e922d commit a41821b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/parser/bmp/messages/peer_up_notification.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::bgp::parse_bgp_message;
2+
use crate::models::capabilities::BgpCapabilityType;
23
use crate::models::*;
34
use crate::parser::bmp::error::ParserBmpError;
45
use crate::parser::bmp::messages::BmpPeerType;
@@ -83,10 +84,14 @@ pub fn parse_peer_up_notification(
8384
if let Some(BmpPeerType::LocalRib) = peer_type {
8485
// Validate that the OPEN messages contain appropriate capabilities for Local RIB
8586
if let BgpMessage::Open(ref open_msg) = &sent_open {
86-
let has_multiprotocol_capability = open_msg
87-
.opt_params
88-
.iter()
89-
.any(|param| matches!(param.param_value, ParamValue::Capacities(_)));
87+
let has_multiprotocol_capability = open_msg.opt_params.iter().any(|param| {
88+
if let ParamValue::Capacities(caps) = &param.param_value {
89+
caps.iter()
90+
.any(|cap| cap.ty == BgpCapabilityType::MULTIPROTOCOL_EXTENSIONS_FOR_BGP_4)
91+
} else {
92+
false
93+
}
94+
});
9095
if !has_multiprotocol_capability {
9196
warn!("RFC 9069: Local RIB peer up notification should include multiprotocol capabilities in fabricated OPEN messages");
9297
}

0 commit comments

Comments
 (0)