Brad Fitzpatrick
f9184ad12b
go.mod: update wireguard-go for https://github.com/tailscale/wireguard-go/pull/13
2020-03-19 22:46:36 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
94024355ed
tailcfg, controlclient, magicsock: request IPv6 endpoints, but ignore them
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-19 21:01:52 -07:00
Brad Fitzpatrick
51b669e4bd
ipn: skip tailscaled UDP ports in service list
2020-03-19 19:56:02 -07:00
Brad Fitzpatrick
60ea635c6d
wgengine/magicsock: delete inaccurate comment
...
I meant to include this in the earlier commit.
2020-03-19 19:48:02 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
a184e05290
wgengine/magicsock: listen on udp6, use it for STUN, report endpoint
...
More steps towards IPv6 transport.
We now send it to tailcontrol, which ignores it.
But it doesn't actually actually support IPv6 yet (outside of STUN).
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-19 13:54:38 -07:00
Brad Fitzpatrick
7caa288213
wgengine/magicsock: rename pconn field to pconn4, in prep for pconn6
2020-03-19 08:49:30 -07:00
Brad Fitzpatrick
5fa825f057
go.mod, go.sum: update
2020-03-19 08:49:12 -07:00
Brad Fitzpatrick
14a2564ef0
go.mod: bump wireguard-go
2020-03-18 13:26:08 -07:00
Brad Fitzpatrick
19a1704abd
netcheck: use best DERP server in past 5 minutes to avoid flip-flopping
...
Fixes #162
2020-03-18 13:07:13 -07:00
Brad Fitzpatrick
6de37f4cc0
tsweb: move some comments, add a TODO
2020-03-18 09:54:48 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
f8d67bb591
portlist: ignore ports bound to localhost
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-17 20:55:45 -07:00
Brad Fitzpatrick
c706731dc7
tsweb: add copyright header
...
And fix an unlikely but potential crash.
2020-03-17 20:08:13 -07:00
Brad Fitzpatrick
8f9fa6a842
logtail: minor style/simplification changes
2020-03-15 22:41:50 -07:00
Brad Fitzpatrick
8de67844bd
cmd/tailscale: make failure message when tailscaled down less technical
2020-03-15 22:40:41 -07:00
Brad Fitzpatrick
5aafe0ee96
cmd/tailscale: don't crash on too many non-flag args
2020-03-15 22:27:36 -07:00
Brad Fitzpatrick
d348b94505
stun, stunner: clarify an error log message more
...
But two earlier changes mean this doesn't show up anymore anyway.
But if it does, it'll be a nice message.
2020-03-15 22:19:45 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
120273d7f6
portlist: document, clean up, fix an open fd spike, optimize a bit
...
I noticed portlist when looking at some profiles and hadn't looked at
the code much before. This is a first pass over it. It allocates a
fair bit. More love remains, but this does a bit:
name old time/op new time/op delta
GetList-8 9.92ms ± 8% 9.64ms ±12% ~ (p=0.247 n=10+10)
name old alloc/op new alloc/op delta
GetList-8 931kB ± 0% 869kB ± 0% -6.70% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
GetList-8 4.59k ± 0% 3.69k ± 1% -19.71% (p=0.000 n=10+10)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-13 21:06:41 -07:00
Brad Fitzpatrick
6c3820e8c4
cmd/tailscaled: rename relaynode reference in defaults file comment
2020-03-13 14:38:04 -07:00
Brad Fitzpatrick
19cc4f8b8e
control/controlclient: remove a number literal in string slice offset
2020-03-13 09:48:15 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
db2436c7ff
wgengine/magicsock: don't interrupt endpoint updates, merge all mutex into one
...
Before, endpoint updates were constantly being interrupted and resumed
on Linux due to tons of LinkChange messages from over-zealous Linux
netlink messages (from router_linux.go)
Now that endpoint updates are fast and bounded in time anyway, just
let them run to completion, but note that another needs to be
scheduled after.
Now logs went from pages of noise to just:
root@taildoc:~# grep -i -E 'stun|endpoint update' log
2020/03/13 08:51:29 magicsock.Conn: starting endpoint update (initial)
2020/03/13 08:51:30 magicsock.Conn.ReSTUN: endpoint update active, need another later ("link-change-minor")
2020/03/13 08:51:31 magicsock.Conn: starting endpoint update (link-change-minor)
2020/03/13 08:51:31 magicsock.Conn.ReSTUN: endpoint update active, need another later ("link-change-minor")
2020/03/13 08:51:33 magicsock.Conn: starting endpoint update (link-change-minor)
2020/03/13 08:51:33 magicsock.Conn.ReSTUN: endpoint update active, need another later ("link-change-minor")
2020/03/13 08:51:35 magicsock.Conn: starting endpoint update (link-change-minor)
2020/03/13 08:51:35 magicsock.Conn.ReSTUN: endpoint update active, need another later ("link-change-minor")
Or, seen in another run:
2020/03/13 08:45:41 magicsock.Conn: starting endpoint update (periodic)
2020/03/13 08:46:09 magicsock.Conn: starting endpoint update (periodic)
2020/03/13 08:46:21 magicsock.Conn: starting endpoint update (link-change-major)
2020/03/13 08:46:37 magicsock.Conn: starting endpoint update (periodic)
2020/03/13 08:47:05 magicsock.Conn: starting endpoint update (periodic)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-13 09:34:11 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
db31550854
wgengine: don't Reconfig on boring link changes
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-13 07:45:59 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
b9c6d3ceb8
netcheck: work behind UDP-blocked networks again, add tests
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-12 14:49:06 -07:00
Brad Fitzpatrick
a87ee4168a
stunner: quiet a harmless log warning
2020-03-12 14:14:23 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
bc73dcf204
wgengine/magicsock: don't block in Send waiting for derphttp.Send
...
Fixes #137
Updates #109
Updates #162
Updates #163
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-12 12:19:12 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
8807913be9
wgengine/magicsock: wait for previous DERP goroutines to end before new ones
...
Updates #109 (hopefully fixes, will wait for graphs to be happy)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-12 12:19:12 -07:00
Brad Fitzpatrick
eff6dcdb4e
wgengine/magicsock: log more about why we're re-STUNing
2020-03-12 12:09:25 -07:00
Brad Fitzpatrick
52c0cb12fb
stunner: return wrapped error (currently unused)
2020-03-12 11:21:19 -07:00
Brad Fitzpatrick
b4d02a251a
syncs: add new package for extra sync types
2020-03-12 11:13:33 -07:00
Brad Fitzpatrick
afc3479d04
netcheck: fix data races for staggler STUN packets arriving after GetReport
...
Fixes #179
2020-03-11 15:35:12 -07:00
Brad Fitzpatrick
b3ddf51a15
wgengine/magicsock: add a pointer value for logging
...
Updates #109
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-11 15:12:19 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
0d3f42e1d8
netcheck: ignore IPv4 STUN failures if we saw at least one reply
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-11 13:57:23 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
ed7e088729
netcheck: ignore IPv6 STUN failures
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-11 12:44:59 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
4fd29349b9
derp: add clients_replaced counter
...
Updates #109
2020-03-11 11:55:43 -07:00
Brad Fitzpatrick
b0f8931d26
wgengine/magicsock: make a test signature a bit more explicit
2020-03-11 09:51:33 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
01b4bec33f
stunner: re-do how Stunner works
...
It used to make assumptions based on having Anycast IPs that are super
near. Now we're intentionally going to a bunch of different distant
IPs to measure latency.
Also, optimize how the hairpin detection works. No need to STUN on
that socket. Just use that separate socket for sending, once we know
the other UDP4 socket's endpoint. The trick is: make our test probe
also a STUN packet, so it fits through magicsock's existing STUN
routing.
This drops netcheck from ~5 seconds to ~250-500ms.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-11 08:08:48 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
023df9239e
Move linkstate boring change filtering to magicsock
...
So we can at least re-STUN on boring updates.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-10 12:50:03 -07:00
Brad Fitzpatrick
5c1e443d34
wgengine/monitor: don't call LinkChange when interfaces look unchanged
...
Basically, don't trust the OS-level link monitor to only tell you
interesting things. Sanity check it.
Also, move the interfaces package into the net directory now that we
have it.
2020-03-10 11:03:19 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
39c0ae1dba
derp/derpmap: new DERP config package, merge netcheck into magicsock more
...
Fixes #153
Updates #162
Updates #163
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-10 10:37:25 -07:00
Brad Fitzpatrick
bd0e20f351
net/dnscache: ignore annoying staticcheck check
2020-03-09 22:12:22 -07:00
Brad Fitzpatrick
d44325295e
net/dnscache: initialize the single Resolver more directly
2020-03-09 21:05:01 -07:00
Brad Fitzpatrick
d07146aafb
go.mod, go.sum: update
2020-03-09 21:01:08 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
5d8001d0ad
derp: add varz for home moves
...
Updates #162
Updates #163 (maybe)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-09 11:09:27 -07:00
Brad Fitzpatrick
8f0fd01efd
net/dnscache: add copyright header to test
2020-03-09 11:07:31 -07:00
Brad Fitzpatrick
4800926006
wgengine/magicsock: add AddrSet appendDests+UpdateDst tests
2020-03-09 09:13:28 -07:00
Brad Fitzpatrick and Brad Fitzpatrick
f42b9b6c9a
wgengine/magicsock: don't discard UDP packet on UDP+DERP race
...
Fixes #155
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-07 14:09:06 -08:00
Brad Fitzpatrick
f6dd2128d9
version: bump
2020-03-06 14:57:27 -08:00
Brad Fitzpatrick
a9cd8f31de
tsweb: don't double import expvar; appease staticcheck
2020-03-06 13:08:32 -08:00
Brad Fitzpatrick
890f5dff40
tsweb: export runtime.MemStats var in Prometheus format
2020-03-06 13:02:01 -08:00
Brad Fitzpatrick
8abdbbdd1f
cmd/derper: also link to /debug/varz
2020-03-06 13:02:01 -08:00
Brad Fitzpatrick
946df89fa6
types/logger: add adapters for Logf to std Logger/Writer
2020-03-06 12:00:24 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
61d83f759b
wgengine/magicsock: remove redundant derpMagicIP comparison
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-06 11:31:39 -08:00
Brad Fitzpatrick
fbab12c94c
wgengine/magicsock: skip netcheck if external STUN aren't in use
...
Updates #146 (not a complete fix yet probably)
2020-03-06 07:47:54 -08:00
Brad Fitzpatrick
fe0051fafd
wgengine/magicsock: expand AddrSet.addrs comment
2020-03-05 21:17:41 -08:00
Brad Fitzpatrick
e733fa6f7e
derp: add some varz tests for active/home conns
2020-03-05 20:29:07 -08:00
Brad Fitzpatrick
dd456f04c5
derp: actually record client's preferred bit
2020-03-05 19:02:54 -08:00
Brad Fitzpatrick
61f3fda405
tsweb: let expvar.Ints be gauges too
2020-03-05 15:10:01 -08:00
Brad Fitzpatrick
6978b93bdd
derp, magicsock: track home (preferred) vs visiting connections for stats
2020-03-05 15:00:56 -08:00
Brad Fitzpatrick
12b77f30ad
wgengine/magicsock: close stale DERP connections
2020-03-05 12:49:37 -08:00
Brad Fitzpatrick
cf4aacde57
derp/derphttp: appease staticcheck
2020-03-05 12:34:57 -08:00
Brad Fitzpatrick
2cff9016e4
net/dnscache: add overly simplistic DNS cache package for selective use
...
I started to write a full DNS caching resolver and I realized it was
overkill and wouldn't work on Windows even in Go 1.14 yet, so I'm
doing this tiny one instead for now, just for all our netcheck STUN
derp lookups, and connections to DERP servers. (This will be caching a
exactly 8 DNS entries, all ours.)
Fixes #145 (can be better later, of course)
2020-03-05 12:23:37 -08:00
Brad Fitzpatrick
a36ccb8525
wgengine/magicsock: actually add to the activeDerp map
...
Fixes bug just introduced in 8f9849c140; not tested enough :(
2020-03-05 12:23:37 -08:00
Brad Fitzpatrick
8f9849c140
wgengine/magicsock: collapse three DERP maps down into one
2020-03-05 08:54:08 -08:00
Brad Fitzpatrick
7e1bed82bd
go.sum: update
2020-03-05 08:51:21 -08:00
Brad Fitzpatrick
40ebba1373
magicsock: use [unexpected] convention more
...
Fixes #136 (not entirely, but we have a convention now)
2020-03-05 08:18:55 -08:00
Brad Fitzpatrick
848a2bddf0
wgengine/magicsock: update set of DERP nodes
2020-03-05 08:18:55 -08:00
Brad Fitzpatrick
57de94c7aa
tsweb: add /debug/ access via &debugkey + TS_DEBUG_KEY_PATH
2020-03-04 13:49:30 -08:00
Brad Fitzpatrick
ff6b3c2c38
netcheck: include two more DERP nodes, show more in CLI report
2020-03-04 13:40:49 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
eac62ec5ff
ipn, wgengine/magicsock: add ipn.Prefs.DisableDERP bool
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-04 12:53:37 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
bf704a5218
derp: protocol negotiation, add v2: send src pub keys to clients in packets
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-04 09:55:13 -08:00
Brad Fitzpatrick
596fd449b9
netcheck: add TODO about alternate timing strategies
2020-03-04 08:20:38 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
b27d4c017a
magicsock, wgengine, ipn, controlclient: plumb regular netchecks to map poll
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-04 08:19:45 -08:00
Brad Fitzpatrick
4cf5ac3060
ipn/ipnserver: remove unnecessary closure parameter
2020-03-03 19:38:01 -08:00
Brad Fitzpatrick
724c37fb41
wgengine/magicsock: start tracking nearest DERP node
2020-03-03 17:50:17 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
e371520cc5
tsweb, derp: add expvar http.Handler for Prometheus's format
...
And add some opinions.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-03 13:59:16 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
89a2c3eb04
wgengine: don't create duplicate iptables rules on Linux, clean up
...
Fixes #131
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-03 13:46:53 -08:00
Brad Fitzpatrick and Brad Fitzpatrick
dd68debd64
cmd/derper: set autocert Email
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-03 13:30:50 -08:00
Brad Fitzpatrick
68ff31a0ba
ipn: have NewFileStore try to create directories as needed
2020-03-03 11:51:44 -08:00
Brad Fitzpatrick
b3d9eab1fe
safesocket: make some effort to create parent directory of sock
2020-03-03 11:47:21 -08:00
Brad Fitzpatrick
383d86df5f
paths: remove some debug logging I left in
2020-03-03 11:45:49 -08:00
Brad Fitzpatrick
65e7c58aa4
cmd/tailscale, cmd/tailscaled, paths: add paths package for default paths
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-03-03 09:36:18 -08:00
Brad Fitzpatrick
06092a3af3
ipn/ipnserver: document potential race, start on test for it
2020-03-03 09:15:11 -08:00
Brad Fitzpatrick
ef1f967ec0
ipn: remove an unnecessary named parameter in doc
2020-03-03 08:05:11 -08:00
Brad Fitzpatrick
844d991baf
netcheck: add Report.Clone, return cloned report to avoid races on late replies
2020-03-02 15:02:34 -08:00
Brad Fitzpatrick
657f9593ae
Reduce some logspam.
2020-03-02 14:55:12 -08:00
Brad Fitzpatrick
4675c70464
wgengine/magicsock: check STUN regularly
2020-03-02 12:37:52 -08:00
Brad Fitzpatrick
7172f3dbf4
version: add IsMobile func
...
And use it control/controlclient.
2020-03-02 12:37:28 -08:00
Brad Fitzpatrick
11489a6e67
go.sum: add lines
2020-03-02 11:07:42 -08:00
Brad Fitzpatrick
bc7bc43fb8
magicsock, interfaces: move some code from magicsock to interfaces
2020-03-02 10:38:44 -08:00
Brad Fitzpatrick
af7a01d6f0
wgengine/magicsock: drop donec channel, rename epUpdateCtx to serve its purpose
2020-03-02 09:31:25 -08:00
Brad Fitzpatrick
a399ef3dc7
cmd/derper: appease staticcheck
2020-03-02 08:59:50 -08:00
Brad Fitzpatrick
051b6ef141
cmd/derper: accept more LetsEncrypt hostnames without explicit config
2020-03-02 08:55:44 -08:00
Brad Fitzpatrick
bcf3719b9e
netcheck: add hairpinning detection
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 14:26:51 -08:00
Brad Fitzpatrick and David Crawshaw
1abf2da392
wgengine/magicsock: reset favorite address on handshakes
...
Updates #92 (not a complete fix; could be better/faster?)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 17:23:09 -05:00
Brad Fitzpatrick
517a91de75
derp/derphttp: fix reconnect behavior
...
I broke it in today's 752146a70f .
Added some comments to prevent recurrences.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 13:39:48 -08:00
Brad Fitzpatrick
38acccad09
derp: remove some debug noise I left in
...
:(
2020-02-28 13:20:56 -08:00
Brad Fitzpatrick
752146a70f
derp: clean up derphttp client code, use contexts
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 13:18:59 -08:00
Brad Fitzpatrick
67ede8d6d2
wgengine, magicsock: fix SetPrivateKey data race
...
Updates #112
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 11:15:07 -08:00
Brad Fitzpatrick
4cd3e82bbd
go.mod: bump wireguard-go
...
Updates #112
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 11:15:07 -08:00
Brad Fitzpatrick
a6c695ba6b
types/key: add IsZero methods
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 11:15:07 -08:00
Brad Fitzpatrick
07f0fd0fdc
version: add a manual date as version for now
...
Maybe we'll auto-bump this with a bot over time.
See golang/go#37475 & golang/go#29814
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2020-02-28 09:44:34 -08:00