We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa1fd4d commit 3af7305Copy full SHA for 3af7305
tun_darwin_gvisor.go
@@ -3,6 +3,7 @@
3
package tun
4
5
import (
6
+ "github.com/sagernet/gvisor/pkg/tcpip/header"
7
"github.com/sagernet/gvisor/pkg/tcpip/link/qdisc/fifo"
8
"github.com/sagernet/gvisor/pkg/tcpip/stack"
9
"github.com/sagernet/sing-tun/internal/fdbased_darwin"
@@ -15,6 +16,11 @@ var _ GVisorTun = (*NativeTun)(nil)
15
16
17
func (t *NativeTun) WritePacket(pkt *stack.PacketBuffer) (int, error) {
18
iovecs := t.iovecsOutputDefault
19
+ if pkt.NetworkProtocolNumber == header.IPv4ProtocolNumber {
20
+ iovecs = append(iovecs, packetHeaderVec4)
21
+ } else {
22
+ iovecs = append(iovecs, packetHeaderVec6)
23
+ }
24
var dataLen int
25
for _, packetSlice := range pkt.AsSlices() {
26
dataLen += len(packetSlice)
0 commit comments