Initial commit
FossilOrigin-Name: c53d95729c009f8f80a7d63847cef7668ff73f8af0523ab65f7734696f85399c
This commit is contained in:
25
src/capwap/sock_set_dontfrag.c
Normal file
25
src/capwap/sock_set_dontfrag.c
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
|
||||
int sock_set_dontfrag(int sock,int val)
|
||||
{
|
||||
#if defined IP_MTU_DISCOVER && defined IP_PMTUDISC_DONT
|
||||
int mtu_type;
|
||||
if (val)
|
||||
mtu_type = IP_PMTUDISC_DO;
|
||||
else
|
||||
mtu_type = IP_PMTUDISC_WANT;
|
||||
|
||||
return setsockopt(sock, SOL_IP, IP_MTU_DISCOVER, &mtu_type, sizeof (mtu_type));
|
||||
#elif defined IP_DONTFRAG
|
||||
|
||||
const int opt = val;
|
||||
return setsockopt(sock, IPPROTO_IP, IP_DONTFRAG, &opt, sizeof (opt));
|
||||
|
||||
#endif
|
||||
|
||||
}
|
Reference in New Issue
Block a user