X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_socket.c;h=efa0f559c1c69f7a8a04f2b17dbfb891f326ff09;hp=f740431459410234309eafe7a0d1a1954af06b35;hb=5bba3124c8c23568def7a4804651a53f3a6b4fd2;hpb=6b12bea62fe2e4bd8b5b6bd0e5ca7f53318705db diff --git a/src/net_socket.c b/src/net_socket.c index f7404314..efa0f559 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -1,7 +1,7 @@ /* net_socket.c -- Handle various kinds of sockets. - Copyright (C) 1998-2003 Ivo Timmermans , - 2000-2003 Guus Sliepen + Copyright (C) 1998-2004 Ivo Timmermans , + 2000-2004 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net_socket.c,v 1.1.2.36 2003/12/20 19:47:52 guus Exp $ + $Id$ */ #include "system.h" @@ -163,13 +163,20 @@ int setup_vpn_in_socket(const sockaddr_t *sa) { bool choice; - if(get_config_bool(lookup_config(myself->connection->config_tree, "DontFragment"), &choice) && choice) { + if(get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) { option = IP_PMTUDISC_DO; - if(setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option))) { - closesocket(nfd); - logger(LOG_ERR, _("Can't set MTU discovery mode: %s"), strerror(errno)); - return -1; - } + setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option)); + } + } +#endif + +#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO) + { + bool choice; + + if(get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) { + option = IPV6_PMTUDISC_DO; + setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, &option, sizeof(option)); } } #endif