Skip to content

Reply pather per source#66

Merged
juagargi merged 3 commits into
hummingbird-endhostfrom
reply-pather-per-source
Jul 13, 2026
Merged

Reply pather per source#66
juagargi merged 3 commits into
hummingbird-endhostfrom
reply-pather-per-source

Conversation

@juagargi

@juagargi juagargi commented Jul 13, 2026

Copy link
Copy Markdown
Owner

The design of snet has one ReplyPather per SCION network object.
The snet.Conn that is obtained from Listen or Dial copies this reference to its own Conn object.
Additionally, there is only one Conn object at the server, where it just obtains it after Listen,
and simply reads all packets, obtaining the remote address as a return value of ReadFrom.

Since the HummReplyPather keeps state per client, it has to do its own bookkeeping.
For each Packet, a client ID is obtained using the IA, IP, and UDP port in said packet.
For each client ID, the HummReplyPather can keep a reverse reservation,
if one was sent via an E2E extension header.

If the reverse reservation contains no flyovers, it is not stored; it doesn't offer better guarantees to the server than the reverse path used to carry the packet from the client to the server in the first place.
Thus it's equivalent to just reverse the regular forward path received at the server.
It would remove a previous reverse reservation for that client ID if there were any,
to make the equivalence truly complete.

This PR adds extensive tests covering the following features of the HummReplyPather:

  • Reverse reservation per client ID.
  • Concurrent use by different goroutines.
  • Cleanup of old (very expired) reverse reservations: avoids the memory consumption to grow forever.
  • Reverse reservations without flyovers do nothing, or clean a previous reverse reservation, even if not expired.
  • Cleanup happens at the SetState function: the only place where the storage grows, now also ensures it can shrink.
  • Benchmark of the cost of cleaning up expired reservations: on a old desktop machine, between 200-800ns, depending on the number of existing reservations.

This change is Reviewable

juagargi added 3 commits July 13, 2026 11:27
TODO:
- Support concurrency.
- Cleanup map eventually.
- Add unit tests for multiple clients.
- Add unit tests for concurrency.
Still TODO:
- Reject reverse rsvs. without flyovers.
Since they are not better than just reversing the current path,
do not store them.
If one of them is received as a reverse reservation, remove any existing
previous reverse reservation for that particular source ID.
@juagargi juagargi marked this pull request as ready for review July 13, 2026 11:47

@juagargi juagargi left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juagargi reviewed 6 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on juagargi).

@juagargi juagargi merged commit e225897 into hummingbird-endhost Jul 13, 2026
1 of 5 checks passed
@juagargi juagargi deleted the reply-pather-per-source branch July 13, 2026 11:50
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.

1 participant