1709 Commits

Author SHA1 Message Date
Brad Fitzpatrick
4afc189919 wgengine/router: make Linux delRoute idempotent, cidrDiff fail late as possible
This makes cidrDiff do as much as possible before failing, and makes a
delete of an already-deleted rule be a no-op. We should never do this
ourselves, but other things on the system can, and this should help us
recover a bit.

Also adds the start of root-requiring tests.

TODO: hook into wgengine/monitor and notice when routes are changed
behind our back, and invalidate our routes map and re-read from
kernel (via the ip command) at least on the next reconfig call.

Updates tailscale/corp#1338

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 2d96215d977e9dd823034ff000adbfd1268a4c2b)
2021-02-23 15:00:57 -08:00
Brad Fitzpatrick
a660748272 health, control/controlclient, wgengine: report when router unhealthy
Updates tailscale/corp#1338

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit fd8e070d01299eb0f0b1d5d0e89747d7f512a22d)
2021-02-23 15:00:57 -08:00
Brad Fitzpatrick
1aeeeb7e45 net/netcheck: do PCP discovery without side effects
Manually cherry-picked subset of c64bd587aee9709bc6a6203de58361e2bafc2dbf
back into the 1.4 branch.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-23 15:00:57 -08:00
David Anderson
3b9fcc2b81 wgengine/monitor: don't log any single-IP routes added to the tailscale table.
Signed-off-by: David Anderson <danderson@tailscale.com>
(cherry picked from commit 6e42430ad8447eb54b793c9ce441ef9dd53f8283)
2021-02-23 15:00:57 -08:00
David Anderson
d51ebe38d4 wgengine/monitor: on linux, also monitor for IPv6 changes.
Signed-off-by: David Anderson <danderson@tailscale.com>
(cherry picked from commit df5adb2e2333b9de4e8e46b87d710ea4edbee49c)
2021-02-23 15:00:57 -08:00
Brad Fitzpatrick
b8b83c8a3f wgengine/magicsock: fix discoEndpoint caching bug when a node key changes
Fixes #1391

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit e9e4f1063d84f865b263141bbbb6128b3ab7c32a)
2021-02-23 15:00:53 -08:00
Brad Fitzpatrick
2d0bd18a08 wgengine/tsdns: skip test that requires local IPv6 when IPv6 unavailable
Fixes #1292

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-16 15:07:35 -05:00
Brad Fitzpatrick
16c67870d3 wgengine/winnet: don't build on non-windows
It only affects 'go install ./...', etc, and only on darwin/arm64 (M1 Macs) where
the go-ole package doesn't compile.

No need to build it.

Updates #943

(cherry picked from commit cbd6224ca41d0c9f0ac0db96e5e2854eb6a5212e)
2021-02-16 11:51:28 -08:00
David Anderson
64a9656c01 VERSION.txt: this is v1.4.4
Signed-off-by: David Anderson <danderson@tailscale.com>
v1.4.4
2021-02-10 13:28:13 -08:00
Brad Fitzpatrick
b26876427c wgengine/router: add another Windows firewall rule to allow incoming UDP
Based on @sailorfrag's research.

Fixes #1312

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-10 13:19:26 -08:00
Brad Fitzpatrick
cc2ec141fe wgengine/magicsock: reconnect to DERP home after network comes back up
Updates #1310
2021-02-10 13:19:26 -08:00
Brad Fitzpatrick
d2c1ae7ed4 VERSION.txt: this is v1.4.3 v1.4.3 2021-02-08 19:22:17 -08:00
Brad Fitzpatrick
121f5a00f7 wgengine/magicsock: fix DERP reader hang regression during concurrent reads
Fixes #1282

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 6b365b02396b54536cb40dbbe235433493874935)
2021-02-08 14:39:02 -08:00
Brad Fitzpatrick
d06ceffd02 wgengine/magicsock: add disabled failing (deadlocking) test for #1282
The fix can make this test run unconditionally.

This moves code from 5c619882bc4911a2c9e7d0bb491b9e50d27afcd7 for
testability but doesn't fix it yet. The #1282 problem remains (when I
wrote its wake-up mechanism, I forgot there were N DERP readers
funneling into 1 UDP reader, and the code just isn't correct at all
for that case).

Also factor out some test helper code from BenchmarkReceiveFrom.

The refactoring in magicsock.go for testability should have no
behavior change.

(cherry picked from commit 6d2b8df06df1d20d4ae92793a066340bb26b6e25)
2021-02-08 14:38:37 -08:00
Brad Fitzpatrick
0cf60b5185 control/controlclient: don't call lite endpoint update path when logged out
This was the other half of the #1271 problem.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit e8d4afedd103f772a02968ef20c6c82ef9796945)
2021-02-05 10:04:04 -08:00
Brad Fitzpatrick
910682c851 control/controlclient: avoid crash sending map request with zero node key
Fixes #1271

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 7529b7401846813beeb58593f2b201169d0469c8)
2021-02-05 10:04:03 -08:00
Brad Fitzpatrick
c027962893 wgengine: access flow pending problem with lock held
Missed review feedback from just-submitted d37058af728c.

(cherry picked from commit 70eb05fd4730f5bca42f870961c94f57bf88b33b)
2021-02-04 11:19:54 -08:00
Brad Fitzpatrick
acc50d6b67 net/packet: add some more TSMP packet reject reasons and MaybeBroken bit
Unused for now, but I want to backport this commit to 1.4 so 1.6 can
start sending these and then at least 1.4 logs will stringify nicely.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit d37058af728c72a4ef29ccb154da4528a9cb9575)
2021-02-04 10:59:17 -08:00
Brad Fitzpatrick
a2ab23ba6c wgengine/magicsock: filter disco packets and packets when stopped from wireguard
Fixes #1167
Fixes tailscale/corp#219

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit f7eed25bb91e11514a0b8a7bc965397481bbf1ac)
2021-02-04 09:38:24 -08:00
Brad Fitzpatrick
71b13b5ac2 cmd/tailscale: fix IPN message reading stall in tailscale status -web
Fixes #1234
Updates #1254

(cherry picked from commit 9a7078985338c4699228373b16d93d3227b3723e)
2021-02-02 14:58:47 -08:00
David Crawshaw
1c238cdce6 net/interfaces: use a uint32_t for ipv4 address
The code was using a C "int", which is a signed 32-bit integer.
That means some valid IP addresses were negative numbers.
(In particular, the default router address handed out by AT&T
fiber: 192.168.1.254. No I don't know why they do that.)
A negative number is < 255, and so was treated by the Go code
as an error.

This fixes the unit test failure:

	$ go test -v -run=TestLikelyHomeRouterIPSyscallExec ./net/interfaces
	=== RUN   TestLikelyHomeRouterIPSyscallExec
	    interfaces_darwin_cgo_test.go:15: syscall() = invalid IP, false, netstat = 192.168.1.254, true
	--- FAIL: TestLikelyHomeRouterIPSyscallExec (0.00s)

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
(cherry picked from commit d139fa9c92d9e86667628bf9ae9e8f671abe4068)
2021-02-02 14:58:45 -08:00
David Anderson
a9f58fe822 VERSION.txt: this is v1.4.2
Signed-off-by: David Anderson <danderson@tailscale.com>
v1.4.2
2021-02-01 16:24:43 -08:00
David Anderson
5417ca69a7 wgengine/router: probe better for v6 policy routing support.
Previously we disabled v6 support if the disable_policy knob was
missing in /proc, but some kernels support policy routing without
exposing the toggle. So instead, treat disable_policy absence as a
"maybe", and make the direct `ip -6 rule` probing a bit more
elaborate to compensate.

Fixes #1241.

Signed-off-by: David Anderson <danderson@tailscale.com>
(cherry picked from commit 267531e4f8649c3c14915299eecf1f29b94a8b9e)
2021-02-01 16:13:32 -08:00
Brad Fitzpatrick
03e640e94d wgengine/router: clarify disabled IPv6 message on Linux
(cherry picked from commit 1f97037b94baf92bf26598c38987e4d69079efb7)
2021-02-01 14:09:50 -08:00
Brad Fitzpatrick
138bcae525 cmd/tailscale/cli: recommend sudo for 'tailscale up' on failure
Fixes #1220

(cherry picked from commit c7d4bf2333b195b1553e588040f008ca307089ea)
2021-02-01 13:54:48 -08:00
Brad Fitzpatrick
bb0ef32dd2 cmd/tailscaled/tailscaled.service: revert recent hardening for now
It broke Debian Stretch. We'll try again later.

Updates #1245

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 2889fabaefc50040507ead652d6d2b212f476c2b)
2021-02-01 13:38:09 -08:00
David Anderson
dde7ba4ecf VERSION.txt: this is v1.4.1
Signed-off-by: David Anderson <danderson@tailscale.com>
v1.4.1
2021-01-28 13:54:32 -08:00
Brad Fitzpatrick
fc30cff688 wgengine/router: don't configure IPv6 on Linux when IPv6 is unavailable
Fixes #1214

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit c7fc4a06dad9eaa5c42e525ddd69d50aede6c919)
2021-01-28 13:45:59 -08:00
David Anderson
775fe13e27 cmd/tailscaled: add /run to the allowed paths for iptables.
Signed-off-by: David Anderson <danderson@tailscale.com>
(cherry picked from commit de497358b84f4b368ce9b637b98ea8899d6b337e)
2021-01-28 13:45:08 -08:00
Josh Bleecher Snyder
2e33fdfe67 types/logger: fix rateFree interaction with verbosity prefixes
We log lines like this:

c.logf("[v1] magicsock: disco: %v->%v (%v, %v) sent %v", c.discoShort, dstDisco.ShortString(), dstKey.ShortString(), derpStr(dst.String()), disco.MessageSummary(m))

The leading [v1] causes it to get unintentionally rate limited.
Until we have a proper fix, work around it.

Fixes #1216

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
(cherry picked from commit 1e28207a152fd1aaccbae7e046d2ed01b51f4970)
2021-01-28 10:22:09 -08:00
David Anderson
3d7cff91b3 VERSION.txt: this is v1.4.0
Signed-off-by: David Anderson <danderson@tailscale.com>
v1.4.0
2021-01-27 15:40:21 -08:00
Brad Fitzpatrick
4d943536f1 wgengine: don't leak TUN device in NewUserspaceEngine error path
Updates #1187

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-01-27 11:06:56 -08:00
Brad Fitzpatrick
9f5b0d058f wgengine: fix bugs from earlier fix
Fixes a regression from e970ed09951a that wasn't covered by tests
in this repo. (Our end-to-end tests in another repo caught this.)

Updates #1204
2021-01-27 10:32:08 -08:00
Sonia Appasamy
4dab0c1702
tailcfg: update node display name fields and methods (#1207)
Signed-off-by: Sonia Appasamy <sonia@tailscale.com>

Consolidates the node display name logic from each of the clients into
tailcfg.Node. UI clients can use these names directly, rather than computing
them independently.
2021-01-27 11:50:31 -05:00
Brad Fitzpatrick
35e10c78fc net/interfaces: don't send over zt* interfaces
Fixes #1208

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-01-26 15:20:43 -08:00
David Anderson
692a011b54 net/interfaces: remove IsTailscaleIP, make callers use tsaddr.
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-01-26 15:10:51 -08:00
Brad Fitzpatrick
e970ed0995 wgengine: fix crash reading long UAPI lines from legacy peers
Also don't log.Fatalf in a function returning an error.

Fixes #1204

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-01-26 11:39:13 -08:00
Brad Fitzpatrick
a7edcd0872 ipn/ipnstate: update tailscale status -web to match CLI 2021-01-26 08:29:59 -08:00
Brad Fitzpatrick
a98538f84a Merge branch 'main' of github.com:tailscale/tailscale into main 2021-01-25 15:53:13 -08:00
Brad Fitzpatrick
c3c59445ff ipn/ipnserver: on Windows in unattended mode, wait for Engine forever
Updates #1187
2021-01-25 15:52:24 -08:00
Brad Fitzpatrick
0dde8fa0a8 ipn/ipnserver: rearrange some code
No functional change. Make a future diff easier to read.
2021-01-25 15:46:39 -08:00
Brad Fitzpatrick
4d3c09ced4 ipn/ipnserver: on Windows in unattended mode, wait for Engine forever
Updates #1187
2021-01-25 15:32:13 -08:00
Sonia Appasamy
567c5a6d9e
tailcfg, controlclient: add DisplayName field to tailcfg.Node and populate it from controlclient (#1191)
Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2021-01-25 17:41:39 -05:00
Brad Fitzpatrick
4fea604979 wgengine/router: stop setPrivateNetwork goroutine on configureInterface failure
On Windows, configureInterface starts a goroutine reconfiguring the
Windows firewall.

But if configureInterface fails later, that goroutine kept running and
likely failing forever, spamming logs. Make it stop quietly if its
launching goroutine filed.
2021-01-25 13:22:51 -08:00
Andrey Petrov
bf6205d200 LICENSE: Reformat for Github
Should be equivalent to the license before, but compatible with the library Github uses to detect the license for the project's metadata: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/licensing-a-repository#detecting-a-license

Signed-off-by: Andrey Petrov <andrey.petrov@shazow.net>
2021-01-24 16:20:22 -08:00
David Anderson
9f7cbf6cf1 wgengine/filter: add a Clone method.
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-01-22 17:31:37 -08:00
Brad Fitzpatrick
9ce92aad3e cmd/tailscaled: update depaware.txt 2021-01-22 14:44:40 -08:00
Brad Fitzpatrick
fa3543d629 control/controlclient: use more direct way of getting the MagicDNS suffix
Suggested by Avery earlier. Ends up fixing bug in "tailscale status" when
MagicDNS if off too:
https://forum.tailscale.com/t/1-3-293-is-released-a-1-4-0-pre-release/349/11?u=bradfitz
2021-01-22 14:30:56 -08:00
Brad Fitzpatrick
e7bf144c3f ipn, wgengine/filter: fix Shields Up recent regression and old bug
Fixes #1192 (regression)
Fixes #1193 (old bug)
2021-01-22 13:39:53 -08:00
Brad Fitzpatrick
97496a83af wgengine/tstun: also support DropSilently on PostFilterIn
Not a problem (yet). But should be consistent with other places that support both
types of drops.
2021-01-22 13:22:32 -08:00