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
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
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
27799a1a96
wgengine: only use AmbientCaps on DSM7+
...
Signed-off-by: Maisem Ali <maisem@tailscale.com >
2021-10-18 13:39:51 -04:00
14f9c75293
wgengine/router: ignore Linux ip route error adding dup route
...
Updates #3060
Updates #391
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-10-14 14:00:45 -07:00
f01ff18b6f
all: fix spelling mistakes
...
Signed-off-by: nicksherron <nsherron90@gmail.com >
2021-10-12 21:23:14 -07:00
4c68b7df7c
tstest: add MemLogger bytes.Buffer wrapper with Logf method
...
We use it tons of places. Updated three at least in this PR.
Another use in next commit.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-09-07 15:33:45 -07:00
6731f934a6
Revert "wgengine: actively log FlushDNS."
...
This log is quite verbose, it was only to be left in for one
unstable build to help debug a user issue.
This reverts commit 1dd2552032
.
Signed-off-by: Denton Gentry <dgentry@tailscale.com >
2021-08-20 18:12:47 -07:00
1dd2552032
wgengine: actively log FlushDNS.
...
Intended to help in resolving customer issue with
DNS caching.
We currently exec `ipconfig /flushdns` from two
places:
- SetDNS(), which logs before invoking
- here in router_windows, which doesn't
We'd like to see a positive indication in logs that flushdns
is being run.
As this log is expected to be spammy, it is proposed to
leave this in just long enough to do an unstable 1.13.x build
and then revert it. They won't run an unsigned image that
I build.
Signed-off-by: Denton Gentry <dgentry@tailscale.com >
2021-08-19 14:43:14 -07:00
5c383bdf5d
wgengine/router: pass in AmbientCaps when calling ip rule
...
Signed-off-by: Maisem Ali <maisem@tailscale.com >
2021-08-18 13:28:53 -07:00
a5da4ed981
all: gofmt with Go 1.17
...
This adds "//go:build" lines and tidies up existing "// +build" lines.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com >
2021-08-05 15:54:00 -07:00
e4fecfe31d
wgengine/{monitor,router}: restore Linux ip rules when systemd deletes them
...
Thanks.
Fixes #1591
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-07-20 15:52:22 -07:00
ed8587f90d
wgengine/router: take a link monitor
...
Prep for #1591 which will need to make Linux's router react to changes
that the link monitor observes.
The router package already depended on the monitor package
transitively. Now it's explicit.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-07-20 13:43:40 -07:00
ec52760a3d
wgengine/router_windows: support toggling local lan access when using
...
exit nodes.
Signed-off-by: Maisem Ali <maisem@tailscale.com >
2021-06-29 09:22:10 -07:00
a49df5cfda
wgenine/router: fix OpenBSD route creation
...
The route creation for the `tun` device was augmented in #1469 but
didn't account for adding IPv4 vs. IPv6 routes. There are 2 primary
changes as a result:
* Ensure that either `-inet` or `-inet6` was used in the
[`route(8)`](https://man.openbsd.org/route ) command
* Use either the `localAddr4` or `localAddr6` for the gateway argument
depending which destination network is being added
The basis for the approach is based on the implementation from
`router_userspace_bsd.go`, including the `inet()` helper function.
Fixes #2048
References #1469
Signed-off-by: Fletcher Nichol <fnichol@nichol.ca >
2021-06-10 10:48:33 -07:00
1ece91cede
go.mod: upgrade wireguard-windows, de-fork wireguard-go
...
Pull in the latest version of wireguard-windows.
Switch to upstream wireguard-go.
This requires reverting all of our import paths.
Unfortunately, this has to happen at the same time.
The wireguard-go change is very low risk,
as that commit matches our fork almost exactly.
(The only changes are import paths, CI files, and a go.mod entry.)
So if there are issues as a result of this commit,
the first place to look is wireguard-windows changes.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com >
2021-05-25 13:18:21 -07:00
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
47ebd1e9a2
wgengine/router: use net.IP.Equal instead of bytes.Equal to compare IPs
...
Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com >
2021-05-04 08:54:50 -07:00
f91c2dfaca
wgengine/router: remove unused field
...
Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com >
2021-05-04 08:54:50 -07:00
9360f36ebd
all: use lower-case letters at the start of error message
...
Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com >
2021-05-04 08:54:50 -07:00
20e04418ff
net/dns: add GOOS build tags
...
Fixes #1786
Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com >
2021-04-29 21:34:55 -07:00
590792915a
wgengine/router{win}: ignore broadcast routes added by Windows when removing routes.
...
Signed-off-by: Maisem Ali <maisem@tailscale.com >
2021-04-24 14:13:35 -07:00
4f3203556d
wgengine/router: add the Tailscale ULA route on darwin.
...
Signed-off-by: Maisem Ali <maisem@tailscale.com >
2021-04-15 17:07:50 -07:00
1b9d8771dc
ipn/ipnlocal,wgengine/router,cmd/tailscale: add flag to allow local lan access when routing traffic via an exit node.
...
For #1527
Signed-off-by: Maisem Ali <maisem@tailscale.com >
2021-04-12 17:29:01 -07:00
19eca34f47
wgengine/router: fix FreeBSD configuration failure on the v6 /48.
...
On FreeBSD, we add the interface IP as a /48 to work around a kernel
bug, so we mustn't then try to add a /48 route to the Tailscale ULA,
since that will fail as a dupe.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-10 19:36:26 -07:00
4a64d2a603
net/dns: some post-review cleanups.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-07 15:40:31 -07:00
68f76e9aa1
net/dns: add GetBaseConfig to OSConfigurator interface.
...
Part of #953 , required to make split DNS work on more basic
platforms.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-07 15:40:31 -07:00
de6dc4c510
net/dns: add a Primary field to OSConfig.
...
Currently ignored.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-05 13:05:47 -07:00
4c61ebacf4
wgengine: move DNS configuration out of wgengine/router.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-05 10:55:35 -07:00
27a1a2976a
wgengine/router: add a CallbackRouter shim.
...
The shim implements both network and DNS configurators,
and feeds both into a single callback that receives
both configs.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-02 18:43:24 -07:00
6ad44f9fdf
wgengine: take in dns.Config, split out to resolver.Config and dns.OSConfig.
...
Stepping stone towards having the DNS package handle the config splitting.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-02 00:59:44 -07:00
8af9d770cf
net/dns: rename Config to OSConfig.
...
Making way for a new higher level config struct.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-02 00:59:44 -07:00
fcfc0d3a08
net/dns: remove ManagerConfig, pass relevant args directly.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-01 23:26:52 -07:00
f77ba75d6c
wgengine/router: move DNS cleanup into the DNS package.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-04-01 22:35:34 -07:00
15875ccc63
wgengine/router: don't store unused tunname on windows.
2021-04-01 22:28:24 -07:00
e64383a80e
wgengine/router: document some fields a bit more
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-04-01 07:50:50 -07:00
2b4bfeda1a
wgengine: pass in an explicit router.Router, rather than a generator.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-26 22:01:55 -07:00
0a84aaca0a
wgengine/router: remove unused wireguard *Device argument.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-26 19:43:13 -07:00
672731ac6f
many: gofmt.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-25 17:41:51 -07:00
6521f02ff6
Move DNS flush logic to net/dns.
...
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-25 17:40:52 -07:00
9f7f2af008
wgengine/router/dns: move to net/dns.
...
Preparation for merging the APIs and whatnot.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-25 16:25:30 -07:00
8432999835
Move wgengine/tsdns to net/dns.
...
Straight move+fixup, no other changes. In prep for merging with
wgengine/router/dns.
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-25 16:25:30 -07:00
e2b3d9aa5f
all: s/Magic DNS/MagicDNS/ for consistency
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-03-23 14:25:28 -07:00
232cfda280
wgengine/router: report to control when setPrivateNetwork fails
...
Fixes #1503
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-03-15 16:19:40 -07:00
d580b3f09e
wgengine/router: fix go vet failure on BSDs
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com >
2021-03-15 14:27:39 -07:00
25d2dd868b
wgengine/router: flushdns in windows when router config changes
...
Fixes: https://github.com/tailscale/tailscale/issues/1430
Signed-off-by: Aleksandar Pesic <peske.nis@gmail.com >
2021-03-15 13:03:01 +01:00
fa6110e47b
wgengine/router: don't touch interface routes
...
Developed by a cast of dozens.
Fixes #1448
Signed-off-by: David Anderson <danderson@tailscale.com >
2021-03-11 21:09:25 -08:00
04e72f95cc
wgengine/router: add OpenBSD IPv6 support.
...
Similar to FreeBSD in https://github.com/tailscale/tailscale/issues/1307 ,
add IPv6 addresses with a prefix length of 48.
Fixes https://github.com/tailscale/tailscale/issues/1372
Signed-off-by: Denton Gentry <dgentry@tailscale.com >
2021-03-08 19:02:59 -08:00
bcea88da46
wgengine: support FreeBSD with IPv6.
...
Fixes https://github.com/tailscale/tailscale/issues/1307 for keepsies.
We cannot set the tun interface address as a /128 on FreeBSD,
due to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218508
Instead we set the interface address as a /48, which is enabled
by commit 82edf94df7
.
Signed-off-by: Denton Gentry <dgentry@tailscale.com >
2021-03-05 19:34:14 -08:00
c8af6bc009
Revert "freebsd: ignore IPv6 for now"
...
This reverts commit 061422affc
.
We have a way to support IPv6 on FreeBSD now.
Signed-off-by: Denton Gentry <dgentry@tailscale.com >
2021-03-05 19:34:14 -08:00