From: Etienne Dechamps Date: Sat, 23 May 2015 09:24:00 +0000 (+0100) Subject: Fix crashes when trying unreachable nodes. X-Git-Tag: release-1.1pre12~131 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=8587e8c0d9ac997fcd2040470c1ccf5930bc18c3;hp=8587e8c0d9ac997fcd2040470c1ccf5930bc18c3;p=tinc Fix crashes when trying unreachable nodes. timeout_handler() calls try_tx(c->node) when c->edge exists. Unfortunately, the existence of c->edge is not enough to conclude that the node is reachable. In fact, during connection establishment, there is a short period of time where we create an edge for the node at the other end of the metaconnection, but we don't have one from the other side yet. Unfortunately, if timeout_handler() runs during that short time window, it will call try_tx() on an unreachable node, which makes things explode because that function is not prepared to handle that case. A typical symptom of this race condition is a hard SEGFAULT while trying to send packets using metaconnections that don't exist, due to n->nexthop containing garbage. This patch fixes the issue by making try_tx() check for reachability, and then making all code paths use try_tx() instead of the more specialized methods so that they go through the check. This regression was introduced in eb7a0db18ea71a44999d6a37b4b179dac0ed9bc7. ---