From 63daebcd1ec2975c0c2ad8e0ee0fced33b1fbbf0 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sat, 4 Oct 2014 14:25:16 +0100 Subject: [PATCH] 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. --- src/protocol_key.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- 2.20.1