aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-service-vpn.c69
1 files changed, 30 insertions, 39 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 87e072209..62d6b3e23 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -713,7 +713,7 @@ print_channel_destination (const struct DestinationEntry *de)
713 { 713 {
714 GNUNET_snprintf (dest, 714 GNUNET_snprintf (dest,
715 sizeof (dest), 715 sizeof (dest),
716 "HS: %s-%s\n", 716 "HS: %s-%s",
717 GNUNET_i2s (&de->details.service_destination.target), 717 GNUNET_i2s (&de->details.service_destination.target),
718 GNUNET_h2s (&de->details.service_destination.service_descriptor)); 718 GNUNET_h2s (&de->details.service_destination.service_descriptor));
719 } 719 }
@@ -830,7 +830,8 @@ create_channel_to_destination (struct DestinationChannel *dt,
830 return NULL; 830 return NULL;
831 } 831 }
832 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 832 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
833 "Creating channel to peer %s offering service %s\n", 833 "Creating channel %p to peer %s offering service %s\n",
834 ts->channel,
834 GNUNET_i2s (&dt->destination->details.service_destination.target), 835 GNUNET_i2s (&dt->destination->details.service_destination.target),
835 GNUNET_h2s (&dt->destination->details.service_destination.service_descriptor)); 836 GNUNET_h2s (&dt->destination->details.service_destination.service_descriptor));
836 } 837 }
@@ -958,12 +959,12 @@ route_packet (struct DestinationEntry *destination,
958 source_port = ntohs (udp->source_port); 959 source_port = ntohs (udp->source_port);
959 destination_port = ntohs (udp->destination_port); 960 destination_port = ntohs (udp->destination_port);
960 get_channel_key_from_ips (af, 961 get_channel_key_from_ips (af,
961 IPPROTO_UDP, 962 IPPROTO_UDP,
962 source_ip, 963 source_ip,
963 source_port, 964 source_port,
964 destination_ip, 965 destination_ip,
965 destination_port, 966 destination_port,
966 &key); 967 &key);
967 } 968 }
968 break; 969 break;
969 case IPPROTO_TCP: 970 case IPPROTO_TCP:
@@ -985,12 +986,12 @@ route_packet (struct DestinationEntry *destination,
985 source_port = ntohs (tcp->source_port); 986 source_port = ntohs (tcp->source_port);
986 destination_port = ntohs (tcp->destination_port); 987 destination_port = ntohs (tcp->destination_port);
987 get_channel_key_from_ips (af, 988 get_channel_key_from_ips (af,
988 IPPROTO_TCP, 989 IPPROTO_TCP,
989 source_ip, 990 source_ip,
990 source_port, 991 source_port,
991 destination_ip, 992 destination_ip,
992 destination_port, 993 destination_port,
993 &key); 994 &key);
994 } 995 }
995 break; 996 break;
996 case IPPROTO_ICMP: 997 case IPPROTO_ICMP:
@@ -1013,12 +1014,12 @@ route_packet (struct DestinationEntry *destination,
1013 source_port = 0; 1014 source_port = 0;
1014 destination_port = 0; 1015 destination_port = 0;
1015 get_channel_key_from_ips (af, 1016 get_channel_key_from_ips (af,
1016 protocol, 1017 protocol,
1017 source_ip, 1018 source_ip,
1018 0, 1019 0,
1019 destination_ip, 1020 destination_ip,
1020 0, 1021 0,
1021 &key); 1022 &key);
1022 } 1023 }
1023 break; 1024 break;
1024 default: 1025 default:
@@ -1048,7 +1049,7 @@ route_packet (struct DestinationEntry *destination,
1048 char xbuf[INET6_ADDRSTRLEN]; 1049 char xbuf[INET6_ADDRSTRLEN];
1049 1050
1050 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1051 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1051 "Routing %s packet from %s:%u -> %s:%u to destination %s:%u\n", 1052 "Routing %s packet from [%s]:%u -> [%s]:%u to destination [%s]:%u\n",
1052 (protocol == IPPROTO_TCP) ? "TCP" : "UDP", 1053 (protocol == IPPROTO_TCP) ? "TCP" : "UDP",
1053 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), 1054 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)),
1054 source_port, 1055 source_port,
@@ -1070,7 +1071,7 @@ route_packet (struct DestinationEntry *destination,
1070 char dbuf[INET6_ADDRSTRLEN]; 1071 char dbuf[INET6_ADDRSTRLEN];
1071 1072
1072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1073 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1073 "Routing %s packet from %s:%u -> %s:%u to service %s at peer %s\n", 1074 "Routing %s packet from [%s]:%u -> [%s]:%u to service %s at peer %s\n",
1074 (protocol == IPPROTO_TCP) ? "TCP" : "UDP", 1075 (protocol == IPPROTO_TCP) ? "TCP" : "UDP",
1075 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)), 1076 inet_ntop (af, source_ip, sbuf, sizeof (sbuf)),
1076 source_port, 1077 source_port,
@@ -1096,6 +1097,9 @@ route_packet (struct DestinationEntry *destination,
1096 &key); 1097 &key);
1097 if (NULL == ts) 1098 if (NULL == ts)
1098 { 1099 {
1100 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1101 "Creating new channel for key %s\n",
1102 GNUNET_h2s (&key));
1099 /* need to either use the existing channel from the destination (if still 1103 /* need to either use the existing channel from the destination (if still
1100 available) or create a fresh one */ 1104 available) or create a fresh one */
1101 if (NULL == dt->ts) 1105 if (NULL == dt->ts)
@@ -2128,7 +2132,7 @@ receive_udp_back (void *cls,
2128 char dbuf[INET6_ADDRSTRLEN]; 2132 char dbuf[INET6_ADDRSTRLEN];
2129 2133
2130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2134 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2131 "Received UDP reply from cadet, sending %u bytes from %s:%u -> %s:%u via TUN\n", 2135 "Received UDP reply from cadet, sending %u bytes from [%s]:%u -> [%s]:%u via TUN\n",
2132 (unsigned int) mlen, 2136 (unsigned int) mlen,
2133 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)), 2137 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
2134 ts->destination_port, 2138 ts->destination_port,
@@ -2279,7 +2283,7 @@ receive_tcp_back (void *cls,
2279 char dbuf[INET6_ADDRSTRLEN]; 2283 char dbuf[INET6_ADDRSTRLEN];
2280 2284
2281 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2282 "Received TCP reply from cadet, sending %u bytes from %s:%u -> %s:%u via TUN\n", 2286 "Received TCP reply from cadet, sending %u bytes from [%s]:%u -> [%s]:%u via TUN\n",
2283 (unsigned int) mlen, 2287 (unsigned int) mlen,
2284 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)), 2288 inet_ntop (ts->af, &ts->destination_ip, sbuf, sizeof (sbuf)),
2285 ts->destination_port, 2289 ts->destination_port,
@@ -2753,7 +2757,6 @@ service_redirect_to_service (void *cls,
2753 void *addr; 2757 void *addr;
2754 struct DestinationEntry *de; 2758 struct DestinationEntry *de;
2755 struct GNUNET_HashCode key; 2759 struct GNUNET_HashCode key;
2756 struct ChannelState *ts;
2757 struct DestinationChannel *dt; 2760 struct DestinationChannel *dt;
2758 2761
2759 /* parse request */ 2762 /* parse request */
@@ -2816,19 +2819,6 @@ service_redirect_to_service (void *cls,
2816 GNUNET_CONTAINER_DLL_insert (de->dt_head, 2819 GNUNET_CONTAINER_DLL_insert (de->dt_head,
2817 de->dt_tail, 2820 de->dt_tail,
2818 dt); 2821 dt);
2819 ts = create_channel_to_destination (dt,
2820 result_af);
2821 switch (result_af)
2822 {
2823 case AF_INET:
2824 ts->destination_ip.v4 = v4;
2825 break;
2826 case AF_INET6:
2827 ts->destination_ip.v6 = v6;
2828 break;
2829 default:
2830 GNUNET_assert (0);
2831 }
2832 /* we're done */ 2822 /* we're done */
2833 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2823 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2834} 2824}
@@ -2948,7 +2938,8 @@ cleanup (void *cls,
2948 } 2938 }
2949 if (NULL != helper_handle) 2939 if (NULL != helper_handle)
2950 { 2940 {
2951 GNUNET_HELPER_stop (helper_handle, GNUNET_NO); 2941 GNUNET_HELPER_kill (helper_handle, GNUNET_NO);
2942 GNUNET_HELPER_wait (helper_handle);
2952 helper_handle = NULL; 2943 helper_handle = NULL;
2953 } 2944 }
2954 if (NULL != nc) 2945 if (NULL != nc)