Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for setting do-not-fragment bit (linux) #39

Merged
merged 1 commit into from
May 21, 2023

Conversation

floatingstatic
Copy link
Contributor

@floatingstatic floatingstatic commented May 20, 2023

Closes #23

This PR only attempts to add support for this in linux. It seems it may be feasible to add support for this under windows but I do not have any way of testing this easily so for now this will be omitted. Other platforms I could not get this working as the socket options required to do this are unclear under BSD platforms (for example) but it may be possible to support this after a little more r&d.

I tested using:

pinger.Size = 1472
pinger.SetDoNotFragment(true)

Which yielded a 1500 byte IP packet (my IP MTU is 1500) per tcpdump on the wire:

12:32:09.158203 IP 10.10.0.50 > 10.10.0.1: ICMP echo request, id 39, seq 0, length 1480

Doing the same as the above but setting pinger.Size = 1473 we get the following error from the kernel which is what we expect to see with do-not-fragment set:

sendto: message too long

Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@SuperQ SuperQ merged commit 235b493 into prometheus-community:main May 21, 2023
@SuperQ
Copy link
Contributor

SuperQ commented May 21, 2023

Thanks for the nice improvements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting the fragmentation of packets option when sending a ping
2 participants