Skip to content

Commit

Permalink
wgengine/netstack: enable TCP SACK (#6066)
Browse files Browse the repository at this point in the history
TCP selective acknowledgement can improve throughput by an order
of magnitude in the presence of loss.

Signed-off-by: Jordan Whited <jordan@tailscale.com>
(cherry picked from commit a471681)
  • Loading branch information
jwhited authored and DentonGentry committed Oct 26, 2022
1 parent 78c60b4 commit 5bdf8e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wgengine/netstack/netstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ func Create(logf logger.Logf, tundev *tstun.Wrapper, e wgengine.Engine, mc *magi
NetworkProtocols: []stack.NetworkProtocolFactory{ipv4.NewProtocol, ipv6.NewProtocol},
TransportProtocols: []stack.TransportProtocolFactory{tcp.NewProtocol, udp.NewProtocol, icmp.NewProtocol4, icmp.NewProtocol6},
})
sackEnabledOpt := tcpip.TCPSACKEnabled(true) // TCP SACK is disabled by default
tcpipErr := ipstack.SetTransportProtocolOption(tcp.ProtocolNumber, &sackEnabledOpt)
if tcpipErr != nil {
return nil, fmt.Errorf("could not enable TCP SACK: %v", tcpipErr)
}
linkEP := channel.New(512, mtu, "")
if tcpipProblem := ipstack.CreateNIC(nicID, linkEP); tcpipProblem != nil {
return nil, fmt.Errorf("could not create netstack NIC: %v", tcpipProblem)
Expand Down

0 comments on commit 5bdf8e2

Please sign in to comment.