net/tstun: implement env var for disabling UDP GRO on Linux (#11924)

Certain device drivers (e.g. vxlan, geneve) do not properly handle
coalesced UDP packets later in the stack, resulting in packet loss.

Updates #11026

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited
2024-04-30 09:14:02 -07:00
committed by GitHub
parent ec04c677c0
commit a47ce618bd
5 changed files with 39 additions and 3 deletions

View File

@ -0,0 +1,19 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package tstun
import (
"github.com/tailscale/wireguard-go/tun"
"tailscale.com/envknob"
)
func setLinkFeatures(dev tun.Device) error {
if envknob.Bool("TS_TUN_DISABLE_UDP_GRO") {
linuxDev, ok := dev.(tun.LinuxDevice)
if ok {
linuxDev.DisableUDPGRO()
}
}
return nil
}