Commit Graph

2726 Commits

Author SHA1 Message Date
Josh Bleecher Snyder 6ec3378f7b remove more dead code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 385f86e85f document, cull dead code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 52ccff8835 WIP: clean shutdown for UDP conn
this appears to work, most of the time.
there's lots of documentation work remaining,
thinking through the structure remaining,
testing remaining,
porting to file remaining (if appropriate).
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 2118b821cd remove dead code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 1e3e5fd8e7 overhaul error handling of peek/waitcompletion 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder e0d8dcf3eb refactor 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder c1bc58defc set sin_family (oops) 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 7cb1369b19 remove some TODOs, make ip address extraction equally awful 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f274a0cfab simplify change point
at the cost of some very, very naughty unsafe
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f71ff18c11 convert manual tests into automated tests 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 961a23b9df tewak 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder f27a61502d start cleaning up code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder a98ed81f2e ipv6 support, UNTESTED, super hacky 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 275cb37031 comments 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 9559752cb5 fix io_uring tun device reads
Well that's an interesting one!
Apparently if you issue multiple concurrent preadv calls on
a TUN device using io_uring, the TUN device falls over.

Possibly corrupting memory along the way.
Which might be why the kernel hung on shutdown...
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 78dbd02718 make it easy to toggle uring on/off 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 4d58223422 switch file.go to test reads instead of writes 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder b05f305eaf simpler init 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder e337ed2033 stick closer to upstream tun reading code 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 0fb656794c make cgo pointer rules happy
well that was a mess
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 283614d5e9 use io_uring for sendmsg
and clean up some dead code and unify some things
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 11036e23a1 disable polling for now
we'll maybe bring it back with a token bucket or something.
and/or do multi-sqe submission.
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 522fa9306e they work with extra junk
thanks, dave
no thanks, kernel devs

write no work
use writev
2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder 7fd5e31070 tun writes...not working yet (but why not??) 2021-07-13 15:15:16 -07:00
Josh Bleecher Snyder a03ee93e21 use polling instead of syscall 2021-07-13 15:15:16 -07:00
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 <josh@tailscale.com>
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 <bradfitz@tailscale.com>
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 <julianknodt@gmail.com>
2021-07-13 13:45:44 -07:00
julianknodt d349a3231e wgcfg: use string cut instead of string split
Signed-off-by: julianknodt <julianknodt@gmail.com>
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 <julianknodt@gmail.com>
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 <xe@tailscale.com>
2021-07-13 15:37:30 -04:00
Dan Bond ceb8c2b34e cmd/tailscale: update web server test copyright
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13 12:30:49 -07:00
Dan Bond 52972679e6 cmd/tailscale: improve web server test structure
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13 12:30:49 -07:00
Dan Bond 4c684fcf8c cmd/tailscale: test web server url func
Signed-off-by: Dan Bond <danbond@protonmail.com>
2021-07-13 12:30:49 -07:00
Dan Bond 652bbc9aa0 cmd/tailscale: log web listen addr
Signed-off-by: Dan Bond <danbond@protonmail.com>
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 <bradfitz@tailscale.com>
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 <xe@tailscale.com>
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 <xe@tailscale.com>
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 <bradfitz@tailscale.com>
2021-07-13 09:31:00 -07:00
maddie d976a84d7e derp: allow self node when verifying clients
Fixes #2408

Signed-off-by: Maddie Zhan <maddie.zhan@cynovan.com>
2021-07-13 08:37:37 -07:00
Brad Fitzpatrick 05da2691a5 cmd/derper/derpprobe: add derp prober
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-13 08:30:15 -07:00