summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2023-09-05ipn, ipn/ipnlocal: add Foreground field for ServeConfigmarwan/postmemMarwan Sulaiman10-288/+214
This PR adds a new field to the serve config that can be used to identify which serves are in "foreground mode" and then can also be used to ensure they do not get persisted to disk so that if Tailscaled gets ungracefully shutdown, the reloaded ServeConfig will not have those ports opened. Updates #8489 Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
2023-09-05ipn, ipn/ipnlocal: add session identifier for WatchIPNBusMarwan Sulaiman3-2/+13
This PR adds a SessionID field to the ipn.Notify struct so that ipn buses can identify a session and register deferred clean up code in the future. The first use case this is for is to be able to tie foreground serve configs to a specific watch session and ensure its clean up when a connection is closed. Updates #8489 Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
2023-09-05util/rands: add package with HexString funcBrad Fitzpatrick5-13/+45
We use it a number of places in different repos. Might as well make one. Another use is coming. Updates #cleanup Change-Id: Ib7ce38de0db35af998171edee81ca875102349a4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-05cli/serve: shorten help text on errorSonia Appasamy2-16/+20
Our BETA serve help text is long and often hides the actual error in the user's usage. Instead of printing the full text, prompt users to use `serve --help` if they want the help info. Fixes #14274 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2023-09-04.github,cmd/gitops-pusher: update to checkout@v4Maisem Ali10-22/+22
checkout@v3 is broken: actions/checkout#1448 Updates #cleanup Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-09-04cmd/testwrapper: emit logs of failed tests on timeoutMaisem Ali1-24/+28
It would just fail the entire pkg, but would not print any logs. It was already tracking all the logs, so have it emit them when the pkg fails/times out. Updates #9231 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-09-04ipn/ipnlocal: prevent cc leaks on multiple Start callsMaisem Ali1-0/+7
If Start was called multiple times concurrently, it would create a new client and shutdown the previous one. However there was a race possible between shutting down the old one and assigning a new one where the concurent goroutine may have assigned another one already and it would leak. Updates tailscale/corp#14471 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-09-04ipn/ipnlocal: fix startIsNoopLockedMaisem Ali1-1/+2
It got broken back when FUS was introduced, but we never caught it. Updates tailscale/corp#14471 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-09-02net/netmon, net/tsdial: add some link change metricsBrad Fitzpatrick3-1/+27
Updates #9040 Change-Id: I2c87572d79d2118bcf1f0122eccfe712c1bea9d5 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-02client/web, clientupdate, util/linuxfw, wgengine/magicsock: Use %v verb for ↵Craig Rodrigues4-5/+6
errors Replace %w verb with %v verb when logging errors. Use %w only for wrapping errors with fmt.Errorf() Fixes: #9213 Signed-off-by: Craig Rodrigues <rodrigc@crodrigues.org>
2023-09-02ipn/ipnlocal: fix deadlock in resetControlClientLockedMaisem Ali6-27/+52
resetControlClientLocked is called while b.mu was held and would call cc.Shutdown which would wait for the observer queue to drain. However, there may be active callbacks from cc already waiting for b.mu resulting in a deadlock. This makes it so that resetControlClientLocked does not call Shutdown, and instead just returns the value. It also makes it so that any status received from previous cc are ignored. Updates tailscale/corp#12827 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-09-01all: implement AppendText alongside MarshalText (#9207)Joe Tsai12-69/+108
This eventually allows encoding packages that may respect the proposed encoding.TextAppender interface. The performance gains from this is between 10-30%. Updates tailscale/corp#14379 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2023-09-01client/web,cmd/tailscale: add prefix flag for web commandWill Norris6-28/+28
We already had a path on the web client server struct, but hadn't plumbed it through to the CLI. Add that now and use it for Synology and QNAP instead of hard-coding the path. (Adding flag for QNAP is tailscale/tailscale-qpkg#112) This will allow supporting other environments (like unraid) without additional changes to the client/web package. Also fix a small bug in unraid handling to only include the csrf token on POST requests. Updates tailscale/corp#13775 Signed-off-by: Will Norris <will@tailscale.com>
2023-09-01cmd/tailscale,ipn: add auto-update flags and prefs (#8861)Andrew Lytvynov8-16/+138
The flags are hidden for now. Adding propagation to tailscaled and persistence only. The prefs field is wrapped in a struct to allow for future expansion (like update schedule). Updates #6907 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-09-01cmd/tailscaled, tstest/integration: make tailscaled die when parent diesBrad Fitzpatrick2-0/+24
I noticed that failed tests were leaving aroudn stray tailscaled processes on macOS at least. To repro, add this to tstest/integration: func TestFailInFewSeconds(t *testing.T) { t.Parallel() time.Sleep(3 * time.Second) os.Exit(1) t.Fatal("boom") } Those three seconds let the other parallel tests (with all their tailscaled child processes) start up and start running their tests, but then we violently os.Exit(1) the test driver and all the children were kept alive (and were spinning away, using all available CPU in gvisor scheduler code, which is a separate scary issue) Updates #cleanup Change-Id: I9c891ed1a1ec639fb2afec2808c04dbb8a460e0e Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-01cmd/tailscale: combine serve and funnel for debug wip funnel stream model ↵Tyler Smalley8-119/+175
(#9169) > **Note** > Behind the `TAILSCALE_USE_WIP_CODE` flag In preparing for incoming CLI changes, this PR merges the code path for the `serve` and `funnel` subcommands. See the parent issue for more context. The following commands will run in foreground mode when using the environment flag. ``` tailscale serve localhost:3000 tailscae funnel localhost:3000 ``` Replaces #9134 Updates #8489 Signed-off-by: Tyler Smalley <tyler@tailscale.com> Signed-off-by: Marwan Sulaiman <marwan@tailscale.com> Co-authored-by: Marwan Sulaiman <marwan@tailscale.com>
2023-09-01control/controlclient: clean up various things in prep for state overhaulBrad Fitzpatrick2-223/+151
We want the overall state (used only for tests) to be computed from the individual states of each component, rather than moving the state around by hand in dozens of places. In working towards that, we found a lot of things to clean up. Updates #cleanup Change-Id: Ieaaae5355dfae789a8ec7a56ce212f1d7e3a92db Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-01ipn/ipnlocal: avoid calling Start from resetForProfileChangeLockedOnEntryBrad Fitzpatrick1-0/+7
During Shutdown of an ephemeral node, we called Logout (to best effort delete the node earlier), which then called back into resetForProfileChangeLockedOnEntry, which then tried to Start again. That's all a waste of work during shutdown and complicates other cleanups coming later. Updates #cleanup Change-Id: I0b8648cac492fc70fa97c4ebef919bbe352c5d7b Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-01control/controlclient: serialize Observer callsBrad Fitzpatrick1-8/+86
Don't just start goroutines and hope for them to be ordered. Fixes potential regression from earlier 7074a40c0. Updates #cleanup Change-Id: I501a6f3e4e8e6306b958bccdc1e47869991c31f7 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-01net/tsdial: be smarter about when to close SystemDial connsBrad Fitzpatrick2-12/+38
It was too aggressive before, as it only had the ill-defined "Major" bool to work with. Now it can check more precisely. Updates #9040 Change-Id: I20967283b64af6a9cad3f8e90cff406de91653b8 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-31control/controlclient, ipn/ipnlocal: unplumb a bool true literal optBrad Fitzpatrick2-5/+1
Updates #cleanup Change-Id: I664f280a2e06b9875942458afcaf6be42a5e462a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-31.github/workflows: only run bench all on packages with benchmarksBrad Fitzpatrick1-2/+3
Drops time by several minutes. Also, on top of that: skip building variant CLIs on the race builder (29s), and getting qemu (15s). Updates #9182 Change-Id: I979e02ab8c0daeebf5200459c9e4458a1f62f728 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-31ipn/ipnlocal: rename LogoutSync to LogoutMaisem Ali4-7/+9
Updates #cleanup Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-31ipn/ipnlocal: fix missing mutex usage for profileManagerMaisem Ali2-7/+10
It required holding b.mu but was documented incorrectly, fix. Updates #cleanup Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-31ipn/ipnlocal,control/controlclient: make Logout more syncMaisem Ali5-106/+61
We already removed the async API, make it more sync and remove the FinishLogout state too. This also makes the callback be synchronous again as the previous attempt was trying to work around the logout callback resulting in a client shutdown getting blocked forever. Updates #3833 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-31.github: do not use testwrapper for benchmarksMaisem Ali1-2/+4
Updates #9182 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-31control/controlclient: run SetControlClientStatus in goroutineMaisem Ali2-8/+5
We have cases where the SetControlClientStatus would result in a Shutdown call back into the auto client that would block forever. The right thing to do here is to fix the LocalBackend state machine but thats a different dumpster fire that we are slowly making progress towards. This makes it so that the SetControlClientStatus happens in a different goroutine so that calls back into the auto client do not block. Also add a few missing mu.Unlocks in LocalBackend.Start. Updates #9181 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-31control/controlclient: rename Auto cancel methods, add missing Lock variantBrad Fitzpatrick1-18/+26
Then use the Locked variants in Shutdown while we already hold the lock. Updates #cleanup Change-Id: I367d53e6be6f37f783c8f43fc9c4d498d0adf501 Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-31ipn/ipnlocal: add missing mutex unlock in error pathBrad Fitzpatrick1-1/+4
Found while debugging something else. Updates #cleanup Change-Id: I73fe55da14bcc3b1ffc39e2dbc0d077bc7f70cf1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-31tsnet: remove redundant ephemeral logout on closeBrad Fitzpatrick1-9/+0
LocalBackend.Shutdown already does it. Updates #cleanup Change-Id: Ie5dd7d8e5d9e69644f211ee1de6c790f57f5ae25 Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-31ipn/ipnlocal: deflake some testsBrad Fitzpatrick1-2/+25
* don't try to re-Start (and thus create a new client) during Shutdown * in tests, wait for controlclient to fully shut down when replacing it * log a bit more Updates tailscale/corp#14139 Updates tailscale/corp#13175 etc Updates #9178 and its flakes. Change-Id: I3ed2440644dc157aa6e616fe36fbd29a6056846c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30control/controlclient: remove unused StartLogoutBrad Fitzpatrick7-54/+18
Updates #cleanup Co-authored-by: Maisem Ali <maisem@tailscale.com> Change-Id: I9d052fdbee787f1e8c872124e4bee61c7f04d142 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30types/logger: add TestLoggerBrad Fitzpatrick1-0/+16
We have this in another repo and I wanted it here too. Updates #cleanup Change-Id: If93dc73f11eaaada5024acf2a885a153b88db5a0 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30go.mod.sri: update SRI hash for go.mod changesFlakes Updater3-3/+3
Signed-off-by: Flakes Updater <noreply+flakes-updater@tailscale.com>
2023-08-30clientupdate: add linux tarball updates (#9144)Andrew Lytvynov8-5/+484
As a fallback to package managers, allow updating tailscale that was self-installed in some way. There are some tricky bits around updating the systemd unit (should we stick to local binary paths or to the ones in tailscaled.service?), so leaving that out for now. Updates #6995 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-08-30ipn/ipnlocal: support most Linuxes in handleC2NUpdate (#9114)Chris Palmer4-75/+100
* ipn/ipnlocal: support most Linuxes in handleC2NUpdate Updates #6995 Signed-off-by: Chris Palmer <cpalmer@tailscale.com>
2023-08-30control/controlclient: cancel map poll when logging outBrad Fitzpatrick1-0/+1
Don't depend on the server to do it. Updates #cleanup Change-Id: I8ff40b02aa877155a71fd4db58cbecb872241ac8 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30control/controlclient: use slices package moreBrad Fitzpatrick1-19/+4
Updates #cleanup Change-Id: Ic17384266dc59bc4e710efdda311d6e0719529da Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30client/web: simply csrf key caching in cgi modeWill Norris1-10/+1
Instead of trying to use the user config dir, and then fail back to the OS temp dir, just always use the temp dir. Also use a filename that is less likely to cause collisions. This addresses an issue on a test synology instance that was mysteriously failing because there was a file at /tmp/tailscale. We could still technically run into this issue if a /tmp/tailscale-web-csrf.key file exists, but that seems far less likely. Updates tailscale/corp#13775 Signed-off-by: Will Norris <will@tailscale.com>
2023-08-30control/controlclient: de-pointer Status.PersistView, document moreBrad Fitzpatrick4-13/+22
Updates #cleanup Updates #1909 Change-Id: I31d91e120e3b299508de2136021eab3b34131a44 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30control/controlclient: delete Status.Log{in,out}FinishedBrad Fitzpatrick6-41/+33
They were entirely redundant and 1:1 with the status field so this turns them into methods instead. Updates #cleanup Updates #1909 Change-Id: I7d939750749edf7dae4c97566bbeb99f2f75adbc Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30cmd/k8s-operator: emit event if HTTPS is disabled on TailnetMaisem Ali3-2/+14
Instead of confusing users, emit an event that explicitly tells the user that HTTPS is disabled on the tailnet and that ingress may not work until they enable it. Updates #9141 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-30cmd/sniproxy: move default debug-port away from 8080.Denton Gentry1-1/+1
Port 8080 is routinely used for HTTP services, make it easier to use --forwards=tcp/8080/... by moving the metrics port out of the way. Updates #1748 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2023-08-30control/controlclient: unexport Status.state, add test-only accessorBrad Fitzpatrick3-12/+16
Updates #cleanup Updates #1909 Change-Id: I38dcde6fa0de0f58ede4529992cee2e36de33dd6 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30cmd/k8s-operator: add metrics to track usageMaisem Ali4-0/+75
Updates #502 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2023-08-30adjust build tags for tamagoAndrea Barisani6-6/+6
Signed-off-by: Andrea Barisani <andrea@inversepath.com>
2023-08-30control/controlclient: merge, simplify two health check callsBrad Fitzpatrick2-13/+16
I'm trying to remove some stuff from the netmap update path. Updates #1909 Change-Id: Iad2c728dda160cd52f33ef9cf0b75b4940e0ce64 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-30cm/k8s-operator,cmd/containerboot: fix STS config, more tests (#9155)Irbe Krumina2-3/+31
Ensures that Statefulset reconciler config has only one of Cluster target IP or tailnet target IP. Adds a test case for containerboot egress proxy mode. Updates tailscale/tailscale#8184 Signed-off-by: irbekrm <irbekrm@gmail.com>
2023-08-30cmd/sniproxy: switch to peterbourgon/ff for flagsDenton Gentry1-10/+15
Add support for TS_APPC_* variables to supply arguments by switching to https://github.com/peterbourgon/ff for CLI flag parsing. For example: TS_APPC_FORWARDS=tcp/22/github.com ./sniproxy Updates https://github.com/tailscale/tailscale/issues/1748 Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2023-08-30cmd/k8s-operator,cmd/containerboot: add kube egress proxy (#9031)Irbe Krumina5-50/+338
First part of work for the functionality that allows users to create an egress proxy to access Tailnet services from within Kubernetes cluster workloads. This PR allows creating an egress proxy that can access Tailscale services over HTTP only. Updates tailscale/tailscale#8184 Signed-off-by: irbekrm <irbekrm@gmail.com> Co-authored-by: Maisem Ali <maisem@tailscale.com> Co-authored-by: Rhea Ghosh <rhea@tailscale.com>