mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-11-01 04:22:44 +08:00
Fix: tun issue with virtio_net_hdr (#254)
This commit is contained in:
24
core/device/tun/tun_wireguard_linux.go
Normal file
24
core/device/tun/tun_wireguard_linux.go
Normal file
@@ -0,0 +1,24 @@
|
||||
//go:build linux && !(amd64 || arm64)
|
||||
|
||||
package tun
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
virtioNetHdrLen = int(unsafe.Sizeof(virtioNetHdr{}))
|
||||
offset = virtioNetHdrLen + 0 /* NO_PI */
|
||||
defaultMTU = 1500
|
||||
)
|
||||
|
||||
// virtioNetHdr is defined in the kernel in include/uapi/linux/virtio_net.h. The
|
||||
// kernel symbol is virtio_net_hdr.
|
||||
type virtioNetHdr struct {
|
||||
flags uint8
|
||||
gsoType uint8
|
||||
hdrLen uint16
|
||||
gsoSize uint16
|
||||
csumStart uint16
|
||||
csumOffset uint16
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
//go:build unix
|
||||
//go:build unix && !linux
|
||||
|
||||
package tun
|
||||
|
||||
//nolint:all
|
||||
const (
|
||||
offset = 4 /* 4 bytes TUN_PI */
|
||||
defaultMTU = 1500
|
||||
|
||||
Reference in New Issue
Block a user