23 lines
825 B
Go
23 lines
825 B
Go
// SetLinkFeaturesPostUp configures link features on t based on select TS_TUN_
|
|
// environment variables and OS feature tests. Callers should ensure t is
|
|
// up prior to calling, otherwise OS feature tests may be inconclusive.
|
|
func (t *Wrapper) SetLinkFeaturesPostUp() {
|
|
if t.isTAP || runtime.GOOS == "android" {
|
|
return
|
|
}
|
|
if groDev, ok := t.tdev.(tun.GRODevice); ok {
|
|
if envknob.Bool("TS_TUN_DISABLE_UDP_GRO") {
|
|
groDev.DisableUDPGRO()
|
|
}
|
|
if envknob.Bool("TS_TUN_DISABLE_TCP_GRO") {
|
|
groDev.DisableTCPGRO()
|
|
}
|
|
err := probeTCPGRO(groDev)
|
|
if errors.Is(err, unix.EINVAL) {
|
|
groDev.DisableTCPGRO()
|
|
groDev.DisableUDPGRO()
|
|
t.logf("disabled TUN TCP & UDP GRO due to GRO probe error: %v", err)
|
|
}
|
|
}
|
|
}
|