diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
commit | 61c39c60565b386e0e12ea669556b030e8cd7180 (patch) | |
tree | 59109aeab8297bdc996faca8c4e38ec7426c36cf /src/vpn/gnunet-service-vpn.c | |
parent | 780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff) | |
download | gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip |
-remove trailing whitespace
Diffstat (limited to 'src/vpn/gnunet-service-vpn.c')
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 258 |
1 files changed, 129 insertions, 129 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 13cbf5021..4ecd0dfc1 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * @file vpn/gnunet-service-vpn.c | 22 | * @file vpn/gnunet-service-vpn.c |
23 | * @brief service that opens a virtual interface and allows its clients | 23 | * @brief service that opens a virtual interface and allows its clients |
24 | * to allocate IPs on the virtual interface and to then redirect | 24 | * to allocate IPs on the virtual interface and to then redirect |
25 | * IP traffic received on those IPs via the GNUnet mesh | 25 | * IP traffic received on those IPs via the GNUnet mesh |
26 | * @author Philipp Toelke | 26 | * @author Philipp Toelke |
27 | * @author Christian Grothoff | 27 | * @author Christian Grothoff |
28 | * | 28 | * |
@@ -150,14 +150,14 @@ struct DestinationEntry | |||
150 | 150 | ||
151 | } service_destination; | 151 | } service_destination; |
152 | 152 | ||
153 | struct | 153 | struct |
154 | { | 154 | { |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Address family used (AF_INET or AF_INET6). | 157 | * Address family used (AF_INET or AF_INET6). |
158 | */ | 158 | */ |
159 | int af; | 159 | int af; |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * IP address of the ultimate destination (only used for exit tunnels). | 162 | * IP address of the ultimate destination (only used for exit tunnels). |
163 | */ | 163 | */ |
@@ -177,7 +177,7 @@ struct DestinationEntry | |||
177 | } exit_destination; | 177 | } exit_destination; |
178 | 178 | ||
179 | } details; | 179 | } details; |
180 | 180 | ||
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
@@ -195,7 +195,7 @@ struct TunnelMessageQueueEntry | |||
195 | * This is a doubly-linked list. | 195 | * This is a doubly-linked list. |
196 | */ | 196 | */ |
197 | struct TunnelMessageQueueEntry *prev; | 197 | struct TunnelMessageQueueEntry *prev; |
198 | 198 | ||
199 | /** | 199 | /** |
200 | * Number of bytes in 'msg'. | 200 | * Number of bytes in 'msg'. |
201 | */ | 201 | */ |
@@ -244,7 +244,7 @@ struct TunnelState | |||
244 | /** | 244 | /** |
245 | * Tail of list of messages scheduled for transmission. | 245 | * Tail of list of messages scheduled for transmission. |
246 | */ | 246 | */ |
247 | struct TunnelMessageQueueEntry *tmq_tail; | 247 | struct TunnelMessageQueueEntry *tmq_tail; |
248 | 248 | ||
249 | /** | 249 | /** |
250 | * Destination entry that has a pointer to this tunnel state; | 250 | * Destination entry that has a pointer to this tunnel state; |
@@ -284,7 +284,7 @@ struct TunnelState | |||
284 | * Address if af is AF_INET. | 284 | * Address if af is AF_INET. |
285 | */ | 285 | */ |
286 | struct in_addr v4; | 286 | struct in_addr v4; |
287 | 287 | ||
288 | /** | 288 | /** |
289 | * Address if af is AF_INET6. | 289 | * Address if af is AF_INET6. |
290 | */ | 290 | */ |
@@ -302,7 +302,7 @@ struct TunnelState | |||
302 | * Address if af is AF_INET. | 302 | * Address if af is AF_INET. |
303 | */ | 303 | */ |
304 | struct in_addr v4; | 304 | struct in_addr v4; |
305 | 305 | ||
306 | /** | 306 | /** |
307 | * Address if af is AF_INET6. | 307 | * Address if af is AF_INET6. |
308 | */ | 308 | */ |
@@ -506,7 +506,7 @@ send_client_reply (struct GNUNET_SERVER_Client *client, | |||
506 | switch (result_af) | 506 | switch (result_af) |
507 | { | 507 | { |
508 | case AF_INET: | 508 | case AF_INET: |
509 | rlen = sizeof (struct in_addr); | 509 | rlen = sizeof (struct in_addr); |
510 | break; | 510 | break; |
511 | case AF_INET6: | 511 | case AF_INET6: |
512 | rlen = sizeof (struct in6_addr); | 512 | rlen = sizeof (struct in6_addr); |
@@ -632,8 +632,8 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
632 | ret = tnq->len; | 632 | ret = tnq->len; |
633 | GNUNET_free (tnq); | 633 | GNUNET_free (tnq); |
634 | if (NULL != (tnq = ts->tmq_head)) | 634 | if (NULL != (tnq = ts->tmq_head)) |
635 | ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, | 635 | ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, |
636 | GNUNET_NO /* cork */, | 636 | GNUNET_NO /* cork */, |
637 | GNUNET_TIME_UNIT_FOREVER_REL, | 637 | GNUNET_TIME_UNIT_FOREVER_REL, |
638 | tnq->len, | 638 | tnq->len, |
639 | &send_to_peer_notify_callback, | 639 | &send_to_peer_notify_callback, |
@@ -678,12 +678,12 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq, | |||
678 | ts->th = NULL; | 678 | ts->th = NULL; |
679 | GNUNET_STATISTICS_update (stats, | 679 | GNUNET_STATISTICS_update (stats, |
680 | gettext_noop ("# Bytes dropped in mesh queue (overflow)"), | 680 | gettext_noop ("# Bytes dropped in mesh queue (overflow)"), |
681 | dq->len, | 681 | dq->len, |
682 | GNUNET_NO); | 682 | GNUNET_NO); |
683 | GNUNET_free (dq); | 683 | GNUNET_free (dq); |
684 | } | 684 | } |
685 | if (NULL == ts->th) | 685 | if (NULL == ts->th) |
686 | ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, | 686 | ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, |
687 | GNUNET_NO /* cork */, | 687 | GNUNET_NO /* cork */, |
688 | GNUNET_TIME_UNIT_FOREVER_REL, | 688 | GNUNET_TIME_UNIT_FOREVER_REL, |
689 | tnq->len, | 689 | tnq->len, |
@@ -803,7 +803,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, | |||
803 | char address[GNUNET_TUN_IPV4_REGEXLEN]; | 803 | char address[GNUNET_TUN_IPV4_REGEXLEN]; |
804 | 804 | ||
805 | GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4, | 805 | GNUNET_TUN_ipv4toregexsearch (&dt->destination->details.exit_destination.ip.v4, |
806 | "255.255.255.255", | 806 | "255.255.255.255", |
807 | address); | 807 | address); |
808 | GNUNET_asprintf (&policy, "%s%s%s:%u", | 808 | GNUNET_asprintf (&policy, "%s%s%s:%u", |
809 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 809 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, |
@@ -815,7 +815,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, | |||
815 | case AF_INET6: | 815 | case AF_INET6: |
816 | { | 816 | { |
817 | char address[GNUNET_TUN_IPV6_REGEXLEN]; | 817 | char address[GNUNET_TUN_IPV6_REGEXLEN]; |
818 | 818 | ||
819 | GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, | 819 | GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, |
820 | 128, address); | 820 | 128, address); |
821 | GNUNET_asprintf (&policy, "%s%s%s:%u", | 821 | GNUNET_asprintf (&policy, "%s%s%s:%u", |
@@ -862,7 +862,7 @@ expire_tunnel (struct TunnelState *except) | |||
862 | 862 | ||
863 | 863 | ||
864 | /** | 864 | /** |
865 | * Route a packet via mesh to the given destination. | 865 | * Route a packet via mesh to the given destination. |
866 | * | 866 | * |
867 | * @param destination description of the destination | 867 | * @param destination description of the destination |
868 | * @param af address family on this end (AF_INET or AF_INET6) | 868 | * @param af address family on this end (AF_INET or AF_INET6) |
@@ -930,7 +930,7 @@ route_packet (struct DestinationEntry *destination, | |||
930 | /* blame kernel? */ | 930 | /* blame kernel? */ |
931 | GNUNET_break (0); | 931 | GNUNET_break (0); |
932 | return; | 932 | return; |
933 | } | 933 | } |
934 | udp = NULL; /* make compiler happy */ | 934 | udp = NULL; /* make compiler happy */ |
935 | icmp = NULL; /* make compiler happy */ | 935 | icmp = NULL; /* make compiler happy */ |
936 | tcp = payload; | 936 | tcp = payload; |
@@ -950,8 +950,8 @@ route_packet (struct DestinationEntry *destination, | |||
950 | &key); | 950 | &key); |
951 | } | 951 | } |
952 | break; | 952 | break; |
953 | case IPPROTO_ICMP: | 953 | case IPPROTO_ICMP: |
954 | case IPPROTO_ICMPV6: | 954 | case IPPROTO_ICMPV6: |
955 | { | 955 | { |
956 | if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) ) | 956 | if ( (AF_INET == af) ^ (protocol == IPPROTO_ICMP) ) |
957 | { | 957 | { |
@@ -986,7 +986,7 @@ route_packet (struct DestinationEntry *destination, | |||
986 | } | 986 | } |
987 | alen = 0; | 987 | alen = 0; |
988 | if (! destination->is_service) | 988 | if (! destination->is_service) |
989 | { | 989 | { |
990 | switch (destination->details.exit_destination.af) | 990 | switch (destination->details.exit_destination.af) |
991 | { | 991 | { |
992 | case AF_INET: | 992 | case AF_INET: |
@@ -1003,7 +1003,7 @@ route_packet (struct DestinationEntry *destination, | |||
1003 | char sbuf[INET6_ADDRSTRLEN]; | 1003 | char sbuf[INET6_ADDRSTRLEN]; |
1004 | char dbuf[INET6_ADDRSTRLEN]; | 1004 | char dbuf[INET6_ADDRSTRLEN]; |
1005 | char xbuf[INET6_ADDRSTRLEN]; | 1005 | char xbuf[INET6_ADDRSTRLEN]; |
1006 | 1006 | ||
1007 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1007 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1008 | "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", | 1008 | "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", |
1009 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", | 1009 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", |
@@ -1025,7 +1025,7 @@ route_packet (struct DestinationEntry *destination, | |||
1025 | { | 1025 | { |
1026 | char sbuf[INET6_ADDRSTRLEN]; | 1026 | char sbuf[INET6_ADDRSTRLEN]; |
1027 | char dbuf[INET6_ADDRSTRLEN]; | 1027 | char dbuf[INET6_ADDRSTRLEN]; |
1028 | 1028 | ||
1029 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1029 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1030 | "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", | 1030 | "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", |
1031 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", | 1031 | (protocol == IPPROTO_TCP) ? "TCP" : "UDP", |
@@ -1066,7 +1066,7 @@ route_packet (struct DestinationEntry *destination, | |||
1066 | ts->destination_container = NULL; /* no longer 'contained' */ | 1066 | ts->destination_container = NULL; /* no longer 'contained' */ |
1067 | /* now bind existing "unbound" tunnel to our IP/port tuple */ | 1067 | /* now bind existing "unbound" tunnel to our IP/port tuple */ |
1068 | ts->protocol = protocol; | 1068 | ts->protocol = protocol; |
1069 | ts->af = af; | 1069 | ts->af = af; |
1070 | if (AF_INET == af) | 1070 | if (AF_INET == af) |
1071 | { | 1071 | { |
1072 | ts->source_ip.v4 = * (const struct in_addr *) source_ip; | 1072 | ts->source_ip.v4 = * (const struct in_addr *) source_ip; |
@@ -1086,7 +1086,7 @@ route_packet (struct DestinationEntry *destination, | |||
1086 | GNUNET_CONTAINER_multihashmap_put (tunnel_map, | 1086 | GNUNET_CONTAINER_multihashmap_put (tunnel_map, |
1087 | &key, | 1087 | &key, |
1088 | ts, | 1088 | ts, |
1089 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1089 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1090 | GNUNET_STATISTICS_update (stats, | 1090 | GNUNET_STATISTICS_update (stats, |
1091 | gettext_noop ("# Active tunnels"), | 1091 | gettext_noop ("# Active tunnels"), |
1092 | 1, GNUNET_NO); | 1092 | 1, GNUNET_NO); |
@@ -1096,12 +1096,12 @@ route_packet (struct DestinationEntry *destination, | |||
1096 | else | 1096 | else |
1097 | { | 1097 | { |
1098 | is_new = GNUNET_NO; | 1098 | is_new = GNUNET_NO; |
1099 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 1099 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
1100 | ts->heap_node, | 1100 | ts->heap_node, |
1101 | GNUNET_TIME_absolute_get ().abs_value_us); | 1101 | GNUNET_TIME_absolute_get ().abs_value_us); |
1102 | } | 1102 | } |
1103 | GNUNET_assert (NULL != ts->tunnel); | 1103 | GNUNET_assert (NULL != ts->tunnel); |
1104 | 1104 | ||
1105 | /* send via tunnel */ | 1105 | /* send via tunnel */ |
1106 | switch (protocol) | 1106 | switch (protocol) |
1107 | { | 1107 | { |
@@ -1110,7 +1110,7 @@ route_packet (struct DestinationEntry *destination, | |||
1110 | { | 1110 | { |
1111 | struct GNUNET_EXIT_UdpServiceMessage *usm; | 1111 | struct GNUNET_EXIT_UdpServiceMessage *usm; |
1112 | 1112 | ||
1113 | mlen = sizeof (struct GNUNET_EXIT_UdpServiceMessage) + | 1113 | mlen = sizeof (struct GNUNET_EXIT_UdpServiceMessage) + |
1114 | payload_length - sizeof (struct GNUNET_TUN_UdpHeader); | 1114 | payload_length - sizeof (struct GNUNET_TUN_UdpHeader); |
1115 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1115 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1116 | { | 1116 | { |
@@ -1139,7 +1139,7 @@ route_packet (struct DestinationEntry *destination, | |||
1139 | struct in6_addr *ip6dst; | 1139 | struct in6_addr *ip6dst; |
1140 | void *payload; | 1140 | void *payload; |
1141 | 1141 | ||
1142 | mlen = sizeof (struct GNUNET_EXIT_UdpInternetMessage) + | 1142 | mlen = sizeof (struct GNUNET_EXIT_UdpInternetMessage) + |
1143 | alen + payload_length - sizeof (struct GNUNET_TUN_UdpHeader); | 1143 | alen + payload_length - sizeof (struct GNUNET_TUN_UdpHeader); |
1144 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1144 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1145 | { | 1145 | { |
@@ -1151,7 +1151,7 @@ route_packet (struct DestinationEntry *destination, | |||
1151 | tnq->msg = &tnq[1]; | 1151 | tnq->msg = &tnq[1]; |
1152 | uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1]; | 1152 | uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1]; |
1153 | uim->header.size = htons ((uint16_t) mlen); | 1153 | uim->header.size = htons ((uint16_t) mlen); |
1154 | uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); | 1154 | uim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_UDP_TO_INTERNET); |
1155 | uim->af = htonl (destination->details.exit_destination.af); | 1155 | uim->af = htonl (destination->details.exit_destination.af); |
1156 | uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; | 1156 | uim->source_port = (ntohs (udp->source_port) < 32000) ? udp->source_port : 0; |
1157 | uim->destination_port = udp->destination_port; | 1157 | uim->destination_port = udp->destination_port; |
@@ -1182,7 +1182,7 @@ route_packet (struct DestinationEntry *destination, | |||
1182 | { | 1182 | { |
1183 | struct GNUNET_EXIT_TcpServiceStartMessage *tsm; | 1183 | struct GNUNET_EXIT_TcpServiceStartMessage *tsm; |
1184 | 1184 | ||
1185 | mlen = sizeof (struct GNUNET_EXIT_TcpServiceStartMessage) + | 1185 | mlen = sizeof (struct GNUNET_EXIT_TcpServiceStartMessage) + |
1186 | payload_length - sizeof (struct GNUNET_TUN_TcpHeader); | 1186 | payload_length - sizeof (struct GNUNET_TUN_TcpHeader); |
1187 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1187 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1188 | { | 1188 | { |
@@ -1209,7 +1209,7 @@ route_packet (struct DestinationEntry *destination, | |||
1209 | struct in6_addr *ip6dst; | 1209 | struct in6_addr *ip6dst; |
1210 | void *payload; | 1210 | void *payload; |
1211 | 1211 | ||
1212 | mlen = sizeof (struct GNUNET_EXIT_TcpInternetStartMessage) + | 1212 | mlen = sizeof (struct GNUNET_EXIT_TcpInternetStartMessage) + |
1213 | alen + payload_length - sizeof (struct GNUNET_TUN_TcpHeader); | 1213 | alen + payload_length - sizeof (struct GNUNET_TUN_TcpHeader); |
1214 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1214 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1215 | { | 1215 | { |
@@ -1248,7 +1248,7 @@ route_packet (struct DestinationEntry *destination, | |||
1248 | { | 1248 | { |
1249 | struct GNUNET_EXIT_TcpDataMessage *tdm; | 1249 | struct GNUNET_EXIT_TcpDataMessage *tdm; |
1250 | 1250 | ||
1251 | mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + | 1251 | mlen = sizeof (struct GNUNET_EXIT_TcpDataMessage) + |
1252 | payload_length - sizeof (struct GNUNET_TUN_TcpHeader); | 1252 | payload_length - sizeof (struct GNUNET_TUN_TcpHeader); |
1253 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1253 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1254 | { | 1254 | { |
@@ -1274,7 +1274,7 @@ route_packet (struct DestinationEntry *destination, | |||
1274 | { | 1274 | { |
1275 | struct GNUNET_EXIT_IcmpServiceMessage *ism; | 1275 | struct GNUNET_EXIT_IcmpServiceMessage *ism; |
1276 | 1276 | ||
1277 | mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + | 1277 | mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + |
1278 | payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); | 1278 | payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); |
1279 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1279 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1280 | { | 1280 | { |
@@ -1303,7 +1303,7 @@ route_packet (struct DestinationEntry *destination, | |||
1303 | case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: | 1303 | case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: |
1304 | case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: | 1304 | case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: |
1305 | /* throw away ICMP payload, won't be useful for the other side anyway */ | 1305 | /* throw away ICMP payload, won't be useful for the other side anyway */ |
1306 | payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); | 1306 | payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); |
1307 | break; | 1307 | break; |
1308 | default: | 1308 | default: |
1309 | GNUNET_STATISTICS_update (stats, | 1309 | GNUNET_STATISTICS_update (stats, |
@@ -1321,7 +1321,7 @@ route_packet (struct DestinationEntry *destination, | |||
1321 | case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED: | 1321 | case GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED: |
1322 | case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM: | 1322 | case GNUNET_TUN_ICMPTYPE6_PARAMETER_PROBLEM: |
1323 | /* throw away ICMP payload, won't be useful for the other side anyway */ | 1323 | /* throw away ICMP payload, won't be useful for the other side anyway */ |
1324 | payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); | 1324 | payload_length = sizeof (struct GNUNET_TUN_IcmpHeader); |
1325 | break; | 1325 | break; |
1326 | case GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST: | 1326 | case GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST: |
1327 | case GNUNET_TUN_ICMPTYPE6_ECHO_REPLY: | 1327 | case GNUNET_TUN_ICMPTYPE6_ECHO_REPLY: |
@@ -1340,8 +1340,8 @@ route_packet (struct DestinationEntry *destination, | |||
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | /* update length calculations, as payload_length may have changed */ | 1342 | /* update length calculations, as payload_length may have changed */ |
1343 | mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + | 1343 | mlen = sizeof (struct GNUNET_EXIT_IcmpServiceMessage) + |
1344 | alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); | 1344 | alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); |
1345 | tnq->len = mlen; | 1345 | tnq->len = mlen; |
1346 | ism->header.size = htons ((uint16_t) mlen); | 1346 | ism->header.size = htons ((uint16_t) mlen); |
1347 | /* finally, copy payload (if there is any left...) */ | 1347 | /* finally, copy payload (if there is any left...) */ |
@@ -1356,7 +1356,7 @@ route_packet (struct DestinationEntry *destination, | |||
1356 | struct in6_addr *ip6dst; | 1356 | struct in6_addr *ip6dst; |
1357 | void *payload; | 1357 | void *payload; |
1358 | 1358 | ||
1359 | mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + | 1359 | mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + |
1360 | alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); | 1360 | alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); |
1361 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1361 | if (mlen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1362 | { | 1362 | { |
@@ -1366,7 +1366,7 @@ route_packet (struct DestinationEntry *destination, | |||
1366 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1366 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); |
1367 | tnq->msg = &tnq[1]; | 1367 | tnq->msg = &tnq[1]; |
1368 | iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1]; | 1368 | iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1]; |
1369 | iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); | 1369 | iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); |
1370 | iim->icmp_header = *icmp; | 1370 | iim->icmp_header = *icmp; |
1371 | /* Perform ICMP protocol-translation (depending on destination AF and source AF) | 1371 | /* Perform ICMP protocol-translation (depending on destination AF and source AF) |
1372 | and throw away ICMP payload depending on ICMP message type */ | 1372 | and throw away ICMP payload depending on ICMP message type */ |
@@ -1375,11 +1375,11 @@ route_packet (struct DestinationEntry *destination, | |||
1375 | case AF_INET: | 1375 | case AF_INET: |
1376 | switch (icmp->type) | 1376 | switch (icmp->type) |
1377 | { | 1377 | { |
1378 | case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: | 1378 | case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: |
1379 | if (destination->details.exit_destination.af == AF_INET6) | 1379 | if (destination->details.exit_destination.af == AF_INET6) |
1380 | iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REPLY; | 1380 | iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REPLY; |
1381 | break; | 1381 | break; |
1382 | case GNUNET_TUN_ICMPTYPE_ECHO_REQUEST: | 1382 | case GNUNET_TUN_ICMPTYPE_ECHO_REQUEST: |
1383 | if (destination->details.exit_destination.af == AF_INET6) | 1383 | if (destination->details.exit_destination.af == AF_INET6) |
1384 | iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST; | 1384 | iim->icmp_header.type = GNUNET_TUN_ICMPTYPE6_ECHO_REQUEST; |
1385 | break; | 1385 | break; |
@@ -1411,7 +1411,7 @@ route_packet (struct DestinationEntry *destination, | |||
1411 | GNUNET_STATISTICS_update (stats, | 1411 | GNUNET_STATISTICS_update (stats, |
1412 | gettext_noop ("# ICMPv4 packets dropped (type not allowed)"), | 1412 | gettext_noop ("# ICMPv4 packets dropped (type not allowed)"), |
1413 | 1, GNUNET_NO); | 1413 | 1, GNUNET_NO); |
1414 | GNUNET_free (tnq); | 1414 | GNUNET_free (tnq); |
1415 | return; | 1415 | return; |
1416 | } | 1416 | } |
1417 | /* end of AF_INET */ | 1417 | /* end of AF_INET */ |
@@ -1467,17 +1467,17 @@ route_packet (struct DestinationEntry *destination, | |||
1467 | GNUNET_STATISTICS_update (stats, | 1467 | GNUNET_STATISTICS_update (stats, |
1468 | gettext_noop ("# ICMPv6 packets dropped (type not allowed)"), | 1468 | gettext_noop ("# ICMPv6 packets dropped (type not allowed)"), |
1469 | 1, GNUNET_NO); | 1469 | 1, GNUNET_NO); |
1470 | GNUNET_free (tnq); | 1470 | GNUNET_free (tnq); |
1471 | return; | 1471 | return; |
1472 | } | 1472 | } |
1473 | /* end of AF_INET6 */ | 1473 | /* end of AF_INET6 */ |
1474 | break; | 1474 | break; |
1475 | default: | 1475 | default: |
1476 | GNUNET_assert (0); | 1476 | GNUNET_assert (0); |
1477 | } | 1477 | } |
1478 | /* update length calculations, as payload_length may have changed */ | 1478 | /* update length calculations, as payload_length may have changed */ |
1479 | mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + | 1479 | mlen = sizeof (struct GNUNET_EXIT_IcmpInternetMessage) + |
1480 | alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); | 1480 | alen + payload_length - sizeof (struct GNUNET_TUN_IcmpHeader); |
1481 | tnq->len = mlen; | 1481 | tnq->len = mlen; |
1482 | iim->header.size = htons ((uint16_t) mlen); | 1482 | iim->header.size = htons ((uint16_t) mlen); |
1483 | 1483 | ||
@@ -1549,7 +1549,7 @@ message_token (void *cls, | |||
1549 | case ETH_P_IPV6: | 1549 | case ETH_P_IPV6: |
1550 | { | 1550 | { |
1551 | const struct GNUNET_TUN_IPv6Header *pkt6; | 1551 | const struct GNUNET_TUN_IPv6Header *pkt6; |
1552 | 1552 | ||
1553 | if (mlen < sizeof (struct GNUNET_TUN_IPv6Header)) | 1553 | if (mlen < sizeof (struct GNUNET_TUN_IPv6Header)) |
1554 | { | 1554 | { |
1555 | /* blame kernel */ | 1555 | /* blame kernel */ |
@@ -1576,8 +1576,8 @@ message_token (void *cls, | |||
1576 | route_packet (de, | 1576 | route_packet (de, |
1577 | AF_INET6, | 1577 | AF_INET6, |
1578 | pkt6->next_header, | 1578 | pkt6->next_header, |
1579 | &pkt6->source_address, | 1579 | &pkt6->source_address, |
1580 | &pkt6->destination_address, | 1580 | &pkt6->destination_address, |
1581 | &pkt6[1], | 1581 | &pkt6[1], |
1582 | mlen - sizeof (struct GNUNET_TUN_IPv6Header)); | 1582 | mlen - sizeof (struct GNUNET_TUN_IPv6Header)); |
1583 | } | 1583 | } |
@@ -1612,14 +1612,14 @@ message_token (void *cls, | |||
1612 | if (pkt4->header_length * 4 != sizeof (struct GNUNET_TUN_IPv4Header)) | 1612 | if (pkt4->header_length * 4 != sizeof (struct GNUNET_TUN_IPv4Header)) |
1613 | { | 1613 | { |
1614 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1614 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1615 | _("Received IPv4 packet with options (dropping it)\n")); | 1615 | _("Received IPv4 packet with options (dropping it)\n")); |
1616 | return GNUNET_OK; | 1616 | return GNUNET_OK; |
1617 | } | 1617 | } |
1618 | route_packet (de, | 1618 | route_packet (de, |
1619 | AF_INET, | 1619 | AF_INET, |
1620 | pkt4->protocol, | 1620 | pkt4->protocol, |
1621 | &pkt4->source_address, | 1621 | &pkt4->source_address, |
1622 | &pkt4->destination_address, | 1622 | &pkt4->destination_address, |
1623 | &pkt4[1], | 1623 | &pkt4[1], |
1624 | mlen - sizeof (struct GNUNET_TUN_IPv4Header)); | 1624 | mlen - sizeof (struct GNUNET_TUN_IPv4Header)); |
1625 | } | 1625 | } |
@@ -1696,7 +1696,7 @@ make_up_icmpv6_payload (struct TunnelState *ts, | |||
1696 | * @param message the actual message | 1696 | * @param message the actual message |
1697 | * @return #GNUNET_OK to keep the connection open, | 1697 | * @return #GNUNET_OK to keep the connection open, |
1698 | * #GNUNET_SYSERR to close it (signal serious error) | 1698 | * #GNUNET_SYSERR to close it (signal serious error) |
1699 | */ | 1699 | */ |
1700 | static int | 1700 | static int |
1701 | receive_icmp_back (void *cls, | 1701 | receive_icmp_back (void *cls, |
1702 | struct GNUNET_MESH_Tunnel *tunnel, | 1702 | struct GNUNET_MESH_Tunnel *tunnel, |
@@ -1731,7 +1731,7 @@ receive_icmp_back (void *cls, | |||
1731 | { | 1731 | { |
1732 | char sbuf[INET6_ADDRSTRLEN]; | 1732 | char sbuf[INET6_ADDRSTRLEN]; |
1733 | char dbuf[INET6_ADDRSTRLEN]; | 1733 | char dbuf[INET6_ADDRSTRLEN]; |
1734 | 1734 | ||
1735 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1735 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1736 | "Received ICMP packet from mesh, sending %u bytes from %s -> %s via TUN\n", | 1736 | "Received ICMP packet from mesh, sending %u bytes from %s -> %s via TUN\n", |
1737 | (unsigned int) mlen, | 1737 | (unsigned int) mlen, |
@@ -1742,8 +1742,8 @@ receive_icmp_back (void *cls, | |||
1742 | { | 1742 | { |
1743 | case AF_INET: | 1743 | case AF_INET: |
1744 | { | 1744 | { |
1745 | size_t size = sizeof (struct GNUNET_TUN_IPv4Header) | 1745 | size_t size = sizeof (struct GNUNET_TUN_IPv4Header) |
1746 | + sizeof (struct GNUNET_TUN_IcmpHeader) | 1746 | + sizeof (struct GNUNET_TUN_IcmpHeader) |
1747 | + sizeof (struct GNUNET_MessageHeader) + | 1747 | + sizeof (struct GNUNET_MessageHeader) + |
1748 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + | 1748 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + |
1749 | mlen; | 1749 | mlen; |
@@ -1767,12 +1767,12 @@ receive_icmp_back (void *cls, | |||
1767 | memcpy (&icmp[1], | 1767 | memcpy (&icmp[1], |
1768 | &i2v[1], | 1768 | &i2v[1], |
1769 | mlen); | 1769 | mlen); |
1770 | /* For some ICMP types, we need to adjust (make up) the payload here. | 1770 | /* For some ICMP types, we need to adjust (make up) the payload here. |
1771 | Also, depending on the AF used on the other side, we have to | 1771 | Also, depending on the AF used on the other side, we have to |
1772 | do ICMP PT (translate ICMP types) */ | 1772 | do ICMP PT (translate ICMP types) */ |
1773 | switch (ntohl (i2v->af)) | 1773 | switch (ntohl (i2v->af)) |
1774 | { | 1774 | { |
1775 | case AF_INET: | 1775 | case AF_INET: |
1776 | switch (icmp->type) | 1776 | switch (icmp->type) |
1777 | { | 1777 | { |
1778 | case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: | 1778 | case GNUNET_TUN_ICMPTYPE_ECHO_REPLY: |
@@ -1780,11 +1780,11 @@ receive_icmp_back (void *cls, | |||
1780 | break; | 1780 | break; |
1781 | case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE: | 1781 | case GNUNET_TUN_ICMPTYPE_DESTINATION_UNREACHABLE: |
1782 | case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: | 1782 | case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: |
1783 | case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: | 1783 | case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: |
1784 | { | 1784 | { |
1785 | struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; | 1785 | struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; |
1786 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; | 1786 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; |
1787 | 1787 | ||
1788 | if (mlen != 0) | 1788 | if (mlen != 0) |
1789 | { | 1789 | { |
1790 | /* sender did not strip ICMP payload? */ | 1790 | /* sender did not strip ICMP payload? */ |
@@ -1814,7 +1814,7 @@ receive_icmp_back (void *cls, | |||
1814 | { | 1814 | { |
1815 | struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; | 1815 | struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; |
1816 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; | 1816 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; |
1817 | 1817 | ||
1818 | if (mlen != 0) | 1818 | if (mlen != 0) |
1819 | { | 1819 | { |
1820 | /* sender did not strip ICMP payload? */ | 1820 | /* sender did not strip ICMP payload? */ |
@@ -1831,7 +1831,7 @@ receive_icmp_back (void *cls, | |||
1831 | { | 1831 | { |
1832 | struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; | 1832 | struct GNUNET_TUN_IPv4Header *ipp = (struct GNUNET_TUN_IPv4Header *) &icmp[1]; |
1833 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; | 1833 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; |
1834 | 1834 | ||
1835 | if (mlen != 0) | 1835 | if (mlen != 0) |
1836 | { | 1836 | { |
1837 | /* sender did not strip ICMP payload? */ | 1837 | /* sender did not strip ICMP payload? */ |
@@ -1881,8 +1881,8 @@ receive_icmp_back (void *cls, | |||
1881 | break; | 1881 | break; |
1882 | case AF_INET6: | 1882 | case AF_INET6: |
1883 | { | 1883 | { |
1884 | size_t size = sizeof (struct GNUNET_TUN_IPv6Header) | 1884 | size_t size = sizeof (struct GNUNET_TUN_IPv6Header) |
1885 | + sizeof (struct GNUNET_TUN_IcmpHeader) | 1885 | + sizeof (struct GNUNET_TUN_IcmpHeader) |
1886 | + sizeof (struct GNUNET_MessageHeader) + | 1886 | + sizeof (struct GNUNET_MessageHeader) + |
1887 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + | 1887 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + |
1888 | mlen; | 1888 | mlen; |
@@ -1905,12 +1905,12 @@ receive_icmp_back (void *cls, | |||
1905 | &i2v[1], | 1905 | &i2v[1], |
1906 | mlen); | 1906 | mlen); |
1907 | 1907 | ||
1908 | /* For some ICMP types, we need to adjust (make up) the payload here. | 1908 | /* For some ICMP types, we need to adjust (make up) the payload here. |
1909 | Also, depending on the AF used on the other side, we have to | 1909 | Also, depending on the AF used on the other side, we have to |
1910 | do ICMP PT (translate ICMP types) */ | 1910 | do ICMP PT (translate ICMP types) */ |
1911 | switch (ntohl (i2v->af)) | 1911 | switch (ntohl (i2v->af)) |
1912 | { | 1912 | { |
1913 | case AF_INET: | 1913 | case AF_INET: |
1914 | /* ICMP PT 4-to-6 and possibly making up payloads */ | 1914 | /* ICMP PT 4-to-6 and possibly making up payloads */ |
1915 | switch (icmp->type) | 1915 | switch (icmp->type) |
1916 | { | 1916 | { |
@@ -1925,7 +1925,7 @@ receive_icmp_back (void *cls, | |||
1925 | { | 1925 | { |
1926 | struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; | 1926 | struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; |
1927 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; | 1927 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; |
1928 | 1928 | ||
1929 | if (mlen != 0) | 1929 | if (mlen != 0) |
1930 | { | 1930 | { |
1931 | /* sender did not strip ICMP payload? */ | 1931 | /* sender did not strip ICMP payload? */ |
@@ -1937,12 +1937,12 @@ receive_icmp_back (void *cls, | |||
1937 | make_up_icmpv6_payload (ts, ipp, udp); | 1937 | make_up_icmpv6_payload (ts, ipp, udp); |
1938 | } | 1938 | } |
1939 | break; | 1939 | break; |
1940 | case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: | 1940 | case GNUNET_TUN_ICMPTYPE_TIME_EXCEEDED: |
1941 | icmp->type = GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED; | 1941 | icmp->type = GNUNET_TUN_ICMPTYPE6_TIME_EXCEEDED; |
1942 | { | 1942 | { |
1943 | struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; | 1943 | struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; |
1944 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; | 1944 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; |
1945 | 1945 | ||
1946 | if (mlen != 0) | 1946 | if (mlen != 0) |
1947 | { | 1947 | { |
1948 | /* sender did not strip ICMP payload? */ | 1948 | /* sender did not strip ICMP payload? */ |
@@ -1957,7 +1957,7 @@ receive_icmp_back (void *cls, | |||
1957 | case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: | 1957 | case GNUNET_TUN_ICMPTYPE_SOURCE_QUENCH: |
1958 | GNUNET_STATISTICS_update (stats, | 1958 | GNUNET_STATISTICS_update (stats, |
1959 | gettext_noop ("# ICMPv4 packets dropped (impossible PT to v6)"), | 1959 | gettext_noop ("# ICMPv4 packets dropped (impossible PT to v6)"), |
1960 | 1, GNUNET_NO); | 1960 | 1, GNUNET_NO); |
1961 | return GNUNET_OK; | 1961 | return GNUNET_OK; |
1962 | default: | 1962 | default: |
1963 | GNUNET_break_op (0); | 1963 | GNUNET_break_op (0); |
@@ -1978,7 +1978,7 @@ receive_icmp_back (void *cls, | |||
1978 | { | 1978 | { |
1979 | struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; | 1979 | struct GNUNET_TUN_IPv6Header *ipp = (struct GNUNET_TUN_IPv6Header *) &icmp[1]; |
1980 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; | 1980 | struct GNUNET_TUN_UdpHeader *udp = (struct GNUNET_TUN_UdpHeader *) &ipp[1]; |
1981 | 1981 | ||
1982 | if (mlen != 0) | 1982 | if (mlen != 0) |
1983 | { | 1983 | { |
1984 | /* sender did not strip ICMP payload? */ | 1984 | /* sender did not strip ICMP payload? */ |
@@ -2018,7 +2018,7 @@ receive_icmp_back (void *cls, | |||
2018 | default: | 2018 | default: |
2019 | GNUNET_assert (0); | 2019 | GNUNET_assert (0); |
2020 | } | 2020 | } |
2021 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2021 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
2022 | ts->heap_node, | 2022 | ts->heap_node, |
2023 | GNUNET_TIME_absolute_get ().abs_value_us); | 2023 | GNUNET_TIME_absolute_get ().abs_value_us); |
2024 | return GNUNET_OK; | 2024 | return GNUNET_OK; |
@@ -2035,7 +2035,7 @@ receive_icmp_back (void *cls, | |||
2035 | * @param message the actual message | 2035 | * @param message the actual message |
2036 | * @return #GNUNET_OK to keep the connection open, | 2036 | * @return #GNUNET_OK to keep the connection open, |
2037 | * #GNUNET_SYSERR to close it (signal serious error) | 2037 | * #GNUNET_SYSERR to close it (signal serious error) |
2038 | */ | 2038 | */ |
2039 | static int | 2039 | static int |
2040 | receive_udp_back (void *cls, | 2040 | receive_udp_back (void *cls, |
2041 | struct GNUNET_MESH_Tunnel *tunnel, | 2041 | struct GNUNET_MESH_Tunnel *tunnel, |
@@ -2070,7 +2070,7 @@ receive_udp_back (void *cls, | |||
2070 | { | 2070 | { |
2071 | char sbuf[INET6_ADDRSTRLEN]; | 2071 | char sbuf[INET6_ADDRSTRLEN]; |
2072 | char dbuf[INET6_ADDRSTRLEN]; | 2072 | char dbuf[INET6_ADDRSTRLEN]; |
2073 | 2073 | ||
2074 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2074 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2075 | "Received UDP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", | 2075 | "Received UDP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", |
2076 | (unsigned int) mlen, | 2076 | (unsigned int) mlen, |
@@ -2083,8 +2083,8 @@ receive_udp_back (void *cls, | |||
2083 | { | 2083 | { |
2084 | case AF_INET: | 2084 | case AF_INET: |
2085 | { | 2085 | { |
2086 | size_t size = sizeof (struct GNUNET_TUN_IPv4Header) | 2086 | size_t size = sizeof (struct GNUNET_TUN_IPv4Header) |
2087 | + sizeof (struct GNUNET_TUN_UdpHeader) | 2087 | + sizeof (struct GNUNET_TUN_UdpHeader) |
2088 | + sizeof (struct GNUNET_MessageHeader) + | 2088 | + sizeof (struct GNUNET_MessageHeader) + |
2089 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + | 2089 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + |
2090 | mlen; | 2090 | mlen; |
@@ -2128,8 +2128,8 @@ receive_udp_back (void *cls, | |||
2128 | break; | 2128 | break; |
2129 | case AF_INET6: | 2129 | case AF_INET6: |
2130 | { | 2130 | { |
2131 | size_t size = sizeof (struct GNUNET_TUN_IPv6Header) | 2131 | size_t size = sizeof (struct GNUNET_TUN_IPv6Header) |
2132 | + sizeof (struct GNUNET_TUN_UdpHeader) | 2132 | + sizeof (struct GNUNET_TUN_UdpHeader) |
2133 | + sizeof (struct GNUNET_MessageHeader) + | 2133 | + sizeof (struct GNUNET_MessageHeader) + |
2134 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + | 2134 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + |
2135 | mlen; | 2135 | mlen; |
@@ -2173,7 +2173,7 @@ receive_udp_back (void *cls, | |||
2173 | default: | 2173 | default: |
2174 | GNUNET_assert (0); | 2174 | GNUNET_assert (0); |
2175 | } | 2175 | } |
2176 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2176 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
2177 | ts->heap_node, | 2177 | ts->heap_node, |
2178 | GNUNET_TIME_absolute_get ().abs_value_us); | 2178 | GNUNET_TIME_absolute_get ().abs_value_us); |
2179 | return GNUNET_OK; | 2179 | return GNUNET_OK; |
@@ -2190,7 +2190,7 @@ receive_udp_back (void *cls, | |||
2190 | * @param message the actual message | 2190 | * @param message the actual message |
2191 | * @return #GNUNET_OK to keep the connection open, | 2191 | * @return #GNUNET_OK to keep the connection open, |
2192 | * #GNUNET_SYSERR to close it (signal serious error) | 2192 | * #GNUNET_SYSERR to close it (signal serious error) |
2193 | */ | 2193 | */ |
2194 | static int | 2194 | static int |
2195 | receive_tcp_back (void *cls, | 2195 | receive_tcp_back (void *cls, |
2196 | struct GNUNET_MESH_Tunnel *tunnel, | 2196 | struct GNUNET_MESH_Tunnel *tunnel, |
@@ -2220,7 +2220,7 @@ receive_tcp_back (void *cls, | |||
2220 | { | 2220 | { |
2221 | char sbuf[INET6_ADDRSTRLEN]; | 2221 | char sbuf[INET6_ADDRSTRLEN]; |
2222 | char dbuf[INET6_ADDRSTRLEN]; | 2222 | char dbuf[INET6_ADDRSTRLEN]; |
2223 | 2223 | ||
2224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2225 | "Received TCP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", | 2225 | "Received TCP reply from mesh, sending %u bytes from %s:%u -> %s:%u via TUN\n", |
2226 | (unsigned int) mlen, | 2226 | (unsigned int) mlen, |
@@ -2238,8 +2238,8 @@ receive_tcp_back (void *cls, | |||
2238 | { | 2238 | { |
2239 | case AF_INET: | 2239 | case AF_INET: |
2240 | { | 2240 | { |
2241 | size_t size = sizeof (struct GNUNET_TUN_IPv4Header) | 2241 | size_t size = sizeof (struct GNUNET_TUN_IPv4Header) |
2242 | + sizeof (struct GNUNET_TUN_TcpHeader) | 2242 | + sizeof (struct GNUNET_TUN_TcpHeader) |
2243 | + sizeof (struct GNUNET_MessageHeader) + | 2243 | + sizeof (struct GNUNET_MessageHeader) + |
2244 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + | 2244 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + |
2245 | mlen; | 2245 | mlen; |
@@ -2277,8 +2277,8 @@ receive_tcp_back (void *cls, | |||
2277 | break; | 2277 | break; |
2278 | case AF_INET6: | 2278 | case AF_INET6: |
2279 | { | 2279 | { |
2280 | size_t size = sizeof (struct GNUNET_TUN_IPv6Header) | 2280 | size_t size = sizeof (struct GNUNET_TUN_IPv6Header) |
2281 | + sizeof (struct GNUNET_TUN_TcpHeader) | 2281 | + sizeof (struct GNUNET_TUN_TcpHeader) |
2282 | + sizeof (struct GNUNET_MessageHeader) + | 2282 | + sizeof (struct GNUNET_MessageHeader) + |
2283 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + | 2283 | sizeof (struct GNUNET_TUN_Layer2PacketHeader) + |
2284 | mlen; | 2284 | mlen; |
@@ -2315,7 +2315,7 @@ receive_tcp_back (void *cls, | |||
2315 | } | 2315 | } |
2316 | break; | 2316 | break; |
2317 | } | 2317 | } |
2318 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2318 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, |
2319 | ts->heap_node, | 2319 | ts->heap_node, |
2320 | GNUNET_TIME_absolute_get ().abs_value_us); | 2320 | GNUNET_TIME_absolute_get ().abs_value_us); |
2321 | return GNUNET_OK; | 2321 | return GNUNET_OK; |
@@ -2342,10 +2342,10 @@ allocate_v4_address (struct in_addr *v4) | |||
2342 | unsigned int tries; | 2342 | unsigned int tries; |
2343 | 2343 | ||
2344 | GNUNET_assert (1 == inet_pton (AF_INET, ipv4addr, &addr)); | 2344 | GNUNET_assert (1 == inet_pton (AF_INET, ipv4addr, &addr)); |
2345 | GNUNET_assert (1 == inet_pton (AF_INET, ipv4mask, &mask)); | 2345 | GNUNET_assert (1 == inet_pton (AF_INET, ipv4mask, &mask)); |
2346 | /* Given 192.168.0.1/255.255.0.0, we want a mask | 2346 | /* Given 192.168.0.1/255.255.0.0, we want a mask |
2347 | of '192.168.255.255', thus: */ | 2347 | of '192.168.255.255', thus: */ |
2348 | mask.s_addr = addr.s_addr | ~mask.s_addr; | 2348 | mask.s_addr = addr.s_addr | ~mask.s_addr; |
2349 | tries = 0; | 2349 | tries = 0; |
2350 | do | 2350 | do |
2351 | { | 2351 | { |
@@ -2357,9 +2357,9 @@ allocate_v4_address (struct in_addr *v4) | |||
2357 | return GNUNET_SYSERR; | 2357 | return GNUNET_SYSERR; |
2358 | } | 2358 | } |
2359 | /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */ | 2359 | /* Pick random IPv4 address within the subnet, except 'addr' or 'mask' itself */ |
2360 | rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2360 | rnd.s_addr = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2361 | UINT32_MAX); | 2361 | UINT32_MAX); |
2362 | v4->s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; | 2362 | v4->s_addr = (addr.s_addr | rnd.s_addr) & mask.s_addr; |
2363 | get_destination_key_from_ip (AF_INET, | 2363 | get_destination_key_from_ip (AF_INET, |
2364 | v4, | 2364 | v4, |
2365 | &key); | 2365 | &key); |
@@ -2399,7 +2399,7 @@ allocate_v6_address (struct in6_addr *v6) | |||
2399 | mask = addr; | 2399 | mask = addr; |
2400 | for (i=127;i>=ipv6prefix;i--) | 2400 | for (i=127;i>=ipv6prefix;i--) |
2401 | mask.s6_addr[i / 8] |= (1 << (i % 8)); | 2401 | mask.s6_addr[i / 8] |= (1 << (i % 8)); |
2402 | 2402 | ||
2403 | /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */ | 2403 | /* Pick random IPv6 address within the subnet, except 'addr' or 'mask' itself */ |
2404 | tries = 0; | 2404 | tries = 0; |
2405 | do | 2405 | do |
@@ -2414,7 +2414,7 @@ allocate_v6_address (struct in6_addr *v6) | |||
2414 | } | 2414 | } |
2415 | for (i=0;i<16;i++) | 2415 | for (i=0;i<16;i++) |
2416 | { | 2416 | { |
2417 | rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 2417 | rnd.s6_addr[i] = (unsigned char) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
2418 | 256); | 2418 | 256); |
2419 | v6->s6_addr[i] | 2419 | v6->s6_addr[i] |
2420 | = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i]; | 2420 | = (addr.s6_addr[i] | rnd.s6_addr[i]) & mask.s6_addr[i]; |
@@ -2466,7 +2466,7 @@ free_destination_entry (struct DestinationEntry *de) | |||
2466 | if (NULL != de->heap_node) | 2466 | if (NULL != de->heap_node) |
2467 | { | 2467 | { |
2468 | GNUNET_CONTAINER_heap_remove_node (de->heap_node); | 2468 | GNUNET_CONTAINER_heap_remove_node (de->heap_node); |
2469 | de->heap_node = NULL; | 2469 | de->heap_node = NULL; |
2470 | GNUNET_assert (GNUNET_YES == | 2470 | GNUNET_assert (GNUNET_YES == |
2471 | GNUNET_CONTAINER_multihashmap_remove (destination_map, | 2471 | GNUNET_CONTAINER_multihashmap_remove (destination_map, |
2472 | &de->key, | 2472 | &de->key, |
@@ -2481,7 +2481,7 @@ free_destination_entry (struct DestinationEntry *de) | |||
2481 | * | 2481 | * |
2482 | * @param except destination that must NOT be cleaned up, even if it is the oldest | 2482 | * @param except destination that must NOT be cleaned up, even if it is the oldest |
2483 | */ | 2483 | */ |
2484 | static void | 2484 | static void |
2485 | expire_destination (struct DestinationEntry *except) | 2485 | expire_destination (struct DestinationEntry *except) |
2486 | { | 2486 | { |
2487 | struct DestinationEntry *de; | 2487 | struct DestinationEntry *de; |
@@ -2495,13 +2495,13 @@ expire_destination (struct DestinationEntry *except) | |||
2495 | 2495 | ||
2496 | 2496 | ||
2497 | /** | 2497 | /** |
2498 | * Allocate an IP address for the response. | 2498 | * Allocate an IP address for the response. |
2499 | * | 2499 | * |
2500 | * @param result_af desired address family; set to the actual | 2500 | * @param result_af desired address family; set to the actual |
2501 | * address family; can initially be AF_UNSPEC if there | 2501 | * address family; can initially be AF_UNSPEC if there |
2502 | * is no preference; will be set to AF_UNSPEC if the | 2502 | * is no preference; will be set to AF_UNSPEC if the |
2503 | * allocation failed | 2503 | * allocation failed |
2504 | * @param addr set to either v4 or v6 depending on which | 2504 | * @param addr set to either v4 or v6 depending on which |
2505 | * storage location was used; set to NULL if allocation failed | 2505 | * storage location was used; set to NULL if allocation failed |
2506 | * @param v4 storage space for an IPv4 address | 2506 | * @param v4 storage space for an IPv4 address |
2507 | * @param v6 storage space for an IPv6 address | 2507 | * @param v6 storage space for an IPv6 address |
@@ -2550,7 +2550,7 @@ allocate_response_ip (int *result_af, | |||
2550 | return GNUNET_SYSERR; | 2550 | return GNUNET_SYSERR; |
2551 | } | 2551 | } |
2552 | return GNUNET_OK; | 2552 | return GNUNET_OK; |
2553 | } | 2553 | } |
2554 | 2554 | ||
2555 | 2555 | ||
2556 | /** | 2556 | /** |
@@ -2577,7 +2577,7 @@ service_redirect_to_ip (void *cls, | |||
2577 | void *addr; | 2577 | void *addr; |
2578 | struct DestinationEntry *de; | 2578 | struct DestinationEntry *de; |
2579 | struct GNUNET_HashCode key; | 2579 | struct GNUNET_HashCode key; |
2580 | 2580 | ||
2581 | /* validate and parse request */ | 2581 | /* validate and parse request */ |
2582 | mlen = ntohs (message->size); | 2582 | mlen = ntohs (message->size); |
2583 | if (mlen < sizeof (struct RedirectToIpRequestMessage)) | 2583 | if (mlen < sizeof (struct RedirectToIpRequestMessage)) |
@@ -2596,7 +2596,7 @@ service_redirect_to_ip (void *cls, | |||
2596 | { | 2596 | { |
2597 | GNUNET_break (0); | 2597 | GNUNET_break (0); |
2598 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2598 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
2599 | return; | 2599 | return; |
2600 | } | 2600 | } |
2601 | break; | 2601 | break; |
2602 | case AF_INET6: | 2602 | case AF_INET6: |
@@ -2604,13 +2604,13 @@ service_redirect_to_ip (void *cls, | |||
2604 | { | 2604 | { |
2605 | GNUNET_break (0); | 2605 | GNUNET_break (0); |
2606 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2606 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
2607 | return; | 2607 | return; |
2608 | } | 2608 | } |
2609 | break; | 2609 | break; |
2610 | default: | 2610 | default: |
2611 | GNUNET_break (0); | 2611 | GNUNET_break (0); |
2612 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2612 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
2613 | return; | 2613 | return; |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | /* allocate response IP */ | 2616 | /* allocate response IP */ |
@@ -2620,13 +2620,13 @@ service_redirect_to_ip (void *cls, | |||
2620 | &v4, &v6)) | 2620 | &v4, &v6)) |
2621 | { | 2621 | { |
2622 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2622 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
2623 | return; | 2623 | return; |
2624 | } | 2624 | } |
2625 | /* send reply with our IP address */ | 2625 | /* send reply with our IP address */ |
2626 | send_client_reply (client, | 2626 | send_client_reply (client, |
2627 | msg->request_id, | 2627 | msg->request_id, |
2628 | result_af, | 2628 | result_af, |
2629 | addr); | 2629 | addr); |
2630 | if (result_af == AF_UNSPEC) | 2630 | if (result_af == AF_UNSPEC) |
2631 | { | 2631 | { |
2632 | /* failure, we're done */ | 2632 | /* failure, we're done */ |
@@ -2637,14 +2637,14 @@ service_redirect_to_ip (void *cls, | |||
2637 | { | 2637 | { |
2638 | char sbuf[INET6_ADDRSTRLEN]; | 2638 | char sbuf[INET6_ADDRSTRLEN]; |
2639 | char dbuf[INET6_ADDRSTRLEN]; | 2639 | char dbuf[INET6_ADDRSTRLEN]; |
2640 | 2640 | ||
2641 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2641 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2642 | "Allocated address %s for redirection via exit to %s\n", | 2642 | "Allocated address %s for redirection via exit to %s\n", |
2643 | inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), | 2643 | inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), |
2644 | inet_ntop (addr_af, | 2644 | inet_ntop (addr_af, |
2645 | &msg[1], dbuf, sizeof (dbuf))); | 2645 | &msg[1], dbuf, sizeof (dbuf))); |
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | /* setup destination record */ | 2648 | /* setup destination record */ |
2649 | de = GNUNET_new (struct DestinationEntry); | 2649 | de = GNUNET_new (struct DestinationEntry); |
2650 | de->is_service = GNUNET_NO; | 2650 | de->is_service = GNUNET_NO; |
@@ -2683,7 +2683,7 @@ service_redirect_to_ip (void *cls, | |||
2683 | * @param message redirection request (a `struct RedirectToPeerRequestMessage`) | 2683 | * @param message redirection request (a `struct RedirectToPeerRequestMessage`) |
2684 | */ | 2684 | */ |
2685 | static void | 2685 | static void |
2686 | service_redirect_to_service (void *cls, | 2686 | service_redirect_to_service (void *cls, |
2687 | struct GNUNET_SERVER_Client *client, | 2687 | struct GNUNET_SERVER_Client *client, |
2688 | const struct GNUNET_MessageHeader *message) | 2688 | const struct GNUNET_MessageHeader *message) |
2689 | { | 2689 | { |
@@ -2696,7 +2696,7 @@ service_redirect_to_service (void *cls, | |||
2696 | struct GNUNET_HashCode key; | 2696 | struct GNUNET_HashCode key; |
2697 | struct TunnelState *ts; | 2697 | struct TunnelState *ts; |
2698 | struct DestinationTunnel *dt; | 2698 | struct DestinationTunnel *dt; |
2699 | 2699 | ||
2700 | /* parse request */ | 2700 | /* parse request */ |
2701 | msg = (const struct RedirectToServiceRequestMessage *) message; | 2701 | msg = (const struct RedirectToServiceRequestMessage *) message; |
2702 | 2702 | ||
@@ -2707,12 +2707,12 @@ service_redirect_to_service (void *cls, | |||
2707 | &v4, &v6)) | 2707 | &v4, &v6)) |
2708 | { | 2708 | { |
2709 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 2709 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
2710 | return; | 2710 | return; |
2711 | } | 2711 | } |
2712 | send_client_reply (client, | 2712 | send_client_reply (client, |
2713 | msg->request_id, | 2713 | msg->request_id, |
2714 | result_af, | 2714 | result_af, |
2715 | addr); | 2715 | addr); |
2716 | if (result_af == AF_UNSPEC) | 2716 | if (result_af == AF_UNSPEC) |
2717 | { | 2717 | { |
2718 | /* failure, we're done */ | 2718 | /* failure, we're done */ |
@@ -2724,14 +2724,14 @@ service_redirect_to_service (void *cls, | |||
2724 | 2724 | ||
2725 | { | 2725 | { |
2726 | char sbuf[INET6_ADDRSTRLEN]; | 2726 | char sbuf[INET6_ADDRSTRLEN]; |
2727 | 2727 | ||
2728 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2728 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2729 | "Allocated address %s for redirection to service %s on peer %s\n", | 2729 | "Allocated address %s for redirection to service %s on peer %s\n", |
2730 | inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), | 2730 | inet_ntop (result_af, addr, sbuf, sizeof (sbuf)), |
2731 | GNUNET_h2s (&msg->service_descriptor), | 2731 | GNUNET_h2s (&msg->service_descriptor), |
2732 | GNUNET_i2s (&msg->target)); | 2732 | GNUNET_i2s (&msg->target)); |
2733 | } | 2733 | } |
2734 | 2734 | ||
2735 | /* setup destination record */ | 2735 | /* setup destination record */ |
2736 | de = GNUNET_new (struct DestinationEntry); | 2736 | de = GNUNET_new (struct DestinationEntry); |
2737 | de->is_service = GNUNET_YES; | 2737 | de->is_service = GNUNET_YES; |
@@ -2778,15 +2778,15 @@ service_redirect_to_service (void *cls, | |||
2778 | /** | 2778 | /** |
2779 | * Function called whenever a tunnel is destroyed. Should clean up | 2779 | * Function called whenever a tunnel is destroyed. Should clean up |
2780 | * any associated state. | 2780 | * any associated state. |
2781 | * | 2781 | * |
2782 | * @param cls closure (set from #GNUNET_MESH_connect) | 2782 | * @param cls closure (set from #GNUNET_MESH_connect) |
2783 | * @param tunnel connection to the other end (henceforth invalid) | 2783 | * @param tunnel connection to the other end (henceforth invalid) |
2784 | * @param tunnel_ctx place where local state associated | 2784 | * @param tunnel_ctx place where local state associated |
2785 | * with the tunnel is stored (our `struct TunnelState`) | 2785 | * with the tunnel is stored (our `struct TunnelState`) |
2786 | */ | 2786 | */ |
2787 | static void | 2787 | static void |
2788 | tunnel_cleaner (void *cls, | 2788 | tunnel_cleaner (void *cls, |
2789 | const struct GNUNET_MESH_Tunnel *tunnel, | 2789 | const struct GNUNET_MESH_Tunnel *tunnel, |
2790 | void *tunnel_ctx) | 2790 | void *tunnel_ctx) |
2791 | { | 2791 | { |
2792 | struct TunnelState *ts = tunnel_ctx; | 2792 | struct TunnelState *ts = tunnel_ctx; |
@@ -2851,7 +2851,7 @@ cleanup (void *cls, | |||
2851 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2851 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2852 | "VPN is shutting down\n"); | 2852 | "VPN is shutting down\n"); |
2853 | if (NULL != destination_map) | 2853 | if (NULL != destination_map) |
2854 | { | 2854 | { |
2855 | GNUNET_CONTAINER_multihashmap_iterate (destination_map, | 2855 | GNUNET_CONTAINER_multihashmap_iterate (destination_map, |
2856 | &cleanup_destination, | 2856 | &cleanup_destination, |
2857 | NULL); | 2857 | NULL); |
@@ -2864,7 +2864,7 @@ cleanup (void *cls, | |||
2864 | destination_heap = NULL; | 2864 | destination_heap = NULL; |
2865 | } | 2865 | } |
2866 | if (NULL != tunnel_map) | 2866 | if (NULL != tunnel_map) |
2867 | { | 2867 | { |
2868 | GNUNET_CONTAINER_multihashmap_iterate (tunnel_map, | 2868 | GNUNET_CONTAINER_multihashmap_iterate (tunnel_map, |
2869 | &cleanup_tunnel, | 2869 | &cleanup_tunnel, |
2870 | NULL); | 2870 | NULL); |
@@ -2916,8 +2916,8 @@ run (void *cls, | |||
2916 | static const struct GNUNET_SERVER_MessageHandler service_handlers[] = { | 2916 | static const struct GNUNET_SERVER_MessageHandler service_handlers[] = { |
2917 | /* callback, cls, type, size */ | 2917 | /* callback, cls, type, size */ |
2918 | { &service_redirect_to_ip, NULL, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP, 0}, | 2918 | { &service_redirect_to_ip, NULL, GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_IP, 0}, |
2919 | { &service_redirect_to_service, NULL, | 2919 | { &service_redirect_to_service, NULL, |
2920 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE, | 2920 | GNUNET_MESSAGE_TYPE_VPN_CLIENT_REDIRECT_TO_SERVICE, |
2921 | sizeof (struct RedirectToServiceRequestMessage) }, | 2921 | sizeof (struct RedirectToServiceRequestMessage) }, |
2922 | {NULL, NULL, 0, 0} | 2922 | {NULL, NULL, 0, 0} |
2923 | }; | 2923 | }; |
@@ -2982,7 +2982,7 @@ run (void *cls, | |||
2982 | &ipv6addr) || | 2982 | &ipv6addr) || |
2983 | (1 != inet_pton (AF_INET6, ipv6addr, &v6))) ) | 2983 | (1 != inet_pton (AF_INET6, ipv6addr, &v6))) ) |
2984 | { | 2984 | { |
2985 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR", | 2985 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6ADDR", |
2986 | _("Must specify valid IPv6 address")); | 2986 | _("Must specify valid IPv6 address")); |
2987 | GNUNET_SCHEDULER_shutdown (); | 2987 | GNUNET_SCHEDULER_shutdown (); |
2988 | return; | 2988 | return; |
@@ -3023,7 +3023,7 @@ run (void *cls, | |||
3023 | &ipv4addr) || | 3023 | &ipv4addr) || |
3024 | (1 != inet_pton (AF_INET, ipv4addr, &v4))) ) | 3024 | (1 != inet_pton (AF_INET, ipv4addr, &v4))) ) |
3025 | { | 3025 | { |
3026 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR", | 3026 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV4ADDR", |
3027 | _("Must specify valid IPv4 address")); | 3027 | _("Must specify valid IPv4 address")); |
3028 | GNUNET_SCHEDULER_shutdown (); | 3028 | GNUNET_SCHEDULER_shutdown (); |
3029 | return; | 3029 | return; |
@@ -3051,9 +3051,9 @@ run (void *cls, | |||
3051 | vpn_argv[6] = NULL; | 3051 | vpn_argv[6] = NULL; |
3052 | 3052 | ||
3053 | mesh_handle = | 3053 | mesh_handle = |
3054 | GNUNET_MESH_connect (cfg_, NULL, | 3054 | GNUNET_MESH_connect (cfg_, NULL, |
3055 | NULL, | 3055 | NULL, |
3056 | &tunnel_cleaner, | 3056 | &tunnel_cleaner, |
3057 | mesh_handlers, | 3057 | mesh_handlers, |
3058 | NULL); | 3058 | NULL); |
3059 | helper_handle = GNUNET_HELPER_start (GNUNET_NO, | 3059 | helper_handle = GNUNET_HELPER_start (GNUNET_NO, |
@@ -3076,7 +3076,7 @@ int | |||
3076 | main (int argc, char *const *argv) | 3076 | main (int argc, char *const *argv) |
3077 | { | 3077 | { |
3078 | return (GNUNET_OK == | 3078 | return (GNUNET_OK == |
3079 | GNUNET_SERVICE_run (argc, argv, "vpn", | 3079 | GNUNET_SERVICE_run (argc, argv, "vpn", |
3080 | GNUNET_SERVICE_OPTION_NONE, | 3080 | GNUNET_SERVICE_OPTION_NONE, |
3081 | &run, NULL)) ? global_ret : 1; | 3081 | &run, NULL)) ? global_ret : 1; |
3082 | } | 3082 | } |