Skip to content
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

fix(iroh-net): reverse ip-port mapping stores only direct addresses in the peermap #1606

Conversation

divagant-martian
Copy link
Contributor

@divagant-martian divagant-martian commented Oct 10, 2023

Description

We were storing reverse mappings for SendAddr::Derp in the PeerMap. This means basically treating the DERP as a peer itself. We concluded this is something we shouldn't do. To fix the issue, the better solution is to enforce it via the type system. As such, we now only do reverse mapping from socket addresses.

As a note, I added a new type IpPort. Using SocketAddrs as key to hashmaps often goes wrong with ipv6 because of the flow control & class fields it contains. These fields can't be assumed stable even within the same connection: sending a the socket address made from an (ipv6, port) and receiving a response can make it look like the socket address is different (same ip, same port, different flow labels) Ignoring these fields has some limitations in extremely exceptional cases (link local addresses with a single interface) As a note, ignoring these fields is what tailscale does (all they store is an ip and a port). This makes communications over ipv6 work better in the common case so I think it's worth doing

Notes & open questions

Some references

Change checklist

  • Self-review.
  • Documentation updates if relevant.
  • Tests if relevant.

@divagant-martian divagant-martian changed the title fix(iroh-net): revert ip-port mapping stores only direct addresses in the peermap fix(iroh-net): reverse ip-port mapping stores only direct addresses in the peermap Oct 10, 2023
@divagant-martian divagant-martian marked this pull request as ready for review October 10, 2023 18:58
@b5 b5 added this to the v0.7.0 milestone Oct 11, 2023
@divagant-martian divagant-martian added this pull request to the merge queue Oct 11, 2023
Merged via the queue into n0-computer:main with commit 176d632 Oct 11, 2023
15 checks passed
@divagant-martian divagant-martian deleted the reverse-map-only-direct-addresses branch December 10, 2023 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants