Brad Fitzpatrick
4b75a27969
wgengine/monitor: fix crash on Linux on type 21 messages
...
Fixes #532
2020-07-07 10:45:25 -07:00
Brad Fitzpatrick
c1cabe75dc
derp: fix server struct fielfd alignment on 32-bit
...
Mostly so the GitHub CI will pass on 32-bit.
2020-07-07 09:08:15 -07:00
Brad Fitzpatrick
724ad13fe1
wgengine/tstun: fix alignment of 64-bit atomic field
...
We had a test for it, but no 32-bit builder apparently. :(
Fixes #529
2020-07-07 08:28:40 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
4db60a8436
wgengine/monitor: parse Linux netlink messages, ignore our own events
...
Fixes tailscale/corp#412 ("flood of link change events at start-up")
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-07-06 22:42:01 -07:00
Brad Fitzpatrick
742b8b44a8
net/tsaddr: new package to hold Tailscale-specific IPs/ranges
...
And update existing callers with (near) duplicated cases.
2020-07-06 22:33:29 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
5c6d8e3053
netcheck, tailcfg, interfaces, magicsock: survey UPnP, NAT-PMP, PCP
...
Don't do anything with UPnP, NAT-PMP, PCP yet, but see how common they
are in the wild.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-07-06 15:25:35 -07:00
Brad Fitzpatrick
6196b7e658
wgengine/magicsock: change API to not permit disco key changes
...
Generate the disco key ourselves and give out the public half instead.
Fixes #525
2020-07-06 12:10:39 -07:00
Brad Fitzpatrick
32156330a8
net/interfaces: add func LikelyHomeRouterIP
...
For discovering where we might direct NAT-PMP/PCP/UPnP queries at in
the future.
2020-07-06 10:38:00 -07:00
Brad Fitzpatrick
c3c607e78a
util/lineread: add little package to read lines from files/Readers
2020-07-06 10:34:33 -07:00
Brad Fitzpatrick
cf74e9039e
net/netcheck: add an informative payload in the netcheck UDP helper packets
...
Per comment from @normanr:
https://github.com/tailscale/tailscale/commit/0a5ab533c1b8853774587a471ab9c8a0949b1eac#r40401954
Updates #188
2020-07-06 09:55:11 -07:00
Brad Fitzpatrick
0a5ab533c1
net/netcheck: send dummy packet out to help airport extreme in hairpin check
...
At least the Apple Airport Extreme doesn't allow hairpin
sends from a private socket until it's seen traffic from
that src IP:port to something else out on the internet.
See https://github.com/tailscale/tailscale/issues/188#issuecomment-600728643
And it seems that even sending to a likely-filtered RFC 5737
documentation-only IPv4 range is enough to set up the mapping.
So do that for now. In the future we might want to classify networks
that do and don't require this separately. But for now help it.
I've confirmed that this is enough to fix the hairpin check on Avery's
home network, even using the RFC 5737 IP.
Fixes #188
2020-07-06 08:24:22 -07:00
Brad Fitzpatrick
b9a95e6ce1
go.sum: add missing lines
2020-07-06 08:23:44 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
0fc15dcbd5
version: explicitly use 9 hex digits in git describe version number
...
So it doesn't vary based on who's doing the release with which version
of git.
Fixes tailscale/corp#419
2020-07-03 22:28:45 -07:00
Brad Fitzpatrick
5132edacf7
wgengine/magicsock: fix data race from undocumented wireguard-go requirement
...
Endpoints need to be Stringers apparently.
Fixes tailscale/corp#422
2020-07-03 22:27:52 -07:00
Brad Fitzpatrick
9fbe8d7cf2
go.mod: bump wireguard
2020-07-03 14:09:29 -07:00
Brad Fitzpatrick
c9089c82e8
control/controlclient, tailcfg: turn active route discovery on by default
...
Updates #483
2020-07-03 13:55:33 -07:00
Brad Fitzpatrick
3f74859bb0
version: new month, new date string
2020-07-03 13:47:09 -07:00
Brad Fitzpatrick
630379a1d0
cmd/tailscale: add tailscale status region name, last write, consistently star
...
There's a lot of confusion around what tailscale status shows, so make it better:
show region names, last write time, and put stars around DERP too if active.
Now stars are always present if activity, and always somewhere.
2020-07-03 13:44:22 -07:00
Brad Fitzpatrick
0ea51872c9
types/logger: add rateFreePrefix rate-limiting-exempt log format prefixes
...
Per conversation with @danderson.
2020-07-03 13:09:32 -07:00
Brad Fitzpatrick
9a8700b02a
wgengine/magicsock: add discoEndpoint heartbeat
...
Updates #483
2020-07-03 12:43:39 -07:00
Brad Fitzpatrick
9f930ef2bf
wgengine/magicsock: remove the discoEndpoint.timers map
...
It ended up being more complicated than it was worth.
2020-07-03 11:45:41 -07:00
Brad Fitzpatrick
f5f3885b5b
wgengine/magicsock: bunch of misc discovery path cleanups
...
* fix tailscale status for peers using discovery
* as part of that, pull out disco address selection into reusable
and testable discoEndpoint.addrForSendLocked
* truncate ping/pong logged hex txids in half to eliminate noise
* move a bunch of random time constants into named constants
with docs
* track a history of per-endpoint pong replies for future use &
status display
* add "send" and " got" prefix to discovery message logging
immediately before the frame type so it's easier to read than
searching for the "<-" or "->" arrows earlier in the line; but keep
those as the more reasily machine readable part for later.
Updates #483
2020-07-03 11:26:22 -07:00
Dmytro Shynkevych and Dave Anderson
e9643ae724
wgengine: prevent log after exit in watchdog test
...
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com >
2020-07-03 10:52:39 -07:00
Dmytro Shynkevych and Dave Anderson
16b2bbbbbb
wgengine: close in reverse order of bringup
...
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com >
2020-07-03 10:52:39 -07:00
Brad Fitzpatrick
7883e5c5e7
go.mod: restore staticcheck module, make it stick around, go mod tidy
...
It kept coming & going as different people ran go mod tidy and others
ran staticcheck.
Make it stop going away with go mod tidy by adding a dep to it.
2020-07-02 22:55:14 -07:00
Brad Fitzpatrick
6c70cf7222
wgengine/magicsock: stop ping timeout timer on pong receipt, misc log cleanup
...
Updates #483
2020-07-02 22:54:57 -07:00
David Anderson and Dave Anderson
0aea087766
tstest/natlab: add PacketHandler and Inject.
...
Together, they can be used to plug custom packet processors into
Machines.
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-02 21:51:09 -07:00
David Anderson and Dave Anderson
73db7e99ab
tstest/natlab: make Machine constructible directly.
...
This is a prelude to adding more fields, which would otherwise
become more unnamed function params.
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-02 21:51:09 -07:00
David Anderson
d94593e884
tstest/natlab: unregister conn4 if registration of conn6 fails.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 02:27:31 +00:00
David Anderson
d7bc4ec029
tstest/natlab: use common helper for conn registration.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 02:26:54 +00:00
David Anderson
80a14c49c6
tstest/natlab: add comments to conns4/conns6.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 02:23:01 +00:00
David Anderson
c53b154171
tstest/natlab: use &Network in test.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 02:22:06 +00:00
David Anderson
622c0d0cb3
tstest/natlab: print trace data when NATLAB_TRACE is set.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 02:10:41 +00:00
David Anderson and Dave Anderson
1d4f9852a7
tstest/natlab: correctly handle dual-stacked PacketConns.
...
Adds a test with multiple networks, one of which is v4-only.
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-02 19:09:31 -07:00
David Anderson
771eb05bcb
tstest/natlab: first network attached becomes the default route.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 01:03:05 +00:00
David Anderson
f2e5da916a
tstest/natlab: allow sensible default construction of networks.
...
Add a test for LAN->LAN traffic.
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-03 00:53:24 +00:00
David Anderson and Dave Anderson
9cd4e65191
smallzstd: new package that constructs zstd small encoders/decoders.
...
It's just a config wrapper that passes "use less memory at the
expense of compression" parameters by default, so that we don't
accidentally construct resource-hungry (de)compressors.
Also includes a benchmark that measures the memory cost of the
small variants vs. the stock variants. The savings are significant
on both compressors (~8x less memory) and decompressors (~1.4x less,
not including the savings from the significantly smaller
window on the compression side - with those savings included it's
more like ~140x smaller).
BenchmarkSmallEncoder-8 56174 19354 ns/op 31 B/op 0 allocs/op
BenchmarkSmallEncoderWithBuild-8 2900 382940 ns/op 1746547 B/op 36 allocs/op
BenchmarkStockEncoder-8 48921 25761 ns/op 286 B/op 0 allocs/op
BenchmarkStockEncoderWithBuild-8 426 2630241 ns/op 13843842 B/op 124 allocs/op
BenchmarkSmallDecoder-8 123814 9344 ns/op 0 B/op 0 allocs/op
BenchmarkSmallDecoderWithBuild-8 41547 27455 ns/op 27694 B/op 31 allocs/op
BenchmarkStockDecoder-8 129832 9417 ns/op 1 B/op 0 allocs/op
BenchmarkStockDecoderWithBuild-8 25561 51751 ns/op 39607 B/op 92 allocs/op
Signed-off-by: David Anderson <danderson@tailscale.com >
2020-07-02 16:13:06 -07:00
Brad Fitzpatrick
97910ce712
tstest/natlab: remove unused PacketConner type
2020-07-02 14:50:04 -07:00
Brad Fitzpatrick
14b4213c17
tstest/natlab: add missing tests from earlier commits
...
Now you can actually see that packet delivery works.
Pairing with @danderson
2020-07-02 14:19:43 -07:00
Brad Fitzpatrick
3f4f1cfe66
tstest/natlab: basic NAT-free packet delivery works
...
Pairing with @danderson
2020-07-02 14:18:36 -07:00
Brad Fitzpatrick
a477e70632
tstest/natlab: network address allocation
...
Pairing with @danderson
2020-07-02 13:39:41 -07:00
Brad Fitzpatrick
bb1a9e4700
tstest/natlab: bit more of in-memory network testing package
...
Pairing with @danderson
2020-07-02 13:02:13 -07:00
Brad Fitzpatrick
23c93da942
tstest/natlab: start of in-memory network testing package
...
Pairing with @danderson
2020-07-02 12:36:12 -07:00
Brad Fitzpatrick
c52905abaa
wgengine/magicsock: log less on no-op disco route switches
...
Also, renew trustBestAddrUntil even if latency isn't better.
2020-07-02 11:39:05 -07:00
Brad Fitzpatrick
847b6f039b
disco: simplify expression, appease staticcheck
...
Was:
disco/disco.go:164:10: unnecessary use of fmt.Sprintf (S1039)
2020-07-02 10:52:23 -07:00
Brad Fitzpatrick
57e8931160
control/controlclient: fix copy/paste-o in debug knob accessor
...
Introduced in a975e86bb8 .
Only affected TS_DEBUG_* env users.
2020-07-02 10:51:23 -07:00
Brad Fitzpatrick
0f0ed3dca0
wgengine/magicsock: clean up discovery logging
...
Updates #483
2020-07-02 10:48:13 -07:00
Brad Fitzpatrick
056fbee4ef
wgengine/magicsock: add TS_DEBUG_OMIT_LOCAL_ADDRS knob to force STUN use only
...
For debugging.
2020-07-02 09:53:10 -07:00
Brad Fitzpatrick
6233fd7ac3
control/controlclient: don't truncate AuthURL in log
...
It's useful to copy/paste directly from there, without using tailscale up.
If it's truncated for some specific reason, it doesn't say why.
2020-07-02 09:45:08 -07:00
Brad Fitzpatrick
e03cc2ef57
wgengine/magicsock: populate discoOfAddr upon receiving ping frames
...
Updates #483
2020-07-02 08:37:46 -07:00