Commit Graph

1758 Commits

Author SHA1 Message Date
David Anderson
12a6626a94 tsweb: use a ResponseWriter wrapper to log more accurately.
Also adds tests, because the logging handler is acquiring a fair
number of branches.

Signed-off-by: David Anderson <dave@natulte.net>
2020-03-19 20:11:07 -07:00
David Anderson
2e43cd3f95 testy: add a virtual clock helper for tests.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-19 20:11:07 -07:00
Brad Fitzpatrick
b1d5548fa7 tailcfg: make NodeKey.IsZero have a value receiver 2020-03-19 20:00:32 -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
David Crawshaw
6ddbcab71e logtail: rename the unused CheckLogs to DrainLogs
Its semantics has changed slightly, this will let us use it to
drive batched logging in special circumstances.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-20 13:26:33 +11:00
David Crawshaw
51a12d1307 filch: a few minor comments
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-20 13:20:45 +11:00
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
073bb8de80 control/controlclient: don't use Node as value type 2020-03-19 13:19:02 -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
David Crawshaw
addbdce296 wgengine, ipn: include number of active DERPs in status
Use this when making the ipn state transition from Starting to
Running. This way a network of quiet nodes with no active
handshaking will still transition to Active.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-19 17:55:16 +11:00
David Crawshaw
1ad78ce698 magicsock: reconnect to home DERP on key change
Typically the home DERP server is found and set on startup before
magicsock's SetPrivateKey can be called, so no DERP connection is
established. Make sure one is by kicking the home DERP tires in
SetPrivateKey.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-19 17:53:44 +11:00
David Crawshaw
455ba751d9 magicsock: start connection to HOME derp immediately
The code as written intended to do this, but it repeated the
comparison of derpNum and c.myDerp after c.myDerp had been
updated, so it never executed.

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-19 17:36:30 +11:00
David Crawshaw
73cae4eb11 tailcfg, controlclient: standardize on wgcfg ShortString key printing
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-19 09:17:34 +11:00
David Crawshaw
acd14960f8 go.mod: bump wireguard-go
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-19 09:10:13 +11: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
David Anderson
df4636567f tsweb: adjust names and docs of the "handler with errors" functions.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-18 01:39:01 -07:00
David Crawshaw
131541c06d derp: deflake test
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-18 16:33:25 +11:00
David Anderson
52d9613b42 github: add license check to CI.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17 21:34:44 -07:00
David Anderson
315a5e5355 scripts: add a license header checker.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17 21:34:44 -07:00
David Anderson
3e2fadf872 version: add license header to input for generated file.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17 21:34:44 -07:00
David Anderson
98eceae55e tsweb: add a Handler type.
Handler is like http.Handler, but returns errors. ErrHandler
converts back to an http.Handler, with added error handling
and logging.

Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17 21:34:44 -07:00
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
David Anderson
a567c56971 tsweb: pull in tlog data structures from corp repo.
This is a prelude to having logging helpers in tsweb.

Signed-off-by: David Anderson <dave@natulte.net>
2020-03-17 17:21:50 -07:00
David Crawshaw
5a0822eefd controlclient, ipn: fix tests for new control param 2020-03-18 08:35:34 +11:00
Brad Fitzpatrick
e085aec8ef all: update to wireguard-go API changes
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-17 08:53:05 -07:00
David Anderson
dd14b658a2 version: bump again, for 0.97.0. 2020-03-16 21:16:18 -07:00
David Anderson
9ea445acd1 version: bump for 0.96.1 tag. 2020-03-16 20:35:35 -07:00
David Anderson
5758d8d48f Merge branch 'master' of github.com:tailscale/tailscale into HEAD 2020-03-16 18:37:38 -07:00
David Anderson
bf98913106 go.mod: bump wireguard-go version.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-16 18:36:30 -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
David Crawshaw
1b2be3f1c8 controlclient: test peer keepalive directive
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-14 14:11:07 -05:00
David Crawshaw
8712164a0a controlclient: use per-peer KeepAlive signal
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-14 14:11:03 -05:00
David Crawshaw
290f83e9f6 tailcfg: fix test
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-14 11:03:00 -05:00
David Crawshaw
7a57ab1793 tailcfg: add a per-peer KeepAlive field 2020-03-14 10:56:52 -05:00
David Anderson
ea0836dce9 cmd/tailscaled: remove default user/group from systemd. 2020-03-13 23:58:38 -07:00
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
42e98d4edc Quiet two little log annoyances. 2020-03-13 09:42:09 -07:00
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
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
Avery Pennarun
7dd63abaed tailcfg.NetInfo: add a .String() renderer.
For pretty printing purposes in logs.
2020-03-13 01:29:47 -04:00