Skip to content

rtrclient: Fix crash on empty ROA array#321

Merged
Brias merged 1 commit intortrlib:masterfrom
ydahhrk:empty-roas
Feb 18, 2026
Merged

rtrclient: Fix crash on empty ROA array#321
Brias merged 1 commit intortrlib:masterfrom
ydahhrk:empty-roas

Conversation

@ydahhrk
Copy link
Contributor

@ydahhrk ydahhrk commented Feb 6, 2026

Contribution description

When rtrclient's -e argument was included, the mustach interface was always attempting to access the ROA array, even when it was empty.

The array can be empty when the server returns a session that contains no prefix PDUs.

Testing procedure

I left a public server at fort-testing.dev.lacnic.net:8323.

Output before patch:

$ rtrclient -e tcp -pa fort-testing.dev.lacnic.net 8323
...
(2026/02/05 18:21:35:896903): RTR Socket: Sync successful, received 0 Prefix PDUs, 0 Router Key PDUs, 1 ASPA PDUs, session_id: 13155, SN: 1
(2026/02/05 18:21:35:896947): RTR_MGR: Group(1) status changed to: RTR_MGR_ESTABLISHED
(2026/02/05 18:21:35:896980): RTR Socket: State: RTR_ESTABLISHED
(2026/02/05 18:21:35:897009): RTR Socket: waiting 3600 sec. till next sync
Sync done
rtrclient: /home/ahhrk/git/rtrlib/./third-party/tommyds/tommyarray.h:97: tommy_array_ref: Assertion `pos < array->count' failed.
Aborted (core dumped)

Output after patch:

$ rtrclient -e tcp -pa fort-testing.dev.lacnic.net 8323
...
(2026/02/05 18:18:58:748383): RTR Socket: Sync successful, received 0 Prefix PDUs, 0 Router Key PDUs, 1 ASPA PDUs, session_id: 13155, SN: 1
(2026/02/05 18:18:58:748422): RTR_MGR: Group(1) status changed to: RTR_MGR_ESTABLISHED
(2026/02/05 18:18:58:748454): RTR Socket: State: RTR_ESTABLISHED
(2026/02/05 18:18:58:748481): RTR Socket: waiting 3600 sec. till next sync
Sync done

(2026/02/05 18:18:59:558883): RTR_MGR: rtr_mgr_stop()
(2026/02/05 18:18:59:558932): RTR Socket: rtr_stop()
(2026/02/05 18:18:59:558962): RTR_MGR: Calling rtr_mgr_cb with RTR_SHUTDOWN
(2026/02/05 18:18:59:558988): RTR_MGR: Received RTR_SHUTDOWN callback
(2026/02/05 18:18:59:559021): RTR_MGR: Group(1) status changed to: RTR_MGR_CLOSED
(2026/02/05 18:18:59:559048): RTR Socket: pthread_cancel()
(2026/02/05 18:18:59:559721): RTR Socket: pthread_join()
(2026/02/05 18:18:59:560149): TCP Transport(fort-testing.dev.lacnic.net:8323): Socket closed
 HOST:  fort-testing.dev.lacnic.net:8323
- ASPA 16777472 => [ 4294967295, 123, 70000 ]
(2026/02/05 18:18:59:560231): RTR Socket: Socket shut down
(2026/02/05 18:18:59:560260): RTR_MGR: rtr_mgr_free()
(2026/02/05 18:18:59:560296): TCP Transport(fort-testing.dev.lacnic.net:8323): Freeing socket

@Brias
Copy link
Contributor

Brias commented Feb 9, 2026

@ydahhrk Many thanks for this detailed and easy to test pull request. 🙏

I only have a few minor requests regarding code style and consistency, then we can merge this PR.

When rtrclient's -e argument was included, the mustach interface was
always attempting to access the ROA array, even when it was empty.

The array can be empty when the server returns a session that contains
no prefix PDUs.
@ydahhrk ydahhrk closed this Feb 12, 2026
@ydahhrk ydahhrk deleted the empty-roas branch February 12, 2026 22:20
@ydahhrk ydahhrk restored the empty-roas branch February 12, 2026 22:20
@ydahhrk ydahhrk deleted the empty-roas branch February 12, 2026 22:21
@ydahhrk ydahhrk restored the empty-roas branch February 12, 2026 22:21
@ydahhrk
Copy link
Contributor Author

ydahhrk commented Feb 12, 2026

Sorry... not sure what happened there.

The commit should be fixed now.

@ydahhrk ydahhrk reopened this Feb 12, 2026
Brias
Brias previously approved these changes Feb 13, 2026
@Brias Brias dismissed their stale review February 13, 2026 11:07

Some tests are failing. I will check next week why.

@Brias Brias merged commit 03a6dd7 into rtrlib:master Feb 18, 2026
1 check failed
@ydahhrk ydahhrk deleted the empty-roas branch February 25, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants