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
426 B
Go
24 lines
426 B
Go
// Copyright (c) Tailscale Inc & contributors
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build darwin && !ios
|
|
|
|
package magicsock
|
|
|
|
import (
|
|
"golang.org/x/sys/unix"
|
|
)
|
|
|
|
// dontFrag{Enabled,Disabled} are the values of the don't fragment sockopt.
|
|
const (
|
|
dontFragEnabled = 1
|
|
dontFragDisabled = 0
|
|
)
|
|
|
|
func getDontFragOpt(network string) int {
|
|
if network == "udp4" {
|
|
return unix.IP_DONTFRAG
|
|
}
|
|
return unix.IPV6_DONTFRAG
|
|
}
|