- dst = lookup_subnet_mac((mac_t *)(&packet->data[6]))->owner;
-
- if(!dst)
- if(debug_lvl >= DEBUG_TRAFFIC)
- {
- syslog(LOG_WARNING, _("Cannot route packet: unknown destination address %x:%x:%x:%x:%x:%x"),
- packet->data[6],
- packet->data[7],
- packet->data[8],
- packet->data[9],
- packet->data[10],
- packet->data[11]);
- }
-cp
- return dst;
+ subnet = lookup_subnet_mac((mac_t *)(&packet->data[0]));
+
+ if(subnet)
+ return subnet->owner;
+ else
+ return NULL;
+}
+
+node_t *route_ipv4(vpn_packet_t *packet)
+{
+ subnet_t *subnet;
+cp
+ if(priorityinheritance)
+ packet->priority = packet->data[15];
+
+ subnet = lookup_subnet_ipv4((ipv4_t *)&packet->data[30]);
+cp
+ if(!subnet)
+ {
+ if(debug_lvl >= DEBUG_TRAFFIC)
+ {
+ syslog(LOG_WARNING, _("Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d"),
+ packet->data[30], packet->data[31], packet->data[32], packet->data[33]);
+ }
+
+ return NULL;
+ }
+cp
+ return subnet->owner;
+}
+
+node_t *route_ipv6(vpn_packet_t *packet)
+{
+ subnet_t *subnet;
+cp
+ subnet = lookup_subnet_ipv6((ipv6_t *)&packet->data[38]);
+cp
+ if(!subnet)
+ {
+ if(debug_lvl >= DEBUG_TRAFFIC)
+ {
+ syslog(LOG_WARNING, _("Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"),
+ ntohs(*(short unsigned int *)&packet->data[38]),
+ ntohs(*(short unsigned int *)&packet->data[40]),
+ ntohs(*(short unsigned int *)&packet->data[42]),
+ ntohs(*(short unsigned int *)&packet->data[44]),
+ ntohs(*(short unsigned int *)&packet->data[46]),
+ ntohs(*(short unsigned int *)&packet->data[48]),
+ ntohs(*(short unsigned int *)&packet->data[50]),
+ ntohs(*(short unsigned int *)&packet->data[52]));
+ }
+
+ return NULL;
+ }
+cp
+ return subnet->owner;