X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet_setup.c;h=7f51fe4b46c938e1b9ef552c75d4e3831e9c1681;hb=0b310bf406dbe58afe37fa31156b9ea47599d7be;hp=29f1212814234ff2b7db709d2eb97449d5e23b8c;hpb=880d74ad2d8a6d73c2e94ec54df542b88dc0c6f4;p=tinc diff --git a/src/net_setup.c b/src/net_setup.c index 29f12128..7f51fe4b 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -145,6 +145,7 @@ bool read_ecdsa_public_key(connection_t *c) { return c->ecdsa; } +#ifndef DISABLE_LEGACY bool read_rsa_public_key(connection_t *c) { if(ecdsa_active(c->ecdsa)) return true; @@ -182,6 +183,7 @@ bool read_rsa_public_key(connection_t *c) { free(fname); return c->rsa; } +#endif static bool read_ecdsa_private_key(void) { FILE *fp; @@ -248,6 +250,7 @@ static bool read_invitation_key(void) { return invitation_key; } +#ifndef DISABLE_LEGACY static bool read_rsa_private_key(void) { FILE *fp; char *fname; @@ -304,6 +307,7 @@ static bool read_rsa_private_key(void) { free(fname); return myself->connection->rsa; } +#endif static timeout_t keyexpire_timeout; @@ -315,6 +319,8 @@ static void keyexpire_handler(void *data) { void regenerate_key(void) { logger(DEBUG_STATUS, LOG_INFO, "Expiring symmetric keys"); send_key_changed(); + for splay_each(node_t, n, node_tree) + n->status.validkey_in = false; } /* @@ -506,6 +512,11 @@ bool setup_myself_reloadable(void) { if(myself->options & OPTION_TCPONLY) myself->options |= OPTION_INDIRECT; + get_config_bool(lookup_config(config_tree, "UDPDiscovery"), &udp_discovery); + get_config_int(lookup_config(config_tree, "UDPDiscoveryKeepaliveInterval"), &udp_discovery_keepalive_interval); + get_config_int(lookup_config(config_tree, "UDPDiscoveryInterval"), &udp_discovery_interval); + get_config_int(lookup_config(config_tree, "UDPDiscoveryTimeout"), &udp_discovery_timeout); + get_config_bool(lookup_config(config_tree, "DirectOnly"), &directonly); get_config_bool(lookup_config(config_tree, "LocalDiscovery"), &localdiscovery); @@ -652,6 +663,9 @@ static bool add_listen_address(char *address, bool bindto) { hint.ai_protocol = IPPROTO_TCP; hint.ai_flags = AI_PASSIVE; +#ifdef HAVE_DECL_RES_INIT + res_init(); +#endif int err = getaddrinfo(address && *address ? address : NULL, port, &hint, &ai); free(address); @@ -773,6 +787,13 @@ static bool setup_myself(void) { myself->options |= PROT_MINOR << 24; +#ifdef DISABLE_LEGACY + experimental = read_ecdsa_private_key(); + if(!experimental) { + logger(DEBUG_ALWAYS, LOG_ERR, "No private key available, cannot start tinc!"); + return false; + } +#else if(!get_config_bool(lookup_config(config_tree, "ExperimentalProtocol"), &experimental)) { experimental = read_ecdsa_private_key(); if(!experimental) @@ -790,6 +811,7 @@ static bool setup_myself(void) { return false; } } +#endif /* Ensure myport is numeric */ @@ -854,6 +876,7 @@ static bool setup_myself(void) { sptps_replaywin = replaywin; } +#ifndef DISABLE_LEGACY /* Generate packet encryption key */ if(!get_config_string(lookup_config(config_tree, "Cipher"), &cipher)) @@ -891,6 +914,7 @@ static bool setup_myself(void) { } free(digest); +#endif /* Compression */