]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Set don't fragment bit in Linux as well as in BSD variants.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 28 Dec 2011 08:32:48 +0000 (10:32 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 28 Dec 2011 14:08:55 +0000 (16:08 +0200)
NEWS
src/cli.c
src/serv.c

diff --git a/NEWS b/NEWS
index 499281b99599212c4dce98ceac0b65dfa3873803..c04f2c80f7c47f31a09f56fa99afee8a4fdf07bb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ See the end for copying conditions.
 
 * Version 3.0.10 (unreleased)
 
+** gnutls-cli/serv: Set don't fragment bit in DTLS sessions
+in Linux as well as in BSD.
+
 ** libgnutls: Corrected ciphersuite GNUTLS_ECDHE_PSK_AES_256_CBC_SHA384
 
 ** libgnutls: Added ciphersuites: GNUTLS_PSK_WITH_AES_256_GCM_SHA384
index 946dc85ea7d4bfba51f19fa5294b3d49e5ee541e..8676d1c71b0bc41deb7a64d8fde5af2e58a89baa 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1460,17 +1460,20 @@ socket_open (socket_st * hd, const char *hostname, const char *service)
       exit (1);
     }
 
-#ifdef IP_DONTFRAG
   if (hints.ai_socktype == SOCK_DGRAM)
     {
+#if defined(IP_DONTFRAG)
       int yes = 1;
       if (setsockopt (sd, IPPROTO_IP, IP_DONTFRAG,
-                          (const void *) &yes, sizeof (yes)) < 0)
-        {
-          perror ("setsockopt(IP_DF) failed");
-        }
-    }
+                      (const void *) &yes, sizeof (yes)) < 0)
+        perror ("setsockopt(IP_DF) failed");
+#elif defined(IP_MTU_DISCOVER)
+      int yes = IP_PMTUDISC_DO;
+      if (setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, 
+                     (const void*) &yes, sizeof (yes)) < 0)
+        perror ("setsockopt(IP_DF) failed");
 #endif
+    }
 
   hd->secure = 0;
   hd->fd = sd;
index 381ab41fc45ff1c0e8ad7f8764f19e03aa208240..370a669df7670c243c3dae42a704e327ca6aff19 100644 (file)
@@ -733,18 +733,21 @@ listen_socket (const char *name, int listen_port, int socktype)
               continue;
             }
         }
-#ifdef IP_DONTFRAG
       else
         {
+#if defined(IP_DONTFRAG)
           yes = 1;
           if (setsockopt (s, IPPROTO_IP, IP_DONTFRAG,
                           (const void *) &yes, sizeof (yes)) < 0)
-            {
               perror ("setsockopt(IP_DF) failed");
-            }
-        }
+#elif defined(IP_MTU_DISCOVER)
+          yes = IP_PMTUDISC_DO;
+          if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, 
+                         (const void*) &yes, sizeof (yes)) < 0)
+              perror ("setsockopt(IP_DF) failed");
 #endif
-      
+        }
+
       if (bind (s, ptr->ai_addr, ptr->ai_addrlen) < 0)
         {
           perror ("bind() failed");