X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet.c;h=64bca947ff08b80c25b4735e68b06321c4e5ae39;hp=6ffd9989d5d4356e6e83c1e3cc08edfa20e16b08;hb=f5122ccecee095b9185b2324dea7bcd9655462ee;hpb=292354912f346fe467f557f0dc026b519997289c diff --git a/src/net.c b/src/net.c index 6ffd9989..64bca947 100644 --- a/src/net.c +++ b/src/net.c @@ -297,7 +297,7 @@ static void check_network_activity(fd_set * readset, fd_set * writeset) { if(FD_ISSET(c->socket, readset)) { if(c->status.connecting) { c->status.connecting = false; - getsockopt(c->socket, SOL_SOCKET, SO_ERROR, &result, &len); + getsockopt(c->socket, SOL_SOCKET, SO_ERROR, (void *)&result, &len); if(!result) finish_connecting(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();