Skip to content

fix: don't advertise Tailscale addresses as direct endpoints - #170

Open
sx4im wants to merge 3 commits into
tailscale:mainfrom
sx4im:fix-168-tailscale-endpoint-gso
Open

sx4im wants to merge 3 commits into
tailscale:mainfrom
sx4im:fix-168-tailscale-endpoint-gso

Conversation

@sx4im

@sx4im sx4im commented Nov 14, 2026

Copy link
Copy Markdown

Direct paths through a peer's Tailscale address are slow to the point of unusable on Linux, and they are never better than the plain LAN address when both machines are on the same network.

What broke: magicsock reports every local interface address, including the tailscaled tunnel interface, and tailcat advertised them all to the peer. A peer on the same LAN could then pick our Tailscale address as the direct path, running WireGuard inside Tailscale's WireGuard through a 1280-byte-MTU tun. On Linux the batched (GSO) sends on that path mostly never arrive, so throughput from Linux fell to 12-18 KB/s while the other direction ran at 25 MB/s.

What changed: onEngineStatus now skips endpoints whose address is a Tailscale address (tsaddr.IsTailscaleIP). The plain LAN address is used instead, and DERP remains the fallback where no direct path exists.

Verified: new regression test TestOnEngineStatusFiltersTailscaleEndpoints, red to green. Without the fix it advertises all eight endpoints, with it only the five non-Tailscale ones. go vet and gofmt are clean. The kernel GSO/MTU behavior itself was not reproduced here; this is a unit-level check of endpoint selection.

One limit worth naming: this stops us advertising our Tailscale addresses. A peer can still learn our Tailscale address from the source of our pings, which is magicsock behavior upstream, so that direction is out of scope for this change.

Fixes #168

Magicsock reports every local interface address, including the
addresses of a tailscaled tunnel interface, and onEngineStatus
advertised them all to the peer. A peer on the same LAN could then
pick our Tailscale address as the direct path, running WireGuard
inside Tailscale's WireGuard through a 1280-byte-MTU tun. On Linux
the batched (GSO) sends on that path mostly never arrive, so
throughput from Linux collapsed to tens of KB/s (tailscale#168).

Skip endpoints whose address is a Tailscale address
(tsaddr.IsTailscaleIP) when advertising; the plain LAN address is
used instead, and DERP remains the fallback where no direct path
exists.
Comment thread tailcat.go
}
var eps []netip.AddrPort
for _, ep := range st.LocalAddrs {
if tsaddr.IsTailscaleIP(ep.Addr.Addr()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably only want to do this conditionally on those 100.64.0.0/10 addresses actually being owned by a local Tailscale daemon/interface.

Plenty of other things in the world uses 100.64.0.0/10 that's not Tailscale.

This branch has not been deployed

No deployments
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.

Direct path through the peer's Tailscale address, plus UDP GSO on Linux, cuts throughput from Linux to about 15 KB/s

2 participants