views:

56

answers:

1

I want to set the Don't Fragment flag on a IP packet. Is there a way to do so via the setsockopt() function or via the flags of the sendto() function?

Can I do this with "normal" sockets or do i have to use raw sockets and build the entire IP header myself, setting it's offset-field to IP_DF (which is defined in ip.h)?

+2  A: 

According to this page, you can set the IP_DONTFRAG option for IP layer, with datagram sockets (UDP). This SO discussion points in a similar direction.

Eli Bendersky
Thanks for the links. I'm developing on Mac. All these constants are defined in the file in.h. Unfortunately, I can't find neither the IP_DONTFRAG nor the IP_MTU_DISCOVER constant. Most (or all) of the other constants, however, are there - for example IP_MULTICAST_TTL and so on. Any idea about this issue on Mac?
j00hi