mirror of
https://github.com/tailscale/tailscale.git
synced 2026-11-24 02:31:18 -08:00
And merge the repeated don't fragment codepaths between Linux and Darwin. Updates tailscale/corp#48168 Change-Id: I5aef408f037c8def99522b4d820c853a6a6a6964 Signed-off-by: Alex Valiushko <[email protected]>
24 lines
473 B
Go
24 lines
473 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build linux && !android
|
|
|
|
package magicsock
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
// dontFrag{Enabled,Disabled} are the values of the don't fragment sockopt.
|
|
const (
|
|
dontFragEnabled = syscall.IP_PMTUDISC_DO
|
|
dontFragDisabled = syscall.IP_PMTUDISC_DONT
|
|
)
|
|
|
|
func getDontFragOpt(network string) int {
|
|
if network == "udp4" {
|
|
return syscall.IP_MTU_DISCOVER
|
|
}
|
|
return syscall.IPV6_MTU_DISCOVER
|
|
}
|