mirror of https://github.com/tailscale/tailscale/
net/tstun: implement env var for disabling UDP GRO on Linux
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>
parent
1e6cdb7d86
commit
e0fab89a07
@ -0,0 +1,22 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
package tstun
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/tailscale/wireguard-go/tun"
|
||||
)
|
||||
|
||||
func setLinkFeatures(dev tun.Device) error {
|
||||
val := os.Getenv("TS_TUN_DISABLE_UDP_GRO")
|
||||
if strings.ToLower(val) == "true" || val == "1" {
|
||||
linuxDev, ok := dev.(tun.LinuxDevice)
|
||||
if ok {
|
||||
linuxDev.DisableUDPGRO()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !linux
|
||||
|
||||
package tstun
|
||||
|
||||
import (
|
||||
"github.com/tailscale/wireguard-go/tun"
|
||||
)
|
||||
|
||||
func setLinkFeatures(dev tun.Device) error {
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue