+static void age_subnets(void *data) {
+ bool left = false;
+
+ for splay_each(subnet_t, s, myself->subnet_tree) {
+ if(s->expires && s->expires < now.tv_sec) {
+ if(debug_level >= DEBUG_TRAFFIC) {
+ char netstr[MAXNETSTR];
+ if(net2str(netstr, sizeof netstr, s))
+ logger(DEBUG_TRAFFIC, LOG_INFO, "Subnet %s expired", netstr);
+ }
+
+ for list_each(connection_t, c, connection_list)
+ if(c->status.active)
+ send_del_subnet(c, s);
+
+ subnet_del(myself, s);
+ } else {
+ if(s->expires)
+ left = true;
+ }
+ }
+
+ if(left)
+ timeout_set(&age_subnets_timeout, &(struct timeval){10, rand() % 100000});
+}
+
+static void learn_mac(mac_t *address) {
+ subnet_t *subnet = lookup_subnet_mac(myself, address);