Closed rolandjitsu closed 1 year ago
+1 This is useful for MTU tests
I need this as well. This can be set with a socket option. Additionally setting DF is not useful in and of itself if we cannot also set the size of the ICMP payload which as far as I can tell is currently not supported in this library. I have proposed a PR that adds some functions that are needed to support setting socket options (SO_MARK in this case) here: https://github.com/prometheus-community/pro-bing/pull/36
If this is accepted and merged I can re-use some of the code to do something like this which I believe will allow setting the DF bit:
syscall.SetsockoptInt(int(fd), syscall.IPPROTO_IP, syscall.IP_MTU_DISCOVER, syscall.IP_PMTUDISC_PROBE)
I'm happy to take a pass at this one.
Similar to how you can do:
We should be able to tell pinger to not fragment packets if too large (due to MTU size).
The option seems to be available as https://pkg.go.dev/golang.org/x/net/ipv4#HeaderFlags (I think).