X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_packet.c;h=69835eef5faa9bf4f92a3d1c91143d9743e3f80f;hp=e4b839ef33ec5f8352a4dfc23cc08d269eedf142;hb=eca357ed916c9782a64a68a2f30b144d84027795;hpb=9e3adef5cb31cb73fbbbd25d3fce115aac107714 diff --git a/src/net_packet.c b/src/net_packet.c index e4b839ef..69835eef 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -454,6 +454,13 @@ bool receive_tcppacket_sptps(connection_t *c, const char *data, int len) { return true; } + if(!to->status.reachable) { + /* This can happen in the form of a race condition + if the node just became unreachable. */ + logger(DEBUG_TRAFFIC, LOG_WARNING, "Cannot relay TCP packet from %s (%s) because the destination, %s (%s), is unreachable", from->name, from->hostname, to->name, to->hostname); + return; + } + /* Help the sender reach us over UDP. Note that we only do this if we're the destination or the static relay; otherwise every hop would initiate its own UDP info message, resulting in elevated chatter. */ @@ -1461,6 +1468,13 @@ skip_harder: return; } + if(!to->status.reachable) { + /* This can happen in the form of a race condition + if the node just became unreachable. */ + logger(DEBUG_TRAFFIC, LOG_WARNING, "Cannot relay packet from %s (%s) because the destination, %s (%s), is unreachable", from->name, from->hostname, to->name, to->hostname); + return; + } + /* The packet is supposed to come from the originator or its static relay (i.e. with no dynamic relays in between). If it did not, "help" the static relay by sending it UDP info.