PMTUD exploration, start small then grow

This commit is contained in:
Nate Brown
2026-05-05 17:05:50 -05:00
parent 33c2d7277c
commit 16a836a73f
33 changed files with 1036 additions and 11 deletions

23
udp/udp_openbsd.go Normal file
View File

@@ -0,0 +1,23 @@
//go:build openbsd && !e2e_testing
// +build openbsd,!e2e_testing
package udp
import (
"golang.org/x/sys/unix"
)
// EnablePathMTUDiscovery sets the don't-fragment bit on outbound packets.
// OpenBSD 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 OpenBSD 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)
})
}