Commit Graph

23 Commits

Author SHA1 Message Date
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 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 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 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