type = DATA(packet)[16] << 8 | DATA(packet)[17];
}
+ /* IP in IP (RFC 2003) packet */
+ if(type == ETH_P_IP && DATA(packet)[start + 9] == 4) {
+ start += 20;
+ }
+
+ if(packet->len <= start + 20) {
+ return;
+ }
+
if(type == ETH_P_IP && DATA(packet)[start + 9] == 6) {
start += (DATA(packet)[start] & 0xf) * 4;
} else if(type == ETH_P_IPV6 && DATA(packet)[start + 6] == 6) {
}
if(!subnet->owner->status.reachable) {
- return route_ipv4_unreachable(source, packet, ether_size, ICMP_DEST_UNREACH, ICMP_NET_UNREACH);
+ route_ipv4_unreachable(source, packet, ether_size, ICMP_DEST_UNREACH, ICMP_NET_UNREACH);
+ return;
}
if(forwarding_mode == FMODE_OFF && source != myself && subnet->owner != myself) {
- return route_ipv4_unreachable(source, packet, ether_size, ICMP_DEST_UNREACH, ICMP_NET_ANO);
+ route_ipv4_unreachable(source, packet, ether_size, ICMP_DEST_UNREACH, ICMP_NET_ANO);
+ return;
}
if(decrement_ttl && source != myself && subnet->owner != myself)
}
if(directonly && subnet->owner != via) {
- return route_ipv4_unreachable(source, packet, ether_size, ICMP_DEST_UNREACH, ICMP_NET_ANO);
+ route_ipv4_unreachable(source, packet, ether_size, ICMP_DEST_UNREACH, ICMP_NET_ANO);
+ return;
}
if(via && packet->len > MAX(via->mtu, 590) && via != myself) {
}
if(!subnet->owner->status.reachable) {
- return route_ipv6_unreachable(source, packet, ether_size, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOROUTE);
+ route_ipv6_unreachable(source, packet, ether_size, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOROUTE);
+ return;
}
if(forwarding_mode == FMODE_OFF && source != myself && subnet->owner != myself) {
- return route_ipv6_unreachable(source, packet, ether_size, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN);
+ route_ipv6_unreachable(source, packet, ether_size, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN);
+ return;
}
if(decrement_ttl && source != myself && subnet->owner != myself)
}
if(directonly && subnet->owner != via) {
- return route_ipv6_unreachable(source, packet, ether_size, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN);
+ route_ipv6_unreachable(source, packet, ether_size, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADMIN);
+ return;
}
if(via && packet->len > MAX(via->mtu, 1294) && via != myself) {