Josh Bleecher Snyder
758c37b83d
net/netns: thread logf into control functions
...
So that darwin can log there without panicking during tests.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-11-18 15:09:51 -08:00
Brad Fitzpatrick
24ea365d48
netcheck, controlclient, magicsock: add more metrics
...
Updates #3307
Change-Id: Ibb33425764a75bde49230632f1b472f923551126
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-16 10:48:19 -08:00
Brad Fitzpatrick
3e1daab704
hostinfo, control/controlclient: tell control when Ubuntu has disabled Tailscale's sources
...
Fixes #3177
Updates #2500
Change-Id: Iff2a8e27ec7d36a1c210263d6218f20ebed37924
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-10 09:56:58 -08:00
Brad Fitzpatrick
d2ef73ed82
control/controlclient: rename a variable to not shadow a package name
...
Change-Id: I1bcb577cb2c47e936d545ad57f308e57399de323
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-10 08:11:29 -08:00
Brad Fitzpatrick
ad63fc0510
control/controlclient: make js/wasm work with Go 1.18+
...
Updates #3157
Change-Id: I2d67e582842ab3638d720bb5db4701b878ad4473
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-07 13:49:55 -08:00
Brad Fitzpatrick
337757a819
ipn/ipnlocal, control/controlclient: don't propagate all map errors to UI
...
Fixes regression from 81cabf48ec
which made
all map errors be sent to the frontend UI.
Fixes #3230
Change-Id: I7f142c801c7d15e268a24ddf901c3e6348b6729c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-03 17:56:54 -07:00
David Anderson
0532eb30db
all: replace tailcfg.DiscoKey with key.DiscoPublic.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-03 14:00:16 -07:00
David Anderson
7e6a1ef4f1
tailcfg: use key.NodePublic in wire protocol types.
...
Updates #3206 .
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-02 09:11:43 -07:00
Brad Fitzpatrick
ff597e773e
tailcfg, control/controlclient: add method to exit client from control plane
...
Change-Id: Ic28ef283ba63396b68fab86bfb0a8ee8f432474c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-01 11:59:04 -07:00
David Anderson
418adae379
various: use NodePublic.AsNodeKey() instead of tailcfg.NodeKeyFromNodePublic()
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 16:19:27 -07:00
David Anderson
4d38194c21
control/controlclient: stop using wgkey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 14:22:51 -07:00
Brad Fitzpatrick
ada8cd99af
control/controlclient: add a LoginEphemeral LoginFlags bit
...
Change-Id: Ib9029ea0c49aa2ee1b6aac6e464ab1f16aef92e8
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-28 13:21:35 -07:00
David Anderson
0c546a28ba
types/persist: use new node key type.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 10:29:43 -07:00
Maisem Ali
81cabf48ec
control/controlclient,tailcfg: propagate registration errors to the frontend
...
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-10-27 06:57:26 -07:00
nicksherron
f01ff18b6f
all: fix spelling mistakes
...
Signed-off-by: nicksherron <nsherron90@gmail.com>
2021-10-12 21:23:14 -07:00
Dave Anderson
980acc38ba
types/key: add a special key with custom serialization for control private keys ( #2792 )
...
* Revert "Revert "types/key: add MachinePrivate and MachinePublic.""
This reverts commit 61c3b98a24
.
Signed-off-by: David Anderson <danderson@tailscale.com>
* types/key: add ControlPrivate, with custom serialization.
ControlPrivate is just a MachinePrivate that serializes differently
in JSON, to be compatible with how the Tailscale control plane
historically serialized its private key.
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-09-03 13:17:46 -07:00
David Anderson
61c3b98a24
Revert "types/key: add MachinePrivate and MachinePublic."
...
Broke the tailscale control plane due to surprise different serialization.
This reverts commit 4fdb88efe1
.
2021-09-03 11:34:34 -07:00
David Anderson
4fdb88efe1
types/key: add MachinePrivate and MachinePublic.
...
Plumb throughout the codebase as a replacement for the mixed use of
tailcfg.MachineKey and wgkey.Private/Public.
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-09-03 10:07:15 -07:00
David Anderson
daf54d1253
control/controlclient: remove TS_DEBUG_USE_DISCO=only.
...
It was useful early in development when disco clients were the
exception and tailscale logs were noisier than today, but now
non-disco is the exception.
Updates #2752
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-09-01 18:11:32 -07:00
slowy07
ac0353e982
fix: typo spelling grammar
...
Signed-off-by: slowy07 <slowy.arfy@gmail.com>
2021-08-24 07:55:04 -07:00
Brad Fitzpatrick
47045265b9
hostinfo: add SetDeviceModel setter, move remaining code from controlclient
...
Updates tailscale/corp#1959
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-20 10:45:22 -07:00
Brad Fitzpatrick
6f8c8c771b
control/controlclient: tweak a couple error messages
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-18 10:11:38 -07:00
Simeng He
e199e407d2
tailcfg: add IP and Types field to PingRequest
...
Signed-off-by: Simeng He <simeng@tailscale.com>
2021-08-18 12:23:24 -04:00
Josh Bleecher Snyder
4c8b5fdec4
control/controlclient: do not periodically print full netmap
...
The netmaps can get really large.
Printing, processing, and uploading them is expensive.
Only print the header on an ongoing basis.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-08-17 12:57:49 -07:00
Brad Fitzpatrick
dfa5e38fad
control/controlclient: report whether we're in a snap package
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-26 15:16:40 -07:00
Brad Fitzpatrick
171ec9f8f4
control/{controlknobs,controlclient}: simplify knobs API, fix controlclient crash
...
From integration tests elsewhere:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x845c9b]
goroutine 226 [running]:
tailscale.com/control/controlclient.(*Direct).sendMapRequest(0xc00053e1e0, 0x16670f0, 0xc000353780, 0xffffffffffffffff, 0xc0003e5f10, 0x0, 0x0)
/home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/direct.go:803 +0x19bb
tailscale.com/control/controlclient.(*Direct).PollNetMap(...)
/home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/direct.go:574
tailscale.com/control/controlclient.(*Auto).mapRoutine(0xc00052a1e0)
/home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/auto.go:464 +0x571
created by tailscale.com/control/controlclient.(*Auto).Start
/home/runner/go/pkg/mod/tailscale.com@v1.1.1-0.20210715222212-1bb6abc604c1/control/controlclient/auto.go:151 +0x65
exit status 2
Also remove types/opt.Bool API addition which is now unnecessary.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-15 22:34:50 -07:00
julianknodt
1bb6abc604
net/portmapper: add upnp port mapping
...
Add in UPnP portmapping, using goupnp library in order to get the UPnP client and run the
portmapping functions. This rips out anywhere where UPnP used to be in portmapping, and has a
flow separate from PMP and PCP.
RELNOTE=portmapper now supports UPnP mappings
Fixes #682
Updates #2109
Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-07-15 15:22:12 -07:00
David Crawshaw
54199d9d58
controlclient: log server key and URL
...
Turns out we never reliably log the control plane URL a client connects
to. Do it here, and include the server public key, which might
inadvertently tell us something interesting some day.
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-06-28 09:38:23 -07:00
Brad Fitzpatrick
b461ba9554
control/controlclient: fix typo/braino in error message
...
Thanks to @normanr for noticing.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-16 15:55:06 -07:00
Brad Fitzpatrick
333e9e75d4
tailcfg, control/controlclient: clarify more, enforce PingRequest.URL is unique
...
Updates #2079
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-15 12:28:34 -07:00
Simeng He
f0121468f4
control/controlclient: add Pinger interface, Options.Pinger
...
Plumbs down a pinger to the direct to enable client to client Ping
functionality from control.
Signed-off-by: Simeng He <simeng@tailscale.com>
2021-06-08 16:30:06 -04:00
Brad Fitzpatrick
e29cec759a
ipn/{ipnlocal,localapi}, control/controlclient: add SetDNS localapi
...
Updates #1235
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-07 20:35:56 -07:00
Josh Bleecher Snyder
25df067dd0
all: adapt to opaque netaddr types
...
This commit is a mishmash of automated edits using gofmt:
gofmt -r 'netaddr.IPPort{IP: a, Port: b} -> netaddr.IPPortFrom(a, b)' -w .
gofmt -r 'netaddr.IPPrefix{IP: a, Port: b} -> netaddr.IPPrefixFrom(a, b)' -w .
gofmt -r 'a.IP.Is4 -> a.IP().Is4' -w .
gofmt -r 'a.IP.As16 -> a.IP().As16' -w .
gofmt -r 'a.IP.Is6 -> a.IP().Is6' -w .
gofmt -r 'a.IP.As4 -> a.IP().As4' -w .
gofmt -r 'a.IP.String -> a.IP().String' -w .
And regexps:
\w*(.*)\.Port = (.*) -> $1 = $1.WithPort($2)
\w*(.*)\.IP = (.*) -> $1 = $1.WithIP($2)
And lots of manual fixups.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-16 14:52:00 -07:00
Avery Pennarun
6307a9285d
controlclient: update Persist.LoginName when it changes.
...
Well, that was anticlimactic.
Fixes tailscale/corp#461 .
Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-05-12 23:21:11 -04:00
Avery Pennarun
b4d04a065f
controlclient: extract a Client interface and rename Client->Auto.
...
This will let us create a mock or fake Client implementation for use
with ipn.Backend.
Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-04-30 00:09:35 -04:00
Brad Fitzpatrick
3411bb959a
control/controlclient: fix signRegisterRequest log suppression check on Windows
...
Fixes #1774
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-22 11:59:19 -07:00
Brad Fitzpatrick
6f52fa02a3
control/controlclient, tailcfg: add Debug.SleepSeconds (mapver 19)
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-21 22:05:41 -07:00
Brad Fitzpatrick
e9d24341e0
tailcfg, control/controlclient: accept nil MapResponse.Node (mapver 18)
...
All MapResponse fields can not be omitted and are tagged "omitempty".
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-19 11:53:21 -07:00
Brad Fitzpatrick
5092cffd1f
control/controlclient: add start of some MapResponse->NetworkMap tests
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-18 20:27:51 -07:00
Brad Fitzpatrick
aef3c0350c
control/controlclient: break direct.go into map.go (+tests), add mapSession
...
So the NetworkMap-from-incremental-MapResponses can be tested easily.
And because direct.go was getting too big.
No change in behavior at this point. Just movement.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-18 19:56:03 -07:00
Brad Fitzpatrick
b993d9802a
ipn/ipnlocal, etc: require file sharing capability to send/recv files
...
tailscale/corp#1582
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-16 10:58:19 -07:00
Brad Fitzpatrick
670838c45f
tailcfg, control/controlclient: (mapver 16) add Node.Online, MapResponse.OnlineChange
...
And fix PeerSeenChange bug where it was ignored unless there were
other peer changes.
Updates tailscale/corp#1574
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-15 20:07:24 -07:00
David Anderson
7055f870f8
control/controlclient: only use a single DNS label as the hostname.
...
Fixes #971
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-04-15 17:08:58 -07:00
Brad Fitzpatrick
34d2f5a3d9
tailcfg: add Endpoint, EndpointType, MapRequest.EndpointType
...
Track endpoints internally with a new tailcfg.Endpoint type that
includes a typed netaddr.IPPort (instead of just a string) and
includes a type for how that endpoint was discovered (STUN, local,
etc).
Use []tailcfg.Endpoint instead of []string internally.
At the last second, send it to the control server as the existing
[]string for endpoints, but also include a new parallel
MapRequest.EndpointType []tailcfg.EndpointType, so the control server
can start filtering out less-important endpoint changes from
new-enough clients. Notably, STUN-discovered endpoints can be filtered
out from 1.6+ clients, as they can discover them amongst each other
via CallMeMaybe disco exchanges started over DERP. And STUN endpoints
change a lot, causing a lot of MapResposne updates. But portmapped
endpoints are worth keeping for now, as they they work right away
without requiring the firewall traversal extra RTT dance.
End result will be less control->client bandwidth. (despite negligible
increase in client->control bandwidth)
Updates tailscale/corp#1543
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-13 10:12:14 -07:00
Brad Fitzpatrick
ccb322db04
tailcfg, control/controlclient: make nil MapResponse.DNSConfig mean unchanged (mapver15)
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-12 12:46:32 -07:00
Simon Kirillov
a64b57e2fb
control/controlclient: create tls client config with server hostname instead of serverURL.Host
...
Signed-off-by: Simon Kirillov <svkirillov3@gmail.com>
2021-04-10 11:20:10 -07:00
Brad Fitzpatrick
3167e55ddf
ipn/{ipnlocal,localapi}, cmd/tailscale: add logout command
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-09 13:26:35 -07:00
Brad Fitzpatrick
597c19ff4e
control/controlclient: refactor some internals
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-07 21:20:17 -07:00
Brad Fitzpatrick
1bd14a072c
cmd/tailscale, ipn/localapi: move IP forwarding check to tailscaled, API
...
Instead of having the CLI check whether IP forwarding is enabled, ask
tailscaled. It has a better idea. If it's netstack, for instance, the
sysctl values don't matter. And it's possible that only the daemon has
permission to know.
Fixes #1626
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-31 12:09:16 -07:00
Brad Fitzpatrick
a998fe7c3d
control/controlclient: support lazy machine key generation
...
It's not done in the caller yet, but the controlclient does it now.
Updates #1573
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-31 08:52:57 -07:00