X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=78d4b76bff18b7fe4d12f3acb2a62d8a2cf6927a;hb=3a149f7521dfff67e6a790c1a830afc649ae083e;hp=dffe0b472c36694053d0bc611efc6969ba368258;hpb=bf81fce8ff7a244ecdfbe2d5535bdf4df07b3f35;p=tinc diff --git a/src/net.c b/src/net.c index dffe0b47..78d4b76b 100644 --- a/src/net.c +++ b/src/net.c @@ -50,7 +50,7 @@ void purge(void) { /* Remove all edges and subnets owned by unreachable nodes. */ - for splay_each(node_t, n, node_tree) { + for splay_each(node_t, n, &node_tree) { if(!n->status.reachable) { logger(DEBUG_SCARY_THINGS, LOG_DEBUG, "Purging node %s (%s)", n->name, n->hostname); @@ -74,9 +74,9 @@ void purge(void) { /* Check if anyone else claims to have an edge to an unreachable node. If not, delete node. */ - for splay_each(node_t, n, node_tree) { + for splay_each(node_t, n, &node_tree) { if(!n->status.reachable) { - for splay_each(edge_t, e, edge_weight_tree) + for splay_each(edge_t, e, &edge_weight_tree) if(e->to == n) { return; } @@ -289,7 +289,7 @@ static void periodic_handler(void *data) { /* If AutoConnect is set, check if we need to make or break connections. */ - if(autoconnect && node_tree->count > 1) { + if(autoconnect && node_tree.count > 1) { do_autoconnect(); } @@ -335,18 +335,17 @@ int reload_configuration(void) { /* Reread our own configuration file */ - exit_configuration(&config_tree); - init_configuration(&config_tree); + splay_empty_tree(&config_tree); - if(!read_server_config(config_tree)) { + if(!read_server_config(&config_tree)) { logger(DEBUG_ALWAYS, LOG_ERR, "Unable to reread configuration file."); return EINVAL; } - read_config_options(config_tree, NULL); + read_config_options(&config_tree, NULL); snprintf(fname, sizeof(fname), "%s" SLASH "hosts" SLASH "%s", confbase, myself->name); - read_config_file(config_tree, fname, true); + read_config_file(&config_tree, fname, true); /* Parse some options that are allowed to be changed while tinc is running */ @@ -355,20 +354,20 @@ int reload_configuration(void) { /* If StrictSubnet is set, expire deleted Subnets and read new ones in */ if(strictsubnets) { - for splay_each(subnet_t, subnet, subnet_tree) + for splay_each(subnet_t, subnet, &subnet_tree) if(subnet->owner) { subnet->expires = 1; } } - for splay_each(node_t, n, node_tree) { + for splay_each(node_t, n, &node_tree) { n->status.has_address = false; } load_all_nodes(); if(strictsubnets) { - for splay_each(subnet_t, subnet, subnet_tree) { + for splay_each(subnet_t, subnet, &subnet_tree) { if(!subnet->owner) { continue; } @@ -397,7 +396,7 @@ int reload_configuration(void) { subnet->expires = 1; } - config_t *cfg = lookup_config(config_tree, "Subnet"); + config_t *cfg = lookup_config(&config_tree, "Subnet"); while(cfg) { subnet_t *subnet, *s2; @@ -416,7 +415,7 @@ int reload_configuration(void) { } } - cfg = lookup_config_next(config_tree, cfg); + cfg = lookup_config_next(&config_tree, cfg); } for splay_each(subnet_t, subnet, myself->subnet_tree) {