aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-30 12:44:32 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-30 12:44:32 +0000
commit0cccabf5c6afcff54573de1b4ed761085a27310d (patch)
treeb64756aa7ace520419f102c50f6dbeb771040463 /src/vpn
parent9ff99f23db620008bc3525f798bc395915c2e68b (diff)
downloadgnunet-0cccabf5c6afcff54573de1b4ed761085a27310d.tar.gz
gnunet-0cccabf5c6afcff54573de1b4ed761085a27310d.zip
-renaming some fields, fixing byte order issues
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-service-vpn.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index a32e739d2..8e6ae655d 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -881,8 +881,8 @@ route_packet (struct DestinationEntry *destination,
881 const struct GNUNET_TUN_UdpHeader *udp; 881 const struct GNUNET_TUN_UdpHeader *udp;
882 const struct GNUNET_TUN_TcpHeader *tcp; 882 const struct GNUNET_TUN_TcpHeader *tcp;
883 const struct GNUNET_TUN_IcmpHeader *icmp; 883 const struct GNUNET_TUN_IcmpHeader *icmp;
884 uint16_t spt; 884 uint16_t source_port;
885 uint16_t dpt; 885 uint16_t destination_port;
886 886
887 switch (protocol) 887 switch (protocol)
888 { 888 {
@@ -900,14 +900,14 @@ route_packet (struct DestinationEntry *destination,
900 GNUNET_break_op (0); 900 GNUNET_break_op (0);
901 return; 901 return;
902 } 902 }
903 spt = ntohs (udp->spt); 903 source_port = ntohs (udp->source_port);
904 dpt = ntohs (udp->dpt); 904 destination_port = ntohs (udp->destination_port);
905 get_tunnel_key_from_ips (af, 905 get_tunnel_key_from_ips (af,
906 IPPROTO_UDP, 906 IPPROTO_UDP,
907 source_ip, 907 source_ip,
908 spt, 908 source_port,
909 destination_ip, 909 destination_ip,
910 dpt, 910 destination_port,
911 &key); 911 &key);
912 } 912 }
913 break; 913 break;
@@ -925,14 +925,14 @@ route_packet (struct DestinationEntry *destination,
925 GNUNET_break_op (0); 925 GNUNET_break_op (0);
926 return; 926 return;
927 } 927 }
928 spt = ntohs (tcp->spt); 928 source_port = ntohs (tcp->source_port);
929 dpt = ntohs (tcp->dpt); 929 destination_port = ntohs (tcp->destination_port);
930 get_tunnel_key_from_ips (af, 930 get_tunnel_key_from_ips (af,
931 IPPROTO_TCP, 931 IPPROTO_TCP,
932 source_ip, 932 source_ip,
933 spt, 933 source_port,
934 destination_ip, 934 destination_ip,
935 dpt, 935 destination_port,
936 &key); 936 &key);
937 } 937 }
938 break; 938 break;
@@ -945,8 +945,8 @@ route_packet (struct DestinationEntry *destination,
945 return; 945 return;
946 } 946 }
947 icmp = payload; 947 icmp = payload;
948 spt = 0; 948 source_port = 0;
949 dpt = 0; 949 destination_port = 0;
950 get_tunnel_key_from_ips (af, 950 get_tunnel_key_from_ips (af,
951 IPPROTO_ICMP, 951 IPPROTO_ICMP,
952 source_ip, 952 source_ip,
@@ -986,13 +986,13 @@ route_packet (struct DestinationEntry *destination,
986 "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", 986 "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n",
987 (protocol == IPPROTO_TCP) ? "TCP" : "UDP", 987 (protocol == IPPROTO_TCP) ? "TCP" : "UDP",
988 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), 988 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)),
989 spt, 989 source_port,
990 inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)), 990 inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)),
991 dpt, 991 destination_port,
992 inet_ntop (destination->details.exit_destination.af, 992 inet_ntop (destination->details.exit_destination.af,
993 &destination->details.exit_destination.ip, 993 &destination->details.exit_destination.ip,
994 xbuf, sizeof (xbuf)), 994 xbuf, sizeof (xbuf)),
995 dpt); 995 destination_port);
996 } 996 }
997 } 997 }
998 else 998 else
@@ -1007,9 +1007,9 @@ route_packet (struct DestinationEntry *destination,
1007 "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", 1007 "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n",
1008 (protocol == IPPROTO_TCP) ? "TCP" : "UDP", 1008 (protocol == IPPROTO_TCP) ? "TCP" : "UDP",
1009 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), 1009 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)),
1010 spt, 1010 source_port,
1011 inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)), 1011 inet_ntop (af, destination_ip, dbuf, sizeof (dbuf)),
1012 dpt, 1012 destination_port,
1013 GNUNET_h2s (&destination->details.service_destination.service_descriptor), 1013 GNUNET_h2s (&destination->details.service_destination.service_descriptor),
1014 GNUNET_i2s (&destination->details.service_destination.target)); 1014 GNUNET_i2s (&destination->details.service_destination.target));
1015 } 1015 }
@@ -1045,8 +1045,8 @@ route_packet (struct DestinationEntry *destination,
1045 ts->source_ip.v6 = * (const struct in6_addr *) source_ip; 1045 ts->source_ip.v6 = * (const struct in6_addr *) source_ip;
1046 ts->destination_ip.v6 = * (const struct in6_addr *) destination_ip; 1046 ts->destination_ip.v6 = * (const struct in6_addr *) destination_ip;
1047 } 1047 }
1048 ts->source_port = spt; 1048 ts->source_port = source_port;
1049 ts->destination_port = dpt; 1049 ts->destination_port = destination_port;
1050 ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap, 1050 ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap,
1051 ts, 1051 ts,
1052 GNUNET_TIME_absolute_get ().abs_value); 1052 GNUNET_TIME_absolute_get ().abs_value);
@@ -1093,8 +1093,8 @@ route_packet (struct DestinationEntry *destination,
1093 usm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE); 1093 usm->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_SERVICE);
1094 /* if the source port is below 32000, we assume it has a special 1094 /* if the source port is below 32000, we assume it has a special
1095 meaning; if not, we pick a random port (this is a heuristic) */ 1095 meaning; if not, we pick a random port (this is a heuristic) */
1096 usm->source_port = (ntohs (udp->spt) < 32000) ? udp->spt : 0; 1096 usm->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0;
1097 usm->destination_port = udp->dpt; 1097 usm->destination_port = udp->destination_port;
1098 usm->service_descriptor = destination->details.service_destination.service_descriptor; 1098 usm->service_descriptor = destination->details.service_destination.service_descriptor;
1099 memcpy (&usm[1], 1099 memcpy (&usm[1],
1100 &udp[1], 1100 &udp[1],
@@ -1122,8 +1122,8 @@ route_packet (struct DestinationEntry *destination,
1122 uim->header.size = htons ((uint16_t) mlen); 1122 uim->header.size = htons ((uint16_t) mlen);
1123 uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); 1123 uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET);
1124 uim->af = htonl (destination->details.exit_destination.af); 1124 uim->af = htonl (destination->details.exit_destination.af);
1125 uim->source_port = (ntohs (udp->spt) < 32000) ? udp->spt : 0; 1125 uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0;
1126 uim->destination_port = udp->dpt; 1126 uim->destination_port = udp->destination_port;
1127 switch (destination->details.exit_destination.af) 1127 switch (destination->details.exit_destination.af)
1128 { 1128 {
1129 case AF_INET: 1129 case AF_INET:
@@ -1630,8 +1630,8 @@ make_up_icmpv4_payload (struct TunnelState *ts,
1630 sizeof (struct GNUNET_TUN_TcpHeader), 1630 sizeof (struct GNUNET_TUN_TcpHeader),
1631 &ts->source_ip.v4, 1631 &ts->source_ip.v4,
1632 &ts->destination_ip.v4); 1632 &ts->destination_ip.v4);
1633 udp->spt = htons (ts->source_port); 1633 udp->source_port = htons (ts->source_port);
1634 udp->dpt = htons (ts->destination_port); 1634 udp->destination_port = htons (ts->destination_port);
1635 udp->len = htons (0); 1635 udp->len = htons (0);
1636 udp->crc = htons (0); 1636 udp->crc = htons (0);
1637} 1637}
@@ -1656,8 +1656,8 @@ make_up_icmpv6_payload (struct TunnelState *ts,
1656 sizeof (struct GNUNET_TUN_TcpHeader), 1656 sizeof (struct GNUNET_TUN_TcpHeader),
1657 &ts->source_ip.v6, 1657 &ts->source_ip.v6,
1658 &ts->destination_ip.v6); 1658 &ts->destination_ip.v6);
1659 udp->spt = htons (ts->source_port); 1659 udp->source_port = htons (ts->source_port);
1660 udp->dpt = htons (ts->destination_port); 1660 udp->destination_port = htons (ts->destination_port);
1661 udp->len = htons (0); 1661 udp->len = htons (0);
1662 udp->crc = htons (0); 1662 udp->crc = htons (0);
1663} 1663}
@@ -2085,13 +2085,13 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2085 &ts->destination_ip.v4, 2085 &ts->destination_ip.v4,
2086 &ts->source_ip.v4); 2086 &ts->source_ip.v4);
2087 if (0 == ntohs (reply->source_port)) 2087 if (0 == ntohs (reply->source_port))
2088 udp->spt = htons (ts->destination_port); 2088 udp->source_port = htons (ts->destination_port);
2089 else 2089 else
2090 udp->spt = reply->source_port; 2090 udp->source_port = reply->source_port;
2091 if (0 == ntohs (reply->destination_port)) 2091 if (0 == ntohs (reply->destination_port))
2092 udp->dpt = htons (ts->source_port); 2092 udp->destination_port = htons (ts->source_port);
2093 else 2093 else
2094 udp->dpt = reply->destination_port; 2094 udp->destination_port = reply->destination_port;
2095 udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader)); 2095 udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader));
2096 GNUNET_TUN_calculate_udp4_checksum (ipv4, 2096 GNUNET_TUN_calculate_udp4_checksum (ipv4,
2097 udp, 2097 udp,
@@ -2130,13 +2130,13 @@ receive_udp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2130 &ts->destination_ip.v6, 2130 &ts->destination_ip.v6,
2131 &ts->source_ip.v6); 2131 &ts->source_ip.v6);
2132 if (0 == ntohs (reply->source_port)) 2132 if (0 == ntohs (reply->source_port))
2133 udp->spt = htons (ts->destination_port); 2133 udp->source_port = htons (ts->destination_port);
2134 else 2134 else
2135 udp->spt = reply->source_port; 2135 udp->source_port = reply->source_port;
2136 if (0 == ntohs (reply->destination_port)) 2136 if (0 == ntohs (reply->destination_port))
2137 udp->dpt = htons (ts->source_port); 2137 udp->destination_port = htons (ts->source_port);
2138 else 2138 else
2139 udp->dpt = reply->destination_port; 2139 udp->destination_port = reply->destination_port;
2140 udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader)); 2140 udp->len = htons (mlen + sizeof (struct GNUNET_TUN_UdpHeader));
2141 GNUNET_TUN_calculate_udp6_checksum (ipv6, 2141 GNUNET_TUN_calculate_udp6_checksum (ipv6,
2142 udp, 2142 udp,
@@ -2243,8 +2243,8 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2243 &ts->destination_ip.v4, 2243 &ts->destination_ip.v4,
2244 &ts->source_ip.v4); 2244 &ts->source_ip.v4);
2245 *tcp = data->tcp_header; 2245 *tcp = data->tcp_header;
2246 tcp->spt = htons (ts->destination_port); 2246 tcp->source_port = htons (ts->destination_port);
2247 tcp->dpt = htons (ts->source_port); 2247 tcp->destination_port = htons (ts->source_port);
2248 GNUNET_TUN_calculate_tcp4_checksum (ipv4, 2248 GNUNET_TUN_calculate_tcp4_checksum (ipv4,
2249 tcp, 2249 tcp,
2250 &data[1], 2250 &data[1],
@@ -2282,8 +2282,8 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel,
2282 &ts->destination_ip.v6, 2282 &ts->destination_ip.v6,
2283 &ts->source_ip.v6); 2283 &ts->source_ip.v6);
2284 *tcp = data->tcp_header; 2284 *tcp = data->tcp_header;
2285 tcp->spt = htons (ts->destination_port); 2285 tcp->source_port = htons (ts->destination_port);
2286 tcp->dpt = htons (ts->source_port); 2286 tcp->destination_port = htons (ts->source_port);
2287 GNUNET_TUN_calculate_tcp6_checksum (ipv6, 2287 GNUNET_TUN_calculate_tcp6_checksum (ipv6,
2288 tcp, 2288 tcp,
2289 &data[1], 2289 &data[1],