How to set Do not Fragment flag (IP_DF) in C

I want to set the Do not Fragment flag in the IP packet. Is there a way to do this using a function setsockopt()or using function flags sendto()?

Can I do this with “normal” sockets or do I need to use raw sockets and build the entire IP header myself by setting its offset-field to IP_DF(which is defined in ip.h)?

+3
source share
1 answer

According to this page , you can set the parameter IP_DONTFRAGfor the IP layer using datagram sockets (UDP). This SO discussion points in the same direction.

+2
source

Source: https://habr.com/ru/post/1760055/


All Articles