9555 Commits

Author SHA1 Message Date
Simon Law
6d45fcfc93
.github/workflows: reviewing depaware.txt is unnecessary (#16990)
Apparently, #16989 introduced a bug in request-dataplane-review.yml:

> you may only define one of `paths` and `paths-ignore` for a single event

Related #16372
Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-08-31 13:29:25 -04:00
Simon Law
442f4758a9
.github/workflows: reviewing depaware.txt is unnecessary (#16989)
@tailscale/dataplane almost never needs to review depaware.txt, when
it is the only change to the DERP implementation.

Related #16372
Updates #cleanup

Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-08-31 12:30:17 -04:00
James Tucker
3b68d607be wgengine/magicsock: drop DERP queue from head rather than tail
If the DERP queue is full, drop the oldest item first, rather than the
youngest, on the assumption that older data is more likely to be
unanswerable.

Updates tailscale/corp#31762

Signed-off-by: James Tucker <james@tailscale.com>
2025-08-29 15:13:02 -07:00
Remy Guercio
89fe2e1f12
cmd/tsidp: add allow-insecure-no-client-registration and JSON file migration (#16881)
Add a ternary flag that unless set explicitly to false keeps the
insecure behavior of TSIDP.

If the flag is false, add functionality on startup to migrate
oidc-funnel-clients.json to oauth-clients.json if it doesn’t exist.
If the flag is false, modify endpoints to behave similarly regardless
of funnel, tailnet, or localhost. They will all verify client ID & secret
when appropriate per RFC 6749. The authorize endpoint will no longer change
based on funnel status or nodeID.

Add extra tests verifying TSIDP endpoints behave as expected
with the new flag.

Safely create the redirect URL from what's passed into the
authorize endpoint.

Fixes #16880

Signed-off-by: Remy Guercio <remy@tailscale.com>
2025-08-29 15:16:39 -05:00
Naman Sood
76fc02be09
words: just an ordinary commit, nothing fishy at all (#16982)
* words: just an ordinary commit, nothing fishy at all

Updates #words

Signed-off-by: Naman Sood <mail@nsood.in>
2025-08-29 14:25:58 -04:00
Joe Tsai
7cbcc10eb1
syncs: add Semaphore.Len (#16981)
The Len reports the number of acquired tokens for metrics.

Updates tailscale/corp#31252

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2025-08-29 10:33:14 -07:00
Brad Fitzpatrick
1a98943204 go.mod: bump github.com/ulikunitz/xz for security warning
Doesn't look to affect us, but pacifies security scanners.

See 88ddf1d0d9

It's for decoding. We only use this package for encoding (via
github.com/google/rpmpack / github.com/goreleaser/nfpm/v2).

Updates #8043

Change-Id: I87631aa5048f9514bb83baf1424f6abb34329c46
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-08-29 07:02:57 -07:00
Joe Tsai
3aea0e095a syncs: delete WaitGroup and use sync.WaitGroup.Go in Go 1.25
Our own WaitGroup wrapper type was a prototype implementation
for the Go method on the standard sync.WaitGroup type.
Now that there is first-class support for Go,
we should migrate over to using it and delete syncs.WaitGroup.

Updates #cleanup
Updates tailscale/tailscale#16330

Change-Id: Ib52b10f9847341ce29b4ca0da927dc9321691235
Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2025-08-28 22:35:24 -07:00
James Tucker
f5d3c59a92 wgengine/magicsock: shorten process internal DERP queue
DERP writes go via TCP and the host OS will have plenty of buffer space.
We've observed in the wild with a backed up TCP socket kernel side
buffers of >2.4MB. The DERP internal queue being larger causes an
increase in the probability that the contents of the backbuffer are
"dead letters" - packets that were assumed to be lost.

A first step to improvement is to size this queue only large enough to
avoid some of the initial connect stall problem, but not large enough
that it is contributing in a substantial way to buffer bloat /
dead-letter retention.

Updates tailscale/corp#31762

Signed-off-by: James Tucker <james@tailscale.com>
2025-08-28 20:44:47 -07:00
James Tucker
d42f0b6a21 util/ringbuffer: rename to ringlog
I need a ringbuffer in the more traditional sense, one that has a notion
of item removal as well as tail loss on overrun. This implementation is
really a clearable log window, and is used as such where it is used.

Updates #cleanup
Updates tailscale/corp#31762

Signed-off-by: James Tucker <james@tailscale.com>
2025-08-28 15:41:07 -07:00
License Updater
4b9a1a0087 licenses: update license notices
Signed-off-by: License Updater <noreply+license-updater@tailscale.com>
2025-08-28 15:12:19 -07:00
Patrick O'Doherty
48dbe70b54
go.mod: bump Go 1.25 release (#16969)
Bump Go 1.25 release to include a go/types patch and resolve govulncheck
CI exceptions.

Updates tailscale/corp#31755

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2025-08-28 13:01:20 -07:00
Maisem Ali
882b05fff9 cmd/viewer: add field comments to generated view methods
Extract field comments from AST and include them in generated view
methods. Comments are preserved from the original struct fields to
provide documentation for the view accessors.

Fixes #16958

Signed-off-by: Maisem Ali <3953239+maisem@users.noreply.github.com>
2025-08-27 09:58:59 -07:00
Jonathan Nobels
80f5a00e76
ipn/local: add the suggested exit node to the ipn bus (#16748)
fixes tailscale/corp#26369

The suggested exit node is currently only calculated during a localAPI request.
For older UIs, this wasn't a bad choice - we could just fetch it on-demand when a menu
presented itself.  For newer incarnations however, this is an always-visible field
that needs to react to changes in the suggested exit node's value.

This change recalculates the suggested exit node ID on netmap updates and
broadcasts it on the IPN bus.   The localAPI version of this remains intact for the
time being.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-08-27 09:51:28 -04:00
Jonathan Nobels
6542a00ab0
tailcfg: add mac-ui-v2 node capability (#16940)
updates tailscale/corp#29841

Adds a  node cap macOS UIs can query to determine
whether then should enable the new windowed UI.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-08-27 09:45:31 -04:00
Jordan Whited
575664b263
wgengine/magicsock: make endpoint.discoPing peer relay aware (#16946)
Updates tailscale/corp#30333

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-26 09:22:36 -07:00
Patrick O'Doherty
c5429cd49c
go.toolchain.branch: bump to go1.25 (#16954)
go.toolchain.rev: bump go1.25 version
flake.nix: bump Go to 1.25

Updates #16330

Signed-off-by: Patrick O'Doherty <patrick@tailscale.com>
2025-08-26 07:44:26 -07:00
M. J. Fromberger
b411ffb52f ipn/ipnlocal: remove UnlockEarly from doSetHostinfoFilterServices
Pull the lock-bearing code into a closure, and use a clone rather than a
shallow copy of the hostinfo record.

Updates #11649

Change-Id: I4f1d42c42ce45e493b204baae0d50b1cbf82b102
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-08-25 11:26:26 -07:00
M. J. Fromberger
9002e5fd6b ipn/ipnlocal: remove an unnecessary unlock shortcut
The early unlock on this branch was required because the "send" method goes on
to acquire the mutex itself. Rather than release the lock just to acquire it
again, call the underlying locked helper directly.

Updates #11649

Change-Id: I50d81864a00150fc41460b7486a9c65655f282f5
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-08-25 11:26:26 -07:00
M. J. Fromberger
2fb9472990 ipn/ipnlocal: remove unnecessary usees of lockAndGetUnlock
In places where we are locking the LocakBackend and immediately deferring an
unlock, and where there is no shortcut path in the control flow below the
deferral, we do not need the unlockOnce helper. Replace all these with use of
the lock directly.

Updates #11649

Change-Id: I3e6a7110dfc9ec6c1d38d2585c5367a0d4e76514
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-08-25 11:26:26 -07:00
Jordan Whited
9403ba8c69
wgengine/magicsock: trigger peer relay path discovery on CallMeMaybe RX (#16929)
Updates tailscale/corp#30333

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-25 09:40:15 -07:00
Aaron Klotz
b5f834aef8 cmd/tailscaled: add Dnscache as a service dependency
Updates https://github.com/tailscale/corp/issues/30961

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-25 10:22:17 -06:00
Claus Lensbøl
fafb514538
client/systray: go back to using upstream library (#16938)
We had a fix in a local branch, but upstream has merged it now.

Updates #1708

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
2025-08-25 08:58:12 -04:00
Kot C
4236a759f3
cmd/tsidp: Add Docker image to README (#16915)
Signed-off-by: Kot C <kot@kot.pink>
2025-08-24 01:52:23 +01:00
M. J. Fromberger
16bd60f9ca
ipn,tsnet: update AdvertiseTags documentation (#16931)
Instead of referring to groups, which is a term of art for a different entity,
update the doc comments to more accurately describe what tags are in reference
to the policy document.

Updates #cleanup

Change-Id: Iefff6f84981985f834bae7c6a6c34044f53f2ea2
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-08-23 08:07:36 -07:00
M. J. Fromberger
6c8fef961e
ipn/ipnlocal: replace the LockedOnEntry pattern with conventional lock/unlock discipline (#16925)
There are several methods within the LocalBackend that used an unusual and
error-prone lock discipline whereby they require the caller to hold the backend
mutex on entry, but release it on the way out.

In #11650 we added some support code to make this pattern more visible.
Now it is time to eliminate the pattern (at least within this package).
This is intended to produce no semantic changes, though I am relying on
integration tests and careful inspection to achieve that.

To the extent possible I preserved the existing control flow. In a few places,
however, I replaced this with an unlock/lock closure. This means we will
sometimes reacquire a lock only to release it again one frame up the stack, but
these operations are not performance sensitive and the legibility gain seems
worthwhile.

We can probably also pull some of these out into separate methods, but I did
not do that here so as to avoid other variable scope changes that might be hard
to see. I would like to do some more cleanup separately.

As a follow-up, we could also remove the unlockOnce helper, but I did not do
that here either.

Updates #11649

Change-Id: I4c92d4536eca629cfcd6187528381c33f4d64e20
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-08-23 02:07:22 -07:00
Mohammed Naser
fa0e83ab4f
tsnet: add Server.AdvertiseTags option (#15840)
Updates #8531

Change-Id: I9b6653872c66929e692bd592ef3f438430c657b5
Signed-off-by: Valentin Alekseev <valentin.alekseev@gmail.com>
Co-authored-by: Valentin Alekseev <valentin.alekseev@gmail.com>
2025-08-23 02:00:09 -07:00
Jordan Whited
86a5292c03
ipn/localapi: make tailscale debug derp STUNOnly-aware (#16927)
Fixes #16926

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-22 15:11:51 -07:00
Need-an-AwP
b558f81a82
fix: invalid memory address or nil pointer dereference (#16922)
Signed-off-by: Need-an-AwP <113933967+Need-an-AwP@users.noreply.github.com>
2025-08-22 11:51:24 -07:00
Tom Proctor
3eeecb4c7f
cmd/k8s-proxy,k8s-operator: fix serve config for userspace mode (#16919)
The serve code leaves it up to the system's DNS resolver and netstack to
figure out how to reach the proxy destination. Combined with k8s-proxy
running in userspace mode, this means we can't rely on MagicDNS being
available or tailnet IPs being routable. I'd like to implement that as a
feature for serve in userspace mode, but for now the safer fix to get
kube-apiserver ProxyGroups consistently working in all environments is to
switch to using localhost as the proxy target instead.

This has a small knock-on in the code that does WhoIs lookups, which now
needs to check the X-Forwarded-For header that serve populates to get
the correct tailnet IP to look up, because the request's remote address
will be loopback.

Fixes #16920

Change-Id: I869ddcaf93102da50e66071bb00114cc1acc1288

Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-08-22 16:07:05 +01:00
Jordan Whited
c85cdabdfc
net/udprelay: set ICMP err immunity sock opt (#16918)
Updates tailscale/corp#31506

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-21 13:59:23 -07:00
Jordan Whited
b17cfe4aed
wgengine/magicsock,net/sockopts: export Windows ICMP suppression logic (#16917)
For eventual use by net/udprelay.Server.

Updates tailscale/corp#31506

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-21 13:44:13 -07:00
Jordan Whited
cf739256ca
net/udprelay: increase socket buffer size (#16910)
This increases throughput over long fat networks, and in the presence
of crypto/syscall-induced delay.

Updates tailscale/corp#31164

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-21 11:03:05 -07:00
Mike O'Driscoll
e296a6be8d
cmd/tsidp: update oidc-funnel-clients.json store path (#16845)
Update odic-funnel-clients.json to take a path, this
allows setting the location of the file and prevents
it from landing in the root directory or users home directory.

Move setting of rootPath until after tsnet has started.
Previously this was added for the lazy creation of the
oidc-key.json. It's now needed earlier in the flow.

Updates #16734
Fixes #16844

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-08-21 13:56:11 -04:00
dependabot[bot]
3e198f6d5f
.github: Bump github/codeql-action from 3.29.7 to 3.29.8 (#16828)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.7 to 3.29.8.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](51f77329af...76621b61de)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 3.29.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-21 09:48:31 -06:00
Jordan Whited
641a90ea33
net/sockopts,wgengine/magicsock: export socket buffer sizing logic (#16909)
For eventual use by net/udprelay.Server

Updates tailscale/corp#31164

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-20 16:24:00 -07:00
Fran Bull
b48d2de6ab cmd/natc,tsconsensus: add cluster config admin
Add the ability for operators of natc in consensus mode to remove
servers from the raft cluster config, without losing other state.

Updates #14667

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-08-20 14:04:28 -07:00
Fran Bull
d986baa18f tsconsensus,cmd/natc: add 'follower only' bootstrap option
Currently consensus has a bootstrap routine where a tsnet node tries to
join each other node with the cluster tag, and if it is not able to join
any other node it starts its own cluster.

That algorithm is racy, and can result in split brain (more than one
leader/cluster) if all the nodes for a cluster are started at the same
time.

Add a FollowOnly argument to the bootstrap function. If provided this
tsnet node will never lead, it will try (and retry with exponential back
off) to follow any node it can contact.

Add a --follow-only flag to cmd/natc that uses this new tsconsensus
functionality.

Also slightly reorganize some arguments into opts structs.

Updates #14667

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-08-20 13:14:35 -07:00
Jordan Whited
d4b7200129
net/udprelay: use batching.Conn (#16866)
This significantly improves throughput of a peer relay server on Linux.

Server.packetReadLoop no longer passes sockets down the stack. Instead,
packet handling methods return a netip.AddrPort and []byte, which
packetReadLoop gathers together for eventual batched writes on the
appropriate socket(s).

Updates tailscale/corp#31164

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-08-19 14:44:39 -07:00
Fran Bull
5c560d7489 tsconsensus: check for bootstrap error
We have been unintentionally ignoring errors from calling bootstrap.
bootstrap sometimes calls raft.BootstrapCluster which sometimes returns
a safe to ignore error, handle that case appropriately.

Updates #14667

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-08-19 10:34:35 -07:00
Adrian Dewhurst
b28699cd31 types/views: add min/max helpers to views.Slice
This has come up in a few situations recently and adding these helpers
is much better than copying the slice (calling AsSlice()) in order to
use slices.Max and friends.

Updates #cleanup

Change-Id: Ib289a07d23c3687220c72c4ce341b9695cd875bf
Signed-off-by: Adrian Dewhurst <adrian@tailscale.com>
2025-08-19 12:43:38 -04:00
Mike O'Driscoll
2581e38789
prober: update runall handler to be generic (#16895)
Update the runall handler to be more generic with an
exclude param to exclude multiple probes as the requesters
definition.

Updates tailscale/corp#27370

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-08-19 12:13:55 -04:00
Mike O'Driscoll
e4031daa08
.github/Makefile/flake: update nix flake support (#16636)
Cleanup nix support, make flake easier to read with nix-systems.
This also harmonizes with golinks flake setup and reduces an input
dependency by 1.

Update deps test to ensure the vendor hash stays harmonized
with go.mod.

Update make tidy to ensure vendor hash stays current.

Overlay the current version of golang, tailscale runs
recent releases faster than nixpkgs can update them into
the unstable branch.

Updates #16637

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-08-19 10:46:07 -04:00
Aaron Klotz
84472167dd tool/gocross: fix environment variable clearing in gocross-wrapper.ps1
The -Environment argument to Start-Process is essentially being treated
as a delta; removing a particular variable from the argument's hash
table does not indicate to delete. Instead we must set the value of each
unwanted variable to $null.

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

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-18 15:34:50 -06:00
Aaron Klotz
d92789affa tool/gocross: don't set executable bits on PowerShell script
Updates https://github.com/tailscale/corp/issues/29940

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-18 14:40:21 -06:00
M. J. Fromberger
55698c8511
ipn/localapi: plumb an event bus through the localapi.Handler (#16892)
Some of the operations of the local API need an event bus to correctly
instantiate other components (notably including the portmapper).

This commit adds that, and as the parameter list is starting to get a bit long
and hard to read, I took the opportunity to move the arguments to a config
type. Only a few call sites needed to be updated and this API is not intended
for general use, so I did not bother to stage the change.

Updates #15160
Updates #16842

Change-Id: I7b057d71161bd859f5acb96e2f878a34c85be0ef
Signed-off-by: M. J. Fromberger <fromberger@tailscale.com>
2025-08-18 10:56:17 -07:00
Aaron Klotz
02f6030dbd tool, tool/gocross: update gocross to support building natively on Windows and add a PowerShell Core wrapper script
gocross-wrapper.ps1 is a PowerShell core script that is essentially a
straight port of gocross-wrapper.sh. It requires PowerShell 7.4, which
is the latest LTS release of PSCore.

Why use PowerShell Core instead of Windows PowerShell? Essentially
because the former is much better to script with and is the edition
that is currently maintained.

Because we're using PowerShell Core, but many people will be running
scripts from a machine that only has Windows PowerShell, go.cmd has
been updated to prompt the user for PowerShell core installation if
necessary.

gocross-wrapper.sh has also been updated to utilize the PSCore script
when running under cygwin or msys.

gocross itself required a couple of updates:

We update gocross to output the PowerShell Core wrapper alongside the
bash wrapper, which will propagate the revised scripts to other repos
as necessary.

We also fix a couple of things in gocross that didn't work on Windows:
we change the toolchain resolution code to use os.UserHomeDir instead
of directly referencing the HOME environment variable, and we fix a
bug in the way arguments were being passed into exec.Command on
non-Unix systems.

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

Signed-off-by: Aaron Klotz <aaron@tailscale.com>
2025-08-18 09:49:24 -06:00
Will Norris
9d9a70d81d client/systray: disable 'more settings' menu if backend not running
Updates #1708

Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d
Signed-off-by: Will Norris <will@tailscale.com>
2025-08-17 08:59:26 -07:00
Mike O'Driscoll
6d45663dd4
cmd/derpprobe,prober: add run all probes handler (#16875)
Add a Run all probes handler that executes all
probes except those that are continuous or the derpmap
probe.

This is leveraged by other tooling to confirm DERP
stability after a deploy.

Updates tailscale/corp#27370

Signed-off-by: Mike O'Driscoll <mikeo@tailscale.com>
2025-08-16 09:42:25 -04:00
Percy Wegmann
192fa6f05d {cmd/dist,release/dist}: add support for intermediary QNAP signing certificates
Updates #23528

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-08-15 16:27:46 -05:00