diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-12 11:16:39 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-12 11:16:39 +0000 |
commit | 691b149091d9bb9b57bf4a82bb370de72fe96aeb (patch) | |
tree | 2dd1557904362f96288fbfaefbcb7480e6ab579d /src/vpn | |
parent | d1187599c5b15a1eb206926012e7fbe530f20fe1 (diff) | |
download | gnunet-691b149091d9bb9b57bf4a82bb370de72fe96aeb.tar.gz gnunet-691b149091d9bb9b57bf4a82bb370de72fe96aeb.zip |
-ICMPv6 has a different protocol number than ICMPv4, fix code accordingly
Diffstat (limited to 'src/vpn')
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index c8ffa8586..26deeee25 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -857,7 +857,7 @@ expire_tunnel (struct TunnelState *except) | |||
857 | * | 857 | * |
858 | * @param destination description of the destination | 858 | * @param destination description of the destination |
859 | * @param af address family on this end (AF_INET or AF_INET6) | 859 | * @param af address family on this end (AF_INET or AF_INET6) |
860 | * @param protocol IPPROTO_TCP or IPPROTO_UDP | 860 | * @param protocol IPPROTO_TCP or IPPROTO_UDP or IPPROTO_ICMP or IPPROTO_ICMPV6 |
861 | * @param source_ip source IP used by the sender (struct in_addr or struct in6_addr) | 861 | * @param source_ip source IP used by the sender (struct in_addr or struct in6_addr) |
862 | * @param destination_ip destination IP used by the sender (struct in_addr or struct in6_addr) | 862 | * @param destination_ip destination IP used by the sender (struct in_addr or struct in6_addr) |
863 | * @param payload payload of the packet after the IP header | 863 | * @param payload payload of the packet after the IP header |
@@ -936,8 +936,14 @@ route_packet (struct DestinationEntry *destination, | |||
936 | &key); | 936 | &key); |
937 | } | 937 | } |
938 | break; | 938 | break; |
939 | case IPPROTO_ICMP: | 939 | case IPPROTO_ICMP: |
940 | case IPPROTO_ICMPV6: | ||
940 | { | 941 | { |
942 | if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) ) | ||
943 | { | ||
944 | GNUNET_break (0); | ||
945 | return; | ||
946 | } | ||
941 | if (payload_length < sizeof (struct GNUNET_TUN_IcmpHeader)) | 947 | if (payload_length < sizeof (struct GNUNET_TUN_IcmpHeader)) |
942 | { | 948 | { |
943 | /* blame kernel? */ | 949 | /* blame kernel? */ |
@@ -948,7 +954,7 @@ route_packet (struct DestinationEntry *destination, | |||
948 | source_port = 0; | 954 | source_port = 0; |
949 | destination_port = 0; | 955 | destination_port = 0; |
950 | get_tunnel_key_from_ips (af, | 956 | get_tunnel_key_from_ips (af, |
951 | IPPROTO_ICMP, | 957 | protocol, |
952 | source_ip, | 958 | source_ip, |
953 | 0, | 959 | 0, |
954 | destination_ip, | 960 | destination_ip, |
@@ -1238,6 +1244,7 @@ route_packet (struct DestinationEntry *destination, | |||
1238 | } | 1244 | } |
1239 | break; | 1245 | break; |
1240 | case IPPROTO_ICMP: | 1246 | case IPPROTO_ICMP: |
1247 | case IPPROTO_ICMPV6: | ||
1241 | if (destination->is_service) | 1248 | if (destination->is_service) |
1242 | { | 1249 | { |
1243 | struct GNUNET_EXIT_IcmpServiceMessage *ism; | 1250 | struct GNUNET_EXIT_IcmpServiceMessage *ism; |
@@ -1875,7 +1882,7 @@ receive_icmp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1875 | tun->flags = htons (0); | 1882 | tun->flags = htons (0); |
1876 | tun->proto = htons (ETH_P_IPV6); | 1883 | tun->proto = htons (ETH_P_IPV6); |
1877 | GNUNET_TUN_initialize_ipv6_header (ipv6, | 1884 | GNUNET_TUN_initialize_ipv6_header (ipv6, |
1878 | IPPROTO_ICMP, | 1885 | IPPROTO_ICMPV6, |
1879 | sizeof (struct GNUNET_TUN_IcmpHeader) + mlen, | 1886 | sizeof (struct GNUNET_TUN_IcmpHeader) + mlen, |
1880 | &ts->destination_ip.v6, | 1887 | &ts->destination_ip.v6, |
1881 | &ts->source_ip.v6); | 1888 | &ts->source_ip.v6); |