X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=7efe7fa3f86cfe39739be804bd0e347f53917542;hb=7be02138580c6821145405fd55def976dfde4998;hp=78d4b76bff18b7fe4d12f3acb2a62d8a2cf6927a;hpb=3a149f7521dfff67e6a790c1a830afc649ae083e;p=tinc diff --git a/src/net.c b/src/net.c index 78d4b76b..7efe7fa3 100644 --- a/src/net.c +++ b/src/net.c @@ -26,6 +26,7 @@ #include "conf_net.h" #include "conf.h" #include "connection.h" +#include "crypto.h" #include "graph.h" #include "logger.h" #include "meta.h" @@ -54,7 +55,7 @@ void purge(void) { if(!n->status.reachable) { logger(DEBUG_SCARY_THINGS, LOG_DEBUG, "Purging node %s (%s)", n->name, n->hostname); - for splay_each(subnet_t, s, n->subnet_tree) { + for splay_each(subnet_t, s, &n->subnet_tree) { send_del_subnet(everyone, s); if(!strictsubnets) { @@ -62,7 +63,7 @@ void purge(void) { } } - for splay_each(edge_t, e, n->edge_tree) { + for splay_each(edge_t, e, &n->edge_tree) { if(!tunnelserver) { send_del_edge(everyone, e); } @@ -81,7 +82,7 @@ void purge(void) { return; } - if(!autoconnect && (!strictsubnets || !n->subnet_tree->head)) + if(!autoconnect && (!strictsubnets || !n->subnet_tree.head)) /* in strictsubnets mode do not delete nodes with subnets */ { node_del(n); @@ -256,7 +257,7 @@ static void timeout_handler(void *data) { } timeout_set(data, &(struct timeval) { - 1, rand() % 100000 + 1, jitter() }); } @@ -294,7 +295,7 @@ static void periodic_handler(void *data) { } timeout_set(data, &(struct timeval) { - 5, rand() % 100000 + 5, jitter() }); } @@ -391,7 +392,7 @@ int reload_configuration(void) { } } } else { /* Only read our own subnets back in */ - for splay_each(subnet_t, subnet, myself->subnet_tree) + for splay_each(subnet_t, subnet, &myself->subnet_tree) if(!subnet->expires) { subnet->expires = 1; } @@ -418,7 +419,7 @@ int reload_configuration(void) { cfg = lookup_config_next(&config_tree, cfg); } - for splay_each(subnet_t, subnet, myself->subnet_tree) { + for splay_each(subnet_t, subnet, &myself->subnet_tree) { if(subnet->expires == 1) { send_del_subnet(everyone, subnet); subnet_update(myself, subnet, false); @@ -482,7 +483,7 @@ void retry(void) { int main_loop(void) { last_periodic_run_time = now; timeout_add(&pingtimer, timeout_handler, &pingtimer, &(struct timeval) { - pingtimeout, rand() % 100000 + pingtimeout, jitter() }); timeout_add(&periodictimer, periodic_handler, &periodictimer, &(struct timeval) { 0, 0