aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-24 14:59:53 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-24 14:59:53 +0000
commite7a5ecbe4366a7bbcd36e3875ff725680cac7eaa (patch)
treea0a8fa40b2595ed696fd9a31e84c2f866a3085e2 /src/vpn
parent1a8d7b5adb9be6bf8a50c2462a75e413b427ee94 (diff)
downloadgnunet-e7a5ecbe4366a7bbcd36e3875ff725680cac7eaa.tar.gz
gnunet-e7a5ecbe4366a7bbcd36e3875ff725680cac7eaa.zip
-fixes
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/gnunet-service-vpn.c45
-rw-r--r--src/vpn/test_gnunet_vpn.c2
-rw-r--r--src/vpn/test_gnunet_vpn.conf3
3 files changed, 37 insertions, 13 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c
index 9efd6683e..3d05e2cd2 100644
--- a/src/vpn/gnunet-service-vpn.c
+++ b/src/vpn/gnunet-service-vpn.c
@@ -757,6 +757,7 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq,
757static struct TunnelState * 757static struct TunnelState *
758create_tunnel_to_destination (struct DestinationEntry *de, 758create_tunnel_to_destination (struct DestinationEntry *de,
759 struct GNUNET_SERVER_Client *client, 759 struct GNUNET_SERVER_Client *client,
760 int client_af,
760 uint64_t request_id) 761 uint64_t request_id)
761{ 762{
762 struct TunnelState *ts; 763 struct TunnelState *ts;
@@ -766,6 +767,7 @@ create_tunnel_to_destination (struct DestinationEntry *de,
766 1, GNUNET_NO); 767 1, GNUNET_NO);
767 GNUNET_assert (NULL == de->ts); 768 GNUNET_assert (NULL == de->ts);
768 ts = GNUNET_malloc (sizeof (struct TunnelState)); 769 ts = GNUNET_malloc (sizeof (struct TunnelState));
770 ts->af = client_af;
769 if (NULL != client) 771 if (NULL != client)
770 { 772 {
771 ts->request_id = request_id; 773 ts->request_id = request_id;
@@ -776,7 +778,6 @@ create_tunnel_to_destination (struct DestinationEntry *de,
776 ts->destination.heap_node = NULL; /* copy is NOT in destination heap */ 778 ts->destination.heap_node = NULL; /* copy is NOT in destination heap */
777 de->ts = ts; 779 de->ts = ts;
778 ts->destination_container = de; /* we are referenced from de */ 780 ts->destination_container = de; /* we are referenced from de */
779 ts->af = AF_UNSPEC; /* so far, unknown */
780 ts->tunnel = GNUNET_MESH_tunnel_create (mesh_handle, 781 ts->tunnel = GNUNET_MESH_tunnel_create (mesh_handle,
781 ts, 782 ts,
782 &tunnel_peer_connect_handler, 783 &tunnel_peer_connect_handler,
@@ -1007,7 +1008,7 @@ route_packet (struct DestinationEntry *destination,
1007 available) or create a fresh one */ 1008 available) or create a fresh one */
1008 is_new = GNUNET_YES; 1009 is_new = GNUNET_YES;
1009 if (NULL == destination->ts) 1010 if (NULL == destination->ts)
1010 ts = create_tunnel_to_destination (destination, NULL, 0); 1011 ts = create_tunnel_to_destination (destination, NULL, af, 0);
1011 else 1012 else
1012 ts = destination->ts; 1013 ts = destination->ts;
1013 if (NULL == ts) 1014 if (NULL == ts)
@@ -2464,6 +2465,7 @@ service_redirect_to_ip (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *cl
2464 void *addr; 2465 void *addr;
2465 struct DestinationEntry *de; 2466 struct DestinationEntry *de;
2466 GNUNET_HashCode key; 2467 GNUNET_HashCode key;
2468 struct TunnelState *ts;
2467 2469
2468 /* validate and parse request */ 2470 /* validate and parse request */
2469 mlen = ntohs (message->size); 2471 mlen = ntohs (message->size);
@@ -2589,11 +2591,23 @@ service_redirect_to_ip (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *cl
2589 1, GNUNET_NO); 2591 1, GNUNET_NO);
2590 while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings) 2592 while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings)
2591 expire_destination (de); 2593 expire_destination (de);
2592 2594
2593 /* setup tunnel to destination */ 2595 /* setup tunnel to destination */
2594 (void) create_tunnel_to_destination (de, 2596 ts = create_tunnel_to_destination (de,
2595 (GNUNET_NO == ntohl (msg->nac)) ? NULL : client, 2597 (GNUNET_NO == ntohl (msg->nac)) ? NULL : client,
2596 msg->request_id); 2598 result_af,
2599 msg->request_id);
2600 switch (result_af)
2601 {
2602 case AF_INET:
2603 ts->destination_ip.v4 = v4;
2604 break;
2605 case AF_INET6:
2606 ts->destination_ip.v6 = v6;
2607 break;
2608 default:
2609 GNUNET_assert (0);
2610 }
2597 /* we're done */ 2611 /* we're done */
2598 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2612 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2599} 2613}
@@ -2619,6 +2633,7 @@ service_redirect_to_service (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Clien
2619 void *addr; 2633 void *addr;
2620 struct DestinationEntry *de; 2634 struct DestinationEntry *de;
2621 GNUNET_HashCode key; 2635 GNUNET_HashCode key;
2636 struct TunnelState *ts;
2622 2637
2623 /* parse request */ 2638 /* parse request */
2624 msg = (const struct RedirectToServiceRequestMessage *) message; 2639 msg = (const struct RedirectToServiceRequestMessage *) message;
@@ -2708,9 +2723,21 @@ service_redirect_to_service (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Clien
2708 GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value); 2723 GNUNET_TIME_absolute_ntoh (msg->expiration_time).abs_value);
2709 while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings) 2724 while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings)
2710 expire_destination (de); 2725 expire_destination (de);
2711 (void) create_tunnel_to_destination (de, 2726 ts = create_tunnel_to_destination (de,
2712 (GNUNET_NO == ntohl (msg->nac)) ? NULL : client, 2727 (GNUNET_NO == ntohl (msg->nac)) ? NULL : client,
2713 msg->request_id); 2728 result_af,
2729 msg->request_id);
2730 switch (result_af)
2731 {
2732 case AF_INET:
2733 ts->destination_ip.v4 = v4;
2734 break;
2735 case AF_INET6:
2736 ts->destination_ip.v6 = v6;
2737 break;
2738 default:
2739 GNUNET_assert (0);
2740 }
2714 /* we're done */ 2741 /* we're done */
2715 GNUNET_SERVER_receive_done (client, GNUNET_OK); 2742 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2716} 2743}
diff --git a/src/vpn/test_gnunet_vpn.c b/src/vpn/test_gnunet_vpn.c
index 3186c1761..5ec62f531 100644
--- a/src/vpn/test_gnunet_vpn.c
+++ b/src/vpn/test_gnunet_vpn.c
@@ -33,7 +33,7 @@
33 33
34#define START_ARM GNUNET_YES 34#define START_ARM GNUNET_YES
35 35
36#define VERBOSE GNUNET_YES 36#define VERBOSE GNUNET_NO
37 37
38struct PeerContext 38struct PeerContext
39{ 39{
diff --git a/src/vpn/test_gnunet_vpn.conf b/src/vpn/test_gnunet_vpn.conf
index cb6ee9728..66f96c3a4 100644
--- a/src/vpn/test_gnunet_vpn.conf
+++ b/src/vpn/test_gnunet_vpn.conf
@@ -16,9 +16,6 @@ EXIT_IPV6 = YES
16# interface does not exist; can we use 'lo'? 16# interface does not exist; can we use 'lo'?
17EXIT_IFNAME = eth1 17EXIT_IFNAME = eth1
18 18
19[vpn]
20DEBUG = YES
21
22[testing] 19[testing]
23WEAKRANDOM = YES 20WEAKRANDOM = YES
24HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat 21HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat