Commit Graph
2701 Commits
Author SHA1 Message Date
Josh Bleecher Snyder 56ba714e10 smush together two return values from C
avoids a per-packet alloc

i will atone for my sins later

if only C let you return multiple values.
or Go let you pass in a pointer w/o it being on the heap.
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder bb78cf81b6 keep 8 requests in the queue at all times 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 38a872d2c1 remove all allocs 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 6ef301e787 remove all allocations 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 48e338130e mve sockaddr_in to Go 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 56ece41326 move iovec to go 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 53117d9761 sheesh 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f75d32151b move msghdr to Go 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder fcdc9086a2 use io_uring 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 4f4dae32dd wgengine/magicsock: fix latent data race in test
logBufWriter had no serialization.
It just so happens that none of its users currently ever log concurrently.
Make it safe for concurrent use.

Signed-off-by: Josh Bleecher Snyder <[email protected]>
2021-07-13 15:14:18 -07:00
Brad Fitzpatrick 01e159b610 ipn/ipnlocal: save prefs to disk on UpdatePrefs
Regression from 6d10655dc3, which added
UpdatePrefs but didn't write it out to disk.

I'd planned on adding tests to state_test.go which is why I'd earlier
added 46896a9311 to prepare for making
such persistence tests easier to write, but turns out state_test.go
didn't even test UpdatePrefs, so I'm staying out of there.
Instead, this is tested using integration tests.

Fixes #2321

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-13 15:01:38 -07:00
julianknodt fb06ad19e7 wgcfg: Switch to using mem.RO
As Brad suggested, mem.RO allows for a lot of easy perf gains. There were also some smaller
changes outside of mem.RO, such as using hex.Decode instead of hex.DecodeString.

```
name        old time/op    new time/op    delta
FromUAPI-8    14.7µs ± 3%    12.3µs ± 4%  -16.58%  (p=0.008 n=5+5)

name        old alloc/op   new alloc/op   delta
FromUAPI-8    9.52kB ± 0%    7.04kB ± 0%  -26.05%  (p=0.008 n=5+5)

name        old allocs/op  new allocs/op  delta
FromUAPI-8      77.0 ± 0%      29.0 ± 0%  -62.34%  (p=0.008 n=5+5)
```

Signed-off-by: julianknodt <[email protected]>
2021-07-13 13:45:44 -07:00
julianknodt d349a3231e wgcfg: use string cut instead of string split
Signed-off-by: julianknodt <[email protected]>
2021-07-13 13:45:44 -07:00
julianknodt 664edbe566 wgcfg: add benchmark for FromUAPI
Adds a benchmark for FromUAPI in wgcfg.
It appears that it's not actually that slow, the main allocations are from the scanner and new
config.
Updates #1912.

Signed-off-by: julianknodt <[email protected]>
2021-07-13 13:45:44 -07:00
Christine Dodrill 5b845631ce tstest/integration/vms: delete a log file i was using to debug the tests (#2416)
Signed-off-by: Christine Dodrill <[email protected]>
2021-07-13 15:37:30 -04:00
Dan Bond ceb8c2b34e cmd/tailscale: update web server test copyright
Signed-off-by: Dan Bond <[email protected]>
2021-07-13 12:30:49 -07:00
Dan Bond 52972679e6 cmd/tailscale: improve web server test structure
Signed-off-by: Dan Bond <[email protected]>
2021-07-13 12:30:49 -07:00
Dan Bond 4c684fcf8c cmd/tailscale: test web server url func
Signed-off-by: Dan Bond <[email protected]>
2021-07-13 12:30:49 -07:00
Dan Bond 652bbc9aa0 cmd/tailscale: log web listen addr
Signed-off-by: Dan Bond <[email protected]>
2021-07-13 12:30:49 -07:00
Brad Fitzpatrick 1cedd944cf cmd/tailscale/cli: diagnose missing tailscaled on 'up'
Fixes #2029

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-13 12:23:11 -07:00
Christine Dodrill ede8ec1e20 tstest/integration/vms: split up test framework into files (#2396)
My spatial memory functions poorly with large files and the vms_test.go
file recently surpassed the point where it functions adequately. This
patch splits up vms_test.go into more files to make my spatial memory
function like I need it to.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-13 13:45:09 -04:00
Christine Dodrill 1f2a877c61 tstest/integration/testcontrol: add ipv6 support (#2394)
Split from https://github.com/tailscale/tailscale/pull/2376.

This adds IPv6 support to testcontrol so each member of the tailscale
network gets an IPv6 address too.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-13 13:10:08 -04:00
Brad Fitzpatrick 61e8fd4698 cmd/derpprobe: move from cmd/derper/derpprobe
Because our corp build system is confused by nested
binaries.

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-13 09:31:00 -07:00
maddie d976a84d7e derp: allow self node when verifying clients
Fixes #2408

Signed-off-by: Maddie Zhan <[email protected]>
2021-07-13 08:37:37 -07:00
Brad Fitzpatrick 05da2691a5 cmd/derper/derpprobe: add derp prober
Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-13 08:30:15 -07:00
David Crawshaw 87481282eb ipn: another controlplane synonym
This one doesn't bother me so much, as long term we want a synonym here.

Fixes #2384
Fixes #2386

Signed-off-by: David Crawshaw <[email protected]>
2021-07-13 08:22:10 -07:00
Brad Fitzpatrick 4c0494185b derp: remove "fine for now" intentional slow memory leak from derp server
It was once believed that it might be useful. It wasn't. We never used it.

Remove it so we don't slowly leak memory.

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-13 08:21:54 -07:00
David Crawshaw c84d7baf98 cmd/tailscale/cli: factor out more up code for testing
In theory, some of the other table-driven tests could be moved into this
form now but I didn't want to disturb too much good test code.

Includes a commented-out test for #2384 that is currently failing.

Signed-off-by: David Crawshaw <[email protected]>
2021-07-13 07:51:10 -07:00
David Anderson d98829583a derp: use a dedicated queue for disco traffic.
Signed-off-by: David Anderson <[email protected]>
2021-07-12 14:23:27 -07:00
David Anderson 67158549ab derp: actually export the new drop counter.
Signed-off-by: David Anderson <[email protected]>
2021-07-12 13:32:04 -07:00
David Anderson 36492ace9d derp: add counters to track the type of dropped packets.
Signed-off-by: David Anderson <[email protected]>
2021-07-12 13:15:59 -07:00
Brad Fitzpatrick 1072397375 go.mod: bump wireguard/windows to a version that still exists
Fixes #2381

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-12 12:14:31 -07:00
Christine Dodrill 1b1c85d069 Revert "Revert "tstest/integration/vms: end-to-end UDP test (#2361)" (#2364)" (#2365)
This reverts commit 254fc7885b.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-12 14:53:16 -04:00
Simeng He 3d049a9d71 tstest/integration: change return type of AwaitIP from string to netaddr.IP
Signed-off-by: Simeng He <[email protected]>
2021-07-12 07:45:48 -07:00
Brad Fitzpatrick 46896a9311 ipn/ipnlocal: start to test whether all state transitions save prefs to disk
Updates #2321

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-12 07:42:22 -07:00
Brad Fitzpatrick 22cac33fe7 ipn: remove an unnecessary lazy map init on read path
It's okay to read from a nil map.

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-11 19:53:23 -07:00
Brad Fitzpatrick 7e7c4c1bbe tailcfg: break DERPNode.DERPTestPort into DERPPort & InsecureForTests
The DERPTestPort int meant two things before: which port to use, and
whether to disable TLS verification. Users would like to set the port
without disabling TLS, so break it into two options.

Updates #1264

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-09 12:30:31 -07:00
Brad Fitzpatrick 92077ae78c wgengine/magicsock: make portmapping async
Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-09 11:15:26 -07:00
Christine Dodrill afbd35482d tstest/integration/vms: add NixOS unstable back (#2330)
The upstream NixOS issue was fixed.
https://github.com/NixOS/nixpkgs/issues/128783

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-09 12:13:21 -04:00
Christine Dodrill 33cacb5284 tstest/integration/vms: unbreak nixos builds (#2372)
To avoid the generated nixos disk images from becoming immune from the
GC, I delete the symlink to the nix store at the end of tests.
`t.Cleanup` runs at the end of a test. I changed this part of the code
to have a separate timer for how long it takes to run NixOS builds, but
I did that by using a subtest. This means that it was creating the NixOS
image, deleting its symlink and then trying to use that symlink to find
the resulting disk image, making the whole thing ineffectual.

This was a mistake. I am reverting this change made in
https://github.com/tailscale/tailscale/pull/2360 to remove this layer of
subtesting.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-09 11:02:19 -04:00
Christine Dodrill b90f149f5e Run tests on integration test changes (#2373)
Hopefully this will catch situations like
https://github.com/tailscale/tailscale/pull/2372

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-09 10:50:23 -04:00
Josh Bleecher Snyder 7a08c159e6 safesocket: create the test socket in a temp dir
This allows the test to be run inside a mounted filesystem,
which I'm doing now as a I develop on a linux VM.

Fixes #2367.

Signed-off-by: Josh Bleecher Snyder <[email protected]>
2021-07-08 16:57:37 -07:00
Christine Dodrill 254fc7885b Revert "tstest/integration/vms: end-to-end UDP test (#2361)" (#2364)
This reverts commit dc78be12c5.
2021-07-08 16:10:01 -04:00
Christine Dodrill dc78be12c5 tstest/integration/vms: end-to-end UDP test (#2361)
This tests incoming and outgoing UDP traffic. It would test incoming UDP
traffic however our socks server doesn't seem to allow for connecting to
destinations over UDP. When the socks server gets that support the
incoming test should pass without issue.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-08 15:58:18 -04:00
Christine Dodrill a19eea965f tstest/integration/vms: use an in-process logcatcher (#2360)
This adapts the existing in-process logcatcher from tstest/integration
into a public type and uses it on the side of testcontrol. This also
fixes a bug in the Alpine Linux OpenRC unit that makes every value in
`/etc/default/tailscaled` exported into tailscaled's environment, a-la
systemd [Service].EnviromentFile.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-08 14:39:45 -04:00
Brad Fitzpatrick 440566c5d2 net/interfaces: trim getPACWindows whitespace before parsing URL
Fixes #2357

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-08 11:26:50 -07:00
Christine Dodrill 1e83b97498 tstest/integration/vms: outgoing SSH test (#2349)
This does a few things:

1. Rewrites the tests so that we get a log of what individual tests
   failed at the end of a test run.
2. Adds a test that runs an HTTP server via the tester tailscale node and
   then has the VMs connect to that over Tailscale.
3. Dials the VM over Tailscale and ensures it answers SSH requests.
4. Other minor framework refactoring.

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-08 11:38:01 -04:00
Christine Dodrill 97279a0fe0 tstest/integration/vms: add Oracle Linux image (#2328)
Oracle Linux[1] is a CentOS fork. It is not very special. I am adding it
to the integration jungle because I am adding it to pkgs and the website
directions.

[1]: https://www.oracle.com/linux/

Signed-off-by: Christine Dodrill <[email protected]>
2021-07-08 10:26:20 -04:00
Brad Fitzpatrick a9fc583211 cmd/tailscale/cli: document the web subcommand a bit more
Fixes #2326

Signed-off-by: Brad Fitzpatrick <[email protected]>
2021-07-07 21:16:33 -07:00
Josh Bleecher Snyder 0ad92b89a6 net/tstun: fix data races
To remove some multi-case selects, we intentionally allowed
sends on closed channels (cc23049cd2).

However, we also introduced concurrent sends and closes,
which is a data race.

This commit fixes the data race. The mutexes here are uncontended,
and thus very cheap.

Signed-off-by: Josh Bleecher Snyder <[email protected]>
2021-07-07 16:15:29 -07:00