X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fgraph.c;h=4e060b7ffa9c647cd4cc3103085e3e542ddf3ef7;hb=4124b9682f8f890acb25d0c92f2583eef670274a;hp=02e8494f4d82b860490a410cc28c1c91954237b8;hpb=6e80da3370249caa1082c23c3ef55f338d1e9e74;p=tinc diff --git a/src/graph.c b/src/graph.c index 02e8494f..4e060b7f 100644 --- a/src/graph.c +++ b/src/graph.c @@ -1,6 +1,6 @@ /* graph.c -- graph algorithms - Copyright (C) 2001-2006 Guus Sliepen , + Copyright (C) 2001-2009 Guus Sliepen , 2001-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -312,27 +312,8 @@ void sssp_bfs(void) { e->to->via = indirect ? n->via : e->to; e->to->options = e->options; - if(sockaddrcmp(&e->to->address, &e->address)) { - node = splay_unlink(node_udp_tree, e->to); - sockaddrfree(&e->to->address); - sockaddrcpy(&e->to->address, &e->address); - - if(e->to->hostname) - free(e->to->hostname); - - e->to->hostname = sockaddr2hostname(&e->to->address); - - if(node) - splay_insert_node(node_udp_tree, node); - - if(e->to->options & OPTION_PMTU_DISCOVERY) { - e->to->mtuprobes = 0; - e->to->minmtu = 0; - e->to->maxmtu = MTU; - if(e->to->status.validkey) - send_mtu_probe(e->to); - } - } + if(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); } @@ -364,13 +345,13 @@ void check_reachability() { if(n->status.reachable) { ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Node %s (%s) became reachable"), n->name, n->hostname); - splay_insert(node_udp_tree, n); } else { ifdebug(TRAFFIC) logger(LOG_DEBUG, _("Node %s (%s) became unreachable"), n->name, n->hostname); - splay_delete(node_udp_tree, n); } + /* TODO: only clear status.validkey if node is unreachable? */ + n->status.validkey = false; n->status.waitingforkey = false; @@ -443,6 +424,7 @@ int dump_graph(struct evbuffer *out) { } void graph(void) { + subnet_cache_flush(); sssp_dijkstra(); check_reachability(); mst_kruskal();