aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-service-vpn.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 629b59173..d18530dab 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -795,13 +795,19 @@ create_channel_to_destination (struct DestinationChannel *dt,
795 ts->af = client_af; 795 ts->af = client_af;
796 ts->destination = *dt->destination; 796 ts->destination = *dt->destination;
797 ts->destination.heap_node = NULL; /* copy is NOT in destination heap */ 797 ts->destination.heap_node = NULL; /* copy is NOT in destination heap */
798 ts->destination_port = dt->destination_port;
798 if (dt->destination->is_service) 799 if (dt->destination->is_service)
799 { 800 {
801 struct GNUNET_HashCode cadet_port;
802
803 GNUNET_TUN_compute_service_cadet_port (&ts->destination.details.service_destination.service_descriptor,
804 ts->destination_port,
805 &cadet_port);
800 ts->channel 806 ts->channel
801 = GNUNET_CADET_channel_create (cadet_handle, 807 = GNUNET_CADET_channel_create (cadet_handle,
802 ts, 808 ts,
803 &dt->destination->details.service_destination.target, 809 &dt->destination->details.service_destination.target,
804 &ts->destination.details.service_destination.service_descriptor, 810 &cadet_port,
805 GNUNET_CADET_OPTION_DEFAULT); 811 GNUNET_CADET_OPTION_DEFAULT);
806 if (NULL == ts->channel) 812 if (NULL == ts->channel)
807 { 813 {
@@ -810,10 +816,10 @@ create_channel_to_destination (struct DestinationChannel *dt,
810 return NULL; 816 return NULL;
811 } 817 }
812 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 818 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
813 "Creating channel %p to peer %s offering service %s\n", 819 "Creating channel to peer %s offering service %s on port %u\n",
814 ts->channel,
815 GNUNET_i2s (&dt->destination->details.service_destination.target), 820 GNUNET_i2s (&dt->destination->details.service_destination.target),
816 GNUNET_h2s (&ts->destination.details.service_destination.service_descriptor)); 821 GNUNET_h2s (&ts->destination.details.service_destination.service_descriptor),
822 (unsigned int) ts->destination_port);
817 } 823 }
818 else 824 else
819 { 825 {
@@ -1072,7 +1078,9 @@ route_packet (struct DestinationEntry *destination,
1072 GNUNET_h2s (&destination->details.service_destination.service_descriptor), 1078 GNUNET_h2s (&destination->details.service_destination.service_descriptor),
1073 GNUNET_i2s (&destination->details.service_destination.target)); 1079 GNUNET_i2s (&destination->details.service_destination.target));
1074 } 1080 }
1075 dt = destination->dt_head; 1081 for (dt = destination->dt_head; NULL != dt; dt = dt->next)
1082 if (dt->destination_port == destination_port)
1083 break;
1076 } 1084 }
1077 if (NULL == dt) 1085 if (NULL == dt)
1078 { 1086 {
@@ -1094,7 +1102,8 @@ route_packet (struct DestinationEntry *destination,
1094 GNUNET_h2s (&key)); 1102 GNUNET_h2s (&key));
1095 /* 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
1096 available) or create a fresh one */ 1104 available) or create a fresh one */
1097 ts = create_channel_to_destination (dt, af); 1105 ts = create_channel_to_destination (dt,
1106 af);
1098 if (NULL == ts) 1107 if (NULL == ts)
1099 return; 1108 return;
1100 /* now bind existing "unbound" channel to our IP/port tuple */ 1109 /* now bind existing "unbound" channel to our IP/port tuple */