summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tun/netstack/tun.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/tun/netstack/tun.go b/tun/netstack/tun.go
index a0b212a..fa15f53 100644
--- a/tun/netstack/tun.go
+++ b/tun/netstack/tun.go
@@ -65,8 +65,13 @@ func CreateNetTUN(localAddresses, dnsServers []netip.Addr, mtu int) (tun.Device,
dnsServers: dnsServers,
mtu: mtu,
}
+ sackEnabledOpt := tcpip.TCPSACKEnabled(true) // TCP SACK is disabled by default
+ tcpipErr := dev.stack.SetTransportProtocolOption(tcp.ProtocolNumber, &sackEnabledOpt)
+ if tcpipErr != nil {
+ return nil, nil, fmt.Errorf("could not enable TCP SACK: %v", tcpipErr)
+ }
dev.ep.AddNotify(dev)
- tcpipErr := dev.stack.CreateNIC(1, dev.ep)
+ tcpipErr = dev.stack.CreateNIC(1, dev.ep)
if tcpipErr != nil {
return nil, nil, fmt.Errorf("CreateNIC: %v", tcpipErr)
}