Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xjasonlyu committed Feb 8, 2022
1 parent bf35298 commit 9d8251a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions core/device/tun/tun_netstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ func Open(name string, mtu uint32) (device.Device, error) {
EthernetHeader: false,
// SYS_READV support only for TUN fd.
PacketDispatchMode: fdbased.Readv,
// TODO: set this field to zero in the future.
// it's a only temporary hack to avoid `socket operation
// on non-socket` error caused by SYS_SENDMMSG syscall.
// TAP/TUN fd's are not sockets and using the WritePackets calls results
// in errors as it always defaults to using SendMMsg which is not supported
// for tap/tun device fds.
//
// Ref: https://github.com/google/gvisor/issues/7125
MaxSyscallHeaderBytes: 0x40,
// This CL changes WritePackets to gracefully degrade to using writev instead
// of sendmmsg if the underlying fd is not a socket.
//
// Fixed: https://github.com/google/gvisor/commit/f33d034fecd7723a1e560ccc62aeeba328454fd0
MaxSyscallHeaderBytes: 0x00,
})
if err != nil {
return nil, fmt.Errorf("create endpoint: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11
golang.zx2c4.com/wireguard v0.0.0-20220202223031-3b95c81cc178
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gvisor.dev/gvisor v0.0.0-20220205064904-d09fa42eaa20
gvisor.dev/gvisor v0.0.0-20220208035940-56a131734b85
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gvisor.dev/gvisor v0.0.0-20220205064904-d09fa42eaa20 h1:Aih4gc0gDmeT48uWlEuR7kl8AjqHR6buUV2kfjPzC0Y=
gvisor.dev/gvisor v0.0.0-20220205064904-d09fa42eaa20/go.mod h1:V4WNP2Uwtx69eOhvLDSQ734EaTJTaBI3P8KgRAlROsg=
gvisor.dev/gvisor v0.0.0-20220208035940-56a131734b85 h1:BELDz7P8Bn3BMDa9NYMDGATVO+F1fd/Pvr3Z2oisCvI=
gvisor.dev/gvisor v0.0.0-20220208035940-56a131734b85/go.mod h1:V4WNP2Uwtx69eOhvLDSQ734EaTJTaBI3P8KgRAlROsg=

0 comments on commit 9d8251a

Please sign in to comment.