]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #634: fix fail to start on Linux LTS 3.14.X, ignores missing
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 5 Jan 2015 13:51:22 +0000 (13:51 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 5 Jan 2015 13:51:22 +0000 (13:51 +0000)
  IP_MTU_DISCOVER OMIT option.

git-svn-id: file:///svn/unbound/trunk@3298 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
services/listen_dnsport.c

index 62d87eedb3181aa2095dd7e2ea83f41245bfbaba..c146547693068679e32c39963c263f933af2b005 100644 (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.
index b7ffb6d3fad355eab448e02fae880614e77b83bf..9062a1f38299f74c96963dec385798a01827dc29 100644 (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"
+
+                       if (errno != EINVAL) {
+                               log_err("setsockopt(..., IP_MTU_DISCOVER, IP_PMTUDISC_OMIT...) failed: %s",
+                                       strerror(errno));
+
+#    ifndef USE_WINSOCK
+                               close(s);
 #    else
-                               "IP_PMTUDISC_DONT"
+                               closesocket(s);
 #    endif
-                               "...) failed: %s",
-                               strerror(errno));
+                               *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);
+                               close(s);
 #    else
-                       closesocket(s);
+                               closesocket(s);
 #    endif
-                       *noproto = 0;
-                       *inuse = 0;
-                       return -1;
+                               *noproto = 0;
+                               *inuse = 0;
+                               return -1;
+                       }
                }
 #  elif defined(IP_DONTFRAG)
                int off = 0;