Fix (ignore) Dont-Fragment for OpenBSD and OS X
This commit is contained in:
parent
d8cb5bdcd7
commit
5fbb08b8cc
|
@ -130,9 +130,11 @@ 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
|
||||||
|
|
||||||
|
#ifdef IP_OPT_DONT_FRAG
|
||||||
/* Set dont-fragment ip header flag */
|
/* Set dont-fragment ip header flag */
|
||||||
flag = DONT_FRAG_VALUE;
|
flag = DONT_FRAG_VALUE;
|
||||||
setsockopt(fd, IPPROTO_IP, IP_OPT_DONT_FRAG, (const void*) &flag, sizeof(flag));
|
setsockopt(fd, IPPROTO_IP, IP_OPT_DONT_FRAG, (const void*) &flag, sizeof(flag));
|
||||||
|
#endif
|
||||||
|
|
||||||
if(bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
|
if(bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0)
|
||||||
err(1, "bind");
|
err(1, "bind");
|
||||||
|
|
|
@ -44,16 +44,16 @@
|
||||||
# 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
|
#if defined IP_MTU_DISCOVER
|
||||||
# define IP_OPT_DONT_FRAG IP_MTUDISC
|
/* Linux */
|
||||||
# define DONT_FRAG_VALUE 1
|
|
||||||
#elif defined IP_MTU_DISCOVER
|
|
||||||
# define IP_OPT_DONT_FRAG IP_MTU_DISCOVER
|
# define IP_OPT_DONT_FRAG IP_MTU_DISCOVER
|
||||||
# define DONT_FRAG_VALUE IP_PMTUDISC_DO
|
# define DONT_FRAG_VALUE IP_PMTUDISC_DO
|
||||||
#elif defined IP_DONTFRAG
|
#elif defined IP_DONTFRAG
|
||||||
|
/* FreeBSD */
|
||||||
# define IP_OPT_DONT_FRAG IP_DONTFRAG
|
# define IP_OPT_DONT_FRAG IP_DONTFRAG
|
||||||
# define DONT_FRAG_VALUE 1
|
# define DONT_FRAG_VALUE 1
|
||||||
#elif defined IP_DONTFRAGMENT
|
#elif defined IP_DONTFRAGMENT
|
||||||
|
/* Winsock2 */
|
||||||
# define IP_OPT_DONT_FRAG IP_DONTFRAGMENT
|
# define IP_OPT_DONT_FRAG IP_DONTFRAGMENT
|
||||||
# define DONT_FRAG_VALUE 1
|
# define DONT_FRAG_VALUE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue