Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# tailcat changelog

## Unreleased

- Direct paths no longer go through a peer's Tailscale address:
tailcat used to offer its Tailscale addresses (100.64.0.0/10 or
fd7a:115c:a1e0::/48) as direct UDP endpoints, so two machines on the
same LAN that both run Tailscale could end up sending WireGuard
inside Tailscale's WireGuard, through a 1280-byte-MTU tunnel. On
Linux the batched (GSO) sends on that path mostly never arrived and
throughput from Linux collapsed to tens of KB/s. Those addresses
are no longer advertised; the plain LAN address is used instead,
and DERP remains the fallback where no direct path exists.
([#168](https://github.com/tailscale/tailcat/issues/168))


## v0.8.0 (2026-11-22)

### Breaking Go API change
Expand Down
12 changes: 12 additions & 0 deletions tailcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -1630,12 +1630,24 @@ func (b *locoBackend) peerForIP(ip netip.Addr) (_ wgengine.PeerForIP, ok bool) {
// has no control plane distributing endpoints, and magicsock never
// attempts a direct path to a peer with no known endpoints, so these
// advertisements are what make direct connections possible at all.
//
// Endpoints on a Tailscale address (100.64.0.0/10 or
// fd7a:115c:a1e0::/48) are left out: advertising one invites the peer
// to run our WireGuard inside Tailscale's WireGuard, through a tun
// device with a 1280-byte MTU, and on Linux the batched (GSO) sends
// on that path mostly never arrive, so throughput from Linux collapses
// to tens of KB/s (#168). A peer on the same LAN always has a plain
// LAN address to use instead, and where no direct path exists at all
// DERP remains the fallback.
func (b *locoBackend) onEngineStatus(st *wgengine.Status, err error) {
if err != nil || st == nil {
return
}
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.

continue
}
eps = append(eps, ep.Addr)
}
slices.SortFunc(eps, func(a, b netip.AddrPort) int { return a.Compare(b) })
Expand Down
53 changes: 53 additions & 0 deletions tailcat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"net/http/httptest"
"net/netip"
"os"
"slices"
"strings"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -44,6 +45,7 @@ import (
"tailscale.com/types/logger"
"tailscale.com/util/clientmetric"
"tailscale.com/util/eventbus"
"tailscale.com/wgengine"
"tailscale.com/wgengine/filter"
)

Expand Down Expand Up @@ -2011,3 +2013,54 @@ func TestPeerKey(t *testing.T) {
}
}
}

func TestOnEngineStatusFiltersTailscaleEndpoints(t *testing.T) {
// Magicsock reports every local interface address as a UDP
// endpoint, including the addresses of a tailscaled tunnel
// interface when the machine also runs Tailscale. Advertising
// one of those invites the peer to run our WireGuard inside
// Tailscale's WireGuard, through a 1280-byte-MTU tun, and on
// Linux the batched (GSO) sends on that path mostly never
// arrive (#168). Only the non-Tailscale endpoints may be
// advertised.
b := &locoBackend{}
b.onEngineStatus(&wgengine.Status{LocalAddrs: []tailcfg.Endpoint{
{Addr: netip.MustParseAddrPort("192.168.1.2:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("100.64.1.2:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("[fd7a:115c:a1e0::1]:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("203.0.113.5:1234"), Type: tailcfg.EndpointSTUN},
{Addr: netip.MustParseAddrPort("[2001:db8::1]:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("100.127.255.255:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("100.128.0.1:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("[fd7a:115c:a1e1::1]:1234"), Type: tailcfg.EndpointLocal},
}}, nil)
b.mu.Lock()
got := append([]netip.AddrPort(nil), b.eps...)
b.mu.Unlock()
want := []netip.AddrPort{
netip.MustParseAddrPort("100.128.0.1:1234"),
netip.MustParseAddrPort("192.168.1.2:1234"),
netip.MustParseAddrPort("203.0.113.5:1234"),
netip.MustParseAddrPort("[2001:db8::1]:1234"),
// Just outside the Tailscale ULA range (fd7a:115c:a1e0::/48
// covers a1e0, not a1e1), so it stays advertised.
netip.MustParseAddrPort("[fd7a:115c:a1e1::1]:1234"),
}
if !slices.Equal(got, want) {
t.Fatalf("advertised endpoints = %v; want %v", got, want)
}

// If every endpoint is a Tailscale address, nothing is
// advertised and no direct path is attempted; DERP remains.
b = &locoBackend{}
b.onEngineStatus(&wgengine.Status{LocalAddrs: []tailcfg.Endpoint{
{Addr: netip.MustParseAddrPort("100.64.1.2:1234"), Type: tailcfg.EndpointLocal},
{Addr: netip.MustParseAddrPort("[fd7a:115c:a1e0::1]:1234"), Type: tailcfg.EndpointLocal},
}}, nil)
b.mu.Lock()
got = append([]netip.AddrPort(nil), b.eps...)
b.mu.Unlock()
if len(got) != 0 {
t.Fatalf("advertised endpoints = %v; want none", got)
}
}