Skip to content

Commit e9cf9c7

Browse files
committed
Add support for Software Version Capability
1 parent 337269e commit e9cf9c7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/bgp/message/open.rs

+13
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ impl<Octs: Octets> OpenMessage<Octs> {
235235
})
236236
}
237237

238+
/// Returns the Software Version capability string.
239+
pub fn get_software_version(&self) -> Option<String> {
240+
self.capabilities().find(|c|
241+
c.typ() == CapabilityType::SoftwareVersion
242+
).map(|cap|
243+
String::from_utf8_lossy(cap.value()).to_string()
244+
)
245+
}
238246
}
239247

240248

@@ -488,6 +496,10 @@ impl<Octs: Octets> Capability<Octs> {
488496
let domain_len = parser.parse_u8()? as usize;
489497
parser.advance(domain_len)?;
490498
},
499+
CapabilityType::SoftwareVersion => {
500+
let len = parser.parse_u8()? as usize;
501+
parser.advance(len)?;
502+
},
491503
CapabilityType::PrestandardRouteRefresh => {
492504
if len > 0 {
493505
warn!("PrestandardRouteRefresh with len > 0, capture me for testing purposes!");
@@ -700,6 +712,7 @@ typeenum!(
700712
70 => EnhancedRouteRefresh,
701713
71 => LongLivedGracefulRestart,
702714
73 => FQDN,
715+
75 => SoftwareVersion,
703716
128 => PrestandardRouteRefresh,
704717
130 => PrestandardOutboundRouteFiltering,
705718
131 => PrestandardMultisession,

0 commit comments

Comments
 (0)