Skip to content

Skip host-socket checks in relay-only ICE mode - #470

Closed
Mr444-dev wants to merge 1 commit into
ValveSoftware:masterfrom
Mr444-dev:fix/relay-only-ice
Closed

Mr444-dev wants to merge 1 commit into
ValveSoftware:masterfrom
Mr444-dev:fix/relay-only-ice

Conversation

@Mr444-dev

Copy link
Copy Markdown
Contributor

Fixes #452.

In relay-only mode, native ICE still tests host sockets against peer relay candidates. A TURN server drops those direct checks, and with multiple interfaces they can delay the usable relay pairs until the connection times out.

Skip host-socket candidates when the permitted candidate types contain only relay candidates. Add a regression case with two symmetric-NAT adapters per peer.

The candidate guard follows the fix proposed by @easymod0 in #452.

Verification:

  • Built test_p2p with CMake/MSVC Debug, native ICE enabled and WebRTC disabled.
  • Ran the new P2P scenario in isolation on Windows: the parent revision timed out during rendezvous; the patched revision connected over relay on both runs with --repeat=2.
  • git diff --check passed.

zpostfacto pushed a commit that referenced this pull request Nov 24, 2026
Relay-only mode stopped us from advertising host and reflexive
candidates, but we still sent connectivity checks directly from our
socket to whatever candidates the peer advertised.  If the peer was not
relay-only, one of those checks could succeed and be nominated, giving
a direct route and exposing our address, which is what relay-only mode
is supposed to prevent.

It also hurt connecting.  Host socket checks to the peer's relay
address are dropped by the TURN server, and since pairs are unfrozen
by remote foundation, those dead checks could hold up the relay pairs
until the connection timed out.  With more than one interface, this
reliably failed against a real TURN server.

Add a test with two symmetric NAT adapters per peer in relay-only mode.

Fixes part of #452.  From PR #470.
zpostfacto pushed a commit that referenced this pull request Nov 24, 2026
Relay-only mode stopped us from advertising host and reflexive
candidates, but we still sent connectivity checks directly from our
socket to whatever candidates the peer advertised.  If the peer was not
relay-only, one of those checks could succeed and be nominated, giving
a direct route and exposing our address, which is what relay-only mode
is supposed to prevent.

It also hurt connecting.  Host socket checks to the peer's relay
address are dropped by the TURN server, and since pairs are unfrozen
by remote foundation, those dead checks could hold up the relay pairs
until the connection timed out.  With more than one interface, this
reliably failed against a real TURN server.

Add a test with two symmetric NAT adapters per peer in relay-only mode.

Fixes part of #452.  From PR #470.

(cherry picked from commit 01bdab6)
@zpostfacto

Copy link
Copy Markdown
Contributor

Thanks! Merged as 01bdab6. I rewrote the comment and commit message to lead with the bigger problem: in relay-only mode we also sent checks directly to whatever candidates the peer advertised, so a direct route could be nominated and expose our address. Your fix closes that too.

This fixes the first half of #452. I'm leaving #452 open for the second half: pairs are unfrozen by remote foundation only, so checks to the same remote candidate wait on each other across all our local candidates. That's ours to fix.

@zpostfacto zpostfacto closed this Nov 24, 2026
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.

ICE (native client): relay-only connections time out against a real TURN server; host-socket checks starve the relay pairs

2 participants