Now it even runs (it still doesn't do anything useful yet).
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 27 Mar 2004 13:50:04 +0000 (13:50 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 27 Mar 2004 13:50:04 +0000 (13:50 +0000)
rt/node.c
rt/rt.c

index 4178b15f7d5f320b652c34bcb9607d69742f55dc..4eee529059483ee051ca5567bd223e813ec5bb52 100644 (file)
--- a/rt/node.c
+++ b/rt/node.c
@@ -47,6 +47,8 @@ bool node_validname(const char *name) {
 }
 
 bool node_init(void) {
+       char *cfgfilename;
+
        nodes = avl_tree_new((avl_compare_t)node_compare, (avl_action_t)node_free);
        myself = node_new();
 
@@ -61,6 +63,18 @@ bool node_init(void) {
                node_exit();
                return false;
        }
+
+       myself->cfg = cfg_tree_new();
+
+       asprintf(&cfgfilename, "%s/hosts/%s", tinc_confbase, myself->name);
+
+       if(!cfg_read_file(myself->cfg, cfgfilename)) {
+               free(cfgfilename);
+               node_exit();
+               return false;
+       }
+
+       free(cfgfilename);
        
        return true;
 }
diff --git a/rt/rt.c b/rt/rt.c
index 25f22cf7da72ddc2fc4ec7decb7724c48520a97d..43e33c650fc545f1c33674fd09b482c64159a10f 100644 (file)
--- a/rt/rt.c
+++ b/rt/rt.c
@@ -129,13 +129,11 @@ bool rt_init(void) {
        }
 
        /* Open the virtual network device */
+
+       clear(new(rt_vnd));
        
-       if(!cfg_get_string(tinc_cfg, "Device", "/dev/net/tun", &rt_vnd->device)
-                       || !cfg_get_string(tinc_cfg, "Interface", tinc_netname, &rt_vnd->interface)
-                       || !cfg_get_choice(tinc_cfg, "Mode", mode_choice, RT_MODE_ROUTER, rt_mode)) {
-               vnd_free(rt_vnd);
-               return false;
-       }
+       replace(rt_vnd->device, device);
+       replace(rt_vnd->interface, iface);
        
        rt_vnd->mode = (rt_mode == RT_MODE_ROUTER) ? VND_MODE_TUN : VND_MODE_TAP;
        rt_vnd->recv = rt_vnd_recv;
@@ -167,6 +165,8 @@ bool rt_init(void) {
                clear(new(listener));
                listener->local.address = *(struct sockaddr_storage *)aip->ai_addr;
                listener->local.id = myself->name;
+               listener->type = SOCK_STREAM;
+               listener->protocol = IPPROTO_TCP;
                // listener->local.cred = ...;
                listener->accept = rt_tnl_accept;