summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2011-12-28 10:32:48 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2011-12-28 16:08:55 +0200
commit725cf45965e66b8d5a19fa39b679d0a2c505ce0f (patch)
treea037c5f6429af73f4909fcf1f4392f998710aba7
parentd2ff834b0b7224f808eea3e2f3cda0b8d0f17a08 (diff)
downloadgnutls-725cf45965e66b8d5a19fa39b679d0a2c505ce0f.tar.gz
Set don't fragment bit in Linux as well as in BSD variants.
-rw-r--r--NEWS3
-rw-r--r--src/cli.c15
-rw-r--r--src/serv.c13
3 files changed, 20 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index 499281b995..c04f2c80f7 100644
--- 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
diff --git a/src/cli.c b/src/cli.c
index 946dc85ea7..8676d1c71b 100644
--- 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;
diff --git a/src/serv.c b/src/serv.c
index 381ab41fc4..370a669df7 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -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");