summaryrefslogtreecommitdiff
path: root/src
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 /src
parentd2ff834b0b7224f808eea3e2f3cda0b8d0f17a08 (diff)
downloadgnutls-725cf45965e66b8d5a19fa39b679d0a2c505ce0f.tar.gz
Set don't fragment bit in Linux as well as in BSD variants.
Diffstat (limited to 'src')
-rw-r--r--src/cli.c15
-rw-r--r--src/serv.c13
2 files changed, 17 insertions, 11 deletions
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");