#include "system.h"
-#include "splay_tree.h"
#include "connection.h"
#include "control_common.h"
#include "ethernet.h"
}
static void age_subnets(int fd, short events, void *data) {
- subnet_t *s;
- connection_t *c;
- splay_node_t *node, *next, *node2;
bool left = false;
time_t now = time(NULL);
- for(node = myself->subnet_tree->head; node; node = next) {
- next = node->next;
- s = node->data;
+ for splay_each(subnet_t, s, myself->subnet_tree) {
if(s->expires && s->expires < now) {
if(debug_level >= DEBUG_TRAFFIC) {
char netstr[MAXNETSTR];
logger(DEBUG_TRAFFIC, LOG_INFO, "Subnet %s expired", netstr);
}
- for(node2 = connection_tree->head; node2; node2 = node2->next) {
- c = node2->data;
+ for list_each(connection_t, c, connection_list)
if(c->status.active)
send_del_subnet(c, s);
- }
subnet_del(myself, s);
} else {
}
static void learn_mac(mac_t *address) {
- subnet_t *subnet;
- splay_node_t *node;
- connection_t *c;
-
- subnet = lookup_subnet_mac(myself, address);
+ subnet_t *subnet = lookup_subnet_mac(myself, address);
/* If we don't know this MAC address yet, store it */
/* And tell all other tinc daemons it's our MAC */
- for(node = connection_tree->head; node; node = node->next) {
- c = node->data;
+ for list_each(connection_t, c, connection_list)
if(c->status.active)
send_add_subnet(c, subnet);
- }
if(!timeout_initialized(&age_subnets_event))
timeout_set(&age_subnets_event, age_subnets, NULL);
static void send_pcap(vpn_packet_t *packet) {
pcap = false;
- for(splay_node_t *node = connection_tree->head; node; node = node->next) {
- connection_t *c = node->data;
+
+ for list_each(connection_t, c, connection_list) {
if(!c->status.pcap)
continue;