Fix usages of readmsg_x

This commit is contained in:
世界 2025-07-08 15:44:35 +08:00 committed by wwqgtxx
parent a0881ada32
commit 4c81c8a62a
4 changed files with 73 additions and 82 deletions

View file

@ -12,14 +12,17 @@ var _ GVisorTun = (*NativeTun)(nil)
func (t *NativeTun) NewEndpoint() (stack.LinkEndpoint, stack.NICOptions, error) {
ep, err := fdbased.New(&fdbased.Options{
FDs: []int{t.tunFd},
MTU: t.options.MTU,
RXChecksumOffload: true,
FDs: []int{t.tunFd},
MTU: t.options.MTU,
RXChecksumOffload: true,
PacketDispatchMode: fdbased.RecvMMsg,
})
if err != nil {
return nil, stack.NICOptions{}, err
}
return ep, stack.NICOptions{
QDisc: fifo.New(ep, 1, 1000),
}, nil
var nicOptions stack.NICOptions
if t.options.MTU < 49152 {
nicOptions.QDisc = fifo.New(ep, 1, 1000)
}
return ep, nicOptions, nil
}