From: Etienne Dechamps Date: Sat, 4 Oct 2014 13:25:16 +0000 (+0100) Subject: Don't send MTU probes to nodes we can't reach directly. X-Git-Tag: release-1.1pre11~34 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=63daebcd1ec2975c0c2ad8e0ee0fced33b1fbbf0;p=tinc Don't send MTU probes to nodes we can't reach directly. Currently, we send MTU probes to each node we receive a key for, even if we know we will never send UDP packets to that node because of indirection. This commit disables MTU probing between nodes that have direct communication disabled, otherwise MTU probes end up getting sent through relays. With the legacy protocol this was never a problem because we would never request the key of a node with indirection enabled; with SPTPS this was not a problem until we introduced relaying because send_sptps_data() would simply ignore indirections, but this is not the case anymore. Note that the fix is implemented in a quick and dirty way, by disabling the call to send_mtu_probe() in ans_key_h(); this is not a clean fix because there's no code to resume sending MTU probes in case the indirection disappears because of a graph change. --- diff --git a/src/protocol_key.c b/src/protocol_key.c index a4d97aeb..ebc46f32 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -399,7 +399,9 @@ bool ans_key_h(connection_t *c, const char *request) { update_node_udp(from, &sa); } - if(from->options & OPTION_PMTU_DISCOVERY && !(from->options & OPTION_TCPONLY)) + /* Don't send probes if we can't send UDP packets directly to that node. + TODO: the indirect (via) condition can change at any time as edges are added and removed, so this should probably be moved to graph.c. */ + if((from->via == myself || from->via == from) && from->options & OPTION_PMTU_DISCOVERY && !(from->options & OPTION_TCPONLY)) send_mtu_probe(from); }