Add checks for the presence of the universal tun/tap device driver.
[tinc] / src / connlist.c
index df10ce3..b1e3146 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id: connlist.c,v 1.1.2.2 2000/10/11 22:00:58 guus Exp $
+    $Id: connlist.c,v 1.1.2.4 2000/10/15 00:59:34 guus Exp $
 */
 
 #include <syslog.h>
 
+#include "net.h"       /* Don't ask. */
 #include "config.h"
+#include "conf.h"
 #include <utils.h>
 
-#include "net.h"       /* Don't ask. */
+#include "system.h"
 
 /* Root of the connection list */
 
@@ -51,12 +53,16 @@ cp
     destroy_queue(p->sq);
   if(p->rq)
     destroy_queue(p->rq);
-  if(p->name)
+  if(p->name && p->name!=unknown)
     free(p->name);
   if(p->hostname)
     free(p->hostname);
-  free_key(p->public_key);
-  free_key(p->datakey);
+  if(p->public_key)
+    RSA_free(p->public_key);
+  if(p->cipher_pktkey)
+    free(p->cipher_pktkey);
+  if(p->buffer)
+    free(p->buffer);
   free(p);
 cp
 }
@@ -79,7 +85,7 @@ cp
          else
            conn_list = next;
 
-         free_conn_element(p);
+         free_conn_list(p);
        }
       else
        prev = p;
@@ -99,7 +105,7 @@ cp
   for(p = conn_list; p != NULL; )
     {
       next = p->next;
-      free_conn_element(p);
+      free_conn_list(p);
       p = next;
     }
 
@@ -204,3 +210,15 @@ cp
   syslog(LOG_DEBUG, _("End of connection list."));
 cp
 }
+
+int read_host_config(conn_list_t *cl)
+{
+  char *fname;
+  int x;
+cp
+  asprintf(&fname, "%s/hosts/%s", confbase, cl->name);
+  x = read_config_file(&cl->config, fname);
+  free(fname);
+cp
+  return x;
+}