/*
route.c -- routing
- Copyright (C) 2000-2002 Ivo Timmermans <itimmermans@bigfoot.com>,
- 2000-2002 Guus Sliepen <guus@sliepen.warande.net>
+ Copyright (C) 2000-2002 Ivo Timmermans <ivo@o2w.nl>,
+ 2000-2002 Guus Sliepen <guus@sliepen.eu.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
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.41 2002/06/08 13:46:07 guus Exp $
+ $Id: route.c,v 1.1.2.44 2002/09/09 19:40:11 guus Exp $
*/
#include "config.h"
#ifdef HAVE_NET_ETHERNET_H
#include <net/ethernet.h>
#endif
+#ifdef HAVE_NETINET_IN_SYSTM_H
+ #include <netinet/in_systm.h>
+#endif
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <netinet/if_ether.h>
subnet_t *subnet;
avl_node_t *node;
connection_t *c;
-cp
+ cp();
subnet = lookup_subnet_mac(address);
/* If we don't know this MAC address yet, store it */
subnet_t *s;
connection_t *c;
avl_node_t *node, *next, *node2;
-cp
+ cp();
for(node = myself->subnet_tree->head; node; node = next)
{
next = node->next;
subnet_del(myself, s);
}
}
-cp
+ cp();
}
node_t *route_mac(vpn_packet_t *packet)
{
subnet_t *subnet;
-cp
+ cp();
/* Learn source address */
learn_mac((mac_t *)(&packet->data[6]));
node_t *route_ipv4(vpn_packet_t *packet)
{
subnet_t *subnet;
-cp
+ cp();
if(priorityinheritance)
packet->priority = packet->data[15];
subnet = lookup_subnet_ipv4((ipv4_t *)&packet->data[30]);
-cp
+ cp();
if(!subnet)
{
if(debug_lvl >= DEBUG_TRAFFIC)
return NULL;
}
-cp
+ cp();
return subnet->owner;
}
node_t *route_ipv6(vpn_packet_t *packet)
{
subnet_t *subnet;
-cp
+ cp();
subnet = lookup_subnet_ipv6((ipv6_t *)&packet->data[38]);
-cp
+ cp();
if(!subnet)
{
if(debug_lvl >= DEBUG_TRAFFIC)
return NULL;
}
-cp
+ cp();
return subnet->owner;
}
uint8_t junk[4];
} pseudo;
-cp
+ cp();
hdr = (struct ip6_hdr *)(packet->data + 14);
ns = (struct nd_neighbor_solicit *)(packet->data + 14 + sizeof(*hdr));
opt = (struct nd_opt_hdr *)(packet->data + 14 + sizeof(*hdr) + sizeof(*ns));
ns->nd_ns_hdr.icmp6_cksum = htons(checksum);
write_packet(packet);
-cp
+ cp();
}
void route_arp(vpn_packet_t *packet)
struct ether_arp *arp;
subnet_t *subnet;
uint8_t ipbuf[4];
-cp
+ cp();
/* First, snatch the source address from the ARP packet */
memcpy(mymac.net.mac.address.x, packet->data + 6, 6);
arp->arp_op = htons(ARPOP_REPLY);
write_packet(packet);
-cp
+ cp();
}
void route_outgoing(vpn_packet_t *packet)
{
uint16_t type;
node_t *n = NULL;
-cp
+ cp();
/* FIXME: multicast? */
switch(routing_mode)