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
David Anderson
c17250cee2
ipn/ipnstate: use key.NodePublic instead of tailcfg.NodeKey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-01 20:32:10 -07:00
David Anderson
c3d7115e63
wgengine: use key.NodePublic instead of tailcfg.NodeKey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-01 18:28:45 -07:00
David Anderson
72ace0acba
wgengine/magicsock: use key.NodePublic instead of tailcfg.NodeKey.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-01 18:03:48 -07:00
David Anderson
d6e7cec6a7
types/netmap: use key.NodePublic instead of tailcfg.NodeKey.
...
Update #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-11-01 17:07:40 -07:00
Brad Fitzpatrick
408b0923a6
wgengine/router: remove last non-test "ip" command usage on Linux
...
Updates #391
Change-Id: Ic2c3f8460b1e4b8d34b936a1725705fcc1effbae
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-01 15:52:24 -07:00
Brad Fitzpatrick
ff1954cfd9
wgengine/router: use netlink for ip rules on Linux
...
Using temporary netlink fork in github.com/tailscale/netlink until we
get the necessary changes upstream in either vishvananda/netlink
or jsimonetti/rtnetlink.
Updates #391
Change-Id: I6e1de96cf0750ccba53dabff670aca0c56dffb7c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-01 15:40:36 -07:00
Brad Fitzpatrick
5dc5bd8d20
cmd/tailscaled, wgengine/netstack: always wire up netstack
...
Even if not in use. We plan to use it for more stuff later.
(not for iOS or macOS-GUIs yet; only tailscaled)
Change-Id: Idaef719d2a009be6a39f158fd8f57f8cca68e0ee
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-01 14:11:30 -07:00
David Anderson
84c3a09a8d
types/key: export constants for key size, not a method.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 17:39:04 -07:00
David Anderson
6422789ea0
disco: use key.NodePublic instead of tailcfg.NodeKey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 17:39: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
eeb97fd89f
various: remove remaining uses of key.NewPrivate.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 15:01:12 -07:00
David Anderson
ccd36cb5b1
wgengine: remove use of legacy key parsing helper.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 14:57:32 -07:00
David Anderson
ef241f782e
wgengine/magicsock: remove uses of tailcfg.DiscoKey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 14:31:44 -07:00
David Anderson
55b6753c11
wgengine/magicsock: remove use of key.{Public,Private}.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 13:20:13 -07:00
David Anderson
c1d009b9e9
ipn/ipnstate: use key.NodePublic instead of the generic key.Public.
...
Updates #3206 .
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 10:00:59 -07:00
David Anderson
37c150aee1
derp: use new node key type.
...
Update #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 16:02:11 -07:00
Brad Fitzpatrick
19189d7018
wgengine/router: add a addrFamily type [linux]
...
In prep for more netlink-ification.
Change-Id: I7c34a04001988107dc2583597aa4f26ddb887e91
2021-10-28 14:52:29 -07:00
David Anderson
e03fda7ae6
wgengine/magicsock: remove test uses of wgkey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 14:17:25 -07:00
Brad Fitzpatrick
7c40a5d440
wgengine/router: refactor in prep for Linux netlink-ification
...
Pull out the list of policy routing rules to a data structure
now shared between the add & delete paths, but to also be shared
by the netlink paths in a future change.
Updates #391
Change-Id: I119ab1c246f141d639006c808b61c585c3d67924
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-28 13:56:46 -07:00
Josh Bleecher Snyder
94fb42d4b2
all: use testingutil.MinAllocsPerRun
...
There are a few remaining uses of testing.AllocsPerRun:
Two in which we only log the number of allocations,
and one in which dynamically calculate the allocations
target based on a different AllocsPerRun run.
This also allows us to tighten the "no allocs"
test in wgengine/filter.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-10-28 12:48:37 -07:00
Josh Bleecher Snyder
1df865a580
wgengine/magicsock: allow even fewer allocs per UDP receive
...
We improved things again for Go 1.18. Lock that in.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-10-28 12:48:37 -07:00
Josh Bleecher Snyder
c1d377078d
wgengine/magicsock: use testingutil.MinAllocsPerRun
...
This speeds up and deflakes the test.
Fixes #2826 (again)
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-10-28 12:48:37 -07:00
Brad Fitzpatrick
aad46bd9ff
wgengine/router: stop cleaning up old dev rules on Linux
...
Anybody using that one old, unreleased version of Tailscale from over
a year ago should've rebooted their machine by now to get various
non-Tailscale security updates. :)
Change-Id: If9e043cb008b20fcd6ddfd03756b3b23a9d7aeb5
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-28 12:29:54 -07:00
David Anderson
c9bf773312
wgengine/magicsock: replace use of wgkey with new node key type.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 11:21:52 -07:00
Brad Fitzpatrick
d36c0d3566
wgengine/router: add debug test to enumerate rules
...
No non-test changes.
Updates #391
Change-Id: Ia88610c08e07a119d002e58250463cb4659b9f54
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-28 11:12:16 -07:00
David Anderson
6e5175373e
types/netmap: use new node key type.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 10:44:34 -07:00
David Anderson
3164c7410e
wgengine/wgcfg: remove unused helper function.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 10:38:13 -07:00
Brad Fitzpatrick
dc2fbf5877
wgengine/router: start using netlink instead of 'ip' on Linux
...
Converts up, down, add/del addresses, add/del routes.
Not yet done: rules.
Updates #391
Change-Id: I02554ca07046d18f838e04a626ba99bbd35266fb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-28 10:16:26 -07:00
David Anderson
a9c78910bd
wgengine/wgcfg: convert to use new node key type.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-28 09:39:23 -07:00
Brad Fitzpatrick
b0b0a80318
net/netcheck: implement netcheck for js/wasm clients
...
And the derper change to add a CORS endpoint for latency measurement.
And a little magicsock change to cut down some log spam on js/wasm.
Updates #3157
Change-Id: I5fd9e6f5098c815116ddc8ac90cbcd0602098a48
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-27 09:59:31 -07:00
Maisem Ali
85fa1b0d61
wgengine: fail NewUserspaceEngine if wireguard device doesn't come up
...
Just something I ran across while debugging an unrelated failure. This
is not in response to any bug/issue.
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-10-25 12:34:14 -07:00
David Crawshaw
0b62f26349
magicsock: remove test data race
...
Speculative, I haven't been able to replicate it locally.
Fixes #3156
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-10-22 11:19:07 -07:00
Brad Fitzpatrick
ed3fb197ad
wgengine/magicsock: fix/disable a few misc things to get js/wasm working
...
Updates #3157
Change-Id: Ie9e3a772bb9878584080bb257b32150492e26eaf
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-22 09:09:37 -07:00
Brad Fitzpatrick
e25afc6656
wgengine/magicsock: don't try to determine endpoints on js/wasm
...
Avoid netcheck, LocalAddr, etc.
Updates #3157
Change-Id: Ibc875c787c0e101b8076e64833f4fcc809372815
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-20 12:57:45 -07:00
Brad Fitzpatrick
6cb2705833
wgengine/magicsock: don't run UDP listeners on js/wasm
...
Be DERP-only for now. (WebRTC can come later :))
Updates #3157
Change-Id: I56ebb3d914e37e8f4ab651306fd705b817ca381c
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-20 12:23:22 -07:00
Brad Fitzpatrick
9310713bfb
all: fix some js/wasm compilation issues
...
Change-Id: I05a3a4835e225a1e413ec3540a7c7e4a2d477084
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-20 10:06:16 -07:00
Brad Fitzpatrick
c30fa5903d
wgengine/magicsock: remove peerMap.byDiscoKey map
...
No longer used.
Updates #3088
Change-Id: I0ced3f87baa4053d3838d3c4a828ed0293923825
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-19 12:22:11 -07:00
David Crawshaw
3552d86525
wgengine/magicsock: turn down timeouts in tests
...
Before:
--- PASS: TestActiveDiscovery (11.78s)
--- PASS: TestActiveDiscovery/facing_easy_firewalls (5.89s)
--- PASS: TestActiveDiscovery/facing_nats (5.89s)
--- PASS: TestActiveDiscovery/simple_internet (0.89s)
After:
--- PASS: TestActiveDiscovery (1.98s)
--- PASS: TestActiveDiscovery/facing_easy_firewalls (0.99s)
--- PASS: TestActiveDiscovery/facing_nats (0.99s)
--- PASS: TestActiveDiscovery/simple_internet (0.89s)
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2021-10-19 09:22:50 -07:00
David Anderson
b956139b0c
wgengine/magicsock: track IP<>node mappings without relying on discokeys.
...
Updates #3088 .
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-18 14:58:21 -07:00
Brad Fitzpatrick
7a243ae5b1
wgengine/magicsock: finish TODO to speed up peerMap.forEachEndpointWithDiscoKey
...
Now that peerMap tracks the set of nodes for a DiscoKey.
Updates #3088
Change-Id: I927bf2bdfd2b8126475f6b6acc44bc799fcb489f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-18 14:50:28 -07:00
Brad Fitzpatrick
11fdb14c53
wgengine/magicsock: don't check always-non-nil endpoint for nil-ness
...
Continuation of 2aa5df7ac1d6cf35f91966644b78a81eb3b7d154, remove nil
check because it can never be nil. (It previously was able to be nil.)
Change-Id: I59cd9ad611dbdcbfba680ed9b22e841b00c9d5e6
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-18 14:37:59 -07:00
David Anderson
e7eb46bced
wgengine/magicsock: add an explicit else branch to peerMap update.
...
Clarifies that the replace+delete of peerinfo data is only when peerInfo
already exists.
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-18 13:05:52 -07:00
Maisem Ali
53199738fb
wgengine: don't try to delete legacy netfilter rules on synology.
...
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-10-18 14:51:25 -04:00
David Anderson
2aa5df7ac1
wgengine/magicsock: document and enforce that peerInfo.ep is non-nil.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-18 10:49:24 -07:00
David Anderson
521b44e653
wgengine/magicsock: move discoKey fields to the mutex-protected section.
...
Fixes #3106
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-18 10:49:24 -07:00
Maisem Ali
27799a1a96
wgengine: only use AmbientCaps on DSM7+
...
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-10-18 13:39:51 -04:00
Brad Fitzpatrick
a6d02dc122
wgengine/magicsock: track which NodeKey each DiscoKey was last for
...
This adds new fields (currently unused) to discoInfo to track what the
last verified (unambiguous) NodeKey a DiscoKey last mapped to, and
when.
Then on CallMeMaybe, Pong and on most Pings, we update the mapping
from DiscoKey to the current NodeKey for that DiscoKey.
Updates #3088
Change-Id: Idc4261972084dec71cf8ec7f9861fb9178eb0a4d
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-18 09:55:02 -07:00
Brad Fitzpatrick
c759fcc7d3
wgengine/magicsock: fix data race with sync.Pool in error+logging path
...
Fixes #3122
Change-Id: Ib52e84f9bd5813d6cf2e80ce5b2296912a48e064
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-17 17:27:57 -07:00
Brad Fitzpatrick
75a7779b42
disco, wgengine/magicsock: send self node key in disco pings
...
This lets clients quickly (sub-millisecond within a local LAN) map
from an ambiguous disco key to a node key without waiting for a
CallMeMaybe (over relatively high latency DERP).
Updates #3088
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-17 10:24:07 -07:00