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

webrtc: correctly report incoming packet address on muxed connection #2586

Merged
merged 3 commits into from
Oct 12, 2023

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Sep 26, 2023

The address in ReadFrom should be the address of the received packet and not the address of the first packet received from the peer. If the interface used to send the first packet disallows incoming packets, this will lead to a connection not being established.

The simplest way to test this is to use tailscale. Packets originated from tailscale address can be sent to localhost addresses, packets from localhost can't be sent to tailscale listeners. So if the first packet from the dialer is from the tailscale interface, the connection will never be established because muxedConnection.ReadFrom will always return the address of the packet as the tailscale address and we will ignore all reachable localhost packets.

My theory is that this is what is causing flakiness like the one observed here: https://github.com/libp2p/go-libp2p/actions/runs/6312484104/job/17138640142?pr=2584
The difference being the interface is a docker interface on the machine.

The change is inline with the pion provided udp_mux implementation: https://github.com/pion/ice/blob/master/udp_muxed_conn.go#L140. They maintain a list of addresses on the connection, we keep this list on the udpmux.

Also fixes: #2536

@sukunrt sukunrt changed the title webrtc: fix udp mux multiple interface bug webrtc: correctly report incoming packet address on muxed connection Sep 26, 2023
p2p/transport/webrtc/udpmux/mux.go Outdated Show resolved Hide resolved
@sukunrt sukunrt merged commit c2124f7 into master Oct 12, 2023
10 of 11 checks passed
@sukunrt sukunrt deleted the sukun/webrtc-udpmux-addr branch October 12, 2023 09:49
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.

WebRTC UDP Mux: more tests
2 participants