Commit Graph
10776 Commits
Author SHA1 Message Date
James Tucker fc66c4beb9 tstest/natlab/vmtest: add peer relay suspend/resume scenario
Add TestPeerRelaySuspendResume, a full-stack VM reproduction of the
literal repro steps from #20082: two nodes (HardNAT, direct impossible)
exchange traffic over a peer relay (One2OneNAT, PeerRelayGrants), one
node suspends (QMP stop) for longer than the relay session's
steady-state lifetime, the relay reaps the idle session, the node
wakes, and traffic must recover. The issue's 5m+ steady-state reap is
compressed to seconds by shrinking the relay server's endpoint
lifetimes to bind=5s (also the endpoint GC tick) and steadyState=15s
via the debug-peer-relay-server-lifetimes LocalAPI debug action
(local.Client.DebugSetPeerRelayServerLifetimes on the relay node's
agent client), invoked right after EnableRelayServer and before the
relay path is established, since server endpoints are advertised with
the lifetime values in effect at allocation time. The suspended
client's session is then reaped within 20s (verified server-side by
polling DebugPeerRelaySessions for the recorded VNI; observed 18s
across runs). Suspend is 40s total; recovery is asserted as TSMP a->b
within 90s of resume, then b->a within 30s, then peer-relay route
re-establishment within the sibling tests' 60s budget. The budget math
is documented inline.

Pre-suspend traffic is shaped, with legitimate traffic only, so that
both sides' wireguard-go peers hold a magicsock *lazyEndpoint frozen on
the relay session epAddr at the suspend instant (the state the
in-process repro, magicsock.TestPeerRelaySessionReapRecovery, forces by
rewinding endpoint.lastRecvWG): 12s of bidirectional TSMP pings (>=1
connection-noted verification handoff), a 25s quiesce (KeepaliveTimeout
10s + connection-noted threshold 10s + margin), then a single final
ICMP ping issued by the to-be-suspended node. Empirically determined
details that the shaping depends on, documented in the test:

 * A LocalAPI TSMP ping always sends a TSMP disco-key advertisement
   data packet right behind the echo request (wgengine.Ping ->
   sendTSMPDiscoAdvertisement), so a TSMP ping receiver always sees two
   back-to-back WireGuard packets and the second replaces the
   just-planted lazyEndpoint with the healthy endpoint; the final ping
   must be ICMP (one packet each way).
 * magicsock's periodic disco-key advertisements (2min cadence anchored
   at first contact, riding the ~5s call-me-maybe cadence relay paths
   sustain) land unpredictably relative to the suspend instant and
   rescue the receiver the same way; they are disabled on a and b via
   TS_USE_CACHED_NETMAP=false.
 * QEMU does not drop packets sent to a stopped VM: they queue in the
   netdev socket and are delivered at wake, when the guest's frozen
   CLOCK_MONOTONIC makes its last WG receive look ~1s old, so any
   queued transport packet un-poisons the woken node. The final ping
   therefore comes from the suspendee, freezing the passive keepalive
   it schedules inside the suspended VM instead of queueing a rescuing
   keepalive toward it.

On current main the test FAILS deterministically (7/7 local runs
across the envknob- and LocalAPI-based lifetime stacks, ~183s each) at
the recovery assertion, with the issue's exact signature: the
suspended-side session is reaped 18s after suspend, both directions of
TSMP traffic black-hole for the full 90s window, the awake node's
wireguard-go retries "Sending handshake initiation" into the dead
relay session every 5s throughout, and the disco plane meanwhile
stays healthy (disco pings succeed via DERP, fresh relay sessions get
allocated but never bind). Earlier, less-shaped variants of the
scenario (final TSMP ping, or final ping from the awake side)
self-recovered 7-21s after resume via the rescue mechanisms above,
which is what motivated pinning them down. Post-fix, recovery should
come via DERP fallback within seconds, followed by relay path
re-establishment.

a and b run with TS_LOG_VERBOSITY=2 and vnet.VerboseSyslog (the relay
with VerboseSyslog) so failures carry the wireguard-go handshake-retry
evidence in the test log.

Updates #20082

Change-Id: Ifa809daa1fa9b6fc19adacbd89c01215f9db8464
Signed-off-by: James Tucker <[email protected]>
2026-06-11 02:59:21 +00:00
James Tucker 69d8695c88 tstest/natlab/vmtest: add peer relay route classification
Make the peer relay path a first-class PingRoute (PingRoutePeerRelay) in
the vmtest harness, so e2e tests can assert relay routing the same way
they assert direct/derp/local today. classifyPing now checks
PingResult.PeerRelay before the empty-Endpoint==DERP fallback, since
magicsock populates exactly one of PeerRelay, Endpoint, or DERPRegionID
(populateCLIPingResponseLocked); previously a relayed disco ping would
have been classified as DERP.

Refactor TestPeerRelay's ad-hoc PeerRelay!="" polling loop to use
PingExpect with the new route class (keeping the relay-side
DebugPeerRelaySessions assertions), add an Env.EnableRelayServer helper
for the RelayServerPort EditPrefs dance, and add a connectivity-matrix
style RunConnectivityTestViaPeerRelay helper plus
TestHardHardViaPeerRelay (a/b behind HardNAT, relay on One2OneNAT with
PeerRelayGrants), giving peer relay regression coverage of the kind
that would have caught #20082-class breakage.

While there, PingExpect now logs and reports the PingResult fields that
classification is based on (Endpoint, DERP region, PeerRelay) so route
mismatches are debuggable from failure output alone.

Updates #20082

Change-Id: Id57682fe5fccc7626b6c93ad1a023e6507eaed63
Signed-off-by: James Tucker <[email protected]>
2026-06-11 02:44:56 +00:00
James Tucker a629edaf96 tstest/natlab/vmtest: add VM suspend/resume support
Add Env.Suspend and Env.Resume, which pause and un-pause a QEMU-backed
node via QMP stop/cont, modeling a host suspend as seen from the
network: the guest's vCPUs and virtual clocks freeze, packets sent to
it while stopped are dropped, and peers/relays/control keep running in
real time and can expire state referencing the sleeping node. This is
the ingredient needed to reproduce suspend-induced path-death
regressions such as a peer relay reaping an idle session while one
endpoint sleeps (#20082).

gokrazy VMs now get a QMP monitor unix socket (-qmp unix:...,server,
nowait, at <sockdir>/<node>-qmp.sock) like cloud VMs already had; the
ad-hoc QMP code in qmpQueryHostFwd is refactored onto a small shared
qmpClient (greeting + qmp_capabilities handshake, synchronous commands
with per-command I/O deadlines, async event skipping). Suspend/Resume
verify the resulting run state via query-status. macOS/tailmac nodes
have no QMP monitor and fail with a clear error.

The TestSuspendResume smoke test brings up two gokrazy nodes on easy
NATs, establishes a tunnel, suspends one for 15s, and asserts that
traffic to it black-holes while paused (the probe ping must run out
its full timeout, not fail instantly), that its guest clock pauses
across the suspend (observed lag is bounded both below and above
around the suspend duration, with a documented 5s slack for Date-
header granularity and stop/cont edge skew, verifying QEMU neither
advances the guest clock on cont nor leaves it frozen), and that TSMP
connectivity recovers within a bounded budget after resume.

Updates #20082

Change-Id: I83cbb3e0712c00b5809e015a1445fb902e542ed6
Signed-off-by: James Tucker <[email protected]>
2026-06-11 02:44:56 +00:00
James Tucker d6211abfb2 net/udprelay,feature/relayserver,client/local: make endpoint lifetimes configurable
The bind and steady state endpoint lifetimes were hardcoded to 30s and
5m, which makes tests reproducing relay-session-reap scenarios, e.g.
in-process magicsock e2e tests and natlab VM tests for #20082 (black
hole following relay session reap), take 5+ minutes of wall time.

Add Server.SetLifetimes, which validates the new values and pokes the
endpoint GC loop to reset its ticker so they take effect immediately,
and a SetLifetimesForTest wrapper for brevity in in-process tests. For
tests that run tailscaled as a separate process, e.g. natlab VM tests,
expose it at runtime via a PermitWrite-gated LocalAPI debug endpoint,
debug-peer-relay-server-lifetimes, mirroring the existing
debug-peer-relay-sessions plumbing through the relayserver extension,
with a corresponding client/local method. A LocalAPI hook is preferred
over env knobs as it is per-instance and parallel-test-safe, and works
after the relay server is started via the RelayServerPort pref.
Production behavior is unchanged unless the hook is used.

Updates #20082

Change-Id: I827c54b222a268cbdb90c41febfe95ae3f2295f2
Signed-off-by: James Tucker <[email protected]>
2026-06-11 02:44:56 +00:00
Claus Lensbøl 92ab4866d5 wgengine/magicsock: increase discoKeyAdvertisementInterval to 2 minutes (#20084)
The 1 minute timeout was hitting timers inside wireguard-go, leading
stale connections hanging forever. Increasing the timeout to 2 minutes
makes a small subset of cached connections establish direct connections
slightly slower.

Updates to wireguard-go will allow a better hook for when to send these
messages in the future. This change only makes fixes the error mode but
if we have better triggers coming in wireguard-go, we should be using
those.

Updates #20081

Signed-off-by: Claus Lensbøl <[email protected]>
2026-06-10 16:25:02 -04:00
Claus Lensbøl 2690d58e47 wgengine/magicsock,tstest/natlab/vmtest: only send callMeMaybe with endpoints (#20088)
9be21088f4 changed sending disco pings so
a callMeMaybe would be not be gated by endpoints existing if the node
was running off of a cached netmap.

This commit partly reverts that change, but keeps in a few bug fixes in
that commit and the tests that was introduced and now skipped.

The behaviour prior to 9be21088f4 is
retained.

Updates #20085

Signed-off-by: Claus Lensbøl <[email protected]>
2026-06-10 16:19:51 -04:00
David Bond e4ea65d32d cmd/k8s-operator: workload identity support for multi-tailnet (#20016)
This commit modifies the reconciler for the `Tailnet` custom resource
to allow referenced secrets to specify an `audience` field. If a
referenced secret contains both an `audience` and `client_id` we assume
the user's intention is to use workload identity.

In that case, we configure the tailscale API client to authenticate
using the Kubernetes token request API against the operator's service
account. This requires the operator to be aware of its own service
account name.

A small change has also been made to the messages added to the `Tailnet`
CRD's status field in the even that it is missing scopes to make it
clearer that certain scopes may not be applied.

Closes: #19090
Updates: #19471

Signed-off-by: David Bond <[email protected]>
2026-06-10 10:22:19 +01:00
Joe Tsai 632293de7d logtail: reject absurdly large retryAfter values (#20070) (#20071)
For real, we're supposed to use min, not max.

Updates tailscale/corp#43105

Signed-off-by: Joe Tsai <[email protected]>
2026-06-09 15:20:22 -07:00
Joe Tsai 3e0d89d75d logtail: reject absurdly large retryAfter values (#20070)
Updates tailscale/corp#43105

Signed-off-by: Joe Tsai <[email protected]>
2026-06-09 14:57:41 -07:00
Brad Fitzpatrick 1deb6a8449 ipn: add no-disconnect in-process bus subscribers
Add NotifyInProcessNoDisconnect for in-process IPN bus subscribers that
must apply every bus update. When such a subscriber falls behind, block
Notify production instead of sending the terminal fell-behind message and
closing the watch.

This is intentionally not available over LocalAPI, where a slow or stuck
out-of-process client should still be disconnected rather than allowed to
stall tailscaled. In-process callers that use the bit must keep their
callbacks fast and must not call back into LocalBackend from the callback.

Updates #20062

Change-Id: I730ad61a07475243bb226fba2262c1a3ded211ae
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-09 12:51:38 -07:00
Adriano Sela Aviles 913df7e6ea cmd/tailscale/cli: unit tests for tailscale ip
Updates #20035

Signed-off-by: Adriano Sela Aviles <[email protected]>
2026-06-09 11:43:24 -07:00
Brad Fitzpatrick edcc2c94d9 ipn: enforce lossless IPN bus delta streams
New-style IPN bus subscribers consume stateful delta streams. Reject
NotifyRateLimit when it is combined with those subscription bits so
tailscaled cannot merge or delay messages that clients need to apply in
order.

Also stop silently dropping notifications when a watcher falls behind.
Remove the watcher, replace its stale queue with one terminal ErrMessage
notification, and close the watch.

Updates #20062

Change-Id: Id9d402ea76f4011cd23f122adf62f30dd4b6f90b
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-09 11:12:20 -07:00
BeckyPauley 60b935e30f net/dns/resolver: remove deprecated 4via6 magic-dns formats (#20057)
This removes deprecated magic-dns formats for 4via6 subnet routers.

These are superseded by the current format: Q-R-S-T-via-X.

Fixes #20053

Change-Id: I0eed1f057f856f248c4dc8ce3b751f6c7edcfbfd

Signed-off-by: Becky Pauley <[email protected]>
2026-06-09 18:10:47 +01:00
Anthony 819f3ba7c1 cmd/k8s-operator: allow custom annotations on deployment (#17143)
Fixes #17188

Signed-off-by: Anthony SCHWARTZ <[email protected]>
Signed-off-by: Anthony SCHWARTZ <[email protected]>
2026-06-09 15:25:40 +01:00
Doug Bryant 2767100bc2 net/netmon: skip RTM_MISS route messages on darwin (#20050)
macOS 26.4 emits RTM_MISS on the routing socket for every failed route
lookup. skipRouteMessage never inspected the message type, so each miss
woke the monitor as a link change and triggered a netcheck. On networks
without an IPv6 default route the netcheck's IPv6 DERP probes fail and
emit more RTM_MISS messages, sustaining the loop indefinitely: netchecks
run at roughly 40x the intended rate, with sustained probe traffic and
corresponding CPU and battery cost.

RTM_MISS scales with traffic volume, not network state, and is never
the leading signal for a topology change: route withdrawals emit
RTM_DELETE synchronously before any subsequent lookup can miss, so
ignoring it loses no signal. Other routing daemons (bird, dhcpcd, frr)
ignore it as well.

Same fix as coder/tailscale@e956a95074.

Fixes #19324

Signed-off-by: Doug Bryant <[email protected]>
2026-06-08 10:45:13 -07:00
Will Norris 4b1408f4a5 words: June is so full of color
Did you know that Gilbert Baker used the Pantone color scale when
designing the rainbow flag? I suppose that's not too surprising. There
are also other color scales like munsell and werner. I guess the rainbow
itself is a color scale, with its seven "roygbiv" colors. (It's also
a fish, with both a tail and scales.) We have so many ways to measure
color on so many different scales. And it turns out "pride" itself is
a scale.

Updates #words

Signed-off-by: Will Norris <[email protected]>
2026-06-08 09:58:54 -07:00
Mike O'Driscoll 732bde6e86 tstest/natlab: test home DERP is re-reported after a profile switch (#20051)
Add a vmtest that guards the fix in #20025: after an in-process control
client swap (profile switch / interactive re-login), magicsock's NetInfo
dedup cache (netInfoLast) must be cleared so the structurally-identical
post-switch NetInfo (same PreferredDERP, same NAT shape) is re-reported to
the new control session rather than suppressed as unchanged.

The test brings a node up, pins its home DERP so the reported NetInfo is
identical across the switch, records the home DERP the test control learned,
switches to a fresh login profile on the same control/network/NAT/DERP, and
asserts the control re-learns the same non-zero home DERP for the node's new
identity. Without ResetNetInfoLast the assertion times out at HomeDERP=0.

To support this, vnet now serves the test control on port 443 (TLS) in
addition to port 80: an immediate re-login makes a fresh noise dial, and
because the prior dial was recent the control client forces an HTTPS (443)
dial (controlhttp.Dialer.forceNoise443), which the harness previously did
not answer. The control endpoint gets its own self-signed cert (the existing
selfSignedDERPCert helper, renamed to the generic selfSignedCert); the cert
is not validated since control noise dials authenticate via the Noise
handshake, so it only needs a TLS peer to complete the forced 443 dial.

Add Env.ForcePreferredDERP and Env.Relogin helpers for the above.

Updates #20024

Signed-off-by: Mike O'Driscoll <[email protected]>
2026-06-08 12:29:39 -04:00
Michael Ben-Ami 618b606b46 feature/conn25: expire idle flows from FlowTable
Track lastSeen on each cached flow and add a sweeper goroutine
that periodically removes flows idle past the idle timeout.

Introduce tunables for idle timeout, maximum flows removed per sweep (to
limit mutex hold time), and the sweeper interval.

Also cap the previously-unlimited tables: 10k client flows, 100k
connector flows.

Updates tailscale/corp#38630

Signed-off-by: Michael Ben-Ami <[email protected]>
2026-06-08 11:03:25 -04:00
Alex Chan 65a117184b all: rename NetworkLock functions/types to TailnetLock
To avoid breaking downstream code, add deprecated aliases for all the
old names.

Updates tailscale/corp#37904

Change-Id: I86d0b0d7da371946440b181c665448f91c3ef8d2
Signed-off-by: Alex Chan <[email protected]>
2026-06-08 13:14:28 +01:00
Fernando Serboncini 254bb6a43c CODEOWNERS: auto-request k8s-devs review for Kubernetes/container paths (#20020)
Assign the Kubernetes operator, kube libraries, container build
commands, and related paths to @tailscale/k8s-devs.

Updates #cleanup

Change-Id: I9d8c7ebfd9a2b6401dd8cb0ff335151afe58357c

Signed-off-by: Fernando Serboncini <[email protected]>
2026-06-07 13:24:32 +01:00
Adriano Sela Aviles 83c8440834 cmd/tailscale/cli: add service support to tailscale ip
Fixes #20035

Signed-off-by: Adriano Sela Aviles <[email protected]>
2026-06-05 18:49:17 -07:00
Nick Khyl c0d0621417 logpolicy,tsnet: remove syspolicy dependency
tsnet depends on logpolicy, which in turn depended on util/syspolicy
because of a single LogTarget policy setting it uses.

In this commit, we replace that dependency with a feature.Hook,
which only tailscaled or its platform-specific alternatives should set.

Updates #20031

Signed-off-by: Nick Khyl <[email protected]>
2026-06-05 16:21:27 -05:00
M. J. Fromberger eda975a9e4 wgengine/magicsock: emit first-netmap latency for uncached resets too (#20029)
This is a refinement of #19916. Previously, we would only emit a latency log
when going from a cached netmap to an uncached one (i.e., from the control
plane). We would like to know the latency in both conditions, though, so
instead use the validity of the previous self state.

Updates #12639
Updates tailscale/projects#27

Change-Id: I6bbeb5d3162f1f98cdb3dcd244f67ef31c170957
Signed-off-by: M. J. Fromberger <[email protected]>
2026-06-05 14:13:16 -07:00
Andrew Lytvynov c07bf57eba cmd/tailscaled: only warn about unsupported attestation when enabled (#20028)
We don't need to log if the policy doesn't actually say that hardware
attestation must be enabled.

Updates #cleanup

Signed-off-by: Andrew Lytvynov <[email protected]>
2026-06-05 14:00:07 -07:00
Mike O'Driscoll 6a709216b9 ipn/ipnlocal,wgengine/magicsock: re-report NetInfo to new control client (#20025)
magicsock de-duplicates NetInfo callbacks against c.netInfoLast, a cache
that lives on the long-lived magicsock.Conn. That cache survives a control
client swap (interactive login or profile switch), where only the control
client (and its own per-client NetInfo dedup) is replaced. As a result, the
first netcheck after the swap produces a structurally-identical NetInfo
(same PreferredDERP, same NAT shape), magicsock suppresses it as unchanged,
and the new control session never learns our home DERP. Peers can't reach
the node over DERP until some unrelated NetInfo field happens to change.

Add Conn.ResetNetInfoLast to clear the dedup cache, and call it from
LocalBackend.setControlClientLocked whenever a control client is installed,
so the next netcheck re-reports the current NetInfo to the new client.

netInfoLast is only a dedup/optimization cache (all readers nil-guard, and
it is recomputed by every netcheck), so clearing it can only add a delivery,
never lose or misroute one; it is scoped to control-client lifecycle events,
not steady-state operation.

Updates #17887
Fixes #20024

Signed-off-by: Mike O'Driscoll <[email protected]>
2026-06-05 13:36:00 -04:00
Brad Fitzpatrick 26864f1302 tstest/natlab: add ACME cert vmtest
This adds a fake vnet ACME service, TXT-backed SetDNS support, and a
VM test that fetches a certificate with tailscale cert, serves it with
tailscale serve, and verifies HTTPS from a second node.

This adds coverage motivated by #19915.

Updates #13038

Change-Id: Ie1e53409509337d81c8fbceb63f59f3dfbd48207
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-05 08:57:17 -07:00
Simon Law 84ffcd2759 cmd/tailscale/cli/jsonoutput: provide examples for jsonoutput.DNS* (#19998)
This patch adds examples for unmarshalling the JSON outputs of the
following commands:

	tailscale dns query --json
	tailscale dns status --json

It also adds an example usage of `tailscale dns` to both
jsonoutput.DNSQueryResult and jsonoutput.DNSStatusResult.

Updates #13326
Updates #18750

Signed-off-by: Simon Law <[email protected]>
2026-06-05 02:02:15 -07:00
James Tucker d0b12dac75 words: they say the long tail tips the scales
Adds eailed critters and scaly ones. No anole was harmed (it was already
in the list), and the loris was turned away at the door for being
suspiciously tailless.

Removes a word that was misread/misinterpreted and starts a rejection
list in the test suite.

Updates #words

Signed-off-by: James Tucker <[email protected]>
2026-06-04 22:51:30 -07:00
Will Norris e8d169db8d client/systray: fix setting StatusNotifierItem ID
This was supposed to have been fixed in #18739, but either there was
a regression, or it never actually fixed it. In order for the
application title to be used as the ID by the fyne.io/systray package,
systray.SetTitle() must be called before systray.Run().

Updates #18736

Signed-off-by: Will Norris <[email protected]>
2026-06-04 15:43:27 -07:00
Adriano Sela Aviles fc9b18f507 tailcfg: add ServiceActionType constants
Updates tailscale/corp#42661

Signed-off-by: Adriano Sela Aviles <[email protected]>
2026-06-04 14:53:15 -07:00
Brad Fitzpatrick 6cb3852535 go.mod: bump wireguard-go for memory leak fix
Updates tailscale/corp#42776

Change-Id: I1f91fb542b3476f1a8f0964a47a742e9331f118d
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-04 14:40:42 -07:00
Brad Fitzpatrick 638b73a68d gokrazy: add two arm64 variants for Pi & VMs
We previously had two GOARCH variants for natlab testing
(gokrazy/natlabapp and gokrazy/natlabapp.arm64), but we didn't have
those variants for the "tsapp" (production, not testing) variant.

This adds arm64 for tsapp too. But there are two major users of arm64
for gokrazy: Raspberry Pis, and cloud VMs. So make two variants.

Updates #1866

Change-Id: Ib9efaf1255101e3cdbc31d49c76fd86dcba21bb1
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-04 14:05:23 -07:00
Adriano Sela Aviles 6cd185bf31 tailcfg: add Attributes to Service Actions
Updates tailscale/corp#42661

Signed-off-by: Adriano Sela Aviles <[email protected]>
2026-06-04 13:40:05 -07:00
Brad Fitzpatrick 772be1b0cc gokrazy, clientupdate: add start of Gokrazy auto-updates, tests
This adds support for Gokrazy GAF (Gokrazy Archive Format) zip
auto-updates, starting to wire up Tailscale's clientupdate mechanism
to Gokrazy's update mechanism.

Currently there's just a CLI command to update from a GAF URL,
with an --unsigned flag for use in a new natlab vmtest.

Next step would be publishing unstable track GAF files on
pkgs.tailscale.com, with detached signatures, and then making the
clientupdate mechanism also download those and check signatures.

Updates #20002

Change-Id: Ib03c56f17a57f8a4638398ef83549dac4813323d
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-04 11:20:14 -07:00
Simon Law 6ff761c5f8 cmd/tailscale/cli/jsonoutput: fix flag parsing for boolean values (#19996)
SchemaVersion didn’t actually parse boolean values properly, so
calling `tailscale lock status --json=false` would fail with:

	invalid boolean value "false" for -json: invalid integer value passed to --json: "false"

This patch makes SchemaVersion.Set delegate to flag.FlagSet for its
argument parsing, with accompanying tests that ensure that both
boolean and integer values are parsed properly.

It also removes the restriction that prevented the flag from appearing
multiple times in the arguments list. Now, the final flag clobbers all
previous ones, aligning this behaviour with the standard flag package.

We also change the SchemaVersion.String output for the zero value to
"false", so that the default help message doesn’t change when we
switch other commands over from their boolean representations:

	user@host:~$ tailscale whoami --help
	FLAGS
	  --json, --json=false
	        output in JSON format (default false)

Updates #17613

Signed-off-by: Simon Law <[email protected]>
2026-06-04 10:18:47 -07:00
Simon Law 0bbaed6af4 cmd/tailscale/cli/jsonoutput: rename exported identifiers (#19994)
Since we don’t think anyone has actually imported the jsonoutput
package yet, we still have a chance to rename its fundamental types:

1. Rename the JSONSchemaVersion struct to SchemaVersion because
   it is a flag.Value that can represent any schema version.

2. Rename the JSONSchemaVersion.Value field to SchemaVersion.Version
   so the struct reads better:

	if args.json.IsSet && args.json.Version == 1 {
		// ...
	}

Updates #17613

Signed-off-by: Simon Law <[email protected]>
2026-06-04 09:55:48 -07:00
Simon Law f05e145d7a cmd/tailscale/cli/jsonoutput: improve doc comments and add examples (#19993)
This patch:

1. Removes hardcoded mentions of a `--json` flag from the
   documentation for JSONSchemaVersion, because the type could be used
   for anything.

2. Removes `code` formatting because Go doc comments don’t support
   this syntax.

3. Fixes [links] in doc comments so they link to the types’
   online documentation.

4. Checks that JSONSchemaVersion satisfies the flag.Value interface.

5. Adds documentation examples for using both JSONSchemaVersion and
   ResponseEnvelope.

Updates #17613
Updates #18750

Signed-off-by: Simon Law <[email protected]>
2026-06-04 09:23:49 -07:00
Brad Fitzpatrick dfb605db4a cmd/ssh-auth-none-demo: update SSH demo a bit
Per chat with an SSH client author who wanted a URL in the output.

And then make it more clear what parts are banners.

Updates #cleanup

Change-Id: If5033ad9dc0dba3d833f24ea39e117a455010492
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-03 19:36:19 -07:00
Patrick O'Doherty 3f5eb31997 go.mod: update tailscale/gliderssh (#19995) 2026-06-03 17:29:54 -07:00
croakerbcts 66c8844fd2 VERSION.txt: this is v1.101.0 (#19992)
Signed-off-by: croakerbcts <[email protected]>
v1.101.0-pre
2026-06-03 15:40:23 -04:00
BeckyPauley 98f1ac0880 cmd/k8s-operator, net/netutil: revert 4via6 changes (#19990)
Reverts support 4via6 in egress proxy and connector (#19863)

Updates #19334

Signed-off-by: Becky Pauley <[email protected]>
2026-06-03 20:20:36 +01:00
Mario Minardi cdcb1cb07b go.toolchain.rev: bump to Go 1.26.4
Updates https://github.com/tailscale/corp/issues/42772
Updates https://github.com/tailscale/tailscale/issues/19982

Signed-off-by: Mario Minardi <[email protected]>
2026-06-03 10:24:00 -06:00
Brendan Creane b26dadf1b5 net/dns/resolver: skip DNS health warning when doing split DNS (#19959)
When MagicDNS is enabled but no global upstream resolvers are configured,
the forwarder only handles specific suffixes and defers other names to the
system resolver. A query it has no resolver for is expected in that case, so
don't raise the dns-forward-failing warning unless a default "." route makes
Tailscale the default resolver.

Fixes #19931

Signed-off-by: Brendan Creane <[email protected]>
2026-06-03 09:14:48 -07:00
Harry Harpham fa542426e5 ipn,ipn/localapi: require local admin to serve Unix domain sockets
This resolves a local privilege escalation (LPE). Prior to this change,
a non-admin user could utilize serve to access local Unix sockets they
otherwise should not be able to access. For example,

  tailscale serve --http 80 unix:/var/run/docker.sock

would give the user access to the Docker socket (usually root only).
This works because tailscaled has root access and implements the proxy
to the socket (see also: 'the confused deputy problem').

We resolve the problem by refusing to serve Unix targets altogether
unless instructed to by a root user.

Thanks to Tim Sageser (dtrsecurity) for this report.

Fixes tailscale/corp#41998

Signed-off-by: Harry Harpham <[email protected]>
2026-06-03 09:45:02 -06:00
Brad Fitzpatrick 40c98cd267 tstest/natlab/vmtest: deflake, de-strictify TestSelfSignedDERPHashPinning
The test was asserting that a tailnet ping between two nodes traversed
DERP rather than going direct. But that wasn't really the point of the test,
and I kept forgetting ways that magicsock could find direct paths and
thus break this test.

So loosen it.

We really just want to see whether DERP worked at all and was used in the process
of getting a ping through, whether it was direct or not.

And that "tailscale debug derp" worked at all, which was what the bug
was about to begin with.

No need for all the "must be over DERP" stuff.

Updates #15579

Change-Id: I70ca63dc10919efa3d193b7af1d31a4a3b9d3950
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-03 06:00:18 -07:00
Kabir 01c59d84a0 cmd/tailscale/cli: show services in serve status (#19600)
The "tailscale serve status" human-readable output previously showed
only serve-based proxies, not services.

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

Change-Id: Ie48858a8d8afd7184979d0fe2ab21ebd6fd0d4a0

Signed-off-by: Kabir Sikand <[email protected]>
2026-06-02 17:09:54 -04:00
Brad Fitzpatrick 9107354488 tstest/natlab/vnet: send unsolicited IPv6 Router Advertisements
vnet only ever sent IPv6 RAs in response to a Router Solicitation. In
practice this meant gokrazy VMs running with a dual-stack LAN never
installed vnet's IPv6 default route: gokrazy brings the link up via
DHCPv4 and the kernel never emits an RS on its own under that init
path. Off-link IPv6 destinations like the fake DERP servers were
therefore unreachable from any gokrazy test node that also had v4
on the same interface. (Pure-v6 nodes happened to work because the
kernel sends an RS as part of v6-only autoconf.)

Fix this in two complementary ways:

  - Send an unsolicited RA every 5s to the link-local all-nodes group
    on every v6-enabled network. This matches what real routers do
    (RFC 4861 §6.2.1, MaxRtrAdvInterval; we use a much shorter
    interval than the spec's 200s default so short-lived tests don't
    have to wait).

  - Send a unicast RA to a newly-registered MAC as soon as a client
    first transmits on the wire. Without this the first periodic RA
    can land before any VM has connected and the next one isn't
    until the next tick, which can be longer than the test runs.

Factor the RA serialization out into buildIPv6RouterAdvertisement so
the solicited, periodic, and per-client paths all share one body.

Update TestSelfSignedDERPHashPinning to use a dual-stack hard-NAT
builder and assert zero errors from DebugDERPRegion (instead of
filtering "over IPv6" errors as it had to before this change). The
new builder also sets TS_DEBUG_STRIP_ENDPOINTS=1 on tailscaled so
disco can't find a direct path: without endpoint stripping, the now-
working non-NATted IPv6 LAN gives the two hard-NAT'd nodes a direct
route, defeating the test's "must traverse DERP" assertion. (Hard
NAT alone was enough before this change because v6 routing was
broken.) Also update sendBetweenClients in the vnet unit tests to
tolerate the new on-register RA noise on its read path.

Updates #13038
Updates #19973

Change-Id: Ic281dc53702a25fa773c46313f453837814233e8
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-02 12:59:27 -07:00
Brad FitzpatrickandNuke c91b7188e8 ipn/localapi,tstest/natlab: fix debug derp TLS check for sha256-raw CertName
serveDebugDERPRegion built its TLS config with
ServerName: cmp.Or(derpNode.CertName, derpNode.HostName), which for a
"sha256-raw:<hex>" CertName passed the raw fingerprint to Go's stock
verifier as a hostname; the handshake always failed with a hostname
mismatch. This is the second half of #15579; the first half (tailscaled
itself failing with "unexpected multiple certs presented") was fixed in

Extract a tlsConfigForNode helper that mirrors derphttp.Client.tlsClient
so that sha256-raw and domain-fronting CertName values are dispatched
to tlsdial.SetConfigExpectedCertHash and tlsdial.SetConfigExpectedCert
respectively, falling back to HostName when CertName is empty.

The core fix here was originally written by @imnuke in #19965; that PR
also added a unit test in ipn/localapi/debugderp_test.go which is
replaced in this commit by a new vmtest that exercises the whole stack:
vnet now serves a self-signed cert valid for each fake DERP node's
HostName and exposes its SHA-256 fingerprint, and vmtest grows a new
SelfSignedDERPCertPinning EnvOption that swaps the test DERP map's
nodes to CertName="sha256-raw:<hex>" with InsecureForTests cleared.
TestSelfSignedDERPHashPinning then stands up two hard-NAT'd nodes, has
them communicate over DERP, and calls DebugDERPRegion on each. Before
this fix the test fails with the exact x509 hostname-mismatch error
from the original bug; after, it passes.

Updates #15579

Change-Id: I61f38ffebc7ac5abc962639db1ae88f5cd8633b1
Co-authored-by: Nuke <[email protected]>
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-02 12:02:40 -07:00
Brad Fitzpatrick 52400dc6f4 ipn/ipnlocal: add back a watchdog after earlier removal from engine
Commit 2b338dd6a8 removed watchdogEngine because it was weird
(so many methods) and increasingly unnecessary after we'd cleaned up
and simplified so much of the locking.

This adds back a watchdog, but an easier to maintain one that's more
idiomatic.

Updates #19759

Change-Id: I86c458473e126c0809f37696446ce7acf4cc4eb9
Signed-off-by: Brad Fitzpatrick <[email protected]>
2026-06-02 11:57:12 -07:00
Jamie Sinn a846665599 Add --strip option to build_dist
Add support for --strip option to strip symbols.

Building a rather custom binary with custom flags needs some additional work, and thought to contribute this back up.

Signed-off-by: Jamie Sinn <[email protected]>
2026-06-02 10:59:29 -07:00