X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fgraph.c;h=98eb469b447087884c52ec21e052192bee30c082;hb=9ade39b7d5564fb6f5a41946c9a23cfa7851a19f;hp=506b6df57e09b81256053d27bb4056d63af0a908;hpb=153abaa4d940bf2bc9bd7275d5efe5c01c354190;p=tinc diff --git a/src/graph.c b/src/graph.c index 506b6df5..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; @@ -266,7 +271,7 @@ static void check_reachability(void) { if(!n->status.reachable) { update_node_udp(n, NULL); } else if(n->connection) { - if(experimental && OPTION_VERSION(n->options) >= 2) { + if(n->status.sptps) { if(n->connection->outgoing) send_req_key(n); } else {