X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fnet.c;h=a04ba005b67fc616e8291a4f80dddb9ff9c50af8;hb=0fdd7da52077d77a11a3646eb3e7d5b6ffa178e8;hp=6ffd9989d5d4356e6e83c1e3cc08edfa20e16b08;hpb=292354912f346fe467f557f0dc026b519997289c;p=tinc diff --git a/src/net.c b/src/net.c index 6ffd9989..a04ba005 100644 --- a/src/net.c +++ b/src/net.c @@ -489,6 +489,36 @@ int main_loop(void) { last_config_check = now; + /* If StrictSubnet is set, expire deleted Subnets and read new ones in */ + + if(strictsubnets) { + subnet_t *subnet; + + for(node = subnet_tree->head; node; node = node->next) { + subnet = node->data; + subnet->expires = 1; + } + + load_all_subnets(); + + for(node = subnet_tree->head; node; node = next) { + next = node->next; + subnet = node->data; + if(subnet->expires == 1) { + send_del_subnet(broadcast, subnet); + if(subnet->owner->status.reachable) + subnet_update(subnet->owner, subnet, false); + subnet_del(subnet->owner, subnet); + } else if(subnet->expires == -1) { + subnet->expires = 0; + } else { + send_add_subnet(broadcast, subnet); + if(subnet->owner->status.reachable) + subnet_update(subnet->owner, subnet, true); + } + } + } + /* Try to make outgoing connections */ try_outgoing_connections();