aspa: Fix provider sorting (#322)Previously, the comparator function returned the difference between the two compared `uin32_t`
values casted to a signed `int`, which could lead to wrong sorting results when the difference is too
big. This fix specifically returns `1`, `0`, or `-1` avoiding any errors due to casting.
rtrclient: Fix crash on empty ROA array (#321)When rtrclient's `-e` argument was included, the mustache interface was
always attempting to access the ROA array, even when it was empty, which
could result in a segmentation fault.
rtrlib: Ensure data passed to users of library is sane (#318)Version 0.8.0 of the library is generating this valgrind issues:
==3239843== Thread 5:
==3239843== Syscall param write(buf) points to uninitialised byte(s)
==3239843== at 0x4D308BF: __libc_write (write.c:26)
==3239843== by 0x4D308BF: write (write.c:24)
==3239843== by 0x486665A: rpki_update_cb_sync_rtr (bgp_rpki.c:758)
==3239843== by 0x54D5B9B: pfx_table_notify_clients (trie-pfx.c:6...
Fix memory leaks* rtrlib: Fix memory leaks
- When running the tests with Valgrind it detected multiple
memory leaks; some of them were caused by missing calls to
`free()` in the tests cases but others were real memory
leaks within the RTRlib.
* aspa: Fix memory leak when ASPA record is replaced
- Previously, whenever an existing ASPA record was removed by a new one,
the provider ASN list of the repl...
aspa: Remove in-place update algorithm- The in-place update algorithm didn't work anymore after upgrading the
swap-in algorithm to draft version 21 of [sidrops-8210bis]. Since
swap-in was the default algorithm, all code related to the in-place
algorithm has been removed (at least for now).
[sidrops-8210bis]: https://datatracker.ietf.org/doc/html/draft-ietf-sidrops-8210bis-21
rtrlib: Make API consistent- To avoid name clashes and have a consistent API naming, every function,
enum, struct, ... that is exported is prefixed with `rtr_`/`RTR_`.
- `int` return types are changed to the pertinent `enum` type if applicable.
- Change `bool` type to indicate the performed operation when notifying users
about changes in the SPKI and PFX tables to specific `enum` type to improve
readability and mak...
rtr_mgr: Add callback to notify users when a new thread starts- Previously, it was not possible for users of the RTRlib to run arbitrary
code once a processing thread for an RTR socket has been started.
This commit adds an optional callback for notifying the user whenever a
new thread has been started and in the future possibly about other events
as well.
- The callback can be configured when initializing the RTRlib.
aspa: Replace existing ASPA record with new one- Whenever an ASPA announcement PDU is received and an ASPA record for that
customer ASN already exists, the new record replaces the old one as defined
in [draft-ietf-sidrops-8210bis-21].
- When an ASPA announcement and a withdrawal is received (in that order) within
one response from the cache server, it is considered a no-op if the customer
ASN doesn't exist yet; if it already exists,...
tests: Use domain of TU dresden for live tests- Further, the tests `test_live_fetching` and `test_live_disabled_features`
are added to the CTest test suite and thus will be executed when running
`ctest`
rtr: Check for plausible length of ASPA PDU- [draft-ietf-sidrops-8210bis-21] specifies that an ASPA PDU must have a
length that is divisible by 4 to be correct. This commit adds a check
and if its length is not divisible by 4 a `Corrupt Data (0)` error is
sent.
- The unit tests in `test_aspa.c` are extended by checks for sent error
PDUs.
[draft-ietf-sidrops-8210bis-21]: https://datatracker.ietf.org/doc/html/draft-ietf-sidrops-8...
rtr: Remove commented out check for `afi_flags`- The previous ASPA implementation contained an `afi_flags` field
in the PDU, which doesn't exist (anymore) in the draft version 21.
Thus, everything remaining to `afi_flags` is removed.
rtr_mgr: Change return type from `int` to enum- Although most functions within the `rtr_mgr` return an enum value,
the function signature defines the return type as `int`. This is
error-prone and reduces readability. To fix this, the `int` return
data type has been replaced by the respective enum type.
Ignore received PDUs of supported but disabled features- Previously, when a PDU of a supported but disabled feature has been received,
a segmentation fault was caused for some of the PDUs due to missing NULL-checks.
Now, those PDUs are ignored and not further processed.
- Previously, a feature that has not been initialized would cause a segmentation
fault when the RTRlib manager was stopped and freed. This has been fixed by
adding the neces...
rtr: Respond with error if ASPA announcement PDU contains no providers- Draft `8210bis` version 21; Section 5.12. states that an ASPA
announcement PDU must always contain at least one provider
autonomous system number
- If an announcement doesn't contain any provider autonomous
system numbers an error `ASPA Provider List Error (9)` is
sent to the cache server and the transport connection is
closed
rtr: Respond with error if ASPA withdrawal PDU contains data- Draft `8210bis` version 21; Section 5.12. states that an ASPA
withdrawal PDU must always be exactly 12 octets long and thus
must not contain any `Provider Autonomous System Numbers`
- Since no other error code is specified for that scenario,
a `Corrupt Data (0)` error response is sent to the cache server
rtr: Update format of ASPA PDU to `8210bis` Draft version 21This removes the `uint16_t provider_count` and the `uint8_t afi_flags` fields
of `struct pdu_aspa`, changes the data type of `uint16_t zero` to `uint8_t`,
and moves the `uint8_t flags` field to be directly after the `uint8_t type`
field.
Fix: Add missing memory allocation NULL-checks (#298)* transport: add missing NULL checks to memory allocation calls
- Memory allocation by `lrtr_calloc` or `lrtr_malloc` could fail which led
to undefined behavior / segmentation faults when dereferencing the result
pointer while initializing an SSH or TCP socket. Now, the `tr_ssh_init`
and `tr_tcp_init` functions prematurely return with an error code instead.
- In addition, the `tr_ssh_ini...
transport: fix bad copy-paste in `tr_ssh_init` (#299)- Checking the wrong pointer (`ssh_socket->config.client_privkey_path`
instead of `ssh_socket->config.server_hostkey_path`) for `NULL` after
copying the server host key path to the SSH socket struct could lead
to undefined behavior or at least an unnecessary error if
`ssh_socket->config.client_privkey_path` is set to `NULL`.
This commit fixes the check so that the correct pointer is e...
rtrlib: extra checks for when user didn't initialize some tables- 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
rtrlib: reworking user interface adding rtr_mgr_setup_sockets function- adjusted tests and tools
- added function rtr_mgr_setup_sockets with functionality that
previously resided in rtr_mgr_init
tools: update rtrclient to support aspa- update main cmake file
Co-authored-by: mrzslz <moritz.schulz@proton.me>
Co-authored-by: carl <115627588+carl-tud@users.noreply.github.com>
tests: add aspa tests- 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 <moritz.schulz@proton.me>
Co-authored-by: carl <115627588+carl-tud@users.noreply.github.com>
rtrlib: add aspa to central management data structure- add aspa_table to rtr_mgr functions
- fix typos and format
Co-authored-by: mrzslz <moritz.schulz@proton.me>
Co-authored-by: carl <115627588+carl-tud@users.noreply.github.com>
rtr: add support for aspa pdus- 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 <moritz.schulz@proton.me>
Co-authored-by: carl <115627588+carl-tud@users.noreply.github.com>
[FIX] Bit selection error for trie buildingMotivation:
- test cases for arm7 Ubuntu18.04 and ppc64le Ubuntu18.04 failed
- pipeline results in fail after commit
- minor improvements for uniform build up live_tests
How:
- trie building is based on address (binary-trie)
- getting a single bit for IPv6 addresses has been error prone for
bit_postion > 95
- unsure why other distributions did not fail
=> may be due to different en...
Updates public rpki-cache and fixes pipline issuesMotivation
- get pipeline checks running
How:
- insert valid rpki-cache which runs also rtr
- edit url in live_tests, README
- modify changelog date in librtr.spec file
=> no changelog results in error, because all changes older
than 2years are dismissed
- add more output on failure for tests
Updates the used public rpki-caches for testing environmentMotivation
- get pipeline checks running
How:
- find valid rpki-cache which runs also rtr
- edit url in live_tests