mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-16 04:47:38 +02:00
PMTUD exploration, start small then grow
This commit is contained in:
@@ -46,3 +46,18 @@ func NewListenConfig(multi bool) net.ListenConfig {
|
||||
func (u *GenericConn) Rebind() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EnablePathMTUDiscovery sets the don't-fragment bit on outbound packets.
|
||||
// NetBSD exposes IPV6_DONTFRAG via golang.org/x/sys/unix but the kernel does
|
||||
// not provide a socket-level knob for setting DF on v4 UDP. The only IP-layer
|
||||
// constant exposed is IP_DF, which is the wire header flag, not a sockopt.
|
||||
// quic-go skips NetBSD for the same reason. So v4 sockets stay at nebula's
|
||||
// historical behavior (kernel may fragment); v6 gets DF.
|
||||
func (u *GenericConn) EnablePathMTUDiscovery() error {
|
||||
if u.isV4Socket() {
|
||||
return nil
|
||||
}
|
||||
return u.controlFD(func(fd uintptr) error {
|
||||
return unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_DONTFRAG, 1)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user