]>
Commit | Line | Data |
---|---|---|
43c09d6d JK |
1 | diff -dur unbound-1.5.1.orig/services/listen_dnsport.c unbound-1.5.1/services/listen_dnsport.c |
2 | --- unbound-1.5.1.orig/services/listen_dnsport.c 2014-09-16 15:49:21.000000000 +0200 | |
3 | +++ unbound-1.5.1/services/listen_dnsport.c 2014-12-18 10:37:55.000000000 +0100 | |
4 | @@ -368,19 +368,20 @@ | |
5 | * (and also uses the interface mtu to determine the size of the packets). | |
6 | * So there won't be any EMSGSIZE error. Against DNS fragmentation attacks. | |
7 | * FreeBSD already has same semantics without setting the option. */ | |
8 | + int action, result = -1; | |
9 | # if defined(IP_PMTUDISC_OMIT) | |
10 | - int action = IP_PMTUDISC_OMIT; | |
11 | -# else | |
12 | - int action = IP_PMTUDISC_DONT; | |
13 | + action = IP_PMTUDISC_OMIT; | |
14 | + result = setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, | |
15 | + &action, (socklen_t)sizeof(action)); | |
16 | # endif | |
17 | - if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, | |
18 | - &action, (socklen_t)sizeof(action)) < 0) { | |
19 | + if (result < 0) { | |
20 | + action = IP_PMTUDISC_DONT; | |
21 | + result = setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, | |
22 | + &action, (socklen_t)sizeof(action)); | |
23 | + } | |
24 | + if (result < 0) { | |
25 | log_err("setsockopt(..., IP_MTU_DISCOVER, " | |
26 | -# if defined(IP_PMTUDISC_OMIT) | |
27 | - "IP_PMTUDISC_OMIT" | |
28 | -# else | |
29 | "IP_PMTUDISC_DONT" | |
30 | -# endif | |
31 | "...) failed: %s", | |
32 | strerror(errno)); | |
33 | # ifndef USE_WINSOCK |