-
-
Notifications
You must be signed in to change notification settings - Fork 4
BGP and BMP parsing support #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DRiKE
added a commit
that referenced
this pull request
Jan 10, 2024
Breaking changes * Extensive moving and refactoring of code, With the focus of _routecore_ heavily shifting towards BGP and BMP related functionality, we decided to copy over the few types used by dependants to those dependants and remove their depedency on _routecore_. This also means we could drop code from _routecore_, and get rid of certain dependencies and feature flags. In addition to that, there has been extensive renaming throughout the code base, though not all of the touched code was ever properly released before. All in all, the 0.4.0 release should be considered breaking and not backwards compatible. New * Parsing of BGP and BMP messages. ([#14]) The newly added feature flags `bgp` and `bmp` enable parsing capabilities for these messages using the [OctSeq](https://github.com/NLnetLabs/octseq) crate. This allows parsing of raw wireformat representations in multiple data types, including [bytes::Bytes](https://docs.rs/bytes/latest/bytes/struct.Bytes.html). The parsing and the resulting types `bgp::Message` and `bmp::Message` are mostly non-allocating and provide (lazy) iterators to the actual data (e.g. Path Attributes or NLRI in a BGP UPDATE PDU), to enable use in high throughput scenarios. * Composing of BGP messages. Creating BGP messages is supported to a certain extent, note that the API is still limited. For BGP OPENs, the Optional Parameters are limited to only the Capability type, and more specifically, only the Four Octet capability (RFC6793), MultiProtocol (RFC4760) and AddPath (RFC7911) can be set. For BGP UPDATEs, the builder (`bgp::message::update_builder`) includes methods to add announcements, withdrawals and next hop information for conventional IPv4 Unicast and MultiProtocol address families. Mandatory path attributes and standard communities have dedicated methods, but arbitrary PathAttributes can be added as well. Depending on the resulting total size, the builder results in multiple PDUs to adhere to the protocol. BGP NOTIFICATIONs and KEEPALIVEs can be created as well, so all message types needed for setting up a BGP session are supported. Note that actually setting up and maintaining a BGP session is (currently) not part of `routecore`. * Added new `asn::SmallAsnSet` which, as, the name suggests, is supposed to hold a relatively small set of ASNs. ([#22]) * Added implementations for the `arbitrary::Arbitrary` trait to ASN and IP resource types. ([#24]) * Reworked AsPath Most of the code related to the BGP path attribute AS_PATH has been overhauled and moved away from `asn` into `bgp::aspath`. The main struct is now generic over `Octets` that represent the wireformat of the path attribute, moving away from the 'sentinel ASN'-approach. It also introduces `HopPath`, a representation that is more convenient to reason about than the wireformat. `HopPath` replaces `AsPathBuilder`. ([#23]) * Added `fn contains` to check whether an `std::net::IpAddr` lies within a `addr::Prefix`. ([#35]) * Better parsing and creation of BGP NOTIFICATION messages. ([#35]) Other changes * Changed the minimal supported Rust version to 1.71. * Changed Rust edition from 2018 to 2021. [#14]: #14 [#22]: #22 [#23]: #23 [#24]: #24 [#35]: #35
DRiKE
added a commit
that referenced
this pull request
Jan 18, 2024
## 0.4.0 Released 2024-01-18. Breaking changes * Extensive moving and refactoring of code With the focus of _routecore_ heavily shifting towards BGP and BMP related functionality, we decided to copy over the few types used by dependants to those dependants and remove their depedency on _routecore_. This also means we could drop code from _routecore_, and get rid of certain dependencies and feature flags. In addition to that, there has been extensive renaming throughout the code base, though not all of the touched code was ever properly released before. All in all, the 0.4.0 release should be considered breaking and not backwards compatible. New * Parsing of BGP and BMP messages. ([#14]) The newly added feature flags `bgp` and `bmp` enable parsing capabilities for raw wireformat representations of these messages in multiple data types, including [bytes::Bytes](https://docs.rs/bytes/latest/bytes/struct.Bytes.html). The parsing and the resulting types `bgp::Message` and `bmp::Message` are mostly non-allocating and provide (lazy) iterators to the actual data (e.g. Path Attributes or NLRI in a BGP UPDATE PDU), to enable use in high throughput scenarios. * Composing of BGP messages. Creating BGP messages is supported to a certain extent, note that the API is still limited. For BGP OPENs, the Optional Parameters are limited to only the Capability type, and more specifically, only the Four Octet capability (RFC6793), MultiProtocol (RFC4760) and AddPath (RFC7911) can be set. For BGP UPDATEs, the builder (`bgp::message::update_builder`) includes methods to add announcements, withdrawals and next hop information for conventional IPv4 Unicast and MultiProtocol address families. Mandatory path attributes and standard communities have dedicated methods, but arbitrary PathAttributes can be added as well. Depending on the resulting total size, the builder results in multiple PDUs to adhere to the protocol. BGP NOTIFICATIONs and KEEPALIVEs can be created as well, so all message types needed for setting up a BGP session are supported. Note that actually setting up and maintaining a BGP session is (currently) not part of `routecore`. * Added new `asn::SmallAsnSet` which, as, the name suggests, is supposed to hold a relatively small set of ASNs. ([#22]) * Added implementations for the `arbitrary::Arbitrary` trait to ASN and IP resource types. ([#24]) * Reworked AsPath Most of the code related to the BGP path attribute AS_PATH has been overhauled and moved away from `asn` into `bgp::aspath`. The main struct is now generic over `Octets` that represent the wireformat of the path attribute, moving away from the 'sentinel ASN'-approach. It also introduces `HopPath`, a representation that is more convenient to reason about than the wireformat. `HopPath` replaces `AsPathBuilder`. ([#23]) * Added `fn contains` to check whether an `std::net::IpAddr` lies within a `addr::Prefix`. ([#35]) * Better parsing and creation of BGP NOTIFICATION messages. ([#35]) Other changes * Changed the minimal supported Rust version to 1.71. * Changed Rust edition from 2018 to 2021. [#14]: #14 [#22]: #22 [#23]: #23 [#24]: #24 [#35]: #35
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR merges the
generic-messagesbranch, which once started out asbgmp, and introduces parsing of BGP and BMP messages.N.B.: Parsing relies on the
OctSeqcrate, and GATs with that. This means the MSRV is bumped to 1.65.Notes:
bgpandbmp(which relies onbgp)bgpfsmfeature flag