X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_setup.c;h=ed69808d6c1a882229c1299d586305b2bda0db75;hb=1c475ecb575367a6b3f9328b0f643ad636155341;hp=49ea31b6893f5bdf09748513bf0e88b0d5892f91;hpb=9e7c6d4dce8b87d40cea537fd0b035a2612580e3;p=tinc diff --git a/src/net_setup.c b/src/net_setup.c index 49ea31b6..ed69808d 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -75,7 +75,7 @@ bool node_read_ecdsa_public_key(node_t *n) { init_configuration(&config_tree); - if(!read_host_config(config_tree, n->name)) { + if(!read_host_config(config_tree, n->name, true)) { goto exit; } @@ -120,7 +120,7 @@ bool read_ecdsa_public_key(connection_t *c) { if(!c->config_tree) { init_configuration(&c->config_tree); - if(!read_host_config(c->config_tree, c->name)) { + if(!read_host_config(c->config_tree, c->name, true)) { return false; } } @@ -215,7 +215,7 @@ static bool read_ecdsa_private_key(void) { logger(DEBUG_ALWAYS, LOG_ERR, "Error reading Ed25519 private key file `%s': %s", fname, strerror(errno)); if(errno == ENOENT) { - logger(DEBUG_ALWAYS, LOG_INFO, "Create an Ed25519 keypair with `tinc -n %s generate-ed25519-keys'.", netname ? : "."); + logger(DEBUG_ALWAYS, LOG_INFO, "Create an Ed25519 keypair with `tinc -n %s generate-ed25519-keys'.", netname ? netname : "."); } free(fname); @@ -307,7 +307,7 @@ static bool read_rsa_private_key(void) { fname, strerror(errno)); if(errno == ENOENT) { - logger(DEBUG_ALWAYS, LOG_INFO, "Create an RSA keypair with `tinc -n %s generate-rsa-keys'.", netname ? : "."); + logger(DEBUG_ALWAYS, LOG_INFO, "Create an RSA keypair with `tinc -n %s generate-rsa-keys'.", netname ? netname : "."); } free(fname); @@ -382,7 +382,7 @@ void load_all_nodes(void) { splay_tree_t *config_tree; init_configuration(&config_tree); read_config_options(config_tree, ent->d_name); - read_host_config(config_tree, ent->d_name); + read_host_config(config_tree, ent->d_name, true); if(!n) { n = new_node(); @@ -637,7 +637,7 @@ bool setup_myself_reloadable(void) { subnet_add(NULL, s); } -#if !defined(IPPROTO_IP) || !defined(IP_TOS) +#if !defined(IP_TOS) if(priorityinheritance) { logger(DEBUG_ALWAYS, LOG_WARNING, "%s not supported on this platform for IPv4 connections", "PriorityInheritance"); @@ -645,7 +645,7 @@ bool setup_myself_reloadable(void) { #endif -#if !defined(IPPROTO_IPV6) || !defined(IPV6_TCLASS) +#if !defined(IPV6_TCLASS) if(priorityinheritance) { logger(DEBUG_ALWAYS, LOG_WARNING, "%s not supported on this platform for IPv6 connections", "PriorityInheritance"); @@ -687,15 +687,8 @@ bool setup_myself_reloadable(void) { keylifetime = 3600; } - config_t *cfg = lookup_config(config_tree, "AutoConnect"); - - if(cfg) { - if(!get_config_bool(cfg, &autoconnect)) { - // Some backwards compatibility with when this option was an int - int val = 0; - get_config_int(cfg, &val); - autoconnect = val; - } + if(!get_config_bool(lookup_config(config_tree, "AutoConnect"), &autoconnect)) { + autoconnect = true; } get_config_bool(lookup_config(config_tree, "DisableBuggyPeers"), &disablebuggypeers); @@ -843,7 +836,7 @@ static bool setup_myself(void) { myself->connection = new_connection(); myself->name = name; myself->connection->name = xstrdup(name); - read_host_config(config_tree, name); + read_host_config(config_tree, name, true); if(!get_config_string(lookup_config(config_tree, "Port"), &myport)) { myport = xstrdup("655"); @@ -902,6 +895,7 @@ static bool setup_myself(void) { free(myport); memcpy(&sa, ai->ai_addr, ai->ai_addrlen); + freeaddrinfo(ai); sockaddr2str(&sa, NULL, &myport); } @@ -948,6 +942,16 @@ static bool setup_myself(void) { } } + get_config_int(lookup_config(config_tree, "FWMark"), &fwmark); +#ifndef SO_MARK + + if(fwmark) { + logger(DEBUG_ALWAYS, LOG_ERR, "FWMark not supported on this platform!"); + return false; + } + +#endif + int replaywin_int; if(get_config_int(lookup_config(config_tree, "ReplayWindow"), &replaywin_int)) { @@ -971,6 +975,7 @@ static bool setup_myself(void) { myself->incipher = NULL; } else if(!(myself->incipher = cipher_open_by_name(cipher))) { logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized cipher type!"); + free(cipher); return false; } @@ -998,6 +1003,7 @@ static bool setup_myself(void) { myself->indigest = NULL; } else if(!(myself->indigest = digest_open_by_name(digest, maclength))) { logger(DEBUG_ALWAYS, LOG_ERR, "Unrecognized digest type!"); + free(digest); return false; }