X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_packet.c;h=df87e27f4409b4210643ceab563bc54c367dea92;hb=0f8e2cc78cafe47a087d3fc9b480551b841aeb30;hp=9e57df5b12c0af0c2f450b30a8d7bd7e93e4fdde;hpb=537c3528863c4736e877c4d1b6c6579940e6df5d;p=tinc diff --git a/src/net_packet.c b/src/net_packet.c index 9e57df5b..df87e27f 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -1125,23 +1125,31 @@ static void try_tx_sptps(node_t *n, bool mtu) { try_sptps(n); - /* Do we need to relay packets? */ + /* Do we need to statically relay packets? */ node_t *via = (n->via == myself) ? n->nexthop : n->via; - /* If the relay doesn't support SPTPS, everything goes via TCP anyway. */ + /* If the static relay doesn't support SPTPS, everything goes via TCP anyway. */ if((via->options >> 24) < 4) return; - /* If we do have a relay, try everything with that one instead. */ + /* If we do have a static relay, try everything with that one instead. */ if(via != n) - return try_tx_sptps(via, mtu); + try_tx_sptps(via, mtu); + + /* Otherwise, try to establish UDP connectivity. */ try_udp(n); if(mtu) try_mtu(n); + + /* If we don't have UDP connectivity (yet), we need to use a dynamic relay (nexthop) + while we try to establish direct connectivity. */ + + if(!n->status.udp_confirmed && n != n->nexthop && (n->nexthop->options >> 24) >= 4) + try_tx_sptps(n->nexthop, mtu); } static void try_tx_legacy(node_t *n, bool mtu) {