-
Notifications
You must be signed in to change notification settings - Fork 37
Add ASPA Support #285
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
Add ASPA Support #285
Conversation
b4d73c9
to
958da6d
Compare
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.
The implementation looks great to me, well structured, simple to follow and understand. The PR description was very helpful, it made it easy for me to get into it.
I could not find any issues, only trivial things that could be improved.
I was not able to verify every detail but everything I looked up is aligned with the draft.
if (((struct pdu_aspa *)pdu)->afi_flags != 0b11) | ||
RTR_DBG1("Warning: AFI flags of received ASPA PDU not set to 0x03"); |
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.
I wonder if ignoring an unexpected value here might cause issue when afi_flags in the future also supports other values with a different meaning. But that probably only happens when the protocol version is also incremented and therefore it is safe to ignore it.
Thanks, @fho. I don’t really have time this week, but I’ll address the changes you requested next week |
@fho Did you take a look at the new changes yet? |
No, I was still waiting for an answer regarding the changed rtr_mgr_init signature + compatibility (#285 (comment)) |
@tanneberger I think there is a confusion because you replied on another thread, that I did not meant. (or you reply was not related to my last comment). |
@fho yeah also just realized that, now the comment is in the correct thread. |
CI: rerun |
can you rebase? |
- add support for rtrv2 including aspa pdus - move rtr pdus to separate header - refactor undo-update logic - add aspa in-place and swap-in update mechanism Co-authored-by: mrzslz <[email protected]> Co-authored-by: carl <[email protected]>
- add `aspa_array`, an ordered dynamic array - add `aspa_table` for storing and managing aspa data - add aspa table update functions - add AS_PATH verification algorithm Co-authored-by: mrzslz <[email protected]> Co-authored-by: carl <[email protected]>
- add aspa_table to rtr_mgr functions - fix typos and format Co-authored-by: mrzslz <[email protected]> Co-authored-by: carl <[email protected]>
- add tests for AS_PATH verification - add tests for `aspa_array` - add tests for aspa pdu parsing and `aspa_table` updating - add tests for live interaction with rtr cache servers Co-authored-by: mrzslz <[email protected]> Co-authored-by: carl <[email protected]>
- update main cmake file Co-authored-by: mrzslz <[email protected]> Co-authored-by: carl <[email protected]>
- removing self-explanatory comments - renaming include guards of ASPA_ARRAY - removing double negation - moving pthread_unlock
CI: rerun |
Let's merge it as soon as @tanneberger gives the final go. |
- adjusted tests and tools - added function rtr_mgr_setup_sockets with functionality that previously resided in rtr_mgr_init
- using lrtr_realloc instead of malloc & memcpy - decreasing the capacity of the array when possible
- added null ptr checks in pfx_validate, aspa_verify and spki_validate - added warnings if the user tries to validate objects where there is no table
@fho I also had to change the user interface: see 0dbb123 -> I also added more validation to handle the new scenario that the user only initialized some tables. I added checks in the validation functions and in the update functions: See this commit: 7a2b951 |
Link to I had a hard time to find it in the UI, GitHub has hidden after a small bubble symbol next to the commit |
81ea44d
to
3ba7a1c
Compare
2fa0c7f
to
1de3677
Compare
- updating README - up- and downscaling now uses an linear offset of 1000
1de3677
to
35d45be
Compare
Introduction
This PR introduces compatibility for RTR version 2 and handling of ASPA RTR PDUs as specified in draft-ietf-sidrops-8210bis-11, section 5.12 and adds AS_PATH verification according to draft-ietf-sidrops-aspa-verification-16, section 6.
Overview
This PR adds a new module called
aspa
which defines a newaspa_table
organizing validated Autonomous System Provider Authorization data received from an RPKI-RTR cache server. Thertr
module was enhanced to parse ASPA PDUs and update theaspa_table
accordingly. Analogous tortr_mgr_validate
(prefixes/ROAs) andrtr_mgr_get_spki
, we're introducing a new functionrtr_mgr_verify_as_path
for AS_PATH verification.rtrclient
has gained a new option,-a
, for printing ASPA data in addition to-p
(prefixes) and-k
.Detailed Design
Storing ASPA Records
ASPA records are structs derived from RTR ASPA PDUs, each containing a customer ASN and a set of providers attested by the customer. The
aspa_table
consists of a linked list where each node holds a reference to anrtr_socket
and anaspa_array
⏤an ordered dynamic array of ASPA records. Eachaspa_array
is comprised of a contiguous block of memory of ASPA records ordered by their customer ASN, enabling faster lookups by binary searching the array of records.Updating an ASPA Table
The ASPA table implements aggregated updating using an array of add record and remove record operations that will be performed sequentially on the ASPA table. This drastically decreases the number of iterations necessary on the existing
aspa_array
to 1. This PR implements two update mechanisms:aspa_array
is manipulated in-place in a single iteration, reducing new memory allocations while blocking callers wanting to verify an AS_PATH (therefore needing read access to the table).aspa_array
is created, incorporating both existing records and simultaneously adding new records in a single iteration. While this approach enables non-blocking updates, it's got a slightly higher memory demand.Details: aspa_private.h
Alternatives Considered
Other Data Structures
This plot shows how the different data structures compare in different benchmarks against each other:
AS_PATH Verification Algorithm Implementation
We tested several implementations of the verification algorithm: netd-tud/IETF-ASPA/hackathon. The algorithm integrated into this PR is an optimized version of the draft algorithm which avoids checking any AS hop twice.
Tests & Quality
This PR has test coverage for
aspa_array
,aspa_table
and rtr_sync with ASPAAdditionally, we checked for memory leaks and other faulty memory access using
valgrind --leak-check=full
.Stats
Based on ASRank relationships we estimate ~75K ASPA records inferred from BGP paths. As an upper limit we consider an ASPA record to take up 24 bytes of memory.
Update Mechanism Performance Measurements
We conducted performance tests on both update approaches:
Ping: @waehlisch @mroethke @fho