Commit Graph
11766 Commits
Author SHA1 Message Date
Mazdak Nasab 5b226c7d1d feature/conn25: write through email and voip related DNS responses
Write through email related DNS responses (MX and TXT),
and voip ones (SRV and NAPTR) as we try to not break them.

Fixes https://github.com/tailscale/corp/issues/39982

Change-Id: I920c4e4401f5a20bcdcad092e94fce8ffa0f12b5
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-09 14:00:58 -07:00
Dep Updater b2560c4dea go.toolchain.rev: bump Go toolchain
* Go toolchain: https://github.com/tailscale/go/compare/509d1573c1cafe9b210180e4ce87f44a409edbba...186053ab2af2ef8fc43f3c1d1150216e89d4aff0

Triggered by @bradfitz via the bumpdep workflow.

Updates #21723

Signed-off-by: Dep Updater <[email protected]>
2026-10-09 11:38:29 -07:00
James Tucker 55642c2154 cmd/tailscale: add TLS ClientHello size check to debug ts2021
tailscale debug ts2021 now starts with an advisory TLS check against
the control plane over port 443: it compares a TLS 1.3 handshake using
Go's default key exchange groups (which include ML-KEM hybrid
post-quantum groups and produce a large ClientHello) with one
restricted to classic groups (a small ClientHello). If the large
ClientHello fails while the small one succeeds, the network path does
not support large (post-quantum) ClientHellos, likely due to a
middlebox dropping ClientHellos that span multiple TCP segments.

The check honors --connect-ip (dialing that IP while keeping the host
for SNI), can be skipped with --skip-tls-check, and never aborts the
surrounding command.

Updates #21708

Signed-off-by: James Tucker <[email protected]>
2026-10-09 11:30:28 -07:00
Brad Fitzpatrick 0a1eb8c4da ipn/ipnlocal: don't answer single-label names from quad-100
Since 7e609b258 (v1.102), quad-100 looks up MagicDNS names in
nodeBackend.nodeByName, which also holds short-name keys for in-process
dials. So a query for "foo." matched peer "foo.tail-scale.ts.net" and
was answered with its Tailscale IP. 1ec348784 fixed that for MagicDNS
off; this fixes it for MagicDNS on, too, matching pre-1.102 behavior.
The OS applies the search domain to short names before they reach
quad-100, so a single-label query is a root zone name, not a tailnet
name, and must be forwarded (e.g. to LAN mDNS/LLMNR or a global
nameserver). Short names still work for in-process dials via
NodeByName.

Updates #20789

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ic8199a96cf79178210c9a85e0cebfb46567a894a
2026-10-09 11:01:40 -07:00
François Marier f5e7486c17 tstest/natlab/vnet: refactor NAT-PMP support (#21715)
This will make the addition of PCP support easier.

No changes to NAT-PMP support or tests.

Updates #21713

Change-Id: I7ac58badbd4e8680c0e50d8dd5d78d6d0abb4aa0
Signed-off-by: Francois Marier <[email protected]>
2026-10-09 11:00:06 -07:00
Claus Lensbøl 1e3097c9f2 tstest/natlab/{vnet,vmtest},cmd/tta: add roaming test to natlab (#21695)
To faciliate roaming a few things had to happen as tta communicated over
the same links as tailscaled communicates over, meaning that the
connection to tta gets cut when cutting the interface.

 - Whenever we have connected to the client after waiting for it to come
   up, clean up idle connections.
 - Have tta use keepalives to reconnect.
 - Delete default route on just via, not the interface.
 - Add capabilities to QMP for setting the interface state.
 - Implement the test.

Fixes tailscale/corp#49639

Signed-off-by: Claus Lensbøl <[email protected]>
2026-10-09 13:05:45 -04:00
Alex Valiushko e0d21b8a52 health: register arbitrary magicsock receive funcs (#21705)
Health tracker no longer holds a pre-set number of receive func health
items. Magicsock can spawn an arbitrary number of new health items
ad-hoc instead.

A tracker that no magicsock registered with no longer reports a missing
receive func, including builds without UDP transport.

Updates tailscale/corp#48168

Change-Id: I1f929db5a9f056d41a590cebd87a5cfdecf55510

Signed-off-by: Alex Valiushko <[email protected]>
2026-10-09 09:57:11 -07:00
Mike Jensenandchaosinthecrd 144f6b20f0 k8s-operator,sessionrecording: fix SPDY protocol DoS risks (#21385)
* k8s-operator,sessionrecording: fix SPDY protocol DoS risks

There was a risk that a malicious kubectl client could cause a DoS issue for the Tailscale proxy performing a k8s recording by defining large quantities of headers, or using a decompression bomb.

This change adds limits of 1000 header pairs, and a maximum of 1MB for the decompressed header block size. In addition fuzz testing is added and integrated with oss-fuzz to review for other protocol issues.

Credit to Eresus Security for reporting the header quantity DoS risk.

Fixes tailscale/corp#45112
Updates tailscale/corp#46608

Change-Id: Ie27b241b9f1cac58198560a88a44ffaa0927b96e
Signed-off-by: Mike Jensen <[email protected]>

* k8s-operator/sessionrecording/spdy: test consecutive header blocks share one zlib context

kubectl compresses every stream's header block against one zlib stream for the
life of the connection, so the proxy decodes them all through a single
zlibReader (conn.zlibReqReader). This test compresses two blocks onto one writer
and decodes both from one reader.

It fails on the second block: parseHeaders' ended() reads one byte past the
first block, which on the shared context is the start of the next block, leaving
the reader unable to decode it ("unexpected EOF"). In a real session that means
every stream after the first fails to parse and its output is never recorded.

Signed-off-by: chaosinthecrd <[email protected]>

* k8s-operator,sessionrecording: parse full 31-bit SPDY stream IDs

dataFrameStreamID masked stream IDs to 7 bits while storeStreamID kept all 32, so output on any stream with ID >= 128 was never matched against a stored stdout/stderr stream and went unrecorded. Keep the 31 spec bits in both places. controlFrameVersion gets the matching 15-bit mask for its version field.

Mask storeStreamID to 31 bits as well: the reserved flag bit in a SYN_STREAM ID field can never appear in a data frame, so an ID stored with the bit set matches nothing.

Change-Id: Icf05a29a2838f2f2492b8d2da9e821f4e2459877
Signed-off-by: Mike Jensen <[email protected]>

---------

Signed-off-by: Mike Jensen <[email protected]>
Signed-off-by: chaosinthecrd <[email protected]>
Co-authored-by: chaosinthecrd <[email protected]>
2026-10-09 10:12:18 -06:00
Dep Updater b9262195b1 go.mod,go.toolchain.rev: bump golang.org/x/net, Go toolchain
* golang.org/x/net: v0.59.0 to v0.60.0
* Go toolchain: https://github.com/tailscale/go/compare/24ee2fd0610e6c505ee4ec061a81215afe119d1f...509d1573c1cafe9b210180e4ce87f44a409edbba
* golangci-lint: v2.13.2 to v2.14.0, for Go 1.27.2's export data version 5

Also fix testcontrol's serveC2N to read the whole c2n response before
returning, as x/net v0.60.0's http2 server now closes the request body
when the handler returns.

Triggered by @bradfitz via the bumpdep workflow.

Updates #21723

Signed-off-by: Dep Updater <[email protected]>
2026-10-09 08:12:09 -07:00
Brad Fitzpatrick d80811b882 version/mkversion: don't use os.DevNull for git config in tests
Git for Windows 2.56.0 rejects GIT_CONFIG_GLOBAL=NUL with "unable to
access 'NUL': Invalid argument" (git-for-windows/git#6449), breaking
TestInfoFromEnvMatchesGit and TestInfoFromEnvPrecedence on Windows
runners with the new git. Point them at an empty file instead.

Updates git-for-windows/git#6449

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: If2b9b6d29344b9280771e507d7d7e6c06f7ab9b0
2026-10-09 08:10:57 -07:00
Alex Valiushko 76648a00fd net/tstun: implement independent injection queue (#21681)
Injected packets now arrive on a queue of their own rather than being
multiplexed onto queue 0. Wrapper.Read is deprecated. It still reads the
first kernel-backed queue, but from now on no single queue of a Wrapper
sees every packet.

Deletes the poll goroutine, the bufferConsumed token, the vectorOutbound
channel, tunVectorReadResult, a full-size slab, and the copy of every
accepted packet between the two slabs.

wireguard-go now runs an extra TUN reader goroutine, a net wash compared
to running our poll routine.

Measured on c8gn.2xlarge, Ubuntu 24.04, Kernel v6.14, tailscaled under
load from two peers, each running iperf3 -P8.

            tx mean   rx mean   cores
  main       7.00      8.84      3.49
  branch     8.94      8.86      3.95

Bumps wireguard-go pin to tailscale/wireguard-go@e61b6b7811.

Updates tailscale/corp#37878

Change-Id: Ide0e8a9f345371b2747fad59dd2bf963c8af5b63

Signed-off-by: Alex Valiushko <[email protected]>
2026-10-08 13:13:11 -07:00
Brad Fitzpatrick 1264887365 tstest/deptest: make ImportAliasCheck results per-commit in CI
ImportAliasCheck runs git grep in a subprocess, whose file reads Go's
test cache can't see. With a shared CI test cache, callers' tests kept
reporting a stale "ok (cached)" for new commits that added bad
x/exp/{maps,slices} imports, as long as the test binary didn't change.
That's how tailscale/corp#49716 merged with green CI.

Read GITHUB_SHA so Go records it in the test cache key, making the
cached result per-commit in CI.

Updates tailscale/corp#49716

Change-Id: I6301f5ed067a05294185b05a195550efa8e5aa01
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-10-08 11:35:59 -07:00
Mazdak Nasab 417d3c00b0 feature/conn25: lock mutex right before shared resources in client
Lock shared resources right before access
for clarity and preventing bugs.

Updates #cleanup

Change-Id: I1f905a3e4ec8b9ede4e8846e84e7bc50d78c67f0
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-08 09:26:56 -07:00
Mazdak Nasab 3420967a5f feature/conn25: lock mutext in client resendTransitIPMapping
Lock mutext in resendTransitIPMapping before accessing
the shared resource to prevent data race.

Fixes https://github.com/tailscale/corp/issues/49568

Change-Id: I35b9e99428361732c9a785020d7609d29a99877e
Signed-off-by: Mazdak Nasab <[email protected]>
2026-10-08 09:26:56 -07:00
kari-ts a89b32904f ipn/localapi: use caller scope for syspolicy requests (#21701)
This resolves unscoped policy requests to the connected user's effective
policy instead of the default scope.

Tested by changing the device-scoped AlwaysOn policy at runtime and
running tailscale syspolicy reload. Cofnirmed tailscaled immediately
enforced the updated policy with tailscale down

Updates tailscale/corp#41463

Signed-off-by: kari <[email protected]>
2026-10-08 08:35:14 -07:00
Tom Proctor 156ff9e439 go.mod,build_docker.sh: support setting --output for mkctr (#21692)
Enable setting the new --output flag from tailscale/mkctr#38 so we can
save the built images to disk instead of immediately pushing them to a
registry.

Updates tailscale/corp#48996

Signed-off-by: Tom Proctor <[email protected]>
2026-10-08 10:04:24 +01:00
kari-ts a5ae05dd9d ipn/ipnlocal: use session user for policy change notifications (#21699)
This fetches the effective policy snapshot for the user scope instead of
using the default policy scope, ensuring that policy change
notifications reflect the correct user-scoped effective policy.

Updates tailscale/corp#41463t

Signed-off-by: kari <[email protected]>
2026-10-07 19:01:49 -07:00
Francois Marier 8bdb4283de tstest/natlab/vmtest: use -icount for gokrazy VMs under TCG
On hosts without hardware virtualization, gokrazy VMs can hang at
boot with no console output. Timing jitter under software emulation
breaks the kernel's early boot timer calibration, causing it to spin
waiting for timer interrupts that never arrive.

Passing -icount shift=auto ties virtual clocks to instruction execution,
making timer calibration deterministic and preventing the boot hang.

Updates #cleanup

Change-Id: I7c0aa96e5344041af9a7246f7d50bed1da47ab95
Signed-off-by: Francois Marier <[email protected]>
2026-10-07 18:54:33 -07:00
James Tucker 852c3d1f0a feature/exitnodehealth: refine exit node warnings based on responsiveness
Report when an active selected exit node has not answered disco messages for a minute. Include the node name and last response time in the warning.

Evaluate responsiveness from existing magicsock heartbeats and clear the warning when the peer becomes idle or responds. Use changes to nonzero WireGuard RX and TX counters to suppress warnings when traffic is working. Keep observation history and warning evaluation in the exitnodehealth feature. WireGuard-only peers are excluded.

Updates #tailscale/corp#33007

Signed-off-by: James Tucker <[email protected]>
2026-10-07 15:38:22 -07:00
M. J. Fromberger 9c00fd0330 tailcfg: update capability version for cache-network-maps (#21694)
Bump the capability version to 149. Nodes running a client prior to this
version must be explicitly opted in to receive the cache-network-maps node
attribute. At or after 149, a node may receive it by default, if the tailnet
policy document permits it.

Updates #12639
Updates tailscale/projects#28

Change-Id: Ia4af6c71b7f983b4ee3aec73a5611dc14f2703c4
Signed-off-by: M. J. Fromberger <[email protected]>
2026-10-07 15:29:48 -07:00
Alex Valiushko 1eb2bb62f3 net/tstun: implement tun.MultiQueueDevice (#21665)
Wrapper presents one read queue per queue of the underlying device, and
forwards the flow it is given on the write side.

pollVector still multiplexes injected packets onto the device's own
read, which is queue 0. Wrapper.Read is now queues[0].Read and behaves
exactly as it did. Locally-terminated traffic stays on flow 0.

This is a no-op change: the Wrapper presents a single queue and
wireguard-go runs the single reader goroutine it ran before.

Updates tailscale/corp#37878

Change-Id: I844e95cf430075e237ad7e83bdbaa8e43e067ccb
Signed-off-by: Alex Valiushko <[email protected]>
2026-10-07 12:09:16 -07:00
James Tucker 2249be1ac8 derp/derpserver, cmd/derper: add optional TCP_SAVE_SYN MSS metrics
Add --tcp-save-syn on Linux to record client MSS in a Prometheus histogram. Count retrieval outcomes separately and limit saved-SYN error logs to one per ten minutes across clients. IPv6 extension headers are unsupported.

Estimate the network-namespace SYN rate from kernel counters once per second. Disable TCP_SAVE_SYN on listeners above 100,000/s or if rate measurement fails, leaving it off until restart.

Updates tailscale/corp#49139

Signed-off-by: James Tucker <[email protected]>
2026-10-07 09:37:39 -07:00
Brendan Creane 4862f5f466 tstest/natlab/vmtest: add a dhcpcd DHCP client option for Ubuntu guests (#21672)
WithDHCPClient(DHCPClientDhcpcd) makes systemd-networkd leave the vnet NIC
unmanaged and runs the dhcpcd that the Ubuntu 24.04 image ships on it.
dhcpcd is the DHCP client on Raspberry Pi OS and other distributions, and
unlike networkd it configures the interface first and runs its resolvconf
hook afterwards. TestDhcpcdOpenresolvDNS checks that dhcpcd holds the
lease, its hook registered the lease's nameserver with openresolv, and
tailscaled forwards through it.

Updates #21607

Signed-off-by: Brendan Creane <[email protected]>
2026-10-06 17:09:47 -07:00
Brendan Creane b62885dd02 net/dns/resolver: don't retry an upstream REFUSED or SERVFAIL over TCP (#20829)
A TCP retry to the server that just answered can only return the same
rcode, and when that server accepted the connection and never answered,
the query ran the full 10s dnsQueryTimeout and the client got nothing.
An upstream rcode now ends the UDP/TCP race when it arrives, and the
client gets it once every resolver has had udpRaceTimeout to answer
instead of waiting for all of them to report. tcpQueryTimeout is also
set on the conn, since a context cannot interrupt a blocked read, and a
new dns_query_fwd_udp_read_ctx_done counter separates query teardown
from upstream read errors.

Fixes #20826

Signed-off-by: Brendan Creane <[email protected]>
2026-10-06 16:19:28 -07:00
Brad Fitzpatrick 508d654ddb net/netcheck: don't keep a home DERP region that was removed from the map
When control removes our home DERP region, magicsock drops the
connection, clears its home, and does a ReSTUN (since #3664). But
the netcheck stickiness checks could still pick the removed region
again, because they keyed off the previous report's PreferredDERP and
recent DERP frame activity, both of which outlive the removal.

Ignore the previous preferred region, and ForcePreferredDERP, when
they're no longer in the current DERP map.

Updates #21673

Change-Id: Ib3b7f62b6861a73d0893d6b3011dfac20bc93117
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-10-06 14:51:22 -07:00
Brad Fitzpatrick 2a61a720e5 ipn/ipnlocal: drop the appc import from ts_omit_appconnectors builds
LocalBackend named appc.AppConnector in its appConnector field, in the
field's constructor call, and in the AppConnector accessor, so even
builds with ts_omit_appconnectors linked the appc package and its
dependencies. The buildfeatures.HasAppConnectors checks let the linker
drop the code but could not remove the import.

Add a build-tag-gated type for the field: appcAppConnector is an alias
for appc.AppConnector by default, and in ts_omit_appconnectors builds it
is an empty struct with no-op versions of the methods local.go calls, so
the shared code still type checks. The constructor call moves behind a
newAppConnector helper in the same gated file, and the AppConnector
accessor keeps its *appc.AppConnector signature there, with a nil-
returning version in the omitted build.

This takes tailscale.com/appc out of depaware-min.txt and
depaware-minbox.txt. Add a DepChecker test to keep it out; it also sets
ts_omit_conn25, since conn25 uses appc as well.

Updates #12614

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ia7e2d9c4f1b8e6a3d5c0f2b7e9a1c4d6f8b0e2a5
2026-10-06 13:12:00 -07:00
Francois Marier 2d34ce3bbf tstest/natlab/vnet: stop agent dials from outliving their Server
While a VM reboots, tests poll its agent roughly every 5s. Each
request that times out leaves behind a goroutine blocked in
Server.takeAgentConn, waiting for TTA to connect back. Several can
pile up before a request succeeds and the test ends, and the rest
wait forever.

Making takeAgentConn return at Server shutdown unblocks any goroutine
still waiting when the test ends.

In a full vmtest run, the two dials stranded by the reboot in
TestGokrazyUpdatesItselfToSameImage logged until the package exited
10 minutes later. With this change, "still waiting" log lines in the
same run drop from 267 to 72, and the longest wait goes from 10m10s
to 40s.

Updates #cleanup

Change-Id: Ib4c1d2ce8f2a7b73d3f0c1e6a9e5b2d8f4a1c7e3
Signed-off-by: Francois Marier <[email protected]>
2026-10-06 11:48:17 -07:00
Joe Tsai e28b7b57ef types/logid: optimize Compare (#21661)
Use bytes.Compare which is up to 10x faster since it is written in assembly.

Updates tailscale/corp#37735

Signed-off-by: Joe Tsai <[email protected]>
2026-10-06 08:52:11 -07:00
Brendan Creane 284ca9991d tstest/natlab: upload tailscaled logs from cloud-image guests (#21664)
Only gokrazy builds trust the fake log catcher's TLS certificate, so
Ubuntu, Debian, Fedora and FreeBSD guests failed every upload and the
failure dump of their tailscaled logs was always empty. vnet now also
serves the log catcher over plain HTTP on port 80, and the harness points
those guests at it with TS_LOG_TARGET. Env.NodeLogs returns what a node
has uploaded.

macOS guests still do not upload: tailmac does not pass TailscaledEnv to
tailscaled, so the setting would not reach it.

Updates #13038

Signed-off-by: Brendan Creane <[email protected]>
2026-10-06 07:54:31 -07:00
Brendan Creane edf8abd69e ipn/conffile: reject null services and endpoints in Services config files (#21647)
A JSON null for a service or for an endpoint target unmarshals as a nil
pointer, and loadConfigV0 dereferenced it without a check. This made
"tailscale serve set-config" panic. Return an error that names the
service or endpoint instead.

Fixes #21534

Signed-off-by: Brendan Creane <[email protected]>
2026-10-05 12:29:40 -07:00
Francois Marier 31baee90c0 tstest/natlab/vnet: don't hand out idle agent conns the agent already closed
TestSelfSignedDERPHashPinning occasionally fails on a slow vm with:

    tailscale up (limit 1m30s): Get "http://unused/up?accept-routes=true": EOF

Because this endpoint has both IPv4 and IPv6 addresses, TTA will fall
back to the second address when running on a slow host and race both
connections. The losing connection will get closed by net.Dialer and
never produce a response.

By keeping the gVisor endpoint with the conn, we can avoid returning
closed connections in takeAgentConnOne().

This fix uncovered a bug in Env.Tailscale(): calling "tailscale
update" via a GET request may be replayed by net.http.Transport and
that will trigger a second update undoing the first. Using POST
disables all such retries.

Update #cleanup

Change-Id: I2f8b7c4d9e1a3b5c7d0e2f4a6b8c1d3e5f7a9b0c
Signed-off-by: Francois Marier <[email protected]>
2026-10-05 11:26:11 -07:00
Brad Fitzpatrick 92a64b306d ipn/{ipnext,ipnlocal},feature/conn25: add ExtraDNSRoutes hook for conn25 split DNS
dnsConfigForNetmap called appc.AppDNSRoutes directly to synthesize the
conn25 split DNS routes from the self node's capability map, which was
the one place node_backend.go depended on the appc package and was
marked with a TODO to make it a hook.

Add ipnext.Hooks.ExtraDNSRoutes, which returns extension-supplied split
DNS routes. authReconfigLocked calls it and passes the result into
dnsConfigForNetmap, which adds the routes alongside the netmap's own
routes with the same UseWithExitNode handling as before.

The hook takes no arguments: the conn25 extension computes the routes
in its OnSelfChange handler and clears them on a switch to a different
node, and it already tracks the AppConnector.Advertise pref from
ProfileStateChange. Both of those hooks fire before the reconfig that
consults ExtraDNSRoutes, so the state is current. The conditions are
unchanged: no routes when this node itself advertises as an app
connector, and none without the experimental capability.

Updates tailscale/corp#37125

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I6c2e9f4b8a1d3e7f5c0b2a9d8e6f4c3b1a7d5e9f
2026-10-05 10:14:23 -07:00
Fran Bull 741b13b509 appc: fix issue removing overlapping routes
Continue to iterate through all of the addrs for a domain to find
candidates for removal.

Fixes #20956

Signed-off-by: Fran Bull <[email protected]>
2026-10-05 08:39:53 -07:00
Paul Scott ba6160953e control/tsp: add RegisterOpts Expiry field for logout (#21633)
This field populates RegisterRequest.Expiry, which
controlclient.Direct.doLogout fills with time.Unix(123, 0) to force the
deletion of the device from the server.

Updates tailscale/corp#48031

Signed-off-by: Paul Scott <[email protected]>
2026-10-05 14:22:14 +01:00
Alex Chan 9128778b65 types/key: rename NLPublic/Private to TLPublic/Private
The NL prefix is one of the last references to the "Network Lock" name
which we're cleaning up.

Updates tailscale/corp#37904

Change-Id: I751194e0b49447e97a65ed6975e3da680226ce85
Signed-off-by: Alex Chan <[email protected]>
2026-10-02 16:03:51 +01:00
Tom Proctor 3ce5e20997 go.mod,cmd/cigocacher: migrate to depending on tb (#21627)
Building cigocacher from the corp repo failed because its go.mod was
missing a reference to go-tool-cache. Migrate cigocacher over to tb so
it's not required.

Updates tailscale/corp#49137

Signed-off-by: Tom Proctor <[email protected]>
2026-10-02 10:59:48 +01:00
Brad Fitzpatrick 67f8c81e61 logpolicy, net/dnscache: cache log server DNS lookups across dials
logtail's dialer only used dnscache in its fallback path, and built a
new Resolver per dial there, so every new connection to the log server
did a fresh DNS lookup (twice when the first dial failed). On systems
without a caching resolver, that adds up to a lot of queries for
log.tailscale.com.

Share one dnscache.Resolver across all log dialers, and have the
bootstrap path go straight to dnsfallback rather than repeating the
regular lookup. Since the cache TTL is a fixed guess, make
dnscache.Dialer expire a cached entry and look the host up again when
dialing its cached IPs fails, so a moved host isn't stuck on stale IPs.

Updates #15326

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I6a55d72a73ed878faebc15317421a54d9ae293ca
2026-10-01 19:22:39 -07:00
Caleb Crome 12e898010c net/dns: add a local Windows hosts-update control
Allow TS_DEBUG_DISABLE_HOSTS_FILE_UPDATES to opt out of Windows hosts entries locally, using the existing tailscaled-env.txt configuration mechanism. Keep the control-plane node attribute authoritative and preserve upstream behavior when the local option is unset or false.

Cover defaults, local opt-out, nil control knobs, and policy precedence with Windows tests. This change is limited to DNS configuration; no route changes or upstream route-fix cherry-pick are included.

Updates tailscale/tailscale#14327

Signed-off-by: Caleb Crome <[email protected]>
2026-10-01 15:37:30 -07:00
François Marier d33279d752 tstest/natlab/vmtest: wait for tailscaled to break race with tta (#21472)
The agent and tailscaled are started concurrently by gokrazy and
tta can win that race, in which case it answers 502 Bad Gateway
because tailscaled.sock does not exist yet.

This is most likely to be seen on slower machines using TCG.

Updates #cleanup

Change-Id: I4012bd189adfb2565470c814204fcf18545f1017
Signed-off-by: Francois Marier <[email protected]>
2026-10-01 11:35:16 -07:00
Jonathan Nobels d8c7cafeda feature/exitnodehealth: warn when selected exit nodes are unavailable (#21017)
updates tailscale/corp#33007

When a selected exit node can't carry internet traffic due to a misconfiguration (wrong ID, node
deleted, routes removed, etc), blackhole default routes are installed and all internet traffic is dropped.
That is the correct behavior -- better to drop than leak to the local network -- but it was entirely silent:
the stable-ID lookup in nodeBackend.updateRouteManagerPrefs misses without a log line, and Status
leaves ExitNodeStatus nil. The user sees a healthy Tailscale with no internet. If an admin fat-fingers the
exit node name in an IT policy, for example, it's easy to break every node with zero feedback.

This adds an exit-node-unavailable health warning covering every way the selection can fail to carry
traffic (short of reachability which is a separate concern), reported via exitnodehealth.ArgExitNodeReason.

The warning names the exit node, caching its display name while it is still a peer so the name survives
its departure, and falls back to the stable ID or IP. When the selection is mandated by the ExitNodeID
or ExitNodeIP policy settings, the message tells the user to contact their network administrator instead
of suggesting they pick another exit node.

To test this, set a forced exit node policy with some random ip or node id. The warning has a 5 second
 threshold. It should clear as soon as you change to a proper exit node.

Signed-off-by: Jonathan Nobels <[email protected]>
2026-10-01 08:57:20 -04:00
David Bond 689a0c155f cmd/k8s-operator,k8s-operator/reconciler/staticendpoints: support static endpoints for Connector resources (#21172)
Previously ProxyClass spec.staticEndpoints was only implemented for
ProxyGroups and silently ignored when the ProxyClass was referenced by
a Connector. Extract the NodePort Service provisioning, port
allocation, and node ExternalIP discovery logic shared with ProxyGroup
into a new k8s-operator/reconciler/staticendpoints package, and wire
it into the StatefulSet reconciler so that each Connector replica gets
a per-pod NodePort Service, the discovered endpoints are written to
its tailscaled config as static endpoints, and tailscaled listens on
the Services' target port via the PORT env var. Also reconcile
Connectors on Node changes, clean up NodePort Services on scale down,
Connector deletion, and when static endpoints are removed, and
surface the endpoints in the Connector's device status.

Add e2e tests for static endpoints on both Connectors and ProxyGroups.
They verify the per-replica NodePort Services, the PORT env var, the
endpoints reported in status and advertised to control, and the
cleanup on scale down and on removal of the static endpoints
configuration. The tests skip on clusters whose Nodes have no
ExternalIP addresses, such as kind.

Fixes #18819

Change-Id: Ia134916062471e6c0088692834257aafabd0e713

Signed-off-by: David Bond <[email protected]>
2026-10-01 12:07:16 +01:00
Raphael Fakhri b0e35bf5b5 util/cmpver: don't panic on numbers that overflow a uint64
Compare parsed each numeric field with strconv.ParseUint and panicked
if that failed, so a version with a field of 20 or more digits, such as
a long build stamp, crashed the caller.

Compare digit runs by length after trimming leading zeros, then
lexically. This gives the same results as before for numbers that fit
in a uint64 and works for numbers of any length.

Fixes #21532

Signed-off-by: Raphael Fakhri <[email protected]>
2026-09-30 21:41:37 -07:00
Brad Fitzpatrick 5d5607fea2 ipn/ipnlocal: use more buildfeatures consts so the linker drops dead code
Several features with ts_omit build tags were still linked into
minimal builds because LocalBackend called into them unconditionally,
so the linker couldn't prove them unreachable. Guard those call sites
with their buildfeatures constants:

  * app connectors: only subscribe to route update and store events
    when app connectors are included; appc is their only publisher.
    This also drops AdvertiseRoute and UnadvertiseRoute.
  * client update: only subscribe to the tailnet default auto-update
    event when auto-updates are supported, as that's all it affects.
  * syspolicy: only register the policy change watch when system
    policy support is included.
  * advertise routes and exit nodes: only validate AdvertiseRoutes
    when one of the two features is included.
  * netstack: only netstack consults the intercepted TCP ports, so
    don't build the port matching func without it.
  * ssh: don't check SSH prefs, report the "SSH on but unusable"
    health message, or intercept port 22 without SSH support. The
    RunSSH pref is still accepted without effect, as before; port 22
    was previously intercepted by netstack builds without SSH.
  * web client: don't track whether the web client should run when
    it's not included.
  * tailnet lock: peers marked UnsignedPeerAPIOnly are only special
    in that tailnet lock skips their signature checks, and the packet
    filter check guards that exemption. Without tailnet lock, all
    peers from control are trusted anyway, so skip the check.

This reduces the size of a build_dist.sh --min tailscaled binary on
linux/amd64 by 65,536 bytes (0.5%), about 28 KB of it in ipnlocal and
most of the rest in eventbus and slices generic instantiations for the
events no longer subscribed to.

Updates #12614

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I8f4d4c0779e84f46f3b076d0fb35514c69a52d8f
2026-09-30 18:34:57 -07:00
Brad Fitzpatrick 654c105f8b tstest/natlab/vmtest, gokrazy, cmd/tailscale/cli: add minimal-build vmtests
Add vmtests that boot pairs of gokrazy VMs whose tailscale and tailscaled
are minimal builds and check that IP traffic flows between them over
WireGuard, so we notice if a minimal build stops doing its one job:
build_dist.sh --extra-small (direct path through NATs), that minus NAT
traversal (DERP across NATs, direct on a shared LAN), and DERP-only.

They found that "tailscale up" built with ts_omit_ipnbus returned before
calling Start or EditPrefs, making it a no-op. Fix that, and have it wait
for the Running state by polling tailscaled's status instead of watching
the IPN bus, so scripts can rely on it as with normal builds.

The extra-small feature list moves to featuretags.ExtraSmall so
build_dist.sh (via a new "featuretags --extra-small") and vmtest share
it. The gokrazy builder gains --output and --go-build-tags flags to build
the variant images, and natlabprep --gokrazy prebuilds them all for CI.

Updates #13038
Updates #12614

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: I0caa2c7b3adf2399da09b6d07a942f1dc34e8486
2026-09-30 15:53:47 -07:00
Nick O'Neill 3e2dca47c5 VERSION.txt: this is v1.105.0 (#21600)
Signed-off-by: Nick O'Neill <[email protected]>
v1.105.0-pre
2026-09-30 12:03:36 -07:00
Nick Khyl ab2380a631 net/dns,util/coalescedop: serialize and coalesce DNS flush calls on Windows
Previously, ipconfig /flushdns and ipconfig /registerdns were called
from multiple sites without coordination: the DNS manager's SetDNS
(in a fire-and-forget goroutine), the router's winRouter.Set (synchronously
on every route change), the link change handler, and session unlock.
These could fire concurrently or in rapid succession, spawning multiple
ipconfig processes and putting excessive pressure on the Dnscache service.

In this PR, we introduce a new util/coalescedop.CoalescedOp type that provides
"one in-flight, at most one pending" semantics: Do() is non-blocking,
at most one execution runs at a time, and concurrent/rapid successive
requests coalesce into a single follow-up execution.

We then use CoalescedOp for both ipconfig /flushdns and ipconfig /registerdns,
replacing the fire-and-forget goroutine in windowsManager.SetDNS
and in the session unlock handler in tailscaled.

We also remove the redundant dns.Flush() call from winRouter.Set, since every
meaningful router.Set is followed by dns.Set in Reconfig, which already
flushes.

Updates #21001

Signed-off-by: Nick Khyl <[email protected]>
2026-09-30 10:44:22 -07:00
Noah Ingwers 238d07c5f3 control/controlclient: allow cancellation during map retry backoff (#21133)
Auto.mapRoutine sleeps in BackOff with c.mu held after PollNetMap fails.
Pausing, restarting the map poll, and shutting down need the same mutex
to cancel that wait, so they can be delayed by the retry timer.

Release c.mu after updating inMapPoll and snapshotting paused. PollNetMap
waits for its map-session callbacks before returning, so accessing the
backoff here cannot race with UpdateFullNetmap resetting it.

Add a synctest regression that checks mutex availability during backoff
and verifies that pausing interrupts the wait without advancing time.

Fixes #21132

Change-Id: I2d5b5a71c5857be60507d4d6ec9e2e0fbd8cf40a
RELNOTE: Reduce pause and shutdown delays during control connection retries.

Signed-off-by: Noah Ingwers <[email protected]>
2026-09-30 12:15:02 -04:00
chaosinthecrd 57b3d3591d cmd/k8s-operator: base egress Pod readiness on EndpointSlice membership
The egress Pods readiness reconciler decided whether a Pod could route
traffic by calling each egress Service's health check through its
ClusterIP up to replicas*3 times and looking for a response from that
Pod. That is O(replicas) calls per Service per reconcile, and a Pod
joining a large ProxyGroup is only sampled 3 times on average, so late
Pods often miss and wait for another 5s requeue. The call only goes
through kube-proxy on the operator's own node, so it does not show that
other nodes route to the Pod either.

egress-eps-reconciler already adds a Pod to an egress Service's
EndpointSlice only once the Pod's state Secret shows the proxy has set up
routing for that Service. This sets the readiness condition once the Pod
is an endpoint in an EndpointSlice of every egress Service for the
ProxyGroup, and removes the health check calls.

Updates tailscale/corp#39464

Signed-off-by: chaosinthecrd <[email protected]>
2026-09-30 16:28:00 +01:00
Brad Fitzpatrick e987d72be2 feature/featuretags: add MinTags, use it in three places
cmd/featuretags --min, cmd/tsconnect/wasmbuild, and a cmd/tailscaled
test each computed "omit every feature except these" on their own.
Move that into featuretags.MinTags so other Go code (such as upcoming
natlab vmtests of minimal builds) can compute the tags without running
cmd/featuretags. No behavior change.

Updates #12614

Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ie0a5faf1f1d3e4e035326572b16f20180671d1c4
2026-09-30 07:42:13 -07:00
James Tucker f5f326030b net/dns: preserve full OS resolver detail in Apple primary mode
When quad-100 must be installed as the OS primary resolver (Apple Mode
B), its catch-all forwarders were blended from base-config nameserver
IPs alone: non-standard ports, search domains, and DoH/DoT endpoints
were lost, and a base read that returned no resolvers silently
installed a catch-all with no forwarders at all, breaking all public
DNS while reporting a healthy DNS configuration.

Introduce OSConfig.Resolvers, which OSConfigurators able to recover the
underlying resolver configuration at full fidelity populate for the DNS
manager only: it never reaches the OS, and Equal ignores it so
configuration application is unaffected. Blend it into the catch-all
route verbatim, falling back to plain IP:53 resolvers derived from
Nameservers.

Teach the forwarder to dial arbitrary https:// resolvers instead of
only well-known public providers: at their BootstrapResolution
addresses when present, or at the URL's own host when that is an IP
literal, so enterprise DoH endpoints recovered from the OS can be
forwarded to over DoH rather than plaintext DNS.

Reject an empty base config on Apple Mode B: keep the previous
configuration, use the upstream empty-base health warning and medium
severity, and let an extension-triggered recompile retry instead of
installing a catch-all that cannot forward. Expose the same missing-
resolver error to OS configurators so bridge-reported absence uses this
warning too, while genuine configuration-read failures remain distinct.

Extend the Apple mode tests with empty-base and full-fidelity blend
coverage, and update the iOS primary-mode cases to model the real
NetworkExtension base read (LAN resolvers and search domains) rather
than the silently empty catch-all.

RELNOTE: Fix silent public DNS breakage when Tailscale must be the system DNS resolver on Apple clients.

Updates #20341
Updates tailscale/corp#45534
Updates tailscale/corp#48693

Change-Id: Ie7e277b0fd39d2b91b1e770f8f01d688e02b4d49
Signed-off-by: James Tucker <[email protected]>
2026-09-29 16:11:57 -07:00