- Fix #634: fix fail to start on Linux LTS 3.14.X, ignores missing

IP_MTU_DISCOVER OMIT option.


git-svn-id: file:///svn/unbound/trunk@3298 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2015-01-05 13:51:22 +00:00
parent 724a4f3ae0
commit ac5ccb6db6
2 changed files with 38 additions and 18 deletions

View file

@ -6,6 +6,8 @@
- print query name when max target count is exceeded.
- patch from Brad Smith that fixes DESTDIR in unbound-control-setup
for installs where config is not in the prefix location.
- Fix #634: fix fail to start on Linux LTS 3.14.X, ignores missing
IP_MTU_DISCOVER OMIT option.
9 December 2014: Wouter
- svn trunk has 1.5.2 in development.

View file

@ -368,29 +368,47 @@ create_udp_sock(int family, int socktype, struct sockaddr* addr,
* (and also uses the interface mtu to determine the size of the packets).
* So there won't be any EMSGSIZE error. Against DNS fragmentation attacks.
* FreeBSD already has same semantics without setting the option. */
# if defined(IP_PMTUDISC_OMIT)
int action = IP_PMTUDISC_OMIT;
# else
int action = IP_PMTUDISC_DONT;
# endif
int omit_set = 0;
int action;
# if defined(IP_PMTUDISC_OMIT)
action = IP_PMTUDISC_OMIT;
if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER,
&action, (socklen_t)sizeof(action)) < 0) {
log_err("setsockopt(..., IP_MTU_DISCOVER, "
# if defined(IP_PMTUDISC_OMIT)
"IP_PMTUDISC_OMIT"
# else
"IP_PMTUDISC_DONT"
# endif
"...) failed: %s",
strerror(errno));
if (errno != EINVAL) {
log_err("setsockopt(..., IP_MTU_DISCOVER, IP_PMTUDISC_OMIT...) failed: %s",
strerror(errno));
# ifndef USE_WINSOCK
close(s);
close(s);
# else
closesocket(s);
closesocket(s);
# endif
*noproto = 0;
*inuse = 0;
return -1;
*noproto = 0;
*inuse = 0;
return -1;
}
}
else
{
omit_set = 1;
}
# endif
if (omit_set == 0) {
action = IP_PMTUDISC_DONT;
if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER,
&action, (socklen_t)sizeof(action)) < 0) {
log_err("setsockopt(..., IP_MTU_DISCOVER, IP_PMTUDISC_DONT...) failed: %s",
strerror(errno));
# ifndef USE_WINSOCK
close(s);
# else
closesocket(s);
# endif
*noproto = 0;
*inuse = 0;
return -1;
}
}
# elif defined(IP_DONTFRAG)
int off = 0;