diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-11-14 13:55:12 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-11-14 13:55:12 +0000 |
commit | b7366f3d6a56d38d0269a33039f88de967e8c130 (patch) | |
tree | e299448a28e358c6549670a094b82f247925f7e2 /src/vpn | |
parent | 6bde5e0c83d1fd344a26de64172ddce37920bb40 (diff) | |
download | gnunet-b7366f3d6a56d38d0269a33039f88de967e8c130.tar.gz gnunet-b7366f3d6a56d38d0269a33039f88de967e8c130.zip |
Use encrypted MESH by default
Diffstat (limited to 'src/vpn')
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 376 |
1 files changed, 188 insertions, 188 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index edb70f5e0..eebdcac55 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -27,8 +27,8 @@ | |||
27 | * @author Christian Grothoff | 27 | * @author Christian Grothoff |
28 | * | 28 | * |
29 | * TODO: | 29 | * TODO: |
30 | * - keep multiple peers/mesh tunnels ready as alternative exits / | 30 | * - keep multiple peers/mesh channels ready as alternative exits / |
31 | * detect & recover from tunnel-to-exit failure gracefully | 31 | * detect & recover from channel-to-exit failure gracefully |
32 | */ | 32 | */ |
33 | #include "platform.h" | 33 | #include "platform.h" |
34 | #include "gnunet_util_lib.h" | 34 | #include "gnunet_util_lib.h" |
@@ -51,45 +51,45 @@ | |||
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
54 | * State we keep for each of our tunnels. | 54 | * State we keep for each of our channels. |
55 | */ | 55 | */ |
56 | struct TunnelState; | 56 | struct ChannelState; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Information we track for each IP address to determine which tunnel | 59 | * Information we track for each IP address to determine which channel |
60 | * to send the traffic over to the destination. | 60 | * to send the traffic over to the destination. |
61 | */ | 61 | */ |
62 | struct DestinationEntry; | 62 | struct DestinationEntry; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * List of tunnels we keep for each destination port for a given | 65 | * List of channels we keep for each destination port for a given |
66 | * destination entry. | 66 | * destination entry. |
67 | */ | 67 | */ |
68 | struct DestinationTunnel | 68 | struct DestinationChannel |
69 | { | 69 | { |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Kept in a DLL. | 72 | * Kept in a DLL. |
73 | */ | 73 | */ |
74 | struct DestinationTunnel *next; | 74 | struct DestinationChannel *next; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Kept in a DLL. | 77 | * Kept in a DLL. |
78 | */ | 78 | */ |
79 | struct DestinationTunnel *prev; | 79 | struct DestinationChannel *prev; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Destination entry list this `struct DestinationTunnel` belongs with. | 82 | * Destination entry list this `struct DestinationChannel` belongs with. |
83 | */ | 83 | */ |
84 | struct DestinationEntry *destination; | 84 | struct DestinationEntry *destination; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Pre-allocated tunnel for this destination, or NULL for none. | 87 | * Pre-allocated channel for this destination, or NULL for none. |
88 | */ | 88 | */ |
89 | struct TunnelState *ts; | 89 | struct ChannelState *ts; |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Destination port this tunnel state is used for. | 92 | * Destination port this channel state is used for. |
93 | */ | 93 | */ |
94 | uint16_t destination_port; | 94 | uint16_t destination_port; |
95 | 95 | ||
@@ -97,7 +97,7 @@ struct DestinationTunnel | |||
97 | 97 | ||
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Information we track for each IP address to determine which tunnel | 100 | * Information we track for each IP address to determine which channel |
101 | * to send the traffic over to the destination. | 101 | * to send the traffic over to the destination. |
102 | */ | 102 | */ |
103 | struct DestinationEntry | 103 | struct DestinationEntry |
@@ -110,14 +110,14 @@ struct DestinationEntry | |||
110 | struct GNUNET_HashCode key; | 110 | struct GNUNET_HashCode key; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Head of DLL of tunnels associated with this destination. | 113 | * Head of DLL of channels associated with this destination. |
114 | */ | 114 | */ |
115 | struct DestinationTunnel *dt_head; | 115 | struct DestinationChannel *dt_head; |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * Tail of DLL of tunnels associated with this destination. | 118 | * Tail of DLL of channels associated with this destination. |
119 | */ | 119 | */ |
120 | struct DestinationTunnel *dt_tail; | 120 | struct DestinationChannel *dt_tail; |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * Entry for this entry in the destination_heap. | 123 | * Entry for this entry in the destination_heap. |
@@ -125,8 +125,8 @@ struct DestinationEntry | |||
125 | struct GNUNET_CONTAINER_HeapNode *heap_node; | 125 | struct GNUNET_CONTAINER_HeapNode *heap_node; |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * #GNUNET_NO if this is a tunnel to an Internet-exit, | 128 | * #GNUNET_NO if this is a channel to an Internet-exit, |
129 | * #GNUNET_YES if this tunnel is to a service. | 129 | * #GNUNET_YES if this channel is to a service. |
130 | */ | 130 | */ |
131 | int is_service; | 131 | int is_service; |
132 | 132 | ||
@@ -139,7 +139,7 @@ struct DestinationEntry | |||
139 | struct | 139 | struct |
140 | { | 140 | { |
141 | /** | 141 | /** |
142 | * The description of the service (only used for service tunnels). | 142 | * The description of the service (only used for service channels). |
143 | */ | 143 | */ |
144 | struct GNUNET_HashCode service_descriptor; | 144 | struct GNUNET_HashCode service_descriptor; |
145 | 145 | ||
@@ -159,7 +159,7 @@ struct DestinationEntry | |||
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 channels). |
163 | */ | 163 | */ |
164 | union | 164 | union |
165 | { | 165 | { |
@@ -182,19 +182,19 @@ struct DestinationEntry | |||
182 | 182 | ||
183 | 183 | ||
184 | /** | 184 | /** |
185 | * A messages we have in queue for a particular tunnel. | 185 | * A messages we have in queue for a particular channel. |
186 | */ | 186 | */ |
187 | struct TunnelMessageQueueEntry | 187 | struct ChannelMessageQueueEntry |
188 | { | 188 | { |
189 | /** | 189 | /** |
190 | * This is a doubly-linked list. | 190 | * This is a doubly-linked list. |
191 | */ | 191 | */ |
192 | struct TunnelMessageQueueEntry *next; | 192 | struct ChannelMessageQueueEntry *next; |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * This is a doubly-linked list. | 195 | * This is a doubly-linked list. |
196 | */ | 196 | */ |
197 | struct TunnelMessageQueueEntry *prev; | 197 | struct ChannelMessageQueueEntry *prev; |
198 | 198 | ||
199 | /** | 199 | /** |
200 | * Number of bytes in 'msg'. | 200 | * Number of bytes in 'msg'. |
@@ -209,16 +209,16 @@ struct TunnelMessageQueueEntry | |||
209 | 209 | ||
210 | 210 | ||
211 | /** | 211 | /** |
212 | * State we keep for each of our tunnels. | 212 | * State we keep for each of our channels. |
213 | */ | 213 | */ |
214 | struct TunnelState | 214 | struct ChannelState |
215 | { | 215 | { |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Information about the tunnel to use, NULL if no tunnel | 218 | * Information about the channel to use, NULL if no channel |
219 | * is available right now. | 219 | * is available right now. |
220 | */ | 220 | */ |
221 | struct GNUNET_MESH_Tunnel *tunnel; | 221 | struct GNUNET_MESH_Channel *channel; |
222 | 222 | ||
223 | /** | 223 | /** |
224 | * Active query with REGEX to locate exit. | 224 | * Active query with REGEX to locate exit. |
@@ -231,29 +231,29 @@ struct TunnelState | |||
231 | struct GNUNET_MESH_TransmitHandle *th; | 231 | struct GNUNET_MESH_TransmitHandle *th; |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * Entry for this entry in the tunnel_heap, NULL as long as this | 234 | * Entry for this entry in the channel_heap, NULL as long as this |
235 | * tunnel state is not fully bound. | 235 | * channel state is not fully bound. |
236 | */ | 236 | */ |
237 | struct GNUNET_CONTAINER_HeapNode *heap_node; | 237 | struct GNUNET_CONTAINER_HeapNode *heap_node; |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * Head of list of messages scheduled for transmission. | 240 | * Head of list of messages scheduled for transmission. |
241 | */ | 241 | */ |
242 | struct TunnelMessageQueueEntry *tmq_head; | 242 | struct ChannelMessageQueueEntry *tmq_head; |
243 | 243 | ||
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 ChannelMessageQueueEntry *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 channel state; |
251 | * NULL if this tunnel state is in the tunnel map. | 251 | * NULL if this channel state is in the channel map. |
252 | */ | 252 | */ |
253 | struct DestinationTunnel *destination_container; | 253 | struct DestinationChannel *destination_container; |
254 | 254 | ||
255 | /** | 255 | /** |
256 | * Destination to which this tunnel leads. Note that | 256 | * Destination to which this channel leads. Note that |
257 | * this struct is NOT in the destination_map (but a | 257 | * this struct is NOT in the destination_map (but a |
258 | * local copy) and that the 'heap_node' should always | 258 | * local copy) and that the 'heap_node' should always |
259 | * be NULL. | 259 | * be NULL. |
@@ -261,7 +261,7 @@ struct TunnelState | |||
261 | struct DestinationEntry destination; | 261 | struct DestinationEntry destination; |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Addess family used for this tunnel on the local TUN interface. | 264 | * Addess family used for this channel on the local TUN interface. |
265 | */ | 265 | */ |
266 | int af; | 266 | int af; |
267 | 267 | ||
@@ -294,7 +294,7 @@ struct TunnelState | |||
294 | 294 | ||
295 | /** | 295 | /** |
296 | * Destination IP address used by the source on our end (this is the IP | 296 | * Destination IP address used by the source on our end (this is the IP |
297 | * that we pick freely within the VPN's tunnel IP range). | 297 | * that we pick freely within the VPN's channel IP range). |
298 | */ | 298 | */ |
299 | union | 299 | union |
300 | { | 300 | { |
@@ -340,7 +340,7 @@ static struct GNUNET_MESH_Handle *mesh_handle; | |||
340 | 340 | ||
341 | /** | 341 | /** |
342 | * Map from IP address to destination information (possibly with a | 342 | * Map from IP address to destination information (possibly with a |
343 | * MESH tunnel handle for fast setup). | 343 | * MESH channel handle for fast setup). |
344 | */ | 344 | */ |
345 | static struct GNUNET_CONTAINER_MultiHashMap *destination_map; | 345 | static struct GNUNET_CONTAINER_MultiHashMap *destination_map; |
346 | 346 | ||
@@ -351,15 +351,15 @@ static struct GNUNET_CONTAINER_Heap *destination_heap; | |||
351 | 351 | ||
352 | /** | 352 | /** |
353 | * Map from source and destination address (IP+port) to connection | 353 | * Map from source and destination address (IP+port) to connection |
354 | * information (mostly with the respective MESH tunnel handle). | 354 | * information (mostly with the respective MESH channel handle). |
355 | */ | 355 | */ |
356 | static struct GNUNET_CONTAINER_MultiHashMap *tunnel_map; | 356 | static struct GNUNET_CONTAINER_MultiHashMap *channel_map; |
357 | 357 | ||
358 | /** | 358 | /** |
359 | * Min-Heap sorted by activity time to expire old mappings; values are | 359 | * Min-Heap sorted by activity time to expire old mappings; values are |
360 | * of type 'struct TunnelState'. | 360 | * of type 'struct ChannelState'. |
361 | */ | 361 | */ |
362 | static struct GNUNET_CONTAINER_Heap *tunnel_heap; | 362 | static struct GNUNET_CONTAINER_Heap *channel_heap; |
363 | 363 | ||
364 | /** | 364 | /** |
365 | * Statistics. | 365 | * Statistics. |
@@ -393,10 +393,10 @@ static struct GNUNET_SERVER_NotificationContext *nc; | |||
393 | static unsigned long long max_destination_mappings; | 393 | static unsigned long long max_destination_mappings; |
394 | 394 | ||
395 | /** | 395 | /** |
396 | * If there are more than this number of open tunnels, old ones | 396 | * If there are more than this number of open channels, old ones |
397 | * will be removed | 397 | * will be removed |
398 | */ | 398 | */ |
399 | static unsigned long long max_tunnel_mappings; | 399 | static unsigned long long max_channel_mappings; |
400 | 400 | ||
401 | 401 | ||
402 | /** | 402 | /** |
@@ -433,7 +433,7 @@ get_destination_key_from_ip (int af, | |||
433 | 433 | ||
434 | /** | 434 | /** |
435 | * Compute the key under which we would store an entry in the | 435 | * Compute the key under which we would store an entry in the |
436 | * tunnel_map for the given socket address pair. | 436 | * channel_map for the given socket address pair. |
437 | * | 437 | * |
438 | * @param af address family (AF_INET or AF_INET6) | 438 | * @param af address family (AF_INET or AF_INET6) |
439 | * @param protocol IPPROTO_TCP or IPPROTO_UDP | 439 | * @param protocol IPPROTO_TCP or IPPROTO_UDP |
@@ -444,7 +444,7 @@ get_destination_key_from_ip (int af, | |||
444 | * @param key where to store the key | 444 | * @param key where to store the key |
445 | */ | 445 | */ |
446 | static void | 446 | static void |
447 | get_tunnel_key_from_ips (int af, | 447 | get_channel_key_from_ips (int af, |
448 | uint8_t protocol, | 448 | uint8_t protocol, |
449 | const void *source_ip, | 449 | const void *source_ip, |
450 | uint16_t source_port, | 450 | uint16_t source_port, |
@@ -533,21 +533,21 @@ send_client_reply (struct GNUNET_SERVER_Client *client, | |||
533 | 533 | ||
534 | 534 | ||
535 | /** | 535 | /** |
536 | * Free resources associated with a tunnel state. | 536 | * Free resources associated with a channel state. |
537 | * | 537 | * |
538 | * @param ts state to free | 538 | * @param ts state to free |
539 | */ | 539 | */ |
540 | static void | 540 | static void |
541 | free_tunnel_state (struct TunnelState *ts) | 541 | free_channel_state (struct ChannelState *ts) |
542 | { | 542 | { |
543 | struct GNUNET_HashCode key; | 543 | struct GNUNET_HashCode key; |
544 | struct TunnelMessageQueueEntry *tnq; | 544 | struct ChannelMessageQueueEntry *tnq; |
545 | struct GNUNET_MESH_Tunnel *tunnel; | 545 | struct GNUNET_MESH_Channel *channel; |
546 | 546 | ||
547 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 547 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
548 | "Cleaning up tunnel state\n"); | 548 | "Cleaning up channel state\n"); |
549 | GNUNET_STATISTICS_update (stats, | 549 | GNUNET_STATISTICS_update (stats, |
550 | gettext_noop ("# Active tunnels"), | 550 | gettext_noop ("# Active channels"), |
551 | -1, GNUNET_NO); | 551 | -1, GNUNET_NO); |
552 | while (NULL != (tnq = ts->tmq_head)) | 552 | while (NULL != (tnq = ts->tmq_head)) |
553 | { | 553 | { |
@@ -564,10 +564,10 @@ free_tunnel_state (struct TunnelState *ts) | |||
564 | ts->th = NULL; | 564 | ts->th = NULL; |
565 | } | 565 | } |
566 | GNUNET_assert (NULL == ts->destination.heap_node); | 566 | GNUNET_assert (NULL == ts->destination.heap_node); |
567 | if (NULL != (tunnel = ts->tunnel)) | 567 | if (NULL != (channel = ts->channel)) |
568 | { | 568 | { |
569 | ts->tunnel = NULL; | 569 | ts->channel = NULL; |
570 | GNUNET_MESH_tunnel_destroy (tunnel); | 570 | GNUNET_MESH_channel_destroy (channel); |
571 | } | 571 | } |
572 | if (NULL != ts->search) | 572 | if (NULL != ts->search) |
573 | { | 573 | { |
@@ -578,7 +578,7 @@ free_tunnel_state (struct TunnelState *ts) | |||
578 | { | 578 | { |
579 | GNUNET_CONTAINER_heap_remove_node (ts->heap_node); | 579 | GNUNET_CONTAINER_heap_remove_node (ts->heap_node); |
580 | ts->heap_node = NULL; | 580 | ts->heap_node = NULL; |
581 | get_tunnel_key_from_ips (ts->af, | 581 | get_channel_key_from_ips (ts->af, |
582 | ts->protocol, | 582 | ts->protocol, |
583 | &ts->source_ip, | 583 | &ts->source_ip, |
584 | ts->source_port, | 584 | ts->source_port, |
@@ -586,7 +586,7 @@ free_tunnel_state (struct TunnelState *ts) | |||
586 | ts->destination_port, | 586 | ts->destination_port, |
587 | &key); | 587 | &key); |
588 | GNUNET_assert (GNUNET_YES == | 588 | GNUNET_assert (GNUNET_YES == |
589 | GNUNET_CONTAINER_multihashmap_remove (tunnel_map, | 589 | GNUNET_CONTAINER_multihashmap_remove (channel_map, |
590 | &key, | 590 | &key, |
591 | ts)); | 591 | ts)); |
592 | } | 592 | } |
@@ -603,7 +603,7 @@ free_tunnel_state (struct TunnelState *ts) | |||
603 | /** | 603 | /** |
604 | * Send a message from the message queue via mesh. | 604 | * Send a message from the message queue via mesh. |
605 | * | 605 | * |
606 | * @param cls the `struct TunnelState` with the message queue | 606 | * @param cls the `struct ChannelState` with the message queue |
607 | * @param size number of bytes available in @a buf | 607 | * @param size number of bytes available in @a buf |
608 | * @param buf where to copy the message | 608 | * @param buf where to copy the message |
609 | * @return number of bytes copied to @a buf | 609 | * @return number of bytes copied to @a buf |
@@ -611,8 +611,8 @@ free_tunnel_state (struct TunnelState *ts) | |||
611 | static size_t | 611 | static size_t |
612 | send_to_peer_notify_callback (void *cls, size_t size, void *buf) | 612 | send_to_peer_notify_callback (void *cls, size_t size, void *buf) |
613 | { | 613 | { |
614 | struct TunnelState *ts = cls; | 614 | struct ChannelState *ts = cls; |
615 | struct TunnelMessageQueueEntry *tnq; | 615 | struct ChannelMessageQueueEntry *tnq; |
616 | size_t ret; | 616 | size_t ret; |
617 | 617 | ||
618 | ts->th = NULL; | 618 | ts->th = NULL; |
@@ -622,7 +622,7 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
622 | GNUNET_assert (NULL != tnq); | 622 | GNUNET_assert (NULL != tnq); |
623 | GNUNET_assert (size >= tnq->len); | 623 | GNUNET_assert (size >= tnq->len); |
624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
625 | "Sending %u bytes via mesh tunnel\n", | 625 | "Sending %u bytes via mesh channel\n", |
626 | tnq->len); | 626 | tnq->len); |
627 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, | 627 | GNUNET_CONTAINER_DLL_remove (ts->tmq_head, |
628 | ts->tmq_tail, | 628 | ts->tmq_tail, |
@@ -632,7 +632,7 @@ 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->channel, |
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, |
@@ -646,27 +646,27 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf) | |||
646 | 646 | ||
647 | 647 | ||
648 | /** | 648 | /** |
649 | * Add the given message to the given tunnel and trigger the | 649 | * Add the given message to the given channel and trigger the |
650 | * transmission process. | 650 | * transmission process. |
651 | * | 651 | * |
652 | * @param tnq message to queue | 652 | * @param tnq message to queue |
653 | * @param ts tunnel to queue the message for | 653 | * @param ts channel to queue the message for |
654 | */ | 654 | */ |
655 | static void | 655 | static void |
656 | send_to_tunnel (struct TunnelMessageQueueEntry *tnq, | 656 | send_to_channel (struct ChannelMessageQueueEntry *tnq, |
657 | struct TunnelState *ts) | 657 | struct ChannelState *ts) |
658 | { | 658 | { |
659 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 659 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
660 | "Queueing %u bytes for transmission via mesh tunnel\n", | 660 | "Queueing %u bytes for transmission via mesh channel\n", |
661 | tnq->len); | 661 | tnq->len); |
662 | GNUNET_assert (NULL != ts->tunnel); | 662 | GNUNET_assert (NULL != ts->channel); |
663 | GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head, | 663 | GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head, |
664 | ts->tmq_tail, | 664 | ts->tmq_tail, |
665 | tnq); | 665 | tnq); |
666 | ts->tmq_length++; | 666 | ts->tmq_length++; |
667 | if (ts->tmq_length > MAX_MESSAGE_QUEUE_SIZE) | 667 | if (ts->tmq_length > MAX_MESSAGE_QUEUE_SIZE) |
668 | { | 668 | { |
669 | struct TunnelMessageQueueEntry *dq; | 669 | struct ChannelMessageQueueEntry *dq; |
670 | 670 | ||
671 | dq = ts->tmq_head; | 671 | dq = ts->tmq_head; |
672 | GNUNET_assert (dq != tnq); | 672 | GNUNET_assert (dq != tnq); |
@@ -683,7 +683,7 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq, | |||
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->channel, |
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, |
@@ -695,7 +695,7 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq, | |||
695 | /** | 695 | /** |
696 | * Regex has found a potential exit peer for us; consider using it. | 696 | * Regex has found a potential exit peer for us; consider using it. |
697 | * | 697 | * |
698 | * @param cls the 'struct TunnelState' | 698 | * @param cls the 'struct ChannelState' |
699 | * @param id Peer providing a regex that matches the string. | 699 | * @param id Peer providing a regex that matches the string. |
700 | * @param get_path Path of the get request. | 700 | * @param get_path Path of the get request. |
701 | * @param get_path_length Lenght of @a get_path. | 701 | * @param get_path_length Lenght of @a get_path. |
@@ -710,7 +710,7 @@ handle_regex_result (void *cls, | |||
710 | const struct GNUNET_PeerIdentity *put_path, | 710 | const struct GNUNET_PeerIdentity *put_path, |
711 | unsigned int put_path_length) | 711 | unsigned int put_path_length) |
712 | { | 712 | { |
713 | struct TunnelState *ts = cls; | 713 | struct ChannelState *ts = cls; |
714 | unsigned int apptype; | 714 | unsigned int apptype; |
715 | 715 | ||
716 | GNUNET_REGEX_search_cancel (ts->search); | 716 | GNUNET_REGEX_search_cancel (ts->search); |
@@ -727,7 +727,7 @@ handle_regex_result (void *cls, | |||
727 | GNUNET_break (0); | 727 | GNUNET_break (0); |
728 | return; | 728 | return; |
729 | } | 729 | } |
730 | ts->tunnel = GNUNET_MESH_tunnel_create (mesh_handle, | 730 | ts->channel = GNUNET_MESH_channel_create (mesh_handle, |
731 | ts, | 731 | ts, |
732 | id, | 732 | id, |
733 | apptype, | 733 | apptype, |
@@ -737,21 +737,21 @@ handle_regex_result (void *cls, | |||
737 | 737 | ||
738 | 738 | ||
739 | /** | 739 | /** |
740 | * Initialize the given destination entry's mesh tunnel. | 740 | * Initialize the given destination entry's mesh channel. |
741 | * | 741 | * |
742 | * @param dt destination tunnel for which we need to setup a tunnel | 742 | * @param dt destination channel for which we need to setup a channel |
743 | * @param client_af address family of the address returned to the client | 743 | * @param client_af address family of the address returned to the client |
744 | * @return tunnel state of the tunnel that was created | 744 | * @return channel state of the channel that was created |
745 | */ | 745 | */ |
746 | static struct TunnelState * | 746 | static struct ChannelState * |
747 | create_tunnel_to_destination (struct DestinationTunnel *dt, | 747 | create_channel_to_destination (struct DestinationChannel *dt, |
748 | int client_af) | 748 | int client_af) |
749 | { | 749 | { |
750 | struct TunnelState *ts; | 750 | struct ChannelState *ts; |
751 | unsigned int apptype; | 751 | unsigned int apptype; |
752 | 752 | ||
753 | GNUNET_STATISTICS_update (stats, | 753 | GNUNET_STATISTICS_update (stats, |
754 | gettext_noop ("# Mesh tunnels created"), | 754 | gettext_noop ("# Mesh channels created"), |
755 | 1, GNUNET_NO); | 755 | 1, GNUNET_NO); |
756 | GNUNET_assert (NULL == dt->ts); | 756 | GNUNET_assert (NULL == dt->ts); |
757 | switch (client_af) | 757 | switch (client_af) |
@@ -766,7 +766,7 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, | |||
766 | GNUNET_break (0); | 766 | GNUNET_break (0); |
767 | return NULL; | 767 | return NULL; |
768 | } | 768 | } |
769 | ts = GNUNET_new (struct TunnelState); | 769 | ts = GNUNET_new (struct ChannelState); |
770 | ts->af = client_af; | 770 | ts->af = client_af; |
771 | ts->destination = *dt->destination; | 771 | ts->destination = *dt->destination; |
772 | ts->destination.heap_node = NULL; /* copy is NOT in destination heap */ | 772 | ts->destination.heap_node = NULL; /* copy is NOT in destination heap */ |
@@ -774,21 +774,21 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, | |||
774 | ts->destination_container = dt; /* we are referenced from dt */ | 774 | ts->destination_container = dt; /* we are referenced from dt */ |
775 | if (dt->destination->is_service) | 775 | if (dt->destination->is_service) |
776 | { | 776 | { |
777 | ts->tunnel = GNUNET_MESH_tunnel_create (mesh_handle, | 777 | ts->channel = GNUNET_MESH_channel_create (mesh_handle, |
778 | ts, | 778 | ts, |
779 | &dt->destination->details.service_destination.target, | 779 | &dt->destination->details.service_destination.target, |
780 | apptype, | 780 | apptype, |
781 | GNUNET_YES, | 781 | GNUNET_YES, |
782 | GNUNET_NO); | 782 | GNUNET_NO); |
783 | if (NULL == ts->tunnel) | 783 | if (NULL == ts->channel) |
784 | { | 784 | { |
785 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 785 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
786 | _("Failed to setup mesh tunnel!\n")); | 786 | _("Failed to setup mesh channel!\n")); |
787 | GNUNET_free (ts); | 787 | GNUNET_free (ts); |
788 | return NULL; | 788 | return NULL; |
789 | } | 789 | } |
790 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 790 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
791 | "Creating tunnel to peer %s offering service %s\n", | 791 | "Creating channel to peer %s offering service %s\n", |
792 | GNUNET_i2s (&dt->destination->details.service_destination.target), | 792 | GNUNET_i2s (&dt->destination->details.service_destination.target), |
793 | GNUNET_h2s (&dt->destination->details.service_destination.service_descriptor)); | 793 | GNUNET_h2s (&dt->destination->details.service_destination.service_descriptor)); |
794 | } | 794 | } |
@@ -841,20 +841,20 @@ create_tunnel_to_destination (struct DestinationTunnel *dt, | |||
841 | 841 | ||
842 | 842 | ||
843 | /** | 843 | /** |
844 | * We have too many active tunnels. Clean up the oldest tunnel. | 844 | * We have too many active channels. Clean up the oldest channel. |
845 | * | 845 | * |
846 | * @param except tunnel that must NOT be cleaned up, even if it is the oldest | 846 | * @param except channel that must NOT be cleaned up, even if it is the oldest |
847 | */ | 847 | */ |
848 | static void | 848 | static void |
849 | expire_tunnel (struct TunnelState *except) | 849 | expire_channel (struct ChannelState *except) |
850 | { | 850 | { |
851 | struct TunnelState *ts; | 851 | struct ChannelState *ts; |
852 | 852 | ||
853 | ts = GNUNET_CONTAINER_heap_peek (tunnel_heap); | 853 | ts = GNUNET_CONTAINER_heap_peek (channel_heap); |
854 | GNUNET_assert (NULL != ts); | 854 | GNUNET_assert (NULL != ts); |
855 | if (except == ts) | 855 | if (except == ts) |
856 | return; /* can't do this */ | 856 | return; /* can't do this */ |
857 | free_tunnel_state (ts); | 857 | free_channel_state (ts); |
858 | } | 858 | } |
859 | 859 | ||
860 | 860 | ||
@@ -879,15 +879,15 @@ route_packet (struct DestinationEntry *destination, | |||
879 | size_t payload_length) | 879 | size_t payload_length) |
880 | { | 880 | { |
881 | struct GNUNET_HashCode key; | 881 | struct GNUNET_HashCode key; |
882 | struct TunnelState *ts; | 882 | struct ChannelState *ts; |
883 | struct TunnelMessageQueueEntry *tnq; | 883 | struct ChannelMessageQueueEntry *tnq; |
884 | size_t alen; | 884 | size_t alen; |
885 | size_t mlen; | 885 | size_t mlen; |
886 | int is_new; | 886 | int is_new; |
887 | const struct GNUNET_TUN_UdpHeader *udp; | 887 | const struct GNUNET_TUN_UdpHeader *udp; |
888 | const struct GNUNET_TUN_TcpHeader *tcp; | 888 | const struct GNUNET_TUN_TcpHeader *tcp; |
889 | const struct GNUNET_TUN_IcmpHeader *icmp; | 889 | const struct GNUNET_TUN_IcmpHeader *icmp; |
890 | struct DestinationTunnel *dt; | 890 | struct DestinationChannel *dt; |
891 | uint16_t source_port; | 891 | uint16_t source_port; |
892 | uint16_t destination_port; | 892 | uint16_t destination_port; |
893 | 893 | ||
@@ -911,7 +911,7 @@ route_packet (struct DestinationEntry *destination, | |||
911 | } | 911 | } |
912 | source_port = ntohs (udp->source_port); | 912 | source_port = ntohs (udp->source_port); |
913 | destination_port = ntohs (udp->destination_port); | 913 | destination_port = ntohs (udp->destination_port); |
914 | get_tunnel_key_from_ips (af, | 914 | get_channel_key_from_ips (af, |
915 | IPPROTO_UDP, | 915 | IPPROTO_UDP, |
916 | source_ip, | 916 | source_ip, |
917 | source_port, | 917 | source_port, |
@@ -938,7 +938,7 @@ route_packet (struct DestinationEntry *destination, | |||
938 | } | 938 | } |
939 | source_port = ntohs (tcp->source_port); | 939 | source_port = ntohs (tcp->source_port); |
940 | destination_port = ntohs (tcp->destination_port); | 940 | destination_port = ntohs (tcp->destination_port); |
941 | get_tunnel_key_from_ips (af, | 941 | get_channel_key_from_ips (af, |
942 | IPPROTO_TCP, | 942 | IPPROTO_TCP, |
943 | source_ip, | 943 | source_ip, |
944 | source_port, | 944 | source_port, |
@@ -966,7 +966,7 @@ route_packet (struct DestinationEntry *destination, | |||
966 | icmp = payload; | 966 | icmp = payload; |
967 | source_port = 0; | 967 | source_port = 0; |
968 | destination_port = 0; | 968 | destination_port = 0; |
969 | get_tunnel_key_from_ips (af, | 969 | get_channel_key_from_ips (af, |
970 | protocol, | 970 | protocol, |
971 | source_ip, | 971 | source_ip, |
972 | 0, | 972 | 0, |
@@ -1037,7 +1037,7 @@ route_packet (struct DestinationEntry *destination, | |||
1037 | } | 1037 | } |
1038 | if (NULL == dt) | 1038 | if (NULL == dt) |
1039 | { | 1039 | { |
1040 | dt = GNUNET_new (struct DestinationTunnel); | 1040 | dt = GNUNET_new (struct DestinationChannel); |
1041 | dt->destination = destination; | 1041 | dt->destination = destination; |
1042 | GNUNET_CONTAINER_DLL_insert (destination->dt_head, | 1042 | GNUNET_CONTAINER_DLL_insert (destination->dt_head, |
1043 | destination->dt_tail, | 1043 | destination->dt_tail, |
@@ -1045,23 +1045,23 @@ route_packet (struct DestinationEntry *destination, | |||
1045 | dt->destination_port = destination_port; | 1045 | dt->destination_port = destination_port; |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | /* see if we have an existing tunnel for this destination */ | 1048 | /* see if we have an existing channel for this destination */ |
1049 | ts = GNUNET_CONTAINER_multihashmap_get (tunnel_map, | 1049 | ts = GNUNET_CONTAINER_multihashmap_get (channel_map, |
1050 | &key); | 1050 | &key); |
1051 | if (NULL == ts) | 1051 | if (NULL == ts) |
1052 | { | 1052 | { |
1053 | /* need to either use the existing tunnel from the destination (if still | 1053 | /* need to either use the existing channel from the destination (if still |
1054 | available) or create a fresh one */ | 1054 | available) or create a fresh one */ |
1055 | is_new = GNUNET_YES; | 1055 | is_new = GNUNET_YES; |
1056 | if (NULL == dt->ts) | 1056 | if (NULL == dt->ts) |
1057 | ts = create_tunnel_to_destination (dt, af); | 1057 | ts = create_channel_to_destination (dt, af); |
1058 | else | 1058 | else |
1059 | ts = dt->ts; | 1059 | ts = dt->ts; |
1060 | if (NULL == ts) | 1060 | if (NULL == ts) |
1061 | return; | 1061 | return; |
1062 | dt->ts = NULL; | 1062 | dt->ts = NULL; |
1063 | ts->destination_container = NULL; /* no longer 'contained' */ | 1063 | ts->destination_container = NULL; /* no longer 'contained' */ |
1064 | /* now bind existing "unbound" tunnel to our IP/port tuple */ | 1064 | /* now bind existing "unbound" channel to our IP/port tuple */ |
1065 | ts->protocol = protocol; | 1065 | ts->protocol = protocol; |
1066 | ts->af = af; | 1066 | ts->af = af; |
1067 | if (AF_INET == af) | 1067 | if (AF_INET == af) |
@@ -1076,30 +1076,30 @@ route_packet (struct DestinationEntry *destination, | |||
1076 | } | 1076 | } |
1077 | ts->source_port = source_port; | 1077 | ts->source_port = source_port; |
1078 | ts->destination_port = destination_port; | 1078 | ts->destination_port = destination_port; |
1079 | ts->heap_node = GNUNET_CONTAINER_heap_insert (tunnel_heap, | 1079 | ts->heap_node = GNUNET_CONTAINER_heap_insert (channel_heap, |
1080 | ts, | 1080 | ts, |
1081 | GNUNET_TIME_absolute_get ().abs_value_us); | 1081 | GNUNET_TIME_absolute_get ().abs_value_us); |
1082 | GNUNET_assert (GNUNET_YES == | 1082 | GNUNET_assert (GNUNET_YES == |
1083 | GNUNET_CONTAINER_multihashmap_put (tunnel_map, | 1083 | GNUNET_CONTAINER_multihashmap_put (channel_map, |
1084 | &key, | 1084 | &key, |
1085 | ts, | 1085 | ts, |
1086 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 1086 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
1087 | GNUNET_STATISTICS_update (stats, | 1087 | GNUNET_STATISTICS_update (stats, |
1088 | gettext_noop ("# Active tunnels"), | 1088 | gettext_noop ("# Active channels"), |
1089 | 1, GNUNET_NO); | 1089 | 1, GNUNET_NO); |
1090 | while (GNUNET_CONTAINER_multihashmap_size (tunnel_map) > max_tunnel_mappings) | 1090 | while (GNUNET_CONTAINER_multihashmap_size (channel_map) > max_channel_mappings) |
1091 | expire_tunnel (ts); | 1091 | expire_channel (ts); |
1092 | } | 1092 | } |
1093 | else | 1093 | else |
1094 | { | 1094 | { |
1095 | is_new = GNUNET_NO; | 1095 | is_new = GNUNET_NO; |
1096 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 1096 | GNUNET_CONTAINER_heap_update_cost (channel_heap, |
1097 | ts->heap_node, | 1097 | ts->heap_node, |
1098 | GNUNET_TIME_absolute_get ().abs_value_us); | 1098 | GNUNET_TIME_absolute_get ().abs_value_us); |
1099 | } | 1099 | } |
1100 | GNUNET_assert (NULL != ts->tunnel); | 1100 | GNUNET_assert (NULL != ts->channel); |
1101 | 1101 | ||
1102 | /* send via tunnel */ | 1102 | /* send via channel */ |
1103 | switch (protocol) | 1103 | switch (protocol) |
1104 | { | 1104 | { |
1105 | case IPPROTO_UDP: | 1105 | case IPPROTO_UDP: |
@@ -1114,7 +1114,7 @@ route_packet (struct DestinationEntry *destination, | |||
1114 | GNUNET_break (0); | 1114 | GNUNET_break (0); |
1115 | return; | 1115 | return; |
1116 | } | 1116 | } |
1117 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1117 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1118 | tnq->len = mlen; | 1118 | tnq->len = mlen; |
1119 | tnq->msg = &tnq[1]; | 1119 | tnq->msg = &tnq[1]; |
1120 | usm = (struct GNUNET_EXIT_UdpServiceMessage *) &tnq[1]; | 1120 | usm = (struct GNUNET_EXIT_UdpServiceMessage *) &tnq[1]; |
@@ -1143,7 +1143,7 @@ route_packet (struct DestinationEntry *destination, | |||
1143 | GNUNET_break (0); | 1143 | GNUNET_break (0); |
1144 | return; | 1144 | return; |
1145 | } | 1145 | } |
1146 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1146 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1147 | tnq->len = mlen; | 1147 | tnq->len = mlen; |
1148 | tnq->msg = &tnq[1]; | 1148 | tnq->msg = &tnq[1]; |
1149 | uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1]; | 1149 | uim = (struct GNUNET_EXIT_UdpInternetMessage *) &tnq[1]; |
@@ -1186,7 +1186,7 @@ route_packet (struct DestinationEntry *destination, | |||
1186 | GNUNET_break (0); | 1186 | GNUNET_break (0); |
1187 | return; | 1187 | return; |
1188 | } | 1188 | } |
1189 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1189 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1190 | tnq->len = mlen; | 1190 | tnq->len = mlen; |
1191 | tnq->msg = &tnq[1]; | 1191 | tnq->msg = &tnq[1]; |
1192 | tsm = (struct GNUNET_EXIT_TcpServiceStartMessage *) &tnq[1]; | 1192 | tsm = (struct GNUNET_EXIT_TcpServiceStartMessage *) &tnq[1]; |
@@ -1213,7 +1213,7 @@ route_packet (struct DestinationEntry *destination, | |||
1213 | GNUNET_break (0); | 1213 | GNUNET_break (0); |
1214 | return; | 1214 | return; |
1215 | } | 1215 | } |
1216 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1216 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1217 | tnq->len = mlen; | 1217 | tnq->len = mlen; |
1218 | tnq->msg = &tnq[1]; | 1218 | tnq->msg = &tnq[1]; |
1219 | tim = (struct GNUNET_EXIT_TcpInternetStartMessage *) &tnq[1]; | 1219 | tim = (struct GNUNET_EXIT_TcpInternetStartMessage *) &tnq[1]; |
@@ -1252,7 +1252,7 @@ route_packet (struct DestinationEntry *destination, | |||
1252 | GNUNET_break (0); | 1252 | GNUNET_break (0); |
1253 | return; | 1253 | return; |
1254 | } | 1254 | } |
1255 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1255 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1256 | tnq->len = mlen; | 1256 | tnq->len = mlen; |
1257 | tnq->msg = &tnq[1]; | 1257 | tnq->msg = &tnq[1]; |
1258 | tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1]; | 1258 | tdm = (struct GNUNET_EXIT_TcpDataMessage *) &tnq[1]; |
@@ -1278,7 +1278,7 @@ route_packet (struct DestinationEntry *destination, | |||
1278 | GNUNET_break (0); | 1278 | GNUNET_break (0); |
1279 | return; | 1279 | return; |
1280 | } | 1280 | } |
1281 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1281 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1282 | tnq->msg = &tnq[1]; | 1282 | tnq->msg = &tnq[1]; |
1283 | ism = (struct GNUNET_EXIT_IcmpServiceMessage *) &tnq[1]; | 1283 | ism = (struct GNUNET_EXIT_IcmpServiceMessage *) &tnq[1]; |
1284 | ism->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE); | 1284 | ism->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_SERVICE); |
@@ -1360,7 +1360,7 @@ route_packet (struct DestinationEntry *destination, | |||
1360 | GNUNET_break (0); | 1360 | GNUNET_break (0); |
1361 | return; | 1361 | return; |
1362 | } | 1362 | } |
1363 | tnq = GNUNET_malloc (sizeof (struct TunnelMessageQueueEntry) + mlen); | 1363 | tnq = GNUNET_malloc (sizeof (struct ChannelMessageQueueEntry) + mlen); |
1364 | tnq->msg = &tnq[1]; | 1364 | tnq->msg = &tnq[1]; |
1365 | iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1]; | 1365 | iim = (struct GNUNET_EXIT_IcmpInternetMessage *) &tnq[1]; |
1366 | iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); | 1366 | iim->header.type = htons (GNUNET_MESSAGE_TYPE_VPN_ICMP_TO_INTERNET); |
@@ -1505,19 +1505,19 @@ route_packet (struct DestinationEntry *destination, | |||
1505 | GNUNET_assert (0); | 1505 | GNUNET_assert (0); |
1506 | break; | 1506 | break; |
1507 | } | 1507 | } |
1508 | send_to_tunnel (tnq, ts); | 1508 | send_to_channel (tnq, ts); |
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | 1511 | ||
1512 | /** | 1512 | /** |
1513 | * Receive packets from the helper-process (someone send to the local | 1513 | * Receive packets from the helper-process (someone send to the local |
1514 | * virtual tunnel interface). Find the destination mapping, and if it | 1514 | * virtual channel interface). Find the destination mapping, and if it |
1515 | * exists, identify the correct MESH tunnel (or possibly create it) | 1515 | * exists, identify the correct MESH channel (or possibly create it) |
1516 | * and forward the packet. | 1516 | * and forward the packet. |
1517 | * | 1517 | * |
1518 | * @param cls closure, NULL | 1518 | * @param cls closure, NULL |
1519 | * @param client NULL | 1519 | * @param client NULL |
1520 | * @param message message we got from the client (VPN tunnel interface) | 1520 | * @param message message we got from the client (VPN channel interface) |
1521 | */ | 1521 | */ |
1522 | static int | 1522 | static int |
1523 | message_token (void *cls, | 1523 | message_token (void *cls, |
@@ -1633,15 +1633,15 @@ message_token (void *cls, | |||
1633 | 1633 | ||
1634 | /** | 1634 | /** |
1635 | * Synthesize a plausible ICMP payload for an ICMP error | 1635 | * Synthesize a plausible ICMP payload for an ICMP error |
1636 | * response on the given tunnel. | 1636 | * response on the given channel. |
1637 | * | 1637 | * |
1638 | * @param ts tunnel information | 1638 | * @param ts channel information |
1639 | * @param ipp IPv4 header to fill in (ICMP payload) | 1639 | * @param ipp IPv4 header to fill in (ICMP payload) |
1640 | * @param udp "UDP" header to fill in (ICMP payload); might actually | 1640 | * @param udp "UDP" header to fill in (ICMP payload); might actually |
1641 | * also be the first 8 bytes of the TCP header | 1641 | * also be the first 8 bytes of the TCP header |
1642 | */ | 1642 | */ |
1643 | static void | 1643 | static void |
1644 | make_up_icmpv4_payload (struct TunnelState *ts, | 1644 | make_up_icmpv4_payload (struct ChannelState *ts, |
1645 | struct GNUNET_TUN_IPv4Header *ipp, | 1645 | struct GNUNET_TUN_IPv4Header *ipp, |
1646 | struct GNUNET_TUN_UdpHeader *udp) | 1646 | struct GNUNET_TUN_UdpHeader *udp) |
1647 | { | 1647 | { |
@@ -1659,15 +1659,15 @@ make_up_icmpv4_payload (struct TunnelState *ts, | |||
1659 | 1659 | ||
1660 | /** | 1660 | /** |
1661 | * Synthesize a plausible ICMP payload for an ICMP error | 1661 | * Synthesize a plausible ICMP payload for an ICMP error |
1662 | * response on the given tunnel. | 1662 | * response on the given channel. |
1663 | * | 1663 | * |
1664 | * @param ts tunnel information | 1664 | * @param ts channel information |
1665 | * @param ipp IPv6 header to fill in (ICMP payload) | 1665 | * @param ipp IPv6 header to fill in (ICMP payload) |
1666 | * @param udp "UDP" header to fill in (ICMP payload); might actually | 1666 | * @param udp "UDP" header to fill in (ICMP payload); might actually |
1667 | * also be the first 8 bytes of the TCP header | 1667 | * also be the first 8 bytes of the TCP header |
1668 | */ | 1668 | */ |
1669 | static void | 1669 | static void |
1670 | make_up_icmpv6_payload (struct TunnelState *ts, | 1670 | make_up_icmpv6_payload (struct ChannelState *ts, |
1671 | struct GNUNET_TUN_IPv6Header *ipp, | 1671 | struct GNUNET_TUN_IPv6Header *ipp, |
1672 | struct GNUNET_TUN_UdpHeader *udp) | 1672 | struct GNUNET_TUN_UdpHeader *udp) |
1673 | { | 1673 | { |
@@ -1684,23 +1684,23 @@ make_up_icmpv6_payload (struct TunnelState *ts, | |||
1684 | 1684 | ||
1685 | 1685 | ||
1686 | /** | 1686 | /** |
1687 | * We got an ICMP packet back from the MESH tunnel. Pass it on to the | 1687 | * We got an ICMP packet back from the MESH channel. Pass it on to the |
1688 | * local virtual interface via the helper. | 1688 | * local virtual interface via the helper. |
1689 | * | 1689 | * |
1690 | * @param cls closure, NULL | 1690 | * @param cls closure, NULL |
1691 | * @param tunnel connection to the other end | 1691 | * @param channel connection to the other end |
1692 | * @param tunnel_ctx pointer to our 'struct TunnelState *' | 1692 | * @param channel_ctx pointer to our 'struct ChannelState *' |
1693 | * @param message the actual message | 1693 | * @param message the actual message |
1694 | * @return #GNUNET_OK to keep the connection open, | 1694 | * @return #GNUNET_OK to keep the connection open, |
1695 | * #GNUNET_SYSERR to close it (signal serious error) | 1695 | * #GNUNET_SYSERR to close it (signal serious error) |
1696 | */ | 1696 | */ |
1697 | static int | 1697 | static int |
1698 | receive_icmp_back (void *cls, | 1698 | receive_icmp_back (void *cls, |
1699 | struct GNUNET_MESH_Tunnel *tunnel, | 1699 | struct GNUNET_MESH_Channel *channel, |
1700 | void **tunnel_ctx, | 1700 | void **channel_ctx, |
1701 | const struct GNUNET_MessageHeader *message) | 1701 | const struct GNUNET_MessageHeader *message) |
1702 | { | 1702 | { |
1703 | struct TunnelState *ts = *tunnel_ctx; | 1703 | struct ChannelState *ts = *channel_ctx; |
1704 | const struct GNUNET_EXIT_IcmpToVPNMessage *i2v; | 1704 | const struct GNUNET_EXIT_IcmpToVPNMessage *i2v; |
1705 | size_t mlen; | 1705 | size_t mlen; |
1706 | 1706 | ||
@@ -2015,7 +2015,7 @@ receive_icmp_back (void *cls, | |||
2015 | default: | 2015 | default: |
2016 | GNUNET_assert (0); | 2016 | GNUNET_assert (0); |
2017 | } | 2017 | } |
2018 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2018 | GNUNET_CONTAINER_heap_update_cost (channel_heap, |
2019 | ts->heap_node, | 2019 | ts->heap_node, |
2020 | GNUNET_TIME_absolute_get ().abs_value_us); | 2020 | GNUNET_TIME_absolute_get ().abs_value_us); |
2021 | return GNUNET_OK; | 2021 | return GNUNET_OK; |
@@ -2023,23 +2023,23 @@ receive_icmp_back (void *cls, | |||
2023 | 2023 | ||
2024 | 2024 | ||
2025 | /** | 2025 | /** |
2026 | * We got a UDP packet back from the MESH tunnel. Pass it on to the | 2026 | * We got a UDP packet back from the MESH channel. Pass it on to the |
2027 | * local virtual interface via the helper. | 2027 | * local virtual interface via the helper. |
2028 | * | 2028 | * |
2029 | * @param cls closure, NULL | 2029 | * @param cls closure, NULL |
2030 | * @param tunnel connection to the other end | 2030 | * @param channel connection to the other end |
2031 | * @param tunnel_ctx pointer to our 'struct TunnelState *' | 2031 | * @param channel_ctx pointer to our 'struct ChannelState *' |
2032 | * @param message the actual message | 2032 | * @param message the actual message |
2033 | * @return #GNUNET_OK to keep the connection open, | 2033 | * @return #GNUNET_OK to keep the connection open, |
2034 | * #GNUNET_SYSERR to close it (signal serious error) | 2034 | * #GNUNET_SYSERR to close it (signal serious error) |
2035 | */ | 2035 | */ |
2036 | static int | 2036 | static int |
2037 | receive_udp_back (void *cls, | 2037 | receive_udp_back (void *cls, |
2038 | struct GNUNET_MESH_Tunnel *tunnel, | 2038 | struct GNUNET_MESH_Channel *channel, |
2039 | void **tunnel_ctx, | 2039 | void **channel_ctx, |
2040 | const struct GNUNET_MessageHeader *message) | 2040 | const struct GNUNET_MessageHeader *message) |
2041 | { | 2041 | { |
2042 | struct TunnelState *ts = *tunnel_ctx; | 2042 | struct ChannelState *ts = *channel_ctx; |
2043 | const struct GNUNET_EXIT_UdpReplyMessage *reply; | 2043 | const struct GNUNET_EXIT_UdpReplyMessage *reply; |
2044 | size_t mlen; | 2044 | size_t mlen; |
2045 | 2045 | ||
@@ -2170,7 +2170,7 @@ receive_udp_back (void *cls, | |||
2170 | default: | 2170 | default: |
2171 | GNUNET_assert (0); | 2171 | GNUNET_assert (0); |
2172 | } | 2172 | } |
2173 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2173 | GNUNET_CONTAINER_heap_update_cost (channel_heap, |
2174 | ts->heap_node, | 2174 | ts->heap_node, |
2175 | GNUNET_TIME_absolute_get ().abs_value_us); | 2175 | GNUNET_TIME_absolute_get ().abs_value_us); |
2176 | return GNUNET_OK; | 2176 | return GNUNET_OK; |
@@ -2178,23 +2178,23 @@ receive_udp_back (void *cls, | |||
2178 | 2178 | ||
2179 | 2179 | ||
2180 | /** | 2180 | /** |
2181 | * We got a TCP packet back from the MESH tunnel. Pass it on to the | 2181 | * We got a TCP packet back from the MESH channel. Pass it on to the |
2182 | * local virtual interface via the helper. | 2182 | * local virtual interface via the helper. |
2183 | * | 2183 | * |
2184 | * @param cls closure, NULL | 2184 | * @param cls closure, NULL |
2185 | * @param tunnel connection to the other end | 2185 | * @param channel connection to the other end |
2186 | * @param tunnel_ctx pointer to our `struct TunnelState *` | 2186 | * @param channel_ctx pointer to our `struct ChannelState *` |
2187 | * @param message the actual message | 2187 | * @param message the actual message |
2188 | * @return #GNUNET_OK to keep the connection open, | 2188 | * @return #GNUNET_OK to keep the connection open, |
2189 | * #GNUNET_SYSERR to close it (signal serious error) | 2189 | * #GNUNET_SYSERR to close it (signal serious error) |
2190 | */ | 2190 | */ |
2191 | static int | 2191 | static int |
2192 | receive_tcp_back (void *cls, | 2192 | receive_tcp_back (void *cls, |
2193 | struct GNUNET_MESH_Tunnel *tunnel, | 2193 | struct GNUNET_MESH_Channel *channel, |
2194 | void **tunnel_ctx, | 2194 | void **channel_ctx, |
2195 | const struct GNUNET_MessageHeader *message) | 2195 | const struct GNUNET_MessageHeader *message) |
2196 | { | 2196 | { |
2197 | struct TunnelState *ts = *tunnel_ctx; | 2197 | struct ChannelState *ts = *channel_ctx; |
2198 | const struct GNUNET_EXIT_TcpDataMessage *data; | 2198 | const struct GNUNET_EXIT_TcpDataMessage *data; |
2199 | size_t mlen; | 2199 | size_t mlen; |
2200 | 2200 | ||
@@ -2312,7 +2312,7 @@ receive_tcp_back (void *cls, | |||
2312 | } | 2312 | } |
2313 | break; | 2313 | break; |
2314 | } | 2314 | } |
2315 | GNUNET_CONTAINER_heap_update_cost (tunnel_heap, | 2315 | GNUNET_CONTAINER_heap_update_cost (channel_heap, |
2316 | ts->heap_node, | 2316 | ts->heap_node, |
2317 | GNUNET_TIME_absolute_get ().abs_value_us); | 2317 | GNUNET_TIME_absolute_get ().abs_value_us); |
2318 | return GNUNET_OK; | 2318 | return GNUNET_OK; |
@@ -2320,7 +2320,7 @@ receive_tcp_back (void *cls, | |||
2320 | 2320 | ||
2321 | 2321 | ||
2322 | /** | 2322 | /** |
2323 | * Allocate an IPv4 address from the range of the tunnel | 2323 | * Allocate an IPv4 address from the range of the channel |
2324 | * for a new redirection. | 2324 | * for a new redirection. |
2325 | * | 2325 | * |
2326 | * @param v4 where to store the address | 2326 | * @param v4 where to store the address |
@@ -2371,7 +2371,7 @@ allocate_v4_address (struct in_addr *v4) | |||
2371 | 2371 | ||
2372 | 2372 | ||
2373 | /** | 2373 | /** |
2374 | * Allocate an IPv6 address from the range of the tunnel | 2374 | * Allocate an IPv6 address from the range of the channel |
2375 | * for a new redirection. | 2375 | * for a new redirection. |
2376 | * | 2376 | * |
2377 | * @param v6 where to store the address | 2377 | * @param v6 where to store the address |
@@ -2441,7 +2441,7 @@ allocate_v6_address (struct in6_addr *v6) | |||
2441 | static void | 2441 | static void |
2442 | free_destination_entry (struct DestinationEntry *de) | 2442 | free_destination_entry (struct DestinationEntry *de) |
2443 | { | 2443 | { |
2444 | struct DestinationTunnel *dt; | 2444 | struct DestinationChannel *dt; |
2445 | 2445 | ||
2446 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2446 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2447 | "Cleaning up destination entry\n"); | 2447 | "Cleaning up destination entry\n"); |
@@ -2452,7 +2452,7 @@ free_destination_entry (struct DestinationEntry *de) | |||
2452 | { | 2452 | { |
2453 | if (NULL != dt->ts) | 2453 | if (NULL != dt->ts) |
2454 | { | 2454 | { |
2455 | free_tunnel_state (dt->ts); | 2455 | free_channel_state (dt->ts); |
2456 | GNUNET_assert (NULL == dt->ts); | 2456 | GNUNET_assert (NULL == dt->ts); |
2457 | } | 2457 | } |
2458 | GNUNET_CONTAINER_DLL_remove (de->dt_head, | 2458 | GNUNET_CONTAINER_DLL_remove (de->dt_head, |
@@ -2691,8 +2691,8 @@ service_redirect_to_service (void *cls, | |||
2691 | void *addr; | 2691 | void *addr; |
2692 | struct DestinationEntry *de; | 2692 | struct DestinationEntry *de; |
2693 | struct GNUNET_HashCode key; | 2693 | struct GNUNET_HashCode key; |
2694 | struct TunnelState *ts; | 2694 | struct ChannelState *ts; |
2695 | struct DestinationTunnel *dt; | 2695 | struct DestinationChannel *dt; |
2696 | 2696 | ||
2697 | /* parse request */ | 2697 | /* parse request */ |
2698 | msg = (const struct RedirectToServiceRequestMessage *) message; | 2698 | msg = (const struct RedirectToServiceRequestMessage *) message; |
@@ -2749,12 +2749,12 @@ service_redirect_to_service (void *cls, | |||
2749 | while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings) | 2749 | while (GNUNET_CONTAINER_multihashmap_size (destination_map) > max_destination_mappings) |
2750 | expire_destination (de); | 2750 | expire_destination (de); |
2751 | 2751 | ||
2752 | dt = GNUNET_new (struct DestinationTunnel); | 2752 | dt = GNUNET_new (struct DestinationChannel); |
2753 | dt->destination = de; | 2753 | dt->destination = de; |
2754 | GNUNET_CONTAINER_DLL_insert (de->dt_head, | 2754 | GNUNET_CONTAINER_DLL_insert (de->dt_head, |
2755 | de->dt_tail, | 2755 | de->dt_tail, |
2756 | dt); | 2756 | dt); |
2757 | ts = create_tunnel_to_destination (dt, | 2757 | ts = create_channel_to_destination (dt, |
2758 | result_af); | 2758 | result_af); |
2759 | switch (result_af) | 2759 | switch (result_af) |
2760 | { | 2760 | { |
@@ -2773,23 +2773,23 @@ service_redirect_to_service (void *cls, | |||
2773 | 2773 | ||
2774 | 2774 | ||
2775 | /** | 2775 | /** |
2776 | * Function called whenever a tunnel is destroyed. Should clean up | 2776 | * Function called whenever a channel is destroyed. Should clean up |
2777 | * any associated state. | 2777 | * any associated state. |
2778 | * | 2778 | * |
2779 | * @param cls closure (set from #GNUNET_MESH_connect) | 2779 | * @param cls closure (set from #GNUNET_MESH_connect) |
2780 | * @param tunnel connection to the other end (henceforth invalid) | 2780 | * @param channel connection to the other end (henceforth invalid) |
2781 | * @param tunnel_ctx place where local state associated | 2781 | * @param channel_ctx place where local state associated |
2782 | * with the tunnel is stored (our `struct TunnelState`) | 2782 | * with the channel is stored (our `struct ChannelState`) |
2783 | */ | 2783 | */ |
2784 | static void | 2784 | static void |
2785 | tunnel_cleaner (void *cls, | 2785 | channel_cleaner (void *cls, |
2786 | const struct GNUNET_MESH_Tunnel *tunnel, | 2786 | const struct GNUNET_MESH_Channel *channel, |
2787 | void *tunnel_ctx) | 2787 | void *channel_ctx) |
2788 | { | 2788 | { |
2789 | struct TunnelState *ts = tunnel_ctx; | 2789 | struct ChannelState *ts = channel_ctx; |
2790 | 2790 | ||
2791 | ts->tunnel = NULL; /* we must not call GNUNET_MESH_tunnel_destroy() anymore */ | 2791 | ts->channel = NULL; /* we must not call GNUNET_MESH_channel_destroy() anymore */ |
2792 | free_tunnel_state (ts); | 2792 | free_channel_state (ts); |
2793 | } | 2793 | } |
2794 | 2794 | ||
2795 | 2795 | ||
@@ -2814,21 +2814,21 @@ cleanup_destination (void *cls, | |||
2814 | 2814 | ||
2815 | 2815 | ||
2816 | /** | 2816 | /** |
2817 | * Free memory occupied by an entry in the tunnel map. | 2817 | * Free memory occupied by an entry in the channel map. |
2818 | * | 2818 | * |
2819 | * @param cls unused | 2819 | * @param cls unused |
2820 | * @param key unused | 2820 | * @param key unused |
2821 | * @param value a `struct TunnelState *` | 2821 | * @param value a `struct ChannelState *` |
2822 | * @return #GNUNET_OK (continue to iterate) | 2822 | * @return #GNUNET_OK (continue to iterate) |
2823 | */ | 2823 | */ |
2824 | static int | 2824 | static int |
2825 | cleanup_tunnel (void *cls, | 2825 | cleanup_channel (void *cls, |
2826 | const struct GNUNET_HashCode *key, | 2826 | const struct GNUNET_HashCode *key, |
2827 | void *value) | 2827 | void *value) |
2828 | { | 2828 | { |
2829 | struct TunnelState *ts = value; | 2829 | struct ChannelState *ts = value; |
2830 | 2830 | ||
2831 | free_tunnel_state (ts); | 2831 | free_channel_state (ts); |
2832 | return GNUNET_OK; | 2832 | return GNUNET_OK; |
2833 | } | 2833 | } |
2834 | 2834 | ||
@@ -2860,18 +2860,18 @@ cleanup (void *cls, | |||
2860 | GNUNET_CONTAINER_heap_destroy (destination_heap); | 2860 | GNUNET_CONTAINER_heap_destroy (destination_heap); |
2861 | destination_heap = NULL; | 2861 | destination_heap = NULL; |
2862 | } | 2862 | } |
2863 | if (NULL != tunnel_map) | 2863 | if (NULL != channel_map) |
2864 | { | 2864 | { |
2865 | GNUNET_CONTAINER_multihashmap_iterate (tunnel_map, | 2865 | GNUNET_CONTAINER_multihashmap_iterate (channel_map, |
2866 | &cleanup_tunnel, | 2866 | &cleanup_channel, |
2867 | NULL); | 2867 | NULL); |
2868 | GNUNET_CONTAINER_multihashmap_destroy (tunnel_map); | 2868 | GNUNET_CONTAINER_multihashmap_destroy (channel_map); |
2869 | tunnel_map = NULL; | 2869 | channel_map = NULL; |
2870 | } | 2870 | } |
2871 | if (NULL != tunnel_heap) | 2871 | if (NULL != channel_heap) |
2872 | { | 2872 | { |
2873 | GNUNET_CONTAINER_heap_destroy (tunnel_heap); | 2873 | GNUNET_CONTAINER_heap_destroy (channel_heap); |
2874 | tunnel_heap = NULL; | 2874 | channel_heap = NULL; |
2875 | } | 2875 | } |
2876 | if (NULL != mesh_handle) | 2876 | if (NULL != mesh_handle) |
2877 | { | 2877 | { |
@@ -2954,13 +2954,13 @@ run (void *cls, | |||
2954 | max_destination_mappings = 200; | 2954 | max_destination_mappings = 200; |
2955 | if (GNUNET_OK != | 2955 | if (GNUNET_OK != |
2956 | GNUNET_CONFIGURATION_get_value_number (cfg, "VPN", "MAX_TUNNELS", | 2956 | GNUNET_CONFIGURATION_get_value_number (cfg, "VPN", "MAX_TUNNELS", |
2957 | &max_tunnel_mappings)) | 2957 | &max_channel_mappings)) |
2958 | max_tunnel_mappings = 200; | 2958 | max_channel_mappings = 200; |
2959 | 2959 | ||
2960 | destination_map = GNUNET_CONTAINER_multihashmap_create (max_destination_mappings * 2, GNUNET_NO); | 2960 | destination_map = GNUNET_CONTAINER_multihashmap_create (max_destination_mappings * 2, GNUNET_NO); |
2961 | destination_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 2961 | destination_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
2962 | tunnel_map = GNUNET_CONTAINER_multihashmap_create (max_tunnel_mappings * 2, GNUNET_NO); | 2962 | channel_map = GNUNET_CONTAINER_multihashmap_create (max_channel_mappings * 2, GNUNET_NO); |
2963 | tunnel_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); | 2963 | channel_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); |
2964 | 2964 | ||
2965 | 2965 | ||
2966 | vpn_argv[0] = GNUNET_strdup ("vpn-gnunet"); | 2966 | vpn_argv[0] = GNUNET_strdup ("vpn-gnunet"); |
@@ -3058,7 +3058,7 @@ run (void *cls, | |||
3058 | mesh_handle = | 3058 | mesh_handle = |
3059 | GNUNET_MESH_connect (cfg_, NULL, | 3059 | GNUNET_MESH_connect (cfg_, NULL, |
3060 | NULL, | 3060 | NULL, |
3061 | &tunnel_cleaner, | 3061 | &channel_cleaner, |
3062 | mesh_handlers, | 3062 | mesh_handlers, |
3063 | NULL); | 3063 | NULL); |
3064 | helper_handle = GNUNET_HELPER_start (GNUNET_NO, | 3064 | helper_handle = GNUNET_HELPER_start (GNUNET_NO, |