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
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
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
nicksherron
f01ff18b6f
all: fix spelling mistakes
...
Signed-off-by: nicksherron <nsherron90@gmail.com>
2021-10-12 21:23:14 -07:00
Brad Fitzpatrick
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
Denton Gentry
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
Denton Gentry
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
Maisem Ali
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
Josh Bleecher Snyder
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
Brad Fitzpatrick
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
Brad Fitzpatrick
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
Maisem Ali
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
Fletcher Nichol
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
Josh Bleecher Snyder
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
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
Josh Bleecher Snyder
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
Josh Bleecher Snyder
f91c2dfaca
wgengine/router: remove unused field
...
Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-05-04 08:54:50 -07:00
Josh Bleecher Snyder
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
Josh Bleecher Snyder
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
Maisem Ali
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
Maisem Ali
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
Maisem Ali
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
David Anderson
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
David Anderson
4a64d2a603
net/dns: some post-review cleanups.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-04-07 15:40:31 -07:00
David Anderson
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
David Anderson
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
David Anderson
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
David Anderson
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
David Anderson
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
David Anderson
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
David Anderson
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
David Anderson
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
David Anderson
15875ccc63
wgengine/router: don't store unused tunname on windows.
2021-04-01 22:28:24 -07:00
Brad Fitzpatrick
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
David Anderson
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
David Anderson
0a84aaca0a
wgengine/router: remove unused wireguard *Device argument.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-03-26 19:43:13 -07:00
David Anderson
672731ac6f
many: gofmt.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-03-25 17:41:51 -07:00
David Anderson
6521f02ff6
Move DNS flush logic to net/dns.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-03-25 17:40:52 -07:00
David Anderson
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
David Anderson
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
Brad Fitzpatrick
e2b3d9aa5f
all: s/Magic DNS/MagicDNS/ for consistency
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-23 14:25:28 -07:00
Brad Fitzpatrick
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
Brad Fitzpatrick
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
Aleksandar Pesic
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
David Anderson
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
Denton Gentry
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
Denton Gentry
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
Denton Gentry
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
Denton Gentry
061422affc
freebsd: ignore IPv6 for now
...
FreeBSD tun devices don't work with the way we implement IPv6
https://github.com/tailscale/tailscale/issues/1307
At least for now, remove any IPv6 addresses from the netmap.
Signed-off-by: Denton Gentry <dgentry@tailscale.com>
2021-03-03 15:33:13 -08:00
David Anderson
1cb0ffc3ff
wgengine/router: make windows gracefully handle disabled IPv4 or IPv6.
...
This is necessary because either protocol can be disabled globally by a
Windows registry policy, at which point trying to touch that address
family results in "Element not found" errors. This change skips programming
address families that Windows tell us are unavailable.
Fixes #1396 .
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-03-03 11:48:17 -08:00