libp2p / libp2p/rust-libp2p

Autonat doesn't support multiple addresses well

Open
#4,873 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
5.6k
Forks
1.3k
Avg merge
8h 47m
Merged PRs (30d)
19

Description

Right now autonat sends concatenation of other_addresses and listen_addresses, which are always processed in the same order by receiving side:
https://github.com/libp2p/rust-libp2p/blob/caf9da4a69f1cce8183d4b17c792476ee44c37bc/protocols/autonat/src/behaviour/as_client.rs#L188-L206

If my understanding of the code is correct, only the first successfully dialed address will be returned.

This is problematic in case of multiple addresses though:

  • out of multiple public addresses only the first one will be confirmed
  • mix of public and private addresses doesn't seem to play very nicely with this either

I think the solution here is that either sender of the probe or receiver should shuffle addresses such that we check different addresses.

I'm not very familiar with autonat right now to understand if it is architecturally supposed to support this use case at all since confirmations will be done for different addresses in different calls.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in protocols/autonat/src/behaviour/as_client.rs at lines 188-206 and trace how other_addresses and listen_addresses are concatenated and processed by the receiving side. Determine whether multiple addresses are intended to be confirmed across probe calls, then define and validate behavior that handles multiple public and mixed public/private addresses.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.