9722 Commits

Author SHA1 Message Date
Claus Lensbøl
9ae8155bab cmol/pprof health (#17303)
health: ensure timers are cleaned up

Updates tailscale/corp#32696

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-09-26 17:30:24 -04:00
Brad Fitzpatrick
832e94607e doctor: add ts_omit_doctor support
Updates #12614

Change-Id: I84c166c4b99ca75d70abe4087e5ff3f7d90d4bcc
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 14:27:55 -07:00
Brad Fitzpatrick
87ee0f4e98 ipn/ipnlocal: move last unconditional gvisor import, complete ts_omit_netstack support
Fixes #17283

Change-Id: Ia84d269683e4a68d7d10562561204934eeaf53bb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 14:00:12 -07:00
Mahyar Mirrashed
eaecc0be54 cmd/tailscale/cli: use tabwriter for tailscale status (#16596)
Fixes #17238

Signed-off-by: Mahyar Mirrashed <mah.mirr@gmail.com>
2025-09-26 13:42:16 -07:00
Brad Fitzpatrick
c95fdb0f8a net/packet/checksum: copy the gvisor checksum, remove the dep
As part of making Tailscale's gvisor dependency optional for small builds,
this was one of the last places left that depended on gvisor. Just copy
the couple functions were were using.

Updates #17283

Change-Id: Id2bc07ba12039afe4c8a3f0b68f4d76d1863bbfe
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 13:04:14 -07:00
Brad Fitzpatrick
afe909664b types/opt: de-weird the API a bit with new True and False consts
Updates #cleanup

Change-Id: I15d8d840877d43e2b884d42354b4eb156094df7d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 12:58:25 -07:00
Brad Fitzpatrick
e766adf71f net/tstun: use ts_omit_gro in another place I missed earlier
I didn't notice this GRO code during b3ae1cb0cc.

Updates #17283

Change-Id: I95c06c19e489097fc8d61180dc57ae4b8a69c58c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 12:50:29 -07:00
Brad Fitzpatrick
e7a79ef5f1 tstest/integration: deflake TestC2NDebugNetmap, disable service collection
Fixes #17298

Change-Id: I83459fa1dad583c32395a80548510bc7ec035c41
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 12:40:10 -07:00
Brad Fitzpatrick
09a33b9262 net/tstun: support ts_omit_netstack
Updates #17283

Change-Id: I1134bb15b3e39a3fa26c0621512aae9181de2210
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 12:10:29 -07:00
Nick Khyl
0b994ef2fe docs/windows/policy: add ADMX policy definition for AllowTailscaledRestart
Updates tailscale/corp#32675

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-09-26 12:32:30 -05:00
Brad Fitzpatrick
f715ee2be9 cmd/tailscaled: start implementing ts_omit_netstack
Baby steps. This permits building without much of gvisor, but not all of it.

Updates #17283

Change-Id: I8433146e259918cc901fe86b4ea29be22075b32c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 09:46:55 -07:00
Brad Fitzpatrick
b3ae1cb0cc wgengine/netstack/gro: permit building without GRO
This only saves ~32KB in the minimal linux/amd64 binary, but it's a
step towards permitting not depending on gvisor for small builds.

Updates #17283

Change-Id: Iae8da5e9465127de354dbcaf25e794a6832d891b
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 09:07:48 -07:00
Andrew Lytvynov
f2b8d37436 feature/tpm: only register HardwareAttestationKey on linux/windows (#17293)
We can only register one key implementation per process. When running on
macOS or Android, trying to register a separate key implementation from
feature/tpm causes a panic.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-09-26 08:39:02 -07:00
Alex Chan
002ecb78d0 all: don't rebind variables in for loops
See https://tip.golang.org/wiki/LoopvarExperiment#does-this-mean-i-dont-have-to-write-x--x-in-my-loops-anymore

Updates https://github.com/tailscale/tailscale/issues/11058

Signed-off-by: Alex Chan <alexc@tailscale.com>
2025-09-26 16:19:42 +01:00
James Tucker
8b3e88cd09 wgengine/magicsock: fix rebind debouncing (#17282)
On platforms that are causing EPIPE at a high frequency this is
resulting in non-working connections, for example when Apple decides to
forcefully close UDP sockets due to an unsoliced packet rejection in the
firewall.

Too frequent rebinds cause a failure to solicit the endpoints triggering
the rebinds, that would normally happen via CallMeMaybe.

Updates #14551
Updates tailscale/corp#25648

Signed-off-by: James Tucker <james@tailscale.com>
2025-09-26 11:06:39 -04:00
Alex Chan
41a2aaf1da cmd/tailscale/cli: fix race condition in up --force-reauth
This commit fixes a race condition where `tailscale up --force-reauth` would
exit prematurely on an already-logged in device.

Previously, the CLI would wait for IPN to report the "Running" state and then
exit. However, this could happen before the new auth URL was printed, leading
to two distinct issues:

*   **Without seamless key renewal:** The CLI could exit immediately after
    the `StartLoginInteractive` call, before IPN has time to switch into
    the "Starting" state or send a new auth URL back to the CLI.
*   **With seamless key renewal:** IPN stays in the "Running" state
    throughout the process, so the CLI exits immediately without performing
    any reauthentication.

The fix is to change the CLI's exit condition.

Instead of waiting for the "Running" state, if we're doing a `--force-reauth`
we now wait to see the node key change, which is a more reliable indicator
that a successful authentication has occurred.

Updates tailscale/corp#31476
Updates tailscale/tailscale#17108

Signed-off-by: Alex Chan <alexc@tailscale.com>
2025-09-26 14:27:20 +01:00
Alex Chan
c011369de2 cmd/tailscale/cli: start WatchIPNBus before initial Start
This partially reverts f3d2fd2.

When that patch was written, the goroutine that responds to IPN notifications
could call `StartLoginInteractive`, creating a race condition that led to
flaky integration tests. We no longer call `StartLoginInteractive` in that
goroutine, so the race is now impossible.

Moving the `WatchIPNBus` call earlier ensures the CLI gets all necessary
IPN notifications, preventing a reauth from hanging.

Updates tailscale/corp#31476

Signed-off-by: Alex Chan <alexc@tailscale.com>
2025-09-26 14:27:20 +01:00
Brad Fitzpatrick
260fe38ad8 Makefile, cmd/tailscaled: add minimal tailscale+cli binary depaware
Updates #12614

Change-Id: I593ed30f620556c6503d80c0ccbbe242567fd5cf
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-26 05:58:52 -07:00
Alex Chan
9154bc10f0 tstest/integration: skip this test rather than commenting it out
Updates #17108

Signed-off-by: Alex Chan <alexc@tailscale.com>
2025-09-26 10:25:10 +01:00
Nick Khyl
892f8a9582 various: allow tailscaled shutdown via LocalAPI
A customer wants to allow their employees to restart tailscaled at will, when access rights and MDM policy allow it,
as a way to fully reset client state and re-create the tunnel in case of connectivity issues.

On Windows, the main tailscaled process runs as a child of a service process. The service restarts the child
when it exits (or crashes) until the service itself is stopped. Regular (non-admin) users can't stop the service,
and allowing them to do so isn't ideal, especially in managed or multi-user environments.

In this PR, we add a LocalAPI endpoint that instructs ipnserver.Server, and by extension the tailscaled process,
to shut down. The service then restarts the child tailscaled. Shutting down tailscaled requires LocalAPI write access
and an enabled policy setting.

Updates tailscale/corp#32674
Updates tailscale/corp#32675

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-09-25 14:26:06 -05:00
Brad Fitzpatrick
45d635cc98 feature/portlist: pull portlist service porting into extension, use eventbus
And yay: tsnet (and thus k8s-operator etc) no longer depends on
portlist! And LocalBackend is smaller.

Removes 50 KB from the minimal binary.

Updates #12614

Change-Id: Iee04057053dc39305303e8bd1d9599db8368d926
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-25 12:19:03 -07:00
Nick Khyl
bbc5107d7d ipn/ipnlocal: do not reset extHost on (*LocalBackend).Shutdown
We made changes to ipnext callback registration/unregistration/invocation in #15780
that made resetting b.exthost to a nil, no-op host in (*LocalBackend).Shutdown() unnecessary.

But resetting it is also racy: b.exthost must be safe for concurrent use with or without b.mu held,
so it shouldn't be written after NewLocalBackend returns. This PR removes it.

Fixes #17279

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-09-25 14:17:52 -05:00
Andrew Lytvynov
c49ed5dd5a feature/tpm: implement key.HardwareAttestationKey (#17256)
Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-09-25 11:54:41 -07:00
Brad Fitzpatrick
a40f23ad4a util/eventbus: flesh out docs a bit
Updates #cleanup

Change-Id: Ia6b0e4b0426be1dd10a777aff0a81d4dd6b69b01
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-25 09:48:33 -07:00
Raj Singh
0b27871860 k8s-operator: add IPv6 support for DNS records (#16691)
This change adds full IPv6 support to the Kubernetes operator's DNS functionality,
enabling dual-stack and IPv6-only cluster support.

Fixes #16633

Signed-off-by: Raj Singh <raj@tailscale.com>
2025-09-25 11:26:43 -04:00
Alex Chan
e0a77cf41a tstest/integration: expand the tests for tailscale up
Expand the integration tests to cover a wider range of scenarios, including:

*   Before and after a successful initial login
*   Auth URLs and auth keys
*   With and without the `--force-reauth` flag
*   With and without seamless key renewal

These tests expose a race condition when using `--force-reauth` on an
already-logged in device. The command completes too quickly, preventing
the auth URL from being displayed. This issue is identified and will be
fixed in a separate commit.

Updates #17108

Signed-off-by: Alex Chan <alexc@tailscale.com>
2025-09-25 14:47:03 +01:00
James Sanderson
70400cb75f cmd/tailscale/cli: reduce strength of lose-ssh risk warning
Ideally we would remove this warning entirely, as it is now possible to
reauthenticate without losing connectivty. However, it is still possible to
lose SSH connectivity if the user changes the ownership of the machine when
they do a force-reauth, and we have no way of knowing if they are going to
do that before they do it.

For now, let's just reduce the strength of the warning to warn them that
they "may" lose their connection, rather than they "will".

Updates tailscale/corp#32429

Signed-off-by: James Sanderson <jsanderson@tailscale.com>
2025-09-25 09:09:34 +01:00
Brad Fitzpatrick
0bd4f4729b ipn/ipnlocal: rename misnamed DisablePortMapperForTest to DisablePortPollerForTest
I think this was originally a brain-o in 9380e2dfc6. It's
disabling the port _poller_, listing what open ports (i.e. services)
are open, not PMP/PCP/UPnP port mapping.

While there, drop in some more testenv.AssertInTest() in a few places.

Updates #cleanup

Change-Id: Ia6f755ad3544f855883b8a7bdcfc066e8649547b
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-24 15:50:35 -07:00
Simon Law
34242df51b derp/derpserver: clean up extraction of derp.Server (#17264)
PR #17258 extracted `derp.Server` into `derp/derpserver.Server`.

This followup patch adds the following cleanups:
1. Rename `derp_server*.go` files to `derpserver*.go` to match
   the package name.
2. Rename the `derpserver.NewServer` constructor to `derpserver.New`
   to reduce stuttering.
3. Remove the unnecessary `derpserver.Conn` type alias.

Updates #17257
Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-09-24 10:38:30 -07:00
Patrick O'Doherty
db02a46645 types/key: Update HardwareAttestationPublic representation (#17233)
Sidestep cmd/viewer incompatibility hiccups with
HardwareAttestationPublic type due to its *ecdsa.PublicKey inner member
by serializing the key to a byte slice instead.

Updates tailscale/corp#31269

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2025-09-24 10:20:41 -07:00
Brad Fitzpatrick
21dc5f4e21 derp/derpserver: split off derp.Server out of derp into its own package
This exports a number of things from the derp (generic + client) package
to be used by the new derpserver package, as now used by cmd/derper.

And then enough other misc changes to lock in that cmd/tailscaled can
be configured to not bring in tailscale.com/client/local. (The webclient
in particular, even when disabled, was bringing it in, so that's now fixed)

Fixes #17257

Change-Id: I88b6c7958643fb54f386dd900bddf73d2d4d96d5
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-24 09:19:01 -07:00
M. J. Fromberger
df747f1c1b util/eventbus: add a Done method to the Monitor type (#17263)
Some systems need to tell whether the monitored goroutine has finished
alongside other channel operations (notably in this case the relay server, but
there seem likely to be others similarly situated).

Updates #15160

Change-Id: I5f0f3fae827b07f9b7102a3b08f60cda9737fe28
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-09-24 09:14:41 -07:00
Brad Fitzpatrick
b3e9a128af net/dns, feature/featuretags: make NetworkManager, systemd-resolved, and DBus modular
Saves 360 KB (19951800 => 19591352 on linux/amd64 --extra-small --box binary)

Updates #12614
Updates #17206

Change-Id: Iafd5b2536dd735111b447546cba335a7a64379ed
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-24 08:55:32 -07:00
Brad Fitzpatrick
b54cdf9f38 all: use buildfeatures.HasCapture const in a handful of places
Help out the linker's dead code elimination.

Updates #12614

Change-Id: I6c13cb44d3250bf1e3a01ad393c637da4613affb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-24 08:31:25 -07:00
Brad Fitzpatrick
8fe575409f feature/featuretags: add build tag to remove captive portal detection
This doesn't yet fully pull it out into a feature/captiveportal package.
This is the usual first step, moving the code to its own files within
the same packages.

Updates #17254

Change-Id: Idfaec839debf7c96f51ca6520ce36ccf2f8eec92
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-24 08:31:13 -07:00
Jordan Whited
4657cbdb11 client, cmd/tailscale/cli, feature/relayserver, net/udprelay: implement tailscale debug peer-relay-sessions (#17239)
Fixes tailscale/corp#30035

Signed-off-by: Dylan Bargatze <dylan@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Co-authored-by: Dylan Bargatze <dylan@tailscale.com>
2025-09-23 15:26:10 -07:00
Brad Fitzpatrick
87ccfbd250 ipn/ipnlocal: fix eventbus data race
Fixes #17252

Change-Id: Id969fca750a48fb43431c53f3e0631bd9bd496d1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-23 14:53:53 -07:00
Jonathan Nobels
4af15a1148 magicsock: fix deadlock in SetStaticEndpoints (#17247)
updates tailscale/corp#32600

A localAPI/cli call to reload-config can end up leaving magicsock's mutex
locked.   We were missing an unlock for the early exit where there's no change in
the static endpoints when the disk-based config is loaded.  This is not likely
the root cause of the linked issue - just noted during investigation.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-09-23 13:35:22 -04:00
License Updater
1791f87870 licenses: update license notices
Signed-off-by: License Updater <noreply+license-updater@tailscale.com>
2025-09-23 10:24:26 -07:00
Percy Wegmann
e3307fbce1 cmd/tailscale: omit the drive subcommand in MacOS GUI apps
In MacOS GUI apps, users have to select folders to share via the GUI. This is both because
the GUI app keeps its own record of shares, and because the sandboxed version of the GUI
app needs to gain access to the shared folders by having the user pick them in a file
selector.

The new build tag `ts_mac_gui` allows the MacOS GUI app build to signal that this
is a MacOS GUI app, which causes the `drive` subcommand to be omitted so that people
do not mistakenly attempt to use it.

Updates tailscale/tailscale#17210

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-09-23 09:40:55 -05:00
Will Norris
e582fb9b53 client/web: use network profile for displaying tailnet info
Also update to use the new DisplayNameOrDefault.

Updates tailscale/corp#30456

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
2025-09-22 11:22:38 -07:00
Will Norris
15b3876c2c client/systray: use new tailnet display name is profile title
Updates tailscale/corp#30456

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
2025-09-22 11:22:27 -07:00
M. J. Fromberger
daad5c2b5c wgengine/router: use eventbus.Monitor in linuxRouter (#17232)
This commit does not change the order or meaning of any eventbus activity, it
only updates the way the plumbing is set up.

Updates #15160

Change-Id: I61b863f9c05459d530a4c34063a8bad9046c0e27
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-09-22 10:49:28 -07:00
Mahyar Mirrashed
5e79e497d3 cmd/tailscale/cli: show last seen time on status command (#16588)
Add a last seen time on the cli's status command, similar to the web
portal.

Before:
```
100.xxx.xxx.xxx    tailscale-operator   tagged-devices linux   offline
```

After:
```
100.xxx.xxx.xxx    tailscale-operator   tagged-devices linux   offline, last seen 20d ago
```

Fixes #16584

Signed-off-by: Mahyar Mirrashed <mah.mirr@gmail.com>
2025-09-22 10:37:27 -07:00
Claus Lensbøl
f67ad67c6f control/controlclient: switch ID to be incrementing instead of random (#17230)
Also cleans up a a few comments.

Updates #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-09-22 13:14:55 -04:00
M. J. Fromberger
1b5201023f ipn/ipnlocal: use eventbus.Monitor in LocalBackend (#17225)
This commit does not change the order or meaning of any eventbus activity, it
only updates the way the plumbing is set up.

Updates #15160

Change-Id: I06860ac4e43952a9bb4d85366138c9d9a17fd9cd
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-09-22 08:43:39 -07:00
M. J. Fromberger
e59fbaab64 util/eventbus: give a nicer error when attempting to use a closed client (#17208)
It is a programming error to Publish or Subscribe on a closed Client, but now
the way you discover that is by getting a panic from down in the machinery of
the bus after the client state has been cleaned up.

To provide a more helpful error, let's panic explicitly when that happens and
say what went wrong ("the client is closed"), by preventing subscriptions from
interleaving with closure of the client. With this change, either an attachment
fails outright (because the client is already closed) or completes and then
shuts down in good order in the normal course.

This does not change the semantics of the client, publishers, or subscribers,
it's just making the failure more eager so we can attach explanatory text.

Updates #15160

Change-Id: Ia492f4c1dea7535aec2cdcc2e5ea5410ed5218d2
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-09-22 07:07:57 -07:00
Claus Lensbøl
6e128498a7 controlclient/auto: switch eventbus to using a monitor (#17205)
Only changes how the go routine consuming the events starts and stops,
not what it does.

Updates #15160

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-09-22 09:16:13 -04:00
David Bond
cc1761e8d2 cmd/k8s-operator: send operator logs to tailscale (#17110)
This commit modifies the k8s operator to wrap its logger using the logtail
logger provided via the tsnet server. This causes any logs written by
the operator to make their way to Tailscale in the same fashion as
wireguard logs to be used by support.

This functionality can also be opted-out of entirely using the
"TS_NO_LOGS_NO_SUPPORT" environment variable.

Updates https://github.com/tailscale/corp/issues/32037

Signed-off-by: David Bond <davidsbond93@gmail.com>
2025-09-22 13:55:16 +01:00
Kristoffer Dalby
986b4d1b0b control/controlclient: fix tka godoc
Updates #cleanup

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2025-09-22 08:32:42 +02:00