Connection gater rejects peers on Tailscale point-to-point interfaces (/32, /128) #361

Open
opened 2026-03-13 14:44:10 +00:00 by oneingan · 0 comments

We are using data-mesher over Tailscale and hit a problem when cluster.interfaces is restricted to ["tailscale0"].

What happens

  • Both peers can resolve each other and establish raw TCP connectivity on the data-mesher port.
  • But data-mesher never properly discovers/exchanges state.
  • Logs look like:
    • no peers discovered in DHT, skipping join state exchange
    • push/pull failure, will try again later
    • failed to exchange state with peers after 3 retries

Environment

  • data-mesher version: 0.1.0
  • transport: Tailscale
  • interface addresses are point-to-point host routes, e.g.:
    • node A: 100.64.0.91/32, fd7a:115c:a1e0::5a/128
    • node B: 100.64.0.4/32, fd7a:115c:a1e0::ff/128

Relevant config

[cluster]
interfaces = ["tailscale0"]
port = 17946
bootstrap_peers = ["/dns/peer.ts.example/tcp/17946/p2p/"]

Observed behavior

  • With interfaces = ["tailscale0"], peers do not successfully form the cluster.
  • With interfaces = [], the cluster works immediately.

Suspected root cause

The interface gater appears to treat “reachable via interface” as “remote IP is contained by one of the local interface CIDRs”.

Relevant code paths:

  • pkg/cluster/gater.go
  • pkg/net/net.go

In particular, IsReachable() checks:

  • enumerate local interface addresses
  • for each *net.IPNet, test ipNet.Contains(remoteIP)

That fails for Tailscale point-to-point addresses because:

  • local 100.64.0.91/32 does not contain remote 100.64.0.4
  • local fd7a:...:5a/128 does not contain remote fd7a:...:ff

So peers on the same logical Tailscale interface are rejected even though the connection is valid and routable.

Why this matters

This makes cluster.interfaces = ["tailscale0"] unusable on common Tailscale setups, even though it is exactly the interface users want to restrict data-mesher to.

Current workaround

We had to set:

[cluster]
interfaces = []
and rely on firewall / tailnet ACLs to constrain exposure.

Suggested fix

The reachability test probably should not use subnet containment for point-to-point interfaces. Possible approaches:

  • treat /32 and /128 addresses on the selected interface as valid local bind interfaces, but do not use them to reject remote peers via Contains()
  • or determine interface suitability by routing / system interface ownership instead of subnet containment
  • or special-case point-to-point interfaces like Tailscale

Happy to provide more logs / exact repro if useful.

We are using data-mesher over Tailscale and hit a problem when cluster.interfaces is restricted to ["tailscale0"]. ### What happens - Both peers can resolve each other and establish raw TCP connectivity on the data-mesher port. - But data-mesher never properly discovers/exchanges state. - Logs look like: - no peers discovered in DHT, skipping join state exchange - push/pull failure, will try again later - failed to exchange state with peers after 3 retries ### Environment - data-mesher version: 0.1.0 - transport: Tailscale - interface addresses are point-to-point host routes, e.g.: - node A: 100.64.0.91/32, fd7a:115c:a1e0::5a/128 - node B: 100.64.0.4/32, fd7a:115c:a1e0::ff/128 ### Relevant config [cluster] interfaces = ["tailscale0"] port = 17946 bootstrap_peers = ["/dns/peer.ts.example/tcp/17946/p2p/<peer-id>"] ### Observed behavior - With interfaces = ["tailscale0"], peers do not successfully form the cluster. - With interfaces = [], the cluster works immediately. ### Suspected root cause The interface gater appears to treat “reachable via interface” as “remote IP is contained by one of the local interface CIDRs”. Relevant code paths: - pkg/cluster/gater.go - pkg/net/net.go In particular, IsReachable() checks: - enumerate local interface addresses - for each *net.IPNet, test ipNet.Contains(remoteIP) That fails for Tailscale point-to-point addresses because: - local 100.64.0.91/32 does not contain remote 100.64.0.4 - local fd7a:...:5a/128 does not contain remote fd7a:...:ff So peers on the same logical Tailscale interface are rejected even though the connection is valid and routable. ### Why this matters This makes cluster.interfaces = ["tailscale0"] unusable on common Tailscale setups, even though it is exactly the interface users want to restrict data-mesher to. ### Current workaround We had to set: [cluster] interfaces = [] and rely on firewall / tailnet ACLs to constrain exposure. ### Suggested fix The reachability test probably should not use subnet containment for point-to-point interfaces. Possible approaches: - treat /32 and /128 addresses on the selected interface as valid local bind interfaces, but do not use them to reject remote peers via Contains() - or determine interface suitability by routing / system interface ownership instead of subnet containment - or special-case point-to-point interfaces like Tailscale Happy to provide more logs / exact repro if useful.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: clan/data-mesher#361