Disable PMTUDiscovery in switch and hub modes.
In switch and hub modes, tinc does not generate ICMP packets in response to packets that are larger than the path MTU. However, if PMTUDiscovery is enabled, the IP_MTU_DISCOVER and IPV6_MTU_DISCOVER option is set on the UDP sockets, which causes all UDP packets to be sent with the DF bit set, causing large packets to be dropped, even if they would otherwise be routed fine.
This commit is contained in:
parent
78fc59e994
commit
d5b56bbba5
3 changed files with 15 additions and 18 deletions
|
@ -286,9 +286,6 @@ 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, "PMTUDiscovery"), &choice) || choice)
|
|
||||||
myself->options |= OPTION_PMTU_DISCOVERY;
|
|
||||||
|
|
||||||
if(myself->options & OPTION_TCPONLY)
|
if(myself->options & OPTION_TCPONLY)
|
||||||
myself->options |= OPTION_INDIRECT;
|
myself->options |= OPTION_INDIRECT;
|
||||||
|
|
||||||
|
@ -309,6 +306,10 @@ bool setup_myself(void)
|
||||||
} else
|
} else
|
||||||
routing_mode = RMODE_ROUTER;
|
routing_mode = RMODE_ROUTER;
|
||||||
|
|
||||||
|
if(routing_mode == RMODE_ROUTER)
|
||||||
|
if(!get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) || choice)
|
||||||
|
myself->options |= OPTION_PMTU_DISCOVERY;
|
||||||
|
|
||||||
get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance);
|
get_config_bool(lookup_config(config_tree, "PriorityInheritance"), &priorityinheritance);
|
||||||
|
|
||||||
#if !defined(SOL_IP) || !defined(IP_TOS)
|
#if !defined(SOL_IP) || !defined(IP_TOS)
|
||||||
|
|
|
@ -193,25 +193,17 @@ int setup_vpn_in_socket(const sockaddr_t *sa)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SOL_IP) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
|
#if defined(SOL_IP) && defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
|
||||||
{
|
if(myself->options & OPTION_PMTU_DISCOVERY) {
|
||||||
bool choice;
|
|
||||||
|
|
||||||
if(!get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) || choice) {
|
|
||||||
option = IP_PMTUDISC_DO;
|
option = IP_PMTUDISC_DO;
|
||||||
setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option));
|
setsockopt(nfd, SOL_IP, IP_MTU_DISCOVER, &option, sizeof(option));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
|
#if defined(SOL_IPV6) && defined(IPV6_MTU_DISCOVER) && defined(IPV6_PMTUDISC_DO)
|
||||||
{
|
if(myself->options & OPTION_PMTU_DISCOVERY) {
|
||||||
bool choice;
|
|
||||||
|
|
||||||
if(!get_config_bool(lookup_config(myself->connection->config_tree, "PMTUDiscovery"), &choice) || choice) {
|
|
||||||
option = IPV6_PMTUDISC_DO;
|
option = IPV6_PMTUDISC_DO;
|
||||||
setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, &option, sizeof(option));
|
setsockopt(nfd, SOL_IPV6, IPV6_MTU_DISCOVER, &option, sizeof(option));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
|
#if defined(SOL_SOCKET) && defined(SO_BINDTODEVICE)
|
||||||
|
|
|
@ -483,7 +483,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, "PMTUDiscovery"), &choice) || choice) && (myself->options & OPTION_PMTU_DISCOVERY))
|
if(myself->options & OPTION_PMTU_DISCOVERY)
|
||||||
c->options |= OPTION_PMTU_DISCOVERY;
|
c->options |= OPTION_PMTU_DISCOVERY;
|
||||||
|
|
||||||
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
|
get_config_int(lookup_config(c->config_tree, "Weight"), &c->estimated_weight);
|
||||||
|
@ -561,6 +561,10 @@ bool ack_h(connection_t *c)
|
||||||
|
|
||||||
n->connection = c;
|
n->connection = c;
|
||||||
c->node = n;
|
c->node = n;
|
||||||
|
if(!(c->options & options & OPTION_PMTU_DISCOVERY)) {
|
||||||
|
c->options &= ~OPTION_PMTU_DISCOVERY;
|
||||||
|
options &= ~OPTION_PMTU_DISCOVERY;
|
||||||
|
}
|
||||||
c->options |= options;
|
c->options |= options;
|
||||||
|
|
||||||
if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)
|
if(get_config_int(lookup_config(c->config_tree, "PMTU"), &mtu) && mtu < n->mtu)
|
||||||
|
|
Loading…
Reference in a new issue