X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=de79b5e848d03f5762a411c2dc35d04c0f89fc55;hb=7208397398f7e08d741bfa83594a88e5d01b6220;hp=e9aed34c48ba74b72fd08f765427c628430bceb8;hpb=46f3eba7755089ff68fdc137b0754cae2fa523eb;p=tinc diff --git a/src/net.c b/src/net.c index e9aed34c..de79b5e8 100644 --- a/src/net.c +++ b/src/net.c @@ -1,7 +1,7 @@ /* net.c -- most of the network code Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2017 Guus Sliepen + 2000-2021 Guus Sliepen 2006 Scott Lamb 2011 Loïc Grenié @@ -23,6 +23,7 @@ #include "system.h" #include "autoconnect.h" +#include "conf_net.h" #include "conf.h" #include "connection.h" #include "device.h" @@ -95,7 +96,7 @@ void purge(void) { /* Put a misbehaving connection in the tarpit */ void tarpit(int fd) { static int pits[10] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; - static int next_pit = 0; + static unsigned int next_pit = 0; if(pits[next_pit] != -1) { closesocket(pits[next_pit]); @@ -340,7 +341,7 @@ int reload_configuration(void) { exit_configuration(&config_tree); init_configuration(&config_tree); - if(!read_server_config()) { + if(!read_server_config(config_tree)) { logger(DEBUG_ALWAYS, LOG_ERR, "Unable to reread configuration file."); return EINVAL; } @@ -404,20 +405,18 @@ int reload_configuration(void) { while(cfg) { subnet_t *subnet, *s2; - if(!get_config_subnet(cfg, &subnet)) { - continue; - } + if(get_config_subnet(cfg, &subnet)) { + if((s2 = lookup_subnet(myself, subnet))) { + if(s2->expires == 1) { + s2->expires = 0; + } - if((s2 = lookup_subnet(myself, subnet))) { - if(s2->expires == 1) { - s2->expires = 0; + free_subnet(subnet); + } else { + subnet_add(myself, subnet); + send_add_subnet(everyone, subnet); + subnet_update(myself, subnet, true); } - - free_subnet(subnet); - } else { - subnet_add(myself, subnet); - send_add_subnet(everyone, subnet); - subnet_update(myself, subnet, true); } cfg = lookup_config_next(config_tree, cfg);