More sensible name, and try to set PMTU discovery on IPv6 sockets as well.

This commit is contained in:
Guus Sliepen 2003-12-20 21:09:33 +00:00
parent 6b12bea62f
commit 9bab08e972
5 changed files with 32 additions and 10 deletions

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: graph.c,v 1.1.2.31 2003/12/20 19:47:52 guus Exp $ $Id: graph.c,v 1.1.2.32 2003/12/20 21:09:33 guus Exp $
*/ */
/* We need to generate two trees from the graph: /* We need to generate two trees from the graph:
@ -231,7 +231,9 @@ void sssp_bfs(void)
avl_insert_node(node_udp_tree, node); avl_insert_node(node_udp_tree, node);
if(e->to->options & OPTION_DONTFRAGMENT) { if(e->to->options & OPTION_DONTFRAGMENT) {
e->to->mtu = MTU;
e->to->mtuprobes = 0; e->to->mtuprobes = 0;
e->to->probedmtu = 0;
if(e->to->status.validkey) if(e->to->status.validkey)
send_mtu_probe(e->to); send_mtu_probe(e->to);
} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_packet.c,v 1.1.2.45 2003/12/20 19:47:52 guus Exp $ $Id: net_packet.c,v 1.1.2.46 2003/12/20 21:09:33 guus Exp $
*/ */
#include "system.h" #include "system.h"
@ -65,8 +65,13 @@ void send_mtu_probe(node_t *n)
n->mtuprobes++; n->mtuprobes++;
if(n->mtuprobes >= 10 && !n->probedmtu) {
ifdebug(TRAFFIC) logger(LOG_INFO, _("No response to MTU probes from %s (%s)"), n->name, n->hostname);
return;
}
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
if(n->mtuprobes >= 100 || n->probedmtu >= n->mtu) { if(n->mtuprobes >= 30 || n->probedmtu >= n->mtu) {
n->mtu = n->probedmtu; n->mtu = n->probedmtu;
ifdebug(TRAFFIC) logger(LOG_INFO, _("Fixing MTU of %s (%s) to %d after %d probes"), n->name, n->hostname, n->mtu, n->mtuprobes); ifdebug(TRAFFIC) logger(LOG_INFO, _("Fixing MTU of %s (%s) to %d after %d probes"), n->name, n->hostname, n->mtu, n->mtuprobes);
return; return;

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net_setup.c,v 1.1.2.48 2003/12/20 19:47:52 guus Exp $ $Id: net_setup.c,v 1.1.2.49 2003/12/20 21:09:33 guus Exp $
*/ */
#include "system.h" #include "system.h"
@ -284,7 +284,7 @@ bool setup_myself(void)
if(get_config_bool(lookup_config(myself->connection->config_tree, "TCPOnly"), &choice) && choice) if(get_config_bool(lookup_config(myself->connection->config_tree, "TCPOnly"), &choice) && choice)
myself->options |= OPTION_TCPONLY; myself->options |= OPTION_TCPONLY;
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)
myself->options |= OPTION_DONTFRAGMENT; myself->options |= OPTION_DONTFRAGMENT;
if(myself->options & OPTION_TCPONLY) if(myself->options & OPTION_TCPONLY)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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: net_socket.c,v 1.1.2.37 2003/12/20 21:09:33 guus Exp $
*/ */
#include "system.h" #include "system.h"
@ -163,11 +163,26 @@ int setup_vpn_in_socket(const sockaddr_t *sa)
{ {
bool choice; bool choice;
if(get_config_bool(lookup_config(myself->connection->config_tree, "DontFragment"), &choice) && choice) { if(sa->sa.sa_family == AF_INET && get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) {
option = IP_PMTUDISC_DO; option = IP_PMTUDISC_DO;
if(setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option))) { if(setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option))) {
closesocket(nfd); closesocket(nfd);
logger(LOG_ERR, _("Can't set MTU discovery mode: %s"), strerror(errno)); logger(LOG_ERR, _("Can't set PMTU discovery mode: %s"), strerror(errno));
return -1;
}
}
}
#endif
#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
{
bool choice;
if(sa->sa.sa_family == AF_INET6 && get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) && choice) {
option = IPV6_PMTUDISC_DO;
if(setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, &option, sizeof(option))) {
closesocket(nfd);
logger(LOG_ERR, _("Can't set PMTU discovery mode: %s"), strerror(errno));
return -1; return -1;
} }
} }

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: protocol_auth.c,v 1.1.4.31 2003/12/20 19:47:52 guus Exp $ $Id: protocol_auth.c,v 1.1.4.32 2003/12/20 21:09:33 guus Exp $
*/ */
#include "system.h" #include "system.h"
@ -476,7 +476,7 @@ bool send_ack(connection_t *c)
if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY) if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY)
c->options |= OPTION_TCPONLY | OPTION_INDIRECT; c->options |= OPTION_TCPONLY | OPTION_INDIRECT;
if((get_config_bool(lookup_config(c->config_tree, "DontFragment"), &choice) && choice) || myself->options & OPTION_DONTFRAGMENT) if((get_config_bool(lookup_config(c->config_tree, "PMTUDiscovery"), &choice) && choice) || myself->options & OPTION_DONTFRAGMENT)
c->options |= OPTION_DONTFRAGMENT; c->options |= OPTION_DONTFRAGMENT;
return send_request(c, "%d %s %d %lx", ACK, myport, c->estimated_weight, c->options); return send_request(c, "%d %s %d %lx", ACK, myport, c->estimated_weight, c->options);