I'm curious, why do you need to set DF bit? I'm asking, because as a 
network engineer I'm often experiencing broken apps with this setting. It 
usually ends up network pointing to app and vice versa.
New tunnel along the path, either GRE or IPSec is lowering MTU, new 
technologies like Cisco SD-WAN are all tunnel inside tunnel inside MPLS and 
MTU can go as low as 1260. 
Different workarounds are configured on routers as dynamic mss size 
adjustment.
In your case you are at least trying to discover MTU, but path could be in 
many cases asymmetric. 

On Friday, April 23, 2021 at 8:20:15 AM UTC+2 Marten Seemann wrote:

> 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 <http://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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2f8afe04-e4f6-485f-acb0-f36b2545b814n%40googlegroups.com.

Reply via email to