X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fgraph.c;h=98eb469b447087884c52ec21e052192bee30c082;hb=9ade39b7d5564fb6f5a41946c9a23cfa7851a19f;hp=b3a2c255c5945c4a1fe26a97f8de43f6ff01cfdb;hpb=4e0fc52197546bbf8a0be7af946f4b569e13048c;p=tinc diff --git a/src/graph.c b/src/graph.c index b3a2c255..98eb469b 100644 --- a/src/graph.c +++ b/src/graph.c @@ -188,7 +188,8 @@ static void sssp_bfs(void) { e->to->options = e->options; e->to->distance = n->distance + 1; - if(e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN) + if(!e->to->status.reachable || (e->to->address.sa.sa_family == AF_UNSPEC && e->address.sa.sa_family != AF_UNKNOWN) +) update_node_udp(e->to, &e->address); list_insert_tail(todo_list, e->to); @@ -217,6 +218,7 @@ static void check_reachability(void) { if(n->status.visited != n->status.reachable) { n->status.reachable = !n->status.reachable; + n->last_state_change = time(NULL); if(n->status.reachable) { logger(DEBUG_TRAFFIC, LOG_DEBUG, "Node %s (%s) became reachable", @@ -226,6 +228,9 @@ static void check_reachability(void) { n->name, n->hostname); } + if(experimental && OPTION_VERSION(n->options) >= 2) + n->status.sptps = true; + /* TODO: only clear status.validkey if node is unreachable? */ n->status.validkey = false; @@ -263,10 +268,16 @@ static void check_reachability(void) { subnet_update(n, NULL, n->status.reachable); - if(!n->status.reachable) + if(!n->status.reachable) { update_node_udp(n, NULL); - else if(n->connection) - send_ans_key(n); + } else if(n->connection) { + if(n->status.sptps) { + if(n->connection->outgoing) + send_req_key(n); + } else { + send_ans_key(n); + } + } } } }