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);
+ subnet_del(subnet->owner, subnet);
+ } else if(subnet->expires == -1) {
+ send_add_subnet(broadcast, subnet);
+ subnet->expires = 0;
+ }
+ }
+ }
+
/* Try to make outgoing connections */
try_outgoing_connections();
extern void flush_queue(struct node_t *);
extern bool read_rsa_public_key(struct connection_t *);
extern void send_mtu_probe(struct node_t *);
+extern void load_all_subnets();
#ifndef HAVE_MINGW
#define closesocket(s) close(s)
/*
Read Subnets from all host config files
*/
-static void load_all_subnets(void) {
+void load_all_subnets(void) {
DIR *dir;
struct dirent *ent;
char *dname;
char *fname;
avl_tree_t *config_tree;
config_t *cfg;
- subnet_t *s;
+ subnet_t *s, *s2;
node_t *n;
bool result;
if(!get_config_subnet(cfg, &s))
continue;
- subnet_add(n, s);
+ if((s2 = lookup_subnet(n, s))) {
+ s2->expires = -1;
+ } else {
+ subnet_add(n, s);
+ }
}
exit_configuration(&config_tree);
#define MAXNETSTR 64
+extern avl_tree_t *subnet_tree;
+
extern int subnet_compare(const struct subnet_t *, const struct subnet_t *);
extern subnet_t *new_subnet(void) __attribute__ ((__malloc__));
extern void free_subnet(subnet_t *);