Minor fixes
This commit is contained in:
parent
4c81c8a62a
commit
7812930a48
5 changed files with 10 additions and 7 deletions
|
|
@ -77,7 +77,7 @@ func (m *Mixed) tunLoop() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if darwinTUN, isDarwinTUN := m.tun.(DarwinTUN); isDarwinTUN {
|
if darwinTUN, isDarwinTUN := m.tun.(DarwinTUN); isDarwinTUN && m.mtu < 49152 {
|
||||||
m.batchLoopDarwin(darwinTUN)
|
m.batchLoopDarwin(darwinTUN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ func (s *System) tunLoop() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if darwinTUN, isDarwinTUN := s.tun.(DarwinTUN); isDarwinTUN {
|
if darwinTUN, isDarwinTUN := s.tun.(DarwinTUN); isDarwinTUN && s.mtu < 49152 {
|
||||||
s.batchLoopDarwin(darwinTUN)
|
s.batchLoopDarwin(darwinTUN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,7 @@ func (t *NativeTun) BatchRead() ([]*buf.Buffer, error) {
|
||||||
func (t *NativeTun) BatchWrite(buffers []*buf.Buffer) error {
|
func (t *NativeTun) BatchWrite(buffers []*buf.Buffer) error {
|
||||||
for i, buffer := range buffers {
|
for i, buffer := range buffers {
|
||||||
iovecs := t.iovecsOutput[i].nextIovecsOutput(buffer)
|
iovecs := t.iovecsOutput[i].nextIovecsOutput(buffer)
|
||||||
|
t.msgHdrsOutput[i] = rawfile.MsgHdrX{}
|
||||||
t.msgHdrsOutput[i].Msg.Iov = &iovecs[0]
|
t.msgHdrsOutput[i].Msg.Iov = &iovecs[0]
|
||||||
t.msgHdrsOutput[i].Msg.Iovlen = 2
|
t.msgHdrsOutput[i].Msg.Iovlen = 2
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ func (t *NativeTun) NewEndpoint() (stack.LinkEndpoint, stack.NICOptions, error)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, stack.NICOptions{}, err
|
return nil, stack.NICOptions{}, err
|
||||||
}
|
}
|
||||||
var nicOptions stack.NICOptions
|
return ep, stack.NICOptions{
|
||||||
if t.options.MTU < 49152 {
|
QDisc: fifo.New(ep, 1, 1000),
|
||||||
nicOptions.QDisc = fifo.New(ep, 1, 1000)
|
}, nil
|
||||||
}
|
|
||||||
return ep, nicOptions, nil
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,10 @@ import (
|
||||||
"github.com/sagernet/gvisor/pkg/tcpip/stack"
|
"github.com/sagernet/gvisor/pkg/tcpip/stack"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
fdbased.BufConfig = []int{65535}
|
||||||
|
}
|
||||||
|
|
||||||
var _ GVisorTun = (*NativeTun)(nil)
|
var _ GVisorTun = (*NativeTun)(nil)
|
||||||
|
|
||||||
func (t *NativeTun) NewEndpoint() (stack.LinkEndpoint, stack.NICOptions, error) {
|
func (t *NativeTun) NewEndpoint() (stack.LinkEndpoint, stack.NICOptions, error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue