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.45 2002/09/09 21:25:07 guus Exp $
+ $Id: route.c,v 1.1.2.46 2002/09/09 22:33:16 guus Exp $
*/
#include "config.h"
int macexpire = 600;
subnet_t mymac;
-void learn_mac(mac_t * address)
+void learn_mac(mac_t *address)
{
subnet_t *subnet;
avl_node_t *node;
}
}
-node_t *route_mac(vpn_packet_t * packet)
+node_t *route_mac(vpn_packet_t *packet)
{
subnet_t *subnet;
/* Learn source address */
- learn_mac((mac_t *) (&packet->data[6]));
+ learn_mac((mac_t *)(&packet->data[6]));
/* Lookup destination address */
- subnet = lookup_subnet_mac((mac_t *) (&packet->data[0]));
+ subnet = lookup_subnet_mac((mac_t *)(&packet->data[0]));
if(subnet)
return subnet->owner;
return NULL;
}
-node_t *route_ipv4(vpn_packet_t * packet)
+node_t *route_ipv4(vpn_packet_t *packet)
{
subnet_t *subnet;
return subnet->owner;
}
-node_t *route_ipv6(vpn_packet_t * packet)
+node_t *route_ipv6(vpn_packet_t *packet)
{
subnet_t *subnet;
return subnet->owner;
}
-uint16_t inet_checksum(uint16_t * data, int len, uint16_t prevsum)
+uint16_t inet_checksum(uint16_t *data, int len, uint16_t prevsum)
{
uint32_t checksum = prevsum ^ 0xFFFF;
return checksum ^ 0xFFFF;
}
-void route_neighborsol(vpn_packet_t * packet)
+void route_neighborsol(vpn_packet_t *packet)
{
struct ip6_hdr *hdr;
struct nd_neighbor_solicit *ns;
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));
+ 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));
/* First, snatch the source address from the neighbor solicitation packet */
write_packet(packet);
}
-void route_arp(vpn_packet_t * packet)
+void route_arp(vpn_packet_t *packet)
{
struct ether_arp *arp;
subnet_t *subnet;
Most of the code here is taken from choparp.c by Takamichi Tateoka (tree@mma.club.uec.ac.jp)
*/
- arp = (struct ether_arp *) (packet->data + 14);
+ arp = (struct ether_arp *)(packet->data + 14);
/* Check if this is a valid ARP request */
write_packet(packet);
}
-void route_outgoing(vpn_packet_t * packet)
+void route_outgoing(vpn_packet_t *packet)
{
uint16_t type;
node_t *n = NULL;
switch (routing_mode) {
case RMODE_ROUTER:
- type = ntohs(*((uint16_t *) (&packet->data[12])));
+ type = ntohs(*((uint16_t *)(&packet->data[12])));
switch (type) {
case 0x0800:
n = route_ipv4(packet);
}
}
-void route_incoming(node_t * source, vpn_packet_t * packet)
+void route_incoming(node_t *source, vpn_packet_t *packet)
{
switch (routing_mode) {
case RMODE_ROUTER:
node_t *n = NULL;
uint16_t type;
- type = ntohs(*((uint16_t *) (&packet->data[12])));
+ type = ntohs(*((uint16_t *)(&packet->data[12])));
switch (type) {
case 0x0800:
n = route_ipv4(packet);
{
subnet_t *subnet;
- subnet = lookup_subnet_mac((mac_t *) (&packet->data[0]));
+ subnet = lookup_subnet_mac((mac_t *)(&packet->data[0]));
if(subnet) {
if(subnet->owner == myself)