GNUNET_HashCode key;
struct TunnelState *state;
- if (protocol == IPPROTO_ICMP)
+ if ( ( (af == AF_INET) && (proto == IPPROTO_ICMP) ) ||
+ ( (af == AF_INET6) && (proto == IPPROTO_ICMPV6) ) )
{
/* ignore ports */
destination_port = 0;
existing session from the IP data in the ICMP payload */
source_port = 0;
destination_port = 0;
- protocol = IPPROTO_ICMP;
switch (af)
{
case AF_INET:
+ protocol = IPPROTO_ICMP;
switch (icmp->type)
{
case GNUNET_TUN_ICMPTYPE_ECHO_REPLY:
}
break;
case AF_INET6:
+ protocol = IPPROTO_ICMPV6;
switch (icmp->type)
{
case GNUNET_TUN_ICMPTYPE6_DESTINATION_UNREACHABLE:
destination_ip, 0,
NULL);
break;
+ case IPPROTO_ICMPV6:
+ state = get_redirect_state (af, IPPROTO_ICMPV6,
+ source_ip, 0,
+ destination_ip, 0,
+ NULL);
+ break;
case IPPROTO_UDP:
state = get_redirect_state (af, IPPROTO_UDP,
source_ip,
&pkt6->destination_address,
&pkt6->source_address);
break;
- case IPPROTO_ICMP:
+ case IPPROTO_ICMPV6:
icmp_from_helper ((const struct GNUNET_TUN_IcmpHeader *) &pkt6[1], size,
AF_INET6,
&pkt6->destination_address,
local_address->proto = (uint8_t) proto;
/* default "local" port range is often 32768--61000,
so we pick a random value in that range */
- if (proto == IPPROTO_ICMP)
+ if ( ( (af == AF_INET) && (proto == IPPROTO_ICMP) ) ||
+ ( (af == AF_INET6) && (proto == IPPROTO_ICMPV6) ) )
local_address->port = 0;
else
local_address->port
tun->proto = htons (ETH_P_IPV6);
GNUNET_TUN_initialize_ipv6_header (ipv6,
- IPPROTO_ICMP,
+ IPPROTO_ICMPV6,
sizeof (struct GNUNET_TUN_IcmpHeader) + payload_length,
&source_address->address.ipv6,
&destination_address->address.ipv6);
if (NULL == state->heap_node)
{
state->ri.remote_address.af = af;
- state->ri.remote_address.proto = IPPROTO_ICMP;
+ state->ri.remote_address.proto = IPPROTO_ICMPV6;
setup_state_record (state);
}
/* check that ICMP type is something we want to support
*
* @param destination description of the destination
* @param af address family on this end (AF_INET or AF_INET6)
- * @param protocol IPPROTO_TCP or IPPROTO_UDP
+ * @param protocol IPPROTO_TCP or IPPROTO_UDP or IPPROTO_ICMP or IPPROTO_ICMPV6
* @param source_ip source IP used by the sender (struct in_addr or struct in6_addr)
* @param destination_ip destination IP used by the sender (struct in_addr or struct in6_addr)
* @param payload payload of the packet after the IP header
&key);
}
break;
- case IPPROTO_ICMP:
+ case IPPROTO_ICMP:
+ case IPPROTO_ICMPV6:
{
+ if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) )
+ {
+ GNUNET_break (0);
+ return;
+ }
if (payload_length < sizeof (struct GNUNET_TUN_IcmpHeader))
{
/* blame kernel? */
source_port = 0;
destination_port = 0;
get_tunnel_key_from_ips (af,
- IPPROTO_ICMP,
+ protocol,
source_ip,
0,
destination_ip,
}
break;
case IPPROTO_ICMP:
+ case IPPROTO_ICMPV6:
if (destination->is_service)
{
struct GNUNET_EXIT_IcmpServiceMessage *ism;
tun->flags = htons (0);
tun->proto = htons (ETH_P_IPV6);
GNUNET_TUN_initialize_ipv6_header (ipv6,
- IPPROTO_ICMP,
+ IPPROTO_ICMPV6,
sizeof (struct GNUNET_TUN_IcmpHeader) + mlen,
&ts->destination_ip.v6,
&ts->source_ip.v6);