We don't have to tell GCC how to cast.
This commit is contained in:
parent
762cc2d279
commit
6c5f3d8b74
17 changed files with 88 additions and 88 deletions
|
@ -29,7 +29,7 @@
|
|||
library for inclusion into tinc (http://tinc.nl.linux.org/) by
|
||||
Guus Sliepen <guus@sliepen.eu.org>.
|
||||
|
||||
$Id: avl_tree.c,v 1.1.2.18 2003/07/30 21:52:41 guus Exp $
|
||||
$Id: avl_tree.c,v 1.1.2.19 2003/08/28 21:05:09 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -280,7 +280,7 @@ void avl_free_tree(avl_tree_t *tree)
|
|||
|
||||
avl_node_t *avl_alloc_node(void)
|
||||
{
|
||||
return (avl_node_t *)xmalloc_and_zero(sizeof(avl_node_t));
|
||||
return xmalloc_and_zero(sizeof(avl_node_t));
|
||||
}
|
||||
|
||||
void avl_free_node(avl_tree_t *tree, avl_node_t *node)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: list.c,v 1.1.2.16 2003/07/17 15:06:25 guus Exp $
|
||||
$Id: list.c,v 1.1.2.17 2003/08/28 21:05:09 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -44,7 +44,7 @@ void list_free(list_t *list)
|
|||
|
||||
list_node_t *list_alloc_node(void)
|
||||
{
|
||||
return (list_node_t *)xmalloc_and_zero(sizeof(list_node_t));
|
||||
return xmalloc_and_zero(sizeof(list_node_t));
|
||||
}
|
||||
|
||||
void list_free_node(list_t *list, list_node_t *node)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: conf.c,v 1.9.4.75 2003/08/08 22:11:54 guus Exp $
|
||||
$Id: conf.c,v 1.9.4.76 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -73,7 +73,7 @@ config_t *new_config(void)
|
|||
{
|
||||
cp();
|
||||
|
||||
return (config_t *) xmalloc_and_zero(sizeof(config_t));
|
||||
return xmalloc_and_zero(sizeof(config_t));
|
||||
}
|
||||
|
||||
void free_config(config_t *cfg)
|
||||
|
@ -131,7 +131,7 @@ config_t *lookup_config_next(const avl_tree_t *config_tree, const config_t *cfg)
|
|||
|
||||
if(node) {
|
||||
if(node->next) {
|
||||
found = (config_t *) node->next->data;
|
||||
found = node->next->data;
|
||||
|
||||
if(!strcasecmp(found->variable, cfg->variable))
|
||||
return found;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: connection.c,v 1.1.2.43 2003/07/29 10:50:15 guus Exp $
|
||||
$Id: connection.c,v 1.1.2.44 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -64,7 +64,7 @@ connection_t *new_connection(void)
|
|||
|
||||
cp();
|
||||
|
||||
c = (connection_t *) xmalloc_and_zero(sizeof(connection_t));
|
||||
c = xmalloc_and_zero(sizeof(connection_t));
|
||||
|
||||
if(!c)
|
||||
return NULL;
|
||||
|
@ -120,7 +120,7 @@ void dump_connections(void)
|
|||
logger(LOG_DEBUG, _("Connections:"));
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
logger(LOG_DEBUG, _(" %s at %s options %lx socket %d status %04x"),
|
||||
c->name, c->hostname, c->options, c->socket, *(uint32_t *)&c->status);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: edge.c,v 1.1.2.26 2003/08/22 11:18:42 guus Exp $
|
||||
$Id: edge.c,v 1.1.2.27 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -88,7 +88,7 @@ edge_t *new_edge(void)
|
|||
{
|
||||
cp();
|
||||
|
||||
return (edge_t *) xmalloc_and_zero(sizeof(edge_t));
|
||||
return xmalloc_and_zero(sizeof(edge_t));
|
||||
}
|
||||
|
||||
void free_edge(edge_t *e)
|
||||
|
@ -148,9 +148,9 @@ void dump_edges(void)
|
|||
logger(LOG_DEBUG, _("Edges:"));
|
||||
|
||||
for(node = node_tree->head; node; node = node->next) {
|
||||
n = (node_t *) node->data;
|
||||
n = node->data;
|
||||
for(node2 = n->edge_tree->head; node2; node2 = node2->next) {
|
||||
e = (edge_t *) node2->data;
|
||||
e = node2->data;
|
||||
address = sockaddr2hostname(&e->address);
|
||||
logger(LOG_DEBUG, _(" %s to %s at %s options %lx weight %d"),
|
||||
e->from->name, e->to->name, address, e->options, e->weight);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: event.c,v 1.1.4.10 2003/07/24 12:08:15 guus Exp $
|
||||
$Id: event.c,v 1.1.4.11 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -61,7 +61,7 @@ event_t *new_event(void)
|
|||
{
|
||||
cp();
|
||||
|
||||
return (event_t *) xmalloc_and_zero(sizeof(event_t));
|
||||
return xmalloc_and_zero(sizeof(event_t));
|
||||
}
|
||||
|
||||
void free_event(event_t *event)
|
||||
|
@ -93,7 +93,7 @@ event_t *get_expired_event(void)
|
|||
cp();
|
||||
|
||||
if(event_tree->head) {
|
||||
event = (event_t *) event_tree->head->data;
|
||||
event = event_tree->head->data;
|
||||
|
||||
if(event->time < now) {
|
||||
avl_delete(event_tree, event);
|
||||
|
|
16
src/graph.c
16
src/graph.c
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: graph.c,v 1.1.2.28 2003/08/22 11:18:42 guus Exp $
|
||||
$Id: graph.c,v 1.1.2.29 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
/* We need to generate two trees from the graph:
|
||||
|
@ -76,7 +76,7 @@ void mst_kruskal(void)
|
|||
/* Clear MST status on connections */
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
c->status.mst = false;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void mst_kruskal(void)
|
|||
/* Clear visited status on nodes */
|
||||
|
||||
for(node = node_tree->head; node; node = node->next) {
|
||||
n = (node_t *) node->data;
|
||||
n = node->data;
|
||||
n->status.visited = false;
|
||||
nodes++;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void mst_kruskal(void)
|
|||
|
||||
for(skipped = false, node = edge_weight_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
e = (edge_t *) node->data;
|
||||
e = node->data;
|
||||
|
||||
if(!e->reverse || e->from->status.visited == e->to->status.visited) {
|
||||
skipped = true;
|
||||
|
@ -158,7 +158,7 @@ void sssp_bfs(void)
|
|||
/* Clear visited status on nodes */
|
||||
|
||||
for(node = node_tree->head; node; node = node->next) {
|
||||
n = (node_t *) node->data;
|
||||
n = node->data;
|
||||
n->status.visited = false;
|
||||
n->status.indirect = true;
|
||||
}
|
||||
|
@ -178,10 +178,10 @@ void sssp_bfs(void)
|
|||
while(todo_tree->head) {
|
||||
for(from = todo_tree->head; from; from = next) { /* "from" is the node from which we start */
|
||||
next = from->next;
|
||||
n = (node_t *) from->data;
|
||||
n = from->data;
|
||||
|
||||
for(to = n->edge_tree->head; to; to = to->next) { /* "to" is the edge connected to "from" */
|
||||
e = (edge_t *) to->data;
|
||||
e = to->data;
|
||||
|
||||
if(!e->reverse)
|
||||
continue;
|
||||
|
@ -245,7 +245,7 @@ void sssp_bfs(void)
|
|||
|
||||
for(node = node_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
n = (node_t *) node->data;
|
||||
n = node->data;
|
||||
|
||||
if(n->status.visited != n->status.reachable) {
|
||||
n->status.reachable = !n->status.reachable;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: device.c,v 1.1.2.20 2003/07/22 20:55:21 guus Exp $
|
||||
$Id: device.c,v 1.1.2.21 2003/08/28 21:05:11 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -94,10 +94,10 @@ bool setup_device(void)
|
|||
if(iface)
|
||||
strncpy(ifr.ifr_name, iface, IFNAMSIZ);
|
||||
|
||||
if(!ioctl(device_fd, TUNSETIFF, (void *) &ifr)) {
|
||||
if(!ioctl(device_fd, TUNSETIFF, &ifr)) {
|
||||
strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
|
||||
iface = ifrname;
|
||||
} else if(!ioctl(device_fd, (('T' << 8) | 202), (void *) &ifr)) {
|
||||
} else if(!ioctl(device_fd, (('T' << 8) | 202), &ifr)) {
|
||||
logger(LOG_WARNING, _("Old ioctl() request was needed for %s"), device);
|
||||
strncpy(ifrname, ifr.ifr_name, IFNAMSIZ);
|
||||
iface = ifrname;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: meta.c,v 1.1.2.43 2003/08/22 11:18:42 guus Exp $
|
||||
$Id: meta.c,v 1.1.2.44 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -80,7 +80,7 @@ void broadcast_meta(connection_t *from, const char *buffer, int length)
|
|||
cp();
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c != from && c->status.active)
|
||||
send_meta(c, buffer, length);
|
||||
|
|
22
src/net.c
22
src/net.c
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: net.c,v 1.35.4.199 2003/08/28 15:27:11 guus Exp $
|
||||
$Id: net.c,v 1.35.4.200 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -63,7 +63,7 @@ static void purge(void)
|
|||
|
||||
for(nnode = node_tree->head; nnode; nnode = nnext) {
|
||||
nnext = nnode->next;
|
||||
n = (node_t *) nnode->data;
|
||||
n = nnode->data;
|
||||
|
||||
if(!n->status.reachable) {
|
||||
ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Purging node %s (%s)"), n->name,
|
||||
|
@ -71,14 +71,14 @@ static void purge(void)
|
|||
|
||||
for(snode = n->subnet_tree->head; snode; snode = snext) {
|
||||
snext = snode->next;
|
||||
s = (subnet_t *) snode->data;
|
||||
s = snode->data;
|
||||
send_del_subnet(broadcast, s);
|
||||
subnet_del(n, s);
|
||||
}
|
||||
|
||||
for(enode = n->edge_tree->head; enode; enode = enext) {
|
||||
enext = enode->next;
|
||||
e = (edge_t *) enode->data;
|
||||
e = enode->data;
|
||||
send_del_edge(broadcast, e);
|
||||
edge_del(e);
|
||||
}
|
||||
|
@ -89,12 +89,12 @@ static void purge(void)
|
|||
|
||||
for(nnode = node_tree->head; nnode; nnode = nnext) {
|
||||
nnext = nnode->next;
|
||||
n = (node_t *) nnode->data;
|
||||
n = nnode->data;
|
||||
|
||||
if(!n->status.reachable) {
|
||||
for(enode = edge_weight_tree->head; enode; enode = enext) {
|
||||
enext = enode->next;
|
||||
e = (edge_t *) enode->data;
|
||||
e = enode->data;
|
||||
|
||||
if(e->to == n)
|
||||
break;
|
||||
|
@ -122,7 +122,7 @@ static int build_fdset(fd_set * fs)
|
|||
|
||||
for(node = connection_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c->status.remove) {
|
||||
connection_del(c);
|
||||
|
@ -224,7 +224,7 @@ static void check_dead_connections(void)
|
|||
|
||||
for(node = connection_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c->last_ping_time + pingtimeout < now) {
|
||||
if(c->status.active) {
|
||||
|
@ -271,7 +271,7 @@ static void check_network_activity(fd_set * f)
|
|||
}
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c->status.remove)
|
||||
continue;
|
||||
|
@ -391,7 +391,7 @@ int main_loop(void)
|
|||
logger(LOG_INFO, _("Flushing event queue"));
|
||||
|
||||
while(event_tree->head) {
|
||||
event = (event_t *) event_tree->head->data;
|
||||
event = event_tree->head->data;
|
||||
event->handler(event->data);
|
||||
event_del(event);
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ int main_loop(void)
|
|||
/* Close connections to hosts that have a changed or deleted host config file */
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c->outgoing) {
|
||||
free(c->outgoing->name);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: net_packet.c,v 1.1.2.39 2003/08/22 11:18:42 guus Exp $
|
||||
$Id: net_packet.c,v 1.1.2.40 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -367,7 +367,7 @@ void broadcast_packet(const node_t *from, vpn_packet_t *packet)
|
|||
packet->len, from->name, from->hostname);
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c->status.active && c->status.mst && c != from->nexthop->connection)
|
||||
send_packet(c->node, packet);
|
||||
|
@ -384,7 +384,7 @@ void flush_queue(node_t *n)
|
|||
|
||||
for(node = n->queue->head; node; node = next) {
|
||||
next = node->next;
|
||||
send_udppacket(n, (vpn_packet_t *) node->data);
|
||||
send_udppacket(n, node->data);
|
||||
list_delete_node(n->queue, node);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: net_setup.c,v 1.1.2.43 2003/08/14 14:21:35 guus Exp $
|
||||
$Id: net_setup.c,v 1.1.2.44 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -362,7 +362,7 @@ bool setup_myself(void)
|
|||
|
||||
myself->connection->outcipher = EVP_bf_ofb();
|
||||
|
||||
myself->key = (char *) xmalloc(myself->keylength);
|
||||
myself->key = xmalloc(myself->keylength);
|
||||
RAND_pseudo_bytes(myself->key, myself->keylength);
|
||||
|
||||
if(!get_config_int(lookup_config(config_tree, "KeyExpire"), &keylifetime))
|
||||
|
@ -549,7 +549,7 @@ void close_network_connections(void)
|
|||
|
||||
for(node = connection_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
|
||||
if(c->outgoing)
|
||||
free(c->outgoing->name), free(c->outgoing), c->outgoing = NULL;
|
||||
|
|
10
src/node.c
10
src/node.c
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: node.c,v 1.1.2.27 2003/08/22 11:18:42 guus Exp $
|
||||
$Id: node.c,v 1.1.2.28 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -72,7 +72,7 @@ void exit_nodes(void)
|
|||
|
||||
node_t *new_node(void)
|
||||
{
|
||||
node_t *n = (node_t *) xmalloc_and_zero(sizeof(*n));
|
||||
node_t *n = xmalloc_and_zero(sizeof(*n));
|
||||
|
||||
cp();
|
||||
|
||||
|
@ -131,13 +131,13 @@ void node_del(node_t *n)
|
|||
|
||||
for(node = n->subnet_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
s = (subnet_t *) node->data;
|
||||
s = node->data;
|
||||
subnet_del(n, s);
|
||||
}
|
||||
|
||||
for(node = n->edge_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
e = (edge_t *) node->data;
|
||||
e = node->data;
|
||||
edge_del(e);
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ void dump_nodes(void)
|
|||
logger(LOG_DEBUG, _("Nodes:"));
|
||||
|
||||
for(node = node_tree->head; node; node = node->next) {
|
||||
n = (node_t *) node->data;
|
||||
n = node->data;
|
||||
logger(LOG_DEBUG, _(" %s at %s cipher %d digest %d maclength %d compression %d options %lx status %04x nexthop %s via %s"),
|
||||
n->name, n->hostname, n->cipher ? n->cipher->nid : 0,
|
||||
n->digest ? n->digest->type : 0, n->maclength, n->compression,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: protocol.c,v 1.28.4.146 2003/08/03 12:38:43 guus Exp $
|
||||
$Id: protocol.c,v 1.28.4.147 2003/08/28 21:05:10 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -219,7 +219,7 @@ bool seen_request(char *request)
|
|||
ifdebug(SCARY_THINGS) logger(LOG_DEBUG, _("Already seen request"));
|
||||
return true;
|
||||
} else {
|
||||
new = (past_request_t *) xmalloc(sizeof(*new));
|
||||
new = xmalloc(sizeof(*new));
|
||||
new->request = xstrdup(request);
|
||||
new->firstseen = now;
|
||||
avl_insert(past_request_tree, new);
|
||||
|
@ -237,7 +237,7 @@ void age_past_requests(void)
|
|||
|
||||
for(node = past_request_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
p = (past_request_t *) node->data;
|
||||
p = node->data;
|
||||
|
||||
if(p->firstseen + pingtimeout < now)
|
||||
avl_delete_node(past_request_tree, node), deleted++;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: protocol_auth.c,v 1.1.4.25 2003/07/22 20:55:20 guus Exp $
|
||||
$Id: protocol_auth.c,v 1.1.4.26 2003/08/28 21:05:11 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -473,15 +473,15 @@ static void send_everything(connection_t *c)
|
|||
/* Send all known subnets and edges */
|
||||
|
||||
for(node = node_tree->head; node; node = node->next) {
|
||||
n = (node_t *) node->data;
|
||||
n = node->data;
|
||||
|
||||
for(node2 = n->subnet_tree->head; node2; node2 = node2->next) {
|
||||
s = (subnet_t *) node2->data;
|
||||
s = node2->data;
|
||||
send_add_subnet(c, s);
|
||||
}
|
||||
|
||||
for(node2 = n->edge_tree->head; node2; node2 = node2->next) {
|
||||
e = (edge_t *) node2->data;
|
||||
e = node2->data;
|
||||
send_add_edge(c, e);
|
||||
}
|
||||
}
|
||||
|
|
46
src/route.c
46
src/route.c
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: route.c,v 1.1.2.63 2003/07/31 13:18:34 guus Exp $
|
||||
$Id: route.c,v 1.1.2.64 2003/08/28 21:05:11 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -113,7 +113,7 @@ static void learn_mac(mac_t *address)
|
|||
/* And tell all other tinc daemons it's our MAC */
|
||||
|
||||
for(node = connection_tree->head; node; node = node->next) {
|
||||
c = (connection_t *) node->data;
|
||||
c = node->data;
|
||||
if(c->status.active)
|
||||
send_add_subnet(c, subnet);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ void age_mac(void)
|
|||
|
||||
for(node = myself->subnet_tree->head; node; node = next) {
|
||||
next = node->next;
|
||||
s = (subnet_t *) node->data;
|
||||
s = node->data;
|
||||
if(s->type == SUBNET_MAC && s->net.mac.lastseen && s->net.mac.lastseen + macexpire < now) {
|
||||
ifdebug(TRAFFIC) logger(LOG_INFO, _("MAC address %hx:%hx:%hx:%hx:%hx:%hx expired"),
|
||||
s->net.mac.address.x[0], s->net.mac.address.x[1],
|
||||
|
@ -140,7 +140,7 @@ void age_mac(void)
|
|||
s->net.mac.address.x[4], s->net.mac.address.x[5]);
|
||||
|
||||
for(node2 = connection_tree->head; node2; node2 = node2->next) {
|
||||
c = (connection_t *) node2->data;
|
||||
c = node2->data;
|
||||
if(c->status.active)
|
||||
send_del_subnet(c, s);
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ static node_t *route_ipv4(vpn_packet_t *packet)
|
|||
if(priorityinheritance)
|
||||
packet->priority = packet->data[15];
|
||||
|
||||
subnet = lookup_subnet_ipv4((ipv4_t *) & packet->data[30]);
|
||||
subnet = lookup_subnet_ipv4((ipv4_t *) &packet->data[30]);
|
||||
|
||||
if(!subnet) {
|
||||
ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d"),
|
||||
|
@ -331,18 +331,18 @@ static node_t *route_ipv6(vpn_packet_t *packet)
|
|||
|
||||
cp();
|
||||
|
||||
subnet = lookup_subnet_ipv6((ipv6_t *) & packet->data[38]);
|
||||
subnet = lookup_subnet_ipv6((ipv6_t *) &packet->data[38]);
|
||||
|
||||
if(!subnet) {
|
||||
ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"),
|
||||
ntohs(*(uint16_t *) & packet->data[38]),
|
||||
ntohs(*(uint16_t *) & packet->data[40]),
|
||||
ntohs(*(uint16_t *) & packet->data[42]),
|
||||
ntohs(*(uint16_t *) & packet->data[44]),
|
||||
ntohs(*(uint16_t *) & packet->data[46]),
|
||||
ntohs(*(uint16_t *) & packet->data[48]),
|
||||
ntohs(*(uint16_t *) & packet->data[50]),
|
||||
ntohs(*(uint16_t *) & packet->data[52]));
|
||||
ntohs(*(uint16_t *) &packet->data[38]),
|
||||
ntohs(*(uint16_t *) &packet->data[40]),
|
||||
ntohs(*(uint16_t *) &packet->data[42]),
|
||||
ntohs(*(uint16_t *) &packet->data[44]),
|
||||
ntohs(*(uint16_t *) &packet->data[46]),
|
||||
ntohs(*(uint16_t *) &packet->data[48]),
|
||||
ntohs(*(uint16_t *) &packet->data[50]),
|
||||
ntohs(*(uint16_t *) &packet->data[52]));
|
||||
route_ipv6_unreachable(packet, ICMP6_DST_UNREACH_ADDR);
|
||||
|
||||
return NULL;
|
||||
|
@ -409,18 +409,18 @@ static void route_neighborsol(vpn_packet_t *packet)
|
|||
|
||||
/* Check if the IPv6 address exists on the VPN */
|
||||
|
||||
subnet = lookup_subnet_ipv6((ipv6_t *) & ns->nd_ns_target);
|
||||
subnet = lookup_subnet_ipv6((ipv6_t *) &ns->nd_ns_target);
|
||||
|
||||
if(!subnet) {
|
||||
ifdebug(TRAFFIC) logger(LOG_WARNING, _("Cannot route packet: neighbor solicitation request for unknown address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[0]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[1]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[2]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[3]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[4]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[5]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[6]),
|
||||
ntohs(((uint16_t *) & ns->nd_ns_target)[7]));
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[0]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[1]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[2]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[3]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[4]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[5]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[6]),
|
||||
ntohs(((uint16_t *) &ns->nd_ns_target)[7]));
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
12
src/subnet.c
12
src/subnet.c
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: subnet.c,v 1.1.2.49 2003/07/30 11:50:45 guus Exp $
|
||||
$Id: subnet.c,v 1.1.2.50 2003/08/28 21:05:11 guus Exp $
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
@ -145,7 +145,7 @@ subnet_t *new_subnet(void)
|
|||
{
|
||||
cp();
|
||||
|
||||
return (subnet_t *) xmalloc_and_zero(sizeof(subnet_t));
|
||||
return xmalloc_and_zero(sizeof(subnet_t));
|
||||
}
|
||||
|
||||
void free_subnet(subnet_t *subnet)
|
||||
|
@ -313,7 +313,7 @@ subnet_t *lookup_subnet_mac(const mac_t *address)
|
|||
subnet.net.mac.address = *address;
|
||||
subnet.owner = NULL;
|
||||
|
||||
p = (subnet_t *) avl_search(subnet_tree, &subnet);
|
||||
p = avl_search(subnet_tree, &subnet);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ subnet_t *lookup_subnet_ipv4(const ipv4_t *address)
|
|||
do {
|
||||
/* Go find subnet */
|
||||
|
||||
p = (subnet_t *) avl_search_closest_smaller(subnet_tree, &subnet);
|
||||
p = avl_search_closest_smaller(subnet_tree, &subnet);
|
||||
|
||||
/* Check if the found subnet REALLY matches */
|
||||
|
||||
|
@ -370,7 +370,7 @@ subnet_t *lookup_subnet_ipv6(const ipv6_t *address)
|
|||
do {
|
||||
/* Go find subnet */
|
||||
|
||||
p = (subnet_t *) avl_search_closest_smaller(subnet_tree, &subnet);
|
||||
p = avl_search_closest_smaller(subnet_tree, &subnet);
|
||||
|
||||
/* Check if the found subnet REALLY matches */
|
||||
|
||||
|
@ -403,7 +403,7 @@ void dump_subnets(void)
|
|||
logger(LOG_DEBUG, _("Subnet list:"));
|
||||
|
||||
for(node = subnet_tree->head; node; node = node->next) {
|
||||
subnet = (subnet_t *) node->data;
|
||||
subnet = node->data;
|
||||
netstr = net2str(subnet);
|
||||
logger(LOG_DEBUG, _(" %s owner %s"), netstr, subnet->owner->name);
|
||||
free(netstr);
|
||||
|
|
Loading…
Reference in a new issue