For my QUIC implementation <https://github.com/lucas-clemente/quic-go/>,
I'm trying to set the DF bit on outgoing packets.
The following code works fine on Linux:
addr, _ := net.ResolveUDPAddr("udp", ":0")
conn, _ := net.ListenUDP("udp", addr)
rawConn, _ := conn.SyscallConn()
rawConn.Control(func(fd uintptr) {
unix.SetsockoptInt(int(fd), unix.IPPROTO_IP, unix.IP_MTU_DISCOVER, 1)
})
On OSX, the sockopt doesn't have a named constant, the correct value to use
here is 28. The code above only works if I'm listening on an address that's
unambiguously IPv4, e.g. *127.0.0.1:0*.
If I listen on an address that allows me to send and receive both IPv4 and
IPv6 (like *:0*), it doesn't work anymore: *SetsockoptInt *now returns
error 22 (invalid argument). That's unfortunate as users of the library
often listen on *:0*.
Is there any way to make this work analogously to how it works on Linux?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/9345f124-1572-4d71-b029-574180750d1an%40googlegroups.com.