X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconf.c;h=de632af36289a2a5da948bb0db5a312ab4a5b460;hb=8156f3760973c17256a93ab48016b8b84f5444de;hp=ff592a866c2b4422ab0ed74ebcd7d510d8092d0a;hpb=0345a1468613e1ba4a4aa6dbbef44a26f1eb42d9;p=tinc diff --git a/src/conf.c b/src/conf.c index ff592a86..de632af3 100644 --- a/src/conf.c +++ b/src/conf.c @@ -32,10 +32,9 @@ #include "names.h" #include "netutl.h" /* for str2address */ #include "protocol.h" -#include "utils.h" /* for cp */ #include "xalloc.h" -splay_tree_t *config_tree; +splay_tree_t *config_tree = NULL; int pinginterval = 0; /* seconds between pings */ int pingtimeout = 0; /* seconds to wait for response */ @@ -193,29 +192,6 @@ bool get_config_address(const config_t *cfg, struct addrinfo **result) { return false; } -bool get_config_subnet(const config_t *cfg, subnet_t **result) { - subnet_t subnet = {0}; - - if(!cfg) { - return false; - } - - if(!str2net(&subnet, cfg->value)) { - logger(DEBUG_ALWAYS, LOG_ERR, "Subnet expected for configuration variable %s in %s line %d", - cfg->variable, cfg->file, cfg->line); - return false; - } - - if(subnetcheck(subnet)) { - *(*result = new_subnet()) = subnet; - return true; - } - - logger(DEBUG_ALWAYS, LOG_ERR, "Network address and prefix length do not match for configuration variable %s in %s line %d", - cfg->variable, cfg->file, cfg->line); - return false; -} - /* Read exactly one line and strip the trailing newline if any. */ @@ -359,6 +335,10 @@ bool read_config_file(splay_tree_t *config_tree, const char *fname, bool verbose } void read_config_options(splay_tree_t *config_tree, const char *prefix) { + if(!cmdline_conf) { + return; + } + size_t prefix_len = prefix ? strlen(prefix) : 0; for(const list_node_t *node = cmdline_conf->tail; node; node = node->prev) { @@ -392,7 +372,7 @@ void read_config_options(splay_tree_t *config_tree, const char *prefix) { } } -bool read_server_config(void) { +bool read_server_config(splay_tree_t *config_tree) { char fname[PATH_MAX]; bool x;