Skip to contentSkip to conversation

tun/netstack: bump to latest gvisor

PATCH In review Shengjing Zhu 2 participants 3 messages Aug 23, 2022 – Aug 29, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tun/netstack: bump to latest gvisor

To build with go1.19, gvisor needs
99325baf ("Bump gVisor build tags to go1.19").

However gvisor.dev/gvisor/pkg/tcpip/buffer is no longer available, so refactor to use gvisor.dev/gvisor/pkg/tcpip/link/channel directly.

---
 tun/netstack/go.mod |   3 +-
 tun/netstack/go.sum | 963 +-------------------------------------------
 tun/netstack/tun.go | 105 ++---
 3 files changed, 37 insertions(+), 1034 deletions(-)
tun/netstack/go.mod +1 -2
index 18aa993..231584b 100644
@@ -5,12 +5,11 @@ go 1.18
 require (
 	golang.org/x/net v0.0.0-20220225172249-27dd8689420f
 	golang.zx2c4.com/wireguard v0.0.0-20220316235147-5aff28b14c24
-	gvisor.dev/gvisor v0.0.0-20211020211948-f76a604701b6
+	gvisor.dev/gvisor v0.0.0-20220817001344-846276b3dbc5
 )
 
 require (
 	github.com/google/btree v1.0.1 // indirect
-	golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
 	golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86 // indirect
 	golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
 	golang.zx2c4.com/wintun v0.0.0-20211104114900-415007cec224 // indirect
tun/netstack/go.sum +2 -961

975 lines not on this page · raw message

tun/netstack/tun.go +34 -71

190 lines not on this page · raw message

Signature · 1 line
2.35.1
#1 lore raw

Hi Shengjing,

Thanks for the patch. I'll apply this. But one question:

tun/netstack/tun.go func CreateNetTUN(localAddresses, dnsServers []netip.Addr, mtu int) (tun.Device, · line 60

Quoted 2 lines · Shengjing Zhu
tun/netstack/tun.go +1 -0
 	dev := &netTun{
+		ep:             channel.New(1024, uint32(mtu), ""),

How did you come up with 1024 here?

And more generally, how's performance of this compare to what was there before?

Thanks,
Jason

#2 lore raw

Hi,

Quoted 11 lines · Jason A. Donenfeld

Hi Shengjing,

Thanks for the patch. I'll apply this. But one question:

Quoted 2 lines · Shengjing Zhu
      dev := &netTun{

+ ep: channel.New(1024, uint32(mtu), ""),

How did you come up with 1024 here?

I simply copied from gvisor,
https://github.com/google/gvisor/blob/c8f981f9/pkg/tcpip/link/tun/device.go#L38

Quoted 2 lines

And more generally, how's performance of this compare to what was there before?

Sorry, I didn't take a performance test.

Signature · 2 lines
Best regards,
Shengjing Zhu