Update gVisor to release-20230605.0-21-g457c1c36d

This commit is contained in:
世界 2023-05-20 12:09:41 +08:00
parent b02f252916
commit e881f21013
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
20 changed files with 71 additions and 550 deletions

View file

@ -21,7 +21,7 @@ import (
"github.com/sagernet/sing-tun/internal/fdbased/stopfd"
"golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/bufferv2"
"gvisor.dev/gvisor/pkg/buffer"
"gvisor.dev/gvisor/pkg/tcpip"
"gvisor.dev/gvisor/pkg/tcpip/header"
"gvisor.dev/gvisor/pkg/tcpip/link/rawfile"
@ -35,7 +35,7 @@ type iovecBuffer struct {
// buffer is the actual buffer that holds the packet contents. Some contents
// are reused across calls to pullBuffer if number of requested bytes is
// smaller than the number of bytes allocated in the buffer.
views []*bufferv2.View
views []*buffer.View
// iovecs are initialized with base pointers/len of the corresponding
// entries in the views defined above, except when GSO is enabled
@ -59,7 +59,7 @@ type iovecBuffer struct {
func newIovecBuffer(sizes []int, skipsVnetHdr bool) *iovecBuffer {
b := &iovecBuffer{
views: make([]*bufferv2.View, len(sizes)),
views: make([]*buffer.View, len(sizes)),
sizes: sizes,
skipsVnetHdr: skipsVnetHdr,
}
@ -87,7 +87,7 @@ func (b *iovecBuffer) nextIovecs() []unix.Iovec {
if b.views[i] != nil {
break
}
v := bufferv2.NewViewSize(b.sizes[i])
v := buffer.NewViewSize(b.sizes[i])
b.views[i] = v
b.iovecs[i+vnetHdrOff] = unix.Iovec{Base: v.BasePtr()}
b.iovecs[i+vnetHdrOff].SetLen(v.Size())
@ -100,14 +100,14 @@ func (b *iovecBuffer) nextIovecs() []unix.Iovec {
// that holds the storage, and updates pulledIndex to indicate which part
// of b.buffer's storage must be reallocated during the next call to
// nextIovecs.
func (b *iovecBuffer) pullBuffer(n int) bufferv2.Buffer {
var views []*bufferv2.View
func (b *iovecBuffer) pullBuffer(n int) buffer.Buffer {
var views []*buffer.View
c := 0
if b.skipsVnetHdr {
c += virtioNetHdrSize
if c >= n {
// Nothing in the packet.
return bufferv2.Buffer{}
return buffer.Buffer{}
}
}
// Remove the used views from the buffer.
@ -126,7 +126,7 @@ func (b *iovecBuffer) pullBuffer(n int) bufferv2.Buffer {
// Exclude the size of the vnet header.
n -= virtioNetHdrSize
}
pulled := bufferv2.Buffer{}
pulled := buffer.Buffer{}
for _, v := range views {
pulled.Append(v)
}