Various small fixes to make tinc runnable again.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 27 Oct 2001 15:19:13 +0000 (15:19 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 27 Oct 2001 15:19:13 +0000 (15:19 +0000)
src/conf.c
src/connection.c
src/net.c
src/process.c
src/tincd.c

index bd546c6..c4fe101 100644 (file)
@@ -19,7 +19,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     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"
@@ -126,11 +126,14 @@ cp
   cfg.line = 0;
 
   found = avl_search_closest_greater(config_tree, &cfg);
   cfg.line = 0;
 
   found = avl_search_closest_greater(config_tree, &cfg);
+
+  if(!found)
+    return NULL;
   
   
-  if(!strcmp(found->variable, variable))
-    return found;
-  else
+  if(strcmp(found->variable, variable))
     return NULL;
     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"),
              cfg->value, cfg->file, cfg->line);
       free(ip);
     {
       syslog(LOG_ERR, _("Network address and subnet mask for configuration variable %s in %s line %d"),
              cfg->value, cfg->file, cfg->line);
       free(ip);
-      return -1;
+      return 0;
     }
 
   subnet = new_subnet();
     }
 
   subnet = new_subnet();
index a86faa9..ccc4125 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     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
+  c = (connection_t *)xmalloc_and_zero(sizeof(connection_t));
+  init_configuration(&c->config_tree);
 cp
 cp
-  return (connection_t *)xmalloc_and_zero(sizeof(connection_t));
+  return c;
 }
 
 void free_connection(connection_t *c)
 }
 
 void free_connection(connection_t *c)
index fe9eed7..50f4acb 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     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 */
 
   cfg = lookup_config(myself->connection->config_tree, "Subnet");
 /* Read in all the subnets specified in the host configuration file */
 
   cfg = lookup_config(myself->connection->config_tree, "Subnet");
@@ -705,7 +707,7 @@ cp
   if(myself->options & OPTION_TCPONLY)
     myself->options |= OPTION_INDIRECT;
 
   if(myself->options & OPTION_TCPONLY)
     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"))
         routing_mode = RMODE_ROUTER;
     {
       if(!strcasecmp(mode, "router"))
         routing_mode = RMODE_ROUTER;
@@ -746,7 +748,7 @@ cp
   myself->key = (char *)xmalloc(myself->keylength);
   RAND_pseudo_bytes(myself->key, myself->keylength);
 
   myself->key = (char *)xmalloc(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;
 
   keyexpires = time(NULL) + keylifetime;
     keylifetime = 3600;
 
   keyexpires = time(NULL) + keylifetime;
@@ -771,8 +773,9 @@ int setup_network_connections(void)
 cp
   init_connections();
   init_subnets();
 cp
   init_connections();
   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)
         {
index d971a0f..86153b5 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     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
      handler to the signal, with error checking this time. */
   for(i = 0; sighandlers[i].signal; i++)
   /* Then, for each known signal that we want to catch, assign a
      handler to the signal, with error checking this time. */
   for(i = 0; sighandlers[i].signal; i++)
index b790d7a..2943d0b 100644 (file)
@@ -17,7 +17,7 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
     along with this program; if not, write to the Free Software
     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;
 
   make_names();
   g_argv = argv;
 
   make_names();
+  init_configuration(&config_tree);
 
   /* Slllluuuuuuurrrrp! */
 cp
 
   /* Slllluuuuuuurrrrp! */
 cp