Fix udp/icmp not work on gso with system stack

This commit is contained in:
wwqgtxx 2026-02-13 00:11:53 +08:00
parent 635920688d
commit 3144f43fc2

View file

@ -17,7 +17,6 @@ import (
"github.com/sagernet/sing-tun/internal/gtcpip/checksum"
"github.com/sagernet/sing-tun/internal/gtcpip/header"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/control"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/rw"
@ -393,10 +392,7 @@ func handleVirtioRead(in []byte, bufs [][]byte, sizes []int, offset int) (int, e
func (t *NativeTun) Write(p []byte) (n int, err error) {
if t.vnetHdr {
buffer := buf.Get(virtioNetHdrLen + len(p))
copy(buffer[virtioNetHdrLen:], p)
_, err = t.BatchWrite([][]byte{buffer}, virtioNetHdrLen)
buf.Put(buffer)
_, err = t.BatchWrite([][]byte{p}, virtioNetHdrLen)
if err != nil {
return
}