diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-12-28 10:32:48 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-12-28 16:08:55 +0200 |
commit | 725cf45965e66b8d5a19fa39b679d0a2c505ce0f (patch) | |
tree | a037c5f6429af73f4909fcf1f4392f998710aba7 /src | |
parent | d2ff834b0b7224f808eea3e2f3cda0b8d0f17a08 (diff) | |
download | gnutls-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.c | 15 | ||||
-rw-r--r-- | src/serv.c | 13 |
2 files changed, 17 insertions, 11 deletions
@@ -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"); |