9053 Commits

Author SHA1 Message Date
Fran Bull
f571f751fb cmd/natc: add optional consensus backend
Enable nat connector to be run on a cluster of machines for high
availability.

Updates #14667

Signed-off-by: Fran Bull <fran@tailscale.com>
2025-05-09 11:01:08 -07:00
Jonathan Nobels
7d6d2b4c50
health, ipn/ipnlocal: add metrics for various client events (#15828)
updates tailscale/corp#28092

Adds metrics for various client events:
* Enabling an exit node
* Enabling a mullvad exit node
* Enabling a preferred exit node
* Setting WantRunning to true/false
* Requesting a bug report ID
* Profile counts
* Profile deletions
* Captive portal detection

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-05-09 12:03:22 -04:00
Olivier Mengué
b1c2860485 client/local: add godoc links
Signed-off-by: Olivier Mengué <dolmen@cpan.org>
2025-05-09 07:34:47 -07:00
Nick Khyl
cb6fc37d66 util/deephash: move tests that depend on other tailscale packages to deephash_test
This is done to prevent import cycles in tests.

Fixes #15923

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-05-08 19:59:08 -05:00
Brad Fitzpatrick
165b99278b feature/taildrop, ipn/ipnlocal: remove leftover dup calls to osshare
I'd moved the osshare calls to feature/taildrop hooks, but forgot to
remove them from ipnlocal, or lost them during a rebase.

But then I noticed cmd/tailscaled also had some, so turn those into a
hook.

Updates #12614

Change-Id: I024fb1d27fbcc49c013158882ee5982c2737037d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-08 10:08:27 -07:00
Brad Fitzpatrick
e2814871a7 util/eventbus: also disable websocket debug on Android
So tsnet-on-Android is smaller, like iOS.

Updates #12614
Updates #15297

Change-Id: I97ae997f5d17576024470fe5fea93d9f5f134bde
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-08 10:03:42 -07:00
James Sanderson
85a7abef0c tsnet: add test for packet filter generation from netmap
This is an integration test that covers all the code in Direct, Auto, and
LocalBackend that processes NetMaps and creates a Filter. The test uses
tsnet as a convenient proxy for setting up all the client pieces correctly,
but is not actually a test specific to tsnet.

Updates tailscale/corp#20514

Signed-off-by: James Sanderson <jsanderson@tailscale.com>
2025-05-08 17:18:30 +01:00
Brad Fitzpatrick
5be6ff9b62 all: remove non-applicable "linux" deps on Android
Updates #12614

Change-Id: I0e2a18eca3515d3d6206c059110556d2bbbb0c5c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 21:05:13 -07:00
Brad Fitzpatrick
9d623cf5eb util/systemd: don't link systemd-notification package on Android
Updates #12614

Change-Id: Ie5f0bb072571249f08aca09132c8491c31d01605
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 16:54:29 -07:00
Brad Fitzpatrick
02f68e5d9f net/dns: don't link dbus, gonotify on Android
Android is Linux, but doesn't use Linux DNS managers (or D-Bus).

Updates #12614

Change-Id: I487802ac74a259cd5d2480ac26f7faa17ca8d1c3
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 16:20:07 -07:00
Brian Palmer
f5cc657e13
control/controlclient: send optional ConnectionHandleForTest with map requests (#15904)
This handle can be used in tests and debugging to identify the specific
client connection.

Updates tailscale/corp#28368

Change-Id: I48cc573fc0bcf018c66a18e67ad6c4f248fb760c

Signed-off-by: Brian Palmer <brianp@tailscale.com>
2025-05-07 12:57:56 -06:00
Brad Fitzpatrick
fd263adc1b ipn/store: don't link in AWS & Kubernetes stuff on Android
Android is Linux, but that not much Linux.

Updates #12614

Change-Id: Ice80bd3e3d173511c30d05a43d25a31e18928db7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 10:38:47 -07:00
Brad Fitzpatrick
04936d6c05 tsnet: add android & iOS results to depaware
Updates #12614

Change-Id: Icd21deb754e7073871eeb34edadd41c167ec5984
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 09:53:21 -07:00
Jordan Whited
7e2630235f
feature/relayserver: consider relay:server node attribute for enablement (#15901)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-07 09:15:33 -07:00
Brad Fitzpatrick
48dacf1bf7 cmd/tailscale/cli: omit "file" subcommand if taildrop is omitted from build
Updates #15812
Updates #12614

Change-Id: Ic945b26a127ba15399abdaab8fe43b1cfa64d874
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 07:25:23 -07:00
Brad Fitzpatrick
7cc2837594 tsnet: don't depend on condregister & its default tailscaled features
None of them are applicable to the common tsnet use cases.

If somebody wants one of them, they can empty import it.

Updates #12614

Change-Id: I3d7f74b555eed22e05a09ad667e4572a5bc452d8
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 07:23:10 -07:00
Brad Fitzpatrick
fee78de1ee Makefile: add tsnet to depaware
Updates #12614

Change-Id: Iff30bc457efcc96f60b563195b213cbc4dccc349
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-07 07:23:10 -07:00
Brad Fitzpatrick
5b597489bc taildrop: merge taildrop and feature/taildrop packages together
Fixes #15812

Change-Id: I3bf0666bf9e7a9caea5f0f99fdb0eb2812157608
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-06 21:11:41 -07:00
Brad Fitzpatrick
068d5ab655 feature/taildrop: move rest of Taildrop out of LocalBackend
Updates #12614

Change-Id: If451dec1d796f6a4216fe485975c87f0c62a53e5
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Co-authored-by: Nick Khyl <nickk@tailscale.com>
2025-05-06 20:41:27 -07:00
Brad Fitzpatrick
cf6a593196 cmd/tailscale/cli: rename "--posture-checking" to "--report-posture"
For consistency with other flags, per Slack chat.

Updates #5902

Change-Id: I7ae1e4c97b37185573926f5fafda82cf8b46f071
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-06 07:44:57 -07:00
Tom Proctor
62182f3bcf
cmd/k8s-operator,k8s-operator/api-proxy: move k8s proxy code to library (#15857)
The defaultEnv and defaultBool functions are copied over temporarily
to minimise diff. This lays the ground work for having both the operator
and the new k8s-proxy binary implement the API proxy

Updates #13358

Change-Id: Ieacc79af64df2f13b27a18135517bb31c80a5a02
Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-05-06 14:52:16 +01:00
Brad Fitzpatrick
597d0e8fd5 ipn/ipnlocal, tailcfg: add MagicDNS opt-in attr for IPv6 AAAA records
Until we turn on AAAA by default (which might make some people rely on
Happy Eyeballs for targets without IPv6), this lets people turn it on
explicitly if they want.

We still should add a peer cap as well in the future to let a peer
explicitly say that it's cool with IPv6.

Related: #9574

Updates #1813
Updates #1152

Change-Id: Iec6ec9b4b5db7a4dc700ecdf4a11146cc5303989
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-05 10:14:03 -07:00
Brad Fitzpatrick
b03a2a323b tstest/integration: work around ETXTBSY flake
This is a hack, but should suffice and be fast enough.

I really want to figure out what's keeping that writable fd open.

Fixes #15868

Change-Id: I285d836029355b11b7467841d31432cc5890a67e
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-04 11:00:56 -07:00
Brad Fitzpatrick
32ce1bdb48 ipn/ipnlocal: use "nb" consistently as receiver for nodeBackend
Cleanup after #15866. It was using a mix of "b" and "c" before. But "b"
is ambiguous with LocalBackend's usual "b".

Updates #12614

Change-Id: I8c2e84597555ec3db0d783a00ac1c12549ce6706
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-02 17:44:40 -07:00
Brad Fitzpatrick
653c45585e ipn/ipnlocal: rename localNodeContext to nodeBackend
As just discussed on Slack with @nickkhyl.

Updates #12614

Change-Id: I138dd7eaffb274494297567375d969b4122f3f50
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-02 17:30:46 -07:00
Brad Fitzpatrick
4fa9411e3f logtail: remove unneeded IP redaction code
Updates tailscale/corp#15664

Change-Id: I9523a43860685048548890cf1931ee6cbd60452c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-02 13:37:27 -07:00
Jordan Whited
fd63123849
wgengine/magicsock: shape relayManager and CallMeMaybeVia handling (#15864)
relayManager will eventually be responsible for handling the allocation
and handshaking of UDP relay server endpoints.

relay servers are endpoint-independent, and Conn must already maintain
handshake state for all endpoints. This justifies a new data structure
to fill these roles.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-02 13:08:17 -07:00
Brad Fitzpatrick
761aea3036 tstest/integration: don't require TestMake, stop leaking binaries in /tmp
Previously all tests shared their tailscale+tailscaled binaries in
system /tmp directories, which often leaked, and required TestMain to
clean up (which feature/taildrop didn't use).

This makes it use testing.T.TempDir for the binaries, but still only
builds them once and efficiently as possible depending on the OS
copies them around between each test's temp dir.

Updates #15812

Change-Id: I0e2585613f272c3d798a423b8ad1737f8916f527
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-02 12:22:47 -07:00
Andrew Lytvynov
3105ecd958
hostinfo,tailcfg: report TPM availability on windows/linux (#15831)
Start collecting fleet data on TPM availability via hostinfo.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-05-02 11:01:13 -07:00
Jordan Whited
f05347a5bf
wgengine/magicsock: implement more relay handshake disco handling (#15856)
Conn.handleDiscoMessage() now makes a distinction between relay
handshake disco messages and peer disco messages.

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-05-02 09:04:18 -07:00
Brad Fitzpatrick
383664b2f7 cmd/tsidp: remove backticks in README in shell example
Fixes #15818

Change-Id: I7a6f4c7368fed74b865a63acdea4559c3d0a0d09
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-01 12:18:50 -07:00
Brad Fitzpatrick
e415f51351 feature/taildrop: add integration test
Taildrop has never had an end-to-end test since it was introduced.

This adds a basic one.

It caught two recent refactoring bugs & one from 2022 (0f7da5c7dc0).

This is prep for moving the rest of Taildrop out of LocalBackend, so
we can do more refactorings with some confidence.

Updates #15812

Change-Id: I6182e49c5641238af0bfdd9fea1ef0420c112738
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-01 12:15:40 -07:00
Brad Fitzpatrick
a0d7c81a27 ipn/ipnlocal: fix Taildrop regression from refactoring
This fixes a refactoring bug introduced in 8b72dd7873201

Tests (that failed on this) are coming in a separate change.

Updates #15812

Change-Id: Ibbf461b4eaefe22ad3005fc243d0a918e8af8981
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-05-01 10:34:10 -07:00
KevinLiang10
e05e620096
util/linuxfw: fix delete snat rule (#15763)
* util/linuxfw: fix delete snat rule

This pr is fixing the bug that in nftables mode setting snat-subnet-routes=false doesn't
delete the masq rule in nat table.

Updates #15661

Signed-off-by: Kevin Liang <kevinliang@tailscale.com>

* change index arithmetic in test to chunk

Signed-off-by: Kevin Liang <kevinliang@tailscale.com>

* reuse rule creation function in rule delete

Signed-off-by: Kevin Liang <kevinliang@tailscale.com>

* add test for deleting the masq rule

Signed-off-by: Kevin Liang <kevinliang@tailscale.com>

---------

Signed-off-by: Kevin Liang <kevinliang@tailscale.com>
2025-05-01 12:12:36 -04:00
Anton Tolchanov
fe0090909b cmd/tailscale/cli: unhide --posture-checking flag to set
Updates #5902

Signed-off-by: Anton Tolchanov <anton@tailscale.com>
2025-05-01 10:09:12 +01:00
Brad Fitzpatrick
c09cd34f59 ipn/ipnlocal: fix Taildrop deadlock
This fixes the Taildrop deadlock from 8b72dd787320.

Fixes #15824

Change-Id: I5ca583de20dd0d0b513ce546439dc632408ca1f1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-30 21:21:37 -07:00
Jordan Whited
ac04338a0d
wgengine/magicsock: fix discoInfo leak (#15845)
Conn.sendDiscoMessage() now verifies if the destination disco key is
associated with any known peer(s) in a thread-safe manner.

Updates #15844

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-04-30 19:07:31 -07:00
Jordan Whited
080387558c
wgengine/magicsock: start to make disco reception Geneve aware (#15832)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-04-30 13:31:35 -07:00
Brad Fitzpatrick
ab2deda4b7 tsnet: add FunnelTLSConfig FunnelOption type
And also validate opts for unknown types, before other side effects.

Fixes #15833

Change-Id: I4cabe16c49c5b7566dcafbec59f2cd1e0c8b4b3c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-30 10:36:35 -07:00
Andrew Lytvynov
a9b3e09a1f
tool/gocross: break circular dependency on tailcfg (#15829)
Instead of using the version package (which depends on
tailcfg.CurrentCapabilityVersion) to get the git commit hash, do it
directly using debug.BuildInfo. This way, when changing struct fields in
tailcfg, we can successfully `go generate` it without compiler errors.

Updates #9634
Updates https://github.com/tailscale/corp/issues/26717

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-04-29 17:35:47 -07:00
Brad Fitzpatrick
cc6f367520 tstest/integration: remove vestigial env var set in tests
TS_CONTROL_IS_PLAINTEXT_HTTP no longer does anything as of
8fd471ce5748d2129dba584b4fa14b0d29229299

Updates #13597

Change-Id: I32ae7f8c5f2a2632e80323b1302a36295ee00736
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-29 07:34:00 -07:00
James Sanderson
1f1c323eeb control/controlclient,health: add tests for control health tracking
Updates tailscale/corp#27759

Signed-off-by: James Sanderson <jsanderson@tailscale.com>
2025-04-29 12:36:38 +01:00
Brad Fitzpatrick
ac1215c7e0 tstest/integration: export test helpers
In prep for Taildrop integration tests using them from another package.

Updates #15812

Change-Id: I6a995de4e7400658229d99c90349ad5bd1f503ae
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-28 16:35:19 -07:00
Brad Fitzpatrick
81420f8944 tstest/integration: move code from integration_test.go to integration.go
So it can be exported & used by other packages in future changes.

Updates #15812

Change-Id: I319000989ebc294e29c92be7f44a0e11ae6f7761
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-28 16:35:19 -07:00
Jordan Whited
61635f8670
wgengine/magicsock: support Geneve-encap'd Disco transmission (#15811)
Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
2025-04-28 15:55:49 -07:00
James Tucker
51b17483ff types/logger: release ArgWriter destination after use
Spotted after Brad showed me this utility in #15806.

Updates #cleanup

Signed-off-by: James Tucker <james@tailscale.com>
2025-04-28 12:54:43 -07:00
James Tucker
b95e8bf4a1 tsweb/varz: export GC CPU fraction gauge
We were missing this metric, but it can be important for some workloads.

Varz memstats output allocation cost reduced from 30 allocs per
invocation to 1 alloc per invocation.

Updates tailscale/corp#28033

Signed-off-by: James Tucker <james@tailscale.com>
Co-authored-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-28 11:52:21 -07:00
Brad Fitzpatrick
189e03e741 net/portmapper: fix test flakes from logging after test done
Fixes #15794

Change-Id: Ic22aa99acb10fdb6dc5f0b6482e722e48237703c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-04-25 15:54:05 -07:00
Nick Khyl
66371f392a feature,ipn/ipnlocal: add profileManager.StateChangeHook
We update profileManager to allow registering a single state (profile+prefs) change hook.
This is to invert the dependency between the profileManager and the LocalBackend, so that
instead of LocalBackend asking profileManager for the state, we can have profileManager
call LocalBackend when the state changes.

We also update feature.Hook with a new (*feature.Hook).GetOk method to avoid calling both
IsSet and Get.

Updates tailscale/corp#28014
Updates #12614

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-04-25 16:32:09 -05:00
Nick Khyl
0cfd643d95 ipn/ipnlocal: update profileManager to use SwitchToProfile when switching to the initial profile
This further minimizes the number of places where the profile manager updates the current profile and prefs.

We also document a scenario where an implicit profile switch can occur.
We should be able to address it after (partially?) inverting the dependency between
LocalBackend and profileManager, so that profileManager notifies LocalBackend
of profile changes instead of the other way around.

Updates tailscale/corp#28014
Updates #12614

Signed-off-by: Nick Khyl <nickk@tailscale.com>
2025-04-25 16:32:09 -05:00