Fix android GSO

This commit is contained in:
世界 2026-07-08 11:14:28 +08:00
parent ebd569670d
commit 5bb0784f61
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 45 additions and 26 deletions

View file

@ -7,8 +7,6 @@ import (
"syscall"
"unsafe"
E "github.com/sagernet/sing/common/exceptions"
"golang.org/x/sys/unix"
)
@ -33,13 +31,17 @@ func checkVNETHDREnabled(fd int, name string) (bool, error) {
func setTCPOffload(fd int) error {
err := unix.IoctlSetInt(fd, unix.TUNSETOFFLOAD, tunTCPOffloads)
if err != nil {
return E.Cause(os.NewSyscallError("TUNSETOFFLOAD", err), "enable offload")
return os.NewSyscallError("TUNSETOFFLOAD", err)
}
return nil
}
func setUDPOffload(fd int) error {
return unix.IoctlSetInt(fd, unix.TUNSETOFFLOAD, tunTCPOffloads|tunUDPOffloads)
err := unix.IoctlSetInt(fd, unix.TUNSETOFFLOAD, tunTCPOffloads|tunUDPOffloads)
if err != nil {
return os.NewSyscallError("TUNSETOFFLOAD", err)
}
return nil
}
type ifreqData struct {