summaryrefslogtreecommitdiffhomepage
path: root/wgengine
AgeCommit message (Collapse)AuthorFilesLines
2020-07-27wgengine/magicsock: log better with less spam on transition to stopped stateBrad Fitzpatrick2-6/+20
Required a minor test update too, which now needs a private key to get far enough to test the thing being tested.
2020-07-25wgengine/magicsock: remove overkill, slow reflect.DeepEqual of NetworkMapBrad Fitzpatrick1-2/+14
No need to allocate or compare all the fields we don't care about.
2020-07-25wgengine: add debug knob to disable the watchdog during debuggingBrad Fitzpatrick1-0/+5
It launches goroutines and interferes with panic-based debugging, obscuring stacks.
2020-07-24wgengine/magicsock: refactor twoDevicePing to make stack construction cleaner.David Anderson1-163/+163
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-24wgengine: configure wireguard peers lazily, as neededBrad Fitzpatrick4-78/+410
wireguard-go uses 3 goroutines per peer (with reasonably large stacks & buffers). Rather than tell wireguard-go about all our peers, only tell it about peers we're actively communicating with. That means we need hooks into magicsock's packet receiving path and tstun's packet sending path to lazily create a wireguard peer on demand from the network map. This frees up lots of memory for iOS (where we have almost nothing left for larger domains with many users). We should ideally do this in wireguard-go itself one day, but that'd be a pretty big change. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-07-24wgengine/magicsock: don't log about disco ping timeouts if we have a working ↵Brad Fitzpatrick1-6/+16
address Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-07-24wgengine/tstun: move sync.Pool to package globalBrad Fitzpatrick1-12/+9
sync.Pools should almost always be packate globals, even though in this case we only have exactly 1 TUN device anyway, so it matters less. Still, it's unusual to see a Pool that's not a package global, so move it.
2020-07-23wgengine/router: support legacy resolvconfDmytro Shynkevych1-2/+57
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-22wgengine/router: don't use 88 or 8888 as table/rule numbers.David Anderson2-40/+55
We originally picked those numbers somewhat at random, but with the idea that 8 is a traditionally lucky number in Chinese culture. Unfortunately, "88" is also neo-nazi shorthand language. Use 52 instead, because those are the digits above the letters "TS" (tailscale) on a qwerty keyboard, so we're unlikely to collide with other users. 5, 2 and 52 are also pleasantly culturally meaningless. Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-22wgengine/router: fix router_test to match the new marks.David Anderson1-16/+16
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-22wgengine/router: switch packet marks to avoid conflict with Weave Net.David Anderson1-2/+2
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-18wgengine/magicsock: fix typo in commentv0.100.0-153Brad Fitzpatrick1-1/+1
2020-07-18wgengine/magicsock: reduce log verbosity of discovery messagesBrad Fitzpatrick1-28/+72
Don't log heartbeat pings & pongs. Track the reason for pings and then only log the ping/pong traffic if it was for initial path discovery.
2020-07-18wgengine/router: use better NetworkManager APIDmytro Shynkevych2-58/+47
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-17Use LittleEndian for correct byte order on DNS IPsEduardo Kienetz1-1/+1
Nameserver IP 10.11.12.13 would otherwise get written to resolv.conf as 13.12.11.10, as was happening on my client. Signed-off-by: Eduardo Kienetz <eduardo@kienetz.com>
2020-07-16wgengine/magicsock: run test DERP in mode where only disco packets allowedBrad Fitzpatrick1-3/+6
So we don't accidentally pass a NAT traversal test by having DERP pick up our slack when we really just wanted DERP as an OOB messaging channel.
2020-07-16all: fix vet warningsBrad Fitzpatrick3-5/+14
2020-07-16wgengine/magicsock: update comment, fix earlier commitBrad Fitzpatrick1-10/+10
https://github.com/tailscale/tailscale/commit/891898525c12630b0f896cb9142ff5274e07afc2 had a continue that meant the didCopy synchronization never ran. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-07-16wgengine/magicsock: gofmtBrad Fitzpatrick1-2/+2
2020-07-16wgengine/magicsock: time.Sleep -> time.AfterDmytro Shynkevych1-1/+1
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-16wgengine/magicsock: make time.Sleep in runDerpReader respect cancellation.Dmytro Shynkevych1-1/+6
Before this patch, the 250ms sleep would not be interrupted by context cancellation, which would result in the goroutine sometimes lingering in tests (100ms grace period). Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-16wgengine/magicsock: make receive from didCopy respect cancellation.Dmytro Shynkevych1-1/+9
Very rarely, cancellation occurs between a successful send on derpRecvCh and a call to copyBuf on the receiving side. Without this patch, this situation results in <-copyBuf blocking indefinitely. Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-15wgengine: only launch pingers for peers predating the discovery protocolBrad Fitzpatrick2-1/+23
Peers advertising a discovery key know how to speak the discovery protocol and do their own heartbeats to get through NATs and keep NATs open. No need for the pinger except for with legacy peers.
2020-07-15wgengine: update for tailscale/wireguard-go API changesBrad Fitzpatrick1-3/+8
* update to new HandshakeDone signature * use new Device.IpcGetOperationFiltered call to avoid sending allowed_ips See https://github.com/tailscale/wireguard-go/commit/dd6c1c8fe14c1af4fc8ef599ff99c302e289b553
2020-07-15tstest/natlab: refactor PacketHandler into a larger interface.David Anderson1-6/+4
The new interface lets implementors more precisely distinguish local traffic from forwarded traffic, and applies different forwarding logic within Machines for each type. This allows Machines to be packet forwarders, which didn't quite work with the implementation of Inject. Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-15tstun: remove buggy-looking log line.Dmytro Shynkevych1-3/+1
This log line looks buggy, even though lacking a filter is expected during bringup. We already know if we forget to SetFilter: it breaks the magicsock test, so no useful information is lost. Resolves #559. Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-14wgengine: fix macos staticcheck errors (#557)Wendi Yu5-16/+22
Signed-off-by: Wendi <wendi.yu@yahoo.ca>
2020-07-14tsdns: response to type ANY queriesDmytro Shynkevych1-1/+1
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-14wgengine/magicsock: wait for derphttp client goroutine to exitDmytro Shynkevych1-0/+11
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-14wgengine/router: dns: unify on *BSD, multimode on Linux, Magic DNS (#536)Dmytro Shynkevych15-242/+906
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-13cmd/tailscaled: graceful shutdown (#534)Dmytro Shynkevych1-0/+7
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-11wgengine/magicsock: add a connectivity test for facing firewalls.David Anderson1-0/+28
The test demonstrates that magicsock can traverse two stateful firewalls facing each other, that each require localhost to initiate connections. Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-11wgengine/magicsock: rearrange TwoDevicePing test for future natlab tests.David Anderson1-32/+47
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-11wgengine/magicsock: make trivial natlab test pass.David Anderson1-19/+16
Signed-off-by: David Anderson <danderson@tailscale.com>
2020-07-10wgengine/magicsock, tstest/natlab: start hooking up natlab to magicsockBrad Fitzpatrick2-11/+71
Also adds ephemeral port support to natlab. Work in progress. Pairing with @danderson.
2020-07-10wgengine/tsdns: local DNS server for testingDmytro Shynkevych2-12/+118
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-08tsdns: fix race in delegateDmytro Shynkevych1-1/+1
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-08wgengine/magicsock: stop discoEndpoint timers on CloseBrad Fitzpatrick1-0/+13
And add some defensive early returns on c.closed.
2020-07-08wgengine/magicsock: remove DisableSTUNForTestingBrad Fitzpatrick1-3/+1
2020-07-07tsdns: dual resolution mode, IPv6 support (#526)Dmytro Shynkevych4-250/+547
This change adds to tsdns the ability to delegate lookups to upstream nameservers. This is crucial for setting Magic DNS as the system resolver. Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-07-07wgengine/monitor: fix other potential crashes on LinuxBrad Fitzpatrick1-11/+16
Never return "nil, nil" anymore. The caller expected a usable interface now. I missed some of these earlier. Also, handle address deletion now. Updates #532
2020-07-07wgengine/monitor: fix crash on Linux on type 21 messagesBrad Fitzpatrick3-7/+9
Fixes #532
2020-07-07wgengine/tstun: fix alignment of 64-bit atomic fieldBrad Fitzpatrick1-1/+2
We had a test for it, but no 32-bit builder apparently. :( Fixes #529
2020-07-06wgengine/monitor: parse Linux netlink messages, ignore our own eventsBrad Fitzpatrick4-22/+105
Fixes tailscale/corp#412 ("flood of link change events at start-up") Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-07-06net/tsaddr: new package to hold Tailscale-specific IPs/rangesBrad Fitzpatrick1-8/+4
And update existing callers with (near) duplicated cases.
2020-07-06netcheck, tailcfg, interfaces, magicsock: survey UPnP, NAT-PMP, PCPBrad Fitzpatrick1-0/+3
Don't do anything with UPnP, NAT-PMP, PCP yet, but see how common they are in the wild. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-07-06wgengine/magicsock: change API to not permit disco key changesBrad Fitzpatrick5-22/+19
Generate the disco key ourselves and give out the public half instead. Fixes #525
2020-07-03wgengine/magicsock: fix data race from undocumented wireguard-go requirementBrad Fitzpatrick2-0/+27
Endpoints need to be Stringers apparently. Fixes tailscale/corp#422
2020-07-03cmd/tailscale: add tailscale status region name, last write, consistently starBrad Fitzpatrick1-11/+52
There's a lot of confusion around what tailscale status shows, so make it better: show region names, last write time, and put stars around DERP too if active. Now stars are always present if activity, and always somewhere.
2020-07-03wgengine/magicsock: add discoEndpoint heartbeatBrad Fitzpatrick1-21/+117
Updates #483