mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-24 00:59:19 +02:00
Set Dont-Fragment for various os
This commit is contained in:
parent
cd9c6bbb82
commit
d8cb5bdcd7
|
@ -130,6 +130,10 @@ open_dns(int localport, in_addr_t listen_ip)
|
||||||
setsockopt(fd, IPPROTO_IP, DSTADDR_SOCKOPT, (const void*) &flag, sizeof(flag));
|
setsockopt(fd, IPPROTO_IP, DSTADDR_SOCKOPT, (const void*) &flag, sizeof(flag));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set dont-fragment ip header flag */
|
||||||
|
flag = DONT_FRAG_VALUE;
|
||||||
|
setsockopt(fd, IPPROTO_IP, IP_OPT_DONT_FRAG, (const void*) &flag, sizeof(flag));
|
||||||
|
|
||||||
if(bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
|
if(bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
|
||||||
err(1, "bind");
|
err(1, "bind");
|
||||||
|
|
||||||
|
|
15
src/common.h
15
src/common.h
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include <winsock.h>
|
|
||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
@ -45,6 +44,20 @@
|
||||||
# define dstaddr(x) (&(((struct in_pktinfo *)(CMSG_DATA(x)))->ipi_addr))
|
# define dstaddr(x) (&(((struct in_pktinfo *)(CMSG_DATA(x)))->ipi_addr))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined IP_MTUDISC
|
||||||
|
# define IP_OPT_DONT_FRAG IP_MTUDISC
|
||||||
|
# define DONT_FRAG_VALUE 1
|
||||||
|
#elif defined IP_MTU_DISCOVER
|
||||||
|
# define IP_OPT_DONT_FRAG IP_MTU_DISCOVER
|
||||||
|
# define DONT_FRAG_VALUE IP_PMTUDISC_DO
|
||||||
|
#elif defined IP_DONTFRAG
|
||||||
|
# define IP_OPT_DONT_FRAG IP_DONTFRAG
|
||||||
|
# define DONT_FRAG_VALUE 1
|
||||||
|
#elif defined IP_DONTFRAGMENT
|
||||||
|
# define IP_OPT_DONT_FRAG IP_DONTFRAGMENT
|
||||||
|
# define DONT_FRAG_VALUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct packet
|
struct packet
|
||||||
{
|
{
|
||||||
int len; /* Total packet length */
|
int len; /* Total packet length */
|
||||||
|
|
Loading…
Reference in New Issue