Various small fixes to make tinc runnable again.

This commit is contained in:
Guus Sliepen 2001-10-27 15:19:13 +00:00
parent ac066bb057
commit b98d9787fd
5 changed files with 30 additions and 16 deletions

View file

@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: conf.c,v 1.9.4.45 2001/10/27 12:13:17 guus Exp $ $Id: conf.c,v 1.9.4.46 2001/10/27 15:19:13 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -127,10 +127,13 @@ cp
found = avl_search_closest_greater(config_tree, &cfg); found = avl_search_closest_greater(config_tree, &cfg);
if(!strcmp(found->variable, variable)) if(!found)
return found;
else
return NULL; return NULL;
if(strcmp(found->variable, variable))
return NULL;
return found;
} }
config_t *lookup_config_next(avl_tree_t *config_tree, config_t *cfg) config_t *lookup_config_next(avl_tree_t *config_tree, config_t *cfg)
@ -253,12 +256,12 @@ cp
/* Teach newbies what subnets are... */ /* Teach newbies what subnets are... */
if((subnet->net.ipv4.address & subnet->net.ipv4.mask) != subnet->net.ipv4.address) if((ip->address & ip->mask) != ip->address)
{ {
syslog(LOG_ERR, _("Network address and subnet mask for configuration variable %s in %s line %d"), syslog(LOG_ERR, _("Network address and subnet mask for configuration variable %s in %s line %d"),
cfg->value, cfg->file, cfg->line); cfg->value, cfg->file, cfg->line);
free(ip); free(ip);
return -1; return 0;
} }
subnet = new_subnet(); subnet = new_subnet();

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: connection.c,v 1.1.2.20 2001/10/27 12:13:17 guus Exp $ $Id: connection.c,v 1.1.2.21 2001/10/27 15:19:13 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -62,8 +62,12 @@ cp
connection_t *new_connection(void) connection_t *new_connection(void)
{ {
connection_t *c;
cp cp
return (connection_t *)xmalloc_and_zero(sizeof(connection_t)); c = (connection_t *)xmalloc_and_zero(sizeof(connection_t));
init_configuration(&c->config_tree);
cp
return c;
} }
void free_connection(connection_t *c) void free_connection(connection_t *c)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.138 2001/10/27 13:13:35 guus Exp $ $Id: net.c,v 1.35.4.139 2001/10/27 15:19:13 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -666,9 +666,11 @@ cp
return -1; return -1;
} }
*/ */
if(!get_config_port(lookup_config(myself->connection->config_tree, "Port"), &myself->connection->port)) if(!get_config_port(lookup_config(myself->connection->config_tree, "Port"), &myself->port))
myself->port = 655; myself->port = 655;
myself->connection->port = myself->port;
/* Read in all the subnets specified in the host configuration file */ /* Read in all the subnets specified in the host configuration file */
cfg = lookup_config(myself->connection->config_tree, "Subnet"); cfg = lookup_config(myself->connection->config_tree, "Subnet");
@ -705,7 +707,7 @@ cp
if(myself->options & OPTION_TCPONLY) if(myself->options & OPTION_TCPONLY)
myself->options |= OPTION_INDIRECT; myself->options |= OPTION_INDIRECT;
if(get_config_string(lookup_config(myself->connection->config_tree, "Mode"), &mode)) if(get_config_string(lookup_config(config_tree, "Mode"), &mode))
{ {
if(!strcasecmp(mode, "router")) if(!strcasecmp(mode, "router"))
routing_mode = RMODE_ROUTER; routing_mode = RMODE_ROUTER;
@ -746,7 +748,7 @@ cp
myself->key = (char *)xmalloc(myself->keylength); myself->key = (char *)xmalloc(myself->keylength);
RAND_pseudo_bytes(myself->key, myself->keylength); RAND_pseudo_bytes(myself->key, myself->keylength);
if(!get_config_int(lookup_config(myself->connection->config_tree, "KeyExpire"), &keylifetime)) if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
keylifetime = 3600; keylifetime = 3600;
keyexpires = time(NULL) + keylifetime; keyexpires = time(NULL) + keylifetime;
@ -771,8 +773,9 @@ int setup_network_connections(void)
cp cp
init_connections(); init_connections();
init_subnets(); init_subnets();
init_nodes();
if(get_config_int(lookup_config(myself->connection->config_tree, "PingTimeout"), &timeout)) if(get_config_int(lookup_config(config_tree, "PingTimeout"), &timeout))
{ {
if(timeout < 1) if(timeout < 1)
{ {

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.c,v 1.1.2.27 2001/10/27 13:13:35 guus Exp $ $Id: process.c,v 1.1.2.28 2001/10/27 15:19:13 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -437,6 +437,9 @@ setup_signals(void)
sigaction(i, &act, NULL); sigaction(i, &act, NULL);
} }
if(!do_detach)
sighandlers[3].handler = SIG_DFL;
/* Then, for each known signal that we want to catch, assign a /* Then, for each known signal that we want to catch, assign a
handler to the signal, with error checking this time. */ handler to the signal, with error checking this time. */
for(i = 0; sighandlers[i].signal; i++) for(i = 0; sighandlers[i].signal; i++)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: tincd.c,v 1.10.4.53 2001/10/27 12:13:17 guus Exp $ $Id: tincd.c,v 1.10.4.54 2001/10/27 15:19:13 guus Exp $
*/ */
#include "config.h" #include "config.h"
@ -319,6 +319,7 @@ main(int argc, char **argv, char **envp)
g_argv = argv; g_argv = argv;
make_names(); make_names();
init_configuration(&config_tree);
/* Slllluuuuuuurrrrp! */ /* Slllluuuuuuurrrrp! */
cp cp