-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add RPKI RTR protocol support (RFC 6810/8210) #257
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
Conversation
Add full support for the RPKI-to-Router (RTR) protocol, enabling downstream clients to communicate with RTR cache servers and fetch Route Origin Authorizations (ROAs). Models (src/models/rpki/rtr.rs): - Core enums: RtrProtocolVersion (V0/V1), RtrPduType, RtrErrorCode - All 10 PDU structs: SerialNotify, SerialQuery, ResetQuery, CacheResponse, IPv4Prefix, IPv6Prefix, EndOfData, CacheReset, RouterKey, ErrorReport - Unified RtrPdu enum for generic PDU handling - Helper methods: is_announcement(), is_withdrawal(), timing defaults - Serde support behind feature flag Parser (src/parser/rpki/rtr.rs): - parse_rtr_pdu(): parse PDU from byte slice - read_rtr_pdu(): read PDU from impl Read - RtrEncode trait with encode() for all PDU types - RtrError enum for comprehensive error handling - Support for v0/v1 differences (EndOfData length, RouterKey) Testing: - 37 unit tests covering all PDU types - Round-trip tests (encode -> parse) - Version-specific tests (v0 vs v1) - Error case coverage Documentation: - Module-level docs with examples - New "RPKI RTR Protocol Support" section in lib.rs - RTR RFCs added to supported RFCs list - New rtr_client example demonstrating ROA fetching and route validation Example usage: cargo run --example rtr_client -- rtr.rpki.cloudflare.com 8282
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive support for the RPKI-to-Router (RTR) protocol (RFC 6810 v0 and RFC 8210 v1), enabling downstream clients to communicate with RTR cache servers and fetch Route Origin Authorizations (ROAs).
Key changes:
- Complete implementation of RTR protocol PDU data structures and parsing/encoding logic
- Support for both RTR protocol versions (v0 and v1) with version-specific handling
- Comprehensive test suite with 37 unit tests covering all PDU types and error cases
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/models/rpki/rtr.rs | Core RTR protocol data structures including 3 enums (RtrProtocolVersion, RtrPduType, RtrErrorCode) and 10 PDU structs with helper methods |
| src/parser/rpki/rtr.rs | RTR PDU parsing and encoding functions with comprehensive error handling and 37 unit tests |
| src/models/rpki/mod.rs | Module definition for RPKI-related data structures |
| src/parser/rpki/mod.rs | Module definition for RPKI protocol parsers |
| src/models/mod.rs | Added rpki module export |
| src/parser/mod.rs | Added rpki module export |
| src/lib.rs | Added extensive documentation for RTR protocol support with examples and PDU type table |
| examples/rtr_client.rs | Complete working example demonstrating RTR client implementation with ROA validation |
| examples/README.md | Added documentation for rtr_client example |
| README.md | Added RPKI RTR Protocol Support section with examples |
| CHANGELOG.md | Added Unreleased section documenting the new RTR protocol feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #257 +/- ##
==========================================
+ Coverage 90.50% 91.31% +0.80%
==========================================
Files 81 84 +3
Lines 13260 14862 +1602
==========================================
+ Hits 12001 13571 +1570
- Misses 1259 1291 +32 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add unit tests covering PDU enum behavior (type/version), From impls for all PDU types, and error report constructors. Extend parser tests to exercise RtrError Display and source, conversion from I/O errors, parsing edge cases (short/truncated lengths, invalid error codes/UTF-8, invalid IPv6 max length), Router Key minimal SPKI, encoding v0 PDUs, reading multiple PDUs from a stream, parsing with extra bytes, and a full ErrorReport roundtrip with encapsulated PDU and text.
Add full support for the RPKI-to-Router (RTR) protocol, enabling downstream clients to communicate with RTR cache servers and fetch Route Origin Authorizations (ROAs).
Models (src/models/rpki/rtr.rs):
Parser (src/parser/rpki/rtr.rs):
Testing:
Documentation:
Example usage:
To start a functional RTR server with Docker: