projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused variables, fix some #includes.
[tinc]
/
src
/
route.c
diff --git
a/src/route.c
b/src/route.c
index
c760466
..
cec35ca
100644
(file)
--- a/
src/route.c
+++ b/
src/route.c
@@
-1,7
+1,7
@@
/*
route.c -- routing
Copyright (C) 2000-2005 Ivo Timmermans,
/*
route.c -- routing
Copyright (C) 2000-2005 Ivo Timmermans,
- 2000-201
0
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-201
2
Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-20,7
+20,6
@@
#include "system.h"
#include "system.h"
-#include "splay_tree.h"
#include "connection.h"
#include "control_common.h"
#include "ethernet.h"
#include "connection.h"
#include "control_common.h"
#include "ethernet.h"
@@
-36,12
+35,12
@@
rmode_t routing_mode = RMODE_ROUTER;
fmode_t forwarding_mode = FMODE_INTERNAL;
rmode_t routing_mode = RMODE_ROUTER;
fmode_t forwarding_mode = FMODE_INTERNAL;
-bool decrement_ttl = true;
+bmode_t broadcast_mode = BMODE_MST;
+bool decrement_ttl = false;
bool directonly = false;
bool priorityinheritance = false;
int macexpire = 600;
bool overwrite_mac = false;
bool directonly = false;
bool priorityinheritance = false;
int macexpire = 600;
bool overwrite_mac = false;
-bool broadcast = true;
mac_t mymac = {{0xFE, 0xFD, 0, 0, 0, 0}};
bool pcap = false;
mac_t mymac = {{0xFE, 0xFD, 0, 0, 0, 0}};
bool pcap = false;
@@
-187,15
+186,10
@@
static void swap_mac_addresses(vpn_packet_t *packet) {
}
static void age_subnets(int fd, short events, void *data) {
}
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);
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];
if(s->expires && s->expires < now) {
if(debug_level >= DEBUG_TRAFFIC) {
char netstr[MAXNETSTR];
@@
-203,11
+197,9
@@
static void age_subnets(int fd, short events, void *data) {
logger(DEBUG_TRAFFIC, LOG_INFO, "Subnet %s expired", netstr);
}
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);
if(c->status.active)
send_del_subnet(c, s);
- }
subnet_del(myself, s);
} else {
subnet_del(myself, s);
} else {
@@
-221,11
+213,7
@@
static void age_subnets(int fd, short events, void *data) {
}
static void learn_mac(mac_t *address) {
}
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 */
/* If we don't know this MAC address yet, store it */
@@
-244,11
+232,9
@@
static void learn_mac(mac_t *address) {
/* And tell all other tinc daemons it's our MAC */
/* 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(c->status.active)
send_add_subnet(c, subnet);
- }
if(!timeout_initialized(&age_subnets_event))
timeout_set(&age_subnets_event, age_subnets, NULL);
if(!timeout_initialized(&age_subnets_event))
timeout_set(&age_subnets_event, age_subnets, NULL);
@@
-447,7
+433,7
@@
static void route_ipv4(node_t *source, vpn_packet_t *packet) {
if(!checklength(source, packet, ether_size + ip_size))
return;
if(!checklength(source, packet, ether_size + ip_size))
return;
- if(broadcast && (((packet->data[30] & 0xf0) == 0xe0) || (
+ if(broadcast
_mode
&& (((packet->data[30] & 0xf0) == 0xe0) || (
packet->data[30] == 255 &&
packet->data[31] == 255 &&
packet->data[32] == 255 &&
packet->data[30] == 255 &&
packet->data[31] == 255 &&
packet->data[32] == 255 &&
@@
-744,7
+730,7
@@
static void route_ipv6(node_t *source, vpn_packet_t *packet) {
return;
}
return;
}
- if(broadcast && packet->data[38] == 255)
+ if(broadcast
_mode
&& packet->data[38] == 255)
broadcast_packet(source, packet);
else
route_ipv6_unicast(source, packet);
broadcast_packet(source, packet);
else
route_ipv6_unicast(source, packet);
@@
-834,8
+820,7
@@
static void route_mac(node_t *source, vpn_packet_t *packet) {
subnet = lookup_subnet_mac(NULL, &dest);
if(!subnet) {
subnet = lookup_subnet_mac(NULL, &dest);
if(!subnet) {
- if(broadcast)
- broadcast_packet(source, packet);
+ broadcast_packet(source, packet);
return;
}
return;
}
@@
-879,8
+864,8
@@
static void route_mac(node_t *source, vpn_packet_t *packet) {
static void send_pcap(vpn_packet_t *packet) {
pcap = false;
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;
if(!c->status.pcap)
continue;