mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
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:
@@ -53,6 +53,9 @@ func New(logf logger.Logf, tunName string) (tun.Device, string, error) {
|
||||
dev.Close()
|
||||
return nil, "", err
|
||||
}
|
||||
if err := setLinkFeatures(dev); err != nil {
|
||||
logf("setting link features: %v", err)
|
||||
}
|
||||
if err := setLinkAttrs(dev); err != nil {
|
||||
logf("setting link attributes: %v", err)
|
||||
}
|
||||
|
19
net/tstun/tun_features_linux.go
Normal file
19
net/tstun/tun_features_linux.go
Normal 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
|
||||
}
|
14
net/tstun/tun_features_notlinux.go
Normal file
14
net/tstun/tun_features_notlinux.go
Normal file
@@ -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
|
||||
}
|
Reference in New Issue
Block a user