fix(relay): malformed reported relayed addr when relay peer is dialer #5576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I don't know if it is a bug or not, but in the
NetworkBehaviour
trait, there is a discrepancy with the remote multiaddr given tohandle_established_Inbound_connection
and the one given tohandle_established_OUTbound_connection
.handle_established_Inbound_connection
receive theremote_addr
not suffixed with/p2p/<remote_peer_id>
buthandle_established_OUTbound_connection
do receiveaddr
suffixed with/p2p/<remote_peer_id>
.This is causing a weird behavior in the
relay
protocol because when creating theHandler
, the remote address is passed down as is, and when a "relayed connection" is negotiated with a remote peer through the relay peer, the/p2p-circuit
is simply pushed without checking the form of the multiaddr.Because of that, we encountered some bug where address was reported like this:
/ip4/1.2.3.4/udp/1234/quic/p2p-circuit
(note the relay peer_id missing), which is invalid (here the specs of a correct relayed address).This PR simply address the bug of the relay peer but maybe something should be done to make sure that the same format is received, both from
incoming
andoutgoing
connections. Since I don't know if it could have side effects else-were, I have just addressed the problem described above.Notes & open questions
Change checklist