Fix reloading Subnets when StrictSubnets is set.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 11 Apr 2010 02:35:16 +0000 (04:35 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 11 Apr 2010 02:35:16 +0000 (04:35 +0200)
src/net.c
src/net_setup.c

index 528e046b9464a9903a79bad73aceaccc8d123cbf..db8eae76e6cfab12d36fced9c28d43ad099b19de 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -508,8 +508,9 @@ int main_loop(void) {
                                                send_del_subnet(broadcast, subnet);
                                                subnet_del(subnet->owner, subnet);
                                        } else if(subnet->expires == -1) {
-                                               send_add_subnet(broadcast, subnet);
                                                subnet->expires = 0;
+                                       } else {
+                                               send_add_subnet(broadcast, subnet);
                                        }
                                }
                        }
index 118d719c439d4420e023915c0406686973c9c45f..cb70926ad0c3dbaa13bac715514098a536f533a8 100644 (file)
@@ -228,9 +228,6 @@ void load_all_subnets(void) {
                        continue;
 
                n = lookup_node(ent->d_name);
-               if(n)
-                       continue;
-
                #ifdef _DIRENT_HAVE_D_TYPE
                //if(ent->d_type != DT_REG)
                //      continue;
@@ -243,9 +240,11 @@ void load_all_subnets(void) {
                if(!result)
                        continue;
 
-               n = new_node();
-               n->name = xstrdup(ent->d_name);
-               node_add(n);
+               if(!n) {
+                       n = new_node();
+                       n->name = xstrdup(ent->d_name);
+                       node_add(n);
+               }
 
                for(cfg = lookup_config(config_tree, "Subnet"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
                        if(!get_config_subnet(cfg, &s))