Skip to content

rpc: disable mDNS when force_relay or force_p2p is set#183

Closed
danielbotros wants to merge 1 commit into
mainfrom
disable-mdns-on-force-relay-p2p
Closed

rpc: disable mDNS when force_relay or force_p2p is set#183
danielbotros wants to merge 1 commit into
mainfrom
disable-mdns-on-force-relay-p2p

Conversation

@danielbotros

Copy link
Copy Markdown
Member

Problem

force_relay / force_p2p exist to force a connection through a specific WebRTC transport (relay-only TURN, or host/srflx-only). But the dialer attempts mDNS local discovery first, and when the target machine is reachable on the LAN/loopback it connects via plain gRPC over mDNS — bypassing WebRTC/ICE entirely and silently ignoring force_relay/force_p2p.

Observed in the SDK dial-options integration tests against the Python SDK (which dials via these FFI bindings): a force_relay connection that should route through TURN instead connected locally over mDNS (no relay candidate_pair ever appears), and a force_relay connection with a deliberately-invalid TURN URI (which must fail) succeeded over mDNS. RUST_LOG=debug showed Starting mDNS queryFound address via mDNSmDNS create_channel: loopback 127.0.0.1 with no TURN allocation.

Fix

Disable mDNS in the force_relay() and force_p2p() builders. Since the FFI (viam_dial_opts_set_force_relay/viam_dial_opts_set_force_p2p) routes through these builders, Python/C consumers pick this up automatically (a viam-python-sdk bundled-rust-utils bump is the follow-up to ship it). Mirrors the Go dialer behavior.

Draft for review/discussion.

force_relay/force_p2p force a connection through a specific WebRTC
transport, but the dialer attempts mDNS local discovery first and will
connect via plain gRPC over LAN/loopback when the target is locally
reachable, bypassing WebRTC/ICE and silently ignoring the flag. Disable
mDNS in both builders so the FFI (and all consumers) get correct behavior.
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.

1 participant