diff options
-rw-r--r-- | src/cadet/cadet_protocol.h | 43 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet.c | 90 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet.h | 34 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.c | 106 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_channel.h | 30 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.h | 3 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet_tunnels.c | 23 |
7 files changed, 237 insertions, 92 deletions
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index 560c186cd..de0cec5d0 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h | |||
@@ -350,9 +350,9 @@ struct GNUNET_CADET_ChannelOpenMessage | |||
350 | uint32_t opt GNUNET_PACKED; | 350 | uint32_t opt GNUNET_PACKED; |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * Destination port. | 353 | * Hash of destination port and listener. |
354 | */ | 354 | */ |
355 | struct GNUNET_HashCode port; | 355 | struct GNUNET_HashCode h_port; |
356 | 356 | ||
357 | /** | 357 | /** |
358 | * ID of the channel within the tunnel. | 358 | * ID of the channel within the tunnel. |
@@ -362,15 +362,42 @@ struct GNUNET_CADET_ChannelOpenMessage | |||
362 | 362 | ||
363 | 363 | ||
364 | /** | 364 | /** |
365 | * Message to manage a Channel | 365 | * Message to acknowledge opening a channel of type |
366 | * (#GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, | 366 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK. |
367 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY). | 367 | */ |
368 | struct GNUNET_CADET_ChannelOpenAckMessage | ||
369 | { | ||
370 | /** | ||
371 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK | ||
372 | */ | ||
373 | struct GNUNET_MessageHeader header; | ||
374 | |||
375 | /** | ||
376 | * For alignment. | ||
377 | */ | ||
378 | uint32_t reserved GNUNET_PACKED; | ||
379 | |||
380 | /** | ||
381 | * ID of the channel | ||
382 | */ | ||
383 | struct GNUNET_CADET_ChannelTunnelNumber ctn; | ||
384 | |||
385 | /** | ||
386 | * Port number of the channel, used to prove to the | ||
387 | * initiator that the receiver knows the port. | ||
388 | */ | ||
389 | struct GNUNET_HashCode port; | ||
390 | }; | ||
391 | |||
392 | |||
393 | /** | ||
394 | * Message to destroy a channel of type | ||
395 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY. | ||
368 | */ | 396 | */ |
369 | struct GNUNET_CADET_ChannelManageMessage | 397 | struct GNUNET_CADET_ChannelDestroyMessage |
370 | { | 398 | { |
371 | /** | 399 | /** |
372 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK or | 400 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY |
373 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY | ||
374 | */ | 401 | */ |
375 | struct GNUNET_MessageHeader header; | 402 | struct GNUNET_MessageHeader header; |
376 | 403 | ||
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index a7e1fca47..af4cebfaa 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -75,7 +75,7 @@ struct CadetClient | |||
75 | * Handle to communicate with the client | 75 | * Handle to communicate with the client |
76 | */ | 76 | */ |
77 | struct GNUNET_MQ_Handle *mq; | 77 | struct GNUNET_MQ_Handle *mq; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Client handle. | 80 | * Client handle. |
81 | */ | 81 | */ |
@@ -83,7 +83,7 @@ struct CadetClient | |||
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Ports that this client has declared interest in. | 85 | * Ports that this client has declared interest in. |
86 | * Indexed by port, contains *Client. | 86 | * Indexed by port, contains `struct OpenPort` |
87 | */ | 87 | */ |
88 | struct GNUNET_CONTAINER_MultiHashMap *ports; | 88 | struct GNUNET_CONTAINER_MultiHashMap *ports; |
89 | 89 | ||
@@ -99,6 +99,7 @@ struct CadetClient | |||
99 | unsigned int id; | 99 | unsigned int id; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | |||
102 | /******************************************************************************/ | 103 | /******************************************************************************/ |
103 | /*********************** GLOBAL VARIABLES ****************************/ | 104 | /*********************** GLOBAL VARIABLES ****************************/ |
104 | /******************************************************************************/ | 105 | /******************************************************************************/ |
@@ -151,14 +152,15 @@ static struct CadetClient *clients_tail; | |||
151 | static unsigned int next_client_id; | 152 | static unsigned int next_client_id; |
152 | 153 | ||
153 | /** | 154 | /** |
154 | * All ports clients of this peer have opened. | 155 | * All ports clients of this peer have opened. Maps from |
156 | * a hashed port to a `struct OpenPort`. | ||
155 | */ | 157 | */ |
156 | struct GNUNET_CONTAINER_MultiHashMap *open_ports; | 158 | struct GNUNET_CONTAINER_MultiHashMap *open_ports; |
157 | 159 | ||
158 | /** | 160 | /** |
159 | * Map from ports to channels where the ports were closed at the | 161 | * Map from ports to channels where the ports were closed at the |
160 | * time we got the inbound connection. | 162 | * time we got the inbound connection. |
161 | * Indexed by port, contains `struct CadetChannel`. | 163 | * Indexed by h_port, contains `struct CadetChannel`. |
162 | */ | 164 | */ |
163 | struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | 165 | struct GNUNET_CONTAINER_MultiHashMap *loose_channels; |
164 | 166 | ||
@@ -436,11 +438,11 @@ shutdown_task (void *cls) | |||
436 | 438 | ||
437 | 439 | ||
438 | /** | 440 | /** |
439 | * We had a remote connection @a value to port @a port before | 441 | * We had a remote connection @a value to port @a h_port before |
440 | * client @a cls opened port @a port. Bind them now. | 442 | * client @a cls opened port @a port. Bind them now. |
441 | * | 443 | * |
442 | * @param cls the `struct CadetClient` | 444 | * @param cls the `struct CadetClient` |
443 | * @param port the port | 445 | * @param h_port the hashed port |
444 | * @param value the `struct CadetChannel` | 446 | * @param value the `struct CadetChannel` |
445 | * @return #GNUNET_YES (iterate over all such channels) | 447 | * @return #GNUNET_YES (iterate over all such channels) |
446 | */ | 448 | */ |
@@ -449,15 +451,16 @@ bind_loose_channel (void *cls, | |||
449 | const struct GNUNET_HashCode *port, | 451 | const struct GNUNET_HashCode *port, |
450 | void *value) | 452 | void *value) |
451 | { | 453 | { |
452 | struct CadetClient *c = cls; | 454 | struct OpenPort *op = cls; |
453 | struct CadetChannel *ch = value; | 455 | struct CadetChannel *ch = value; |
454 | 456 | ||
455 | GCCH_bind (ch, | 457 | GCCH_bind (ch, |
456 | c); | 458 | op->c, |
459 | &op->port); | ||
457 | GNUNET_assert (GNUNET_YES == | 460 | GNUNET_assert (GNUNET_YES == |
458 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, | 461 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, |
459 | port, | 462 | &op->h_port, |
460 | value)); | 463 | ch)); |
461 | return GNUNET_YES; | 464 | return GNUNET_YES; |
462 | } | 465 | } |
463 | 466 | ||
@@ -476,6 +479,7 @@ handle_port_open (void *cls, | |||
476 | const struct GNUNET_CADET_PortMessage *pmsg) | 479 | const struct GNUNET_CADET_PortMessage *pmsg) |
477 | { | 480 | { |
478 | struct CadetClient *c = cls; | 481 | struct CadetClient *c = cls; |
482 | struct OpenPort *op; | ||
479 | 483 | ||
480 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 484 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
481 | "Open port %s requested by %s\n", | 485 | "Open port %s requested by %s\n", |
@@ -483,11 +487,17 @@ handle_port_open (void *cls, | |||
483 | GSC_2s (c)); | 487 | GSC_2s (c)); |
484 | if (NULL == c->ports) | 488 | if (NULL == c->ports) |
485 | c->ports = GNUNET_CONTAINER_multihashmap_create (4, | 489 | c->ports = GNUNET_CONTAINER_multihashmap_create (4, |
486 | GNUNET_NO); | 490 | GNUNET_NO); |
491 | op = GNUNET_new (struct OpenPort); | ||
492 | op->c = c; | ||
493 | op->port = pmsg->port; | ||
494 | GCCH_hash_port (&op->h_port, | ||
495 | &pmsg->port, | ||
496 | &my_full_id); | ||
487 | if (GNUNET_OK != | 497 | if (GNUNET_OK != |
488 | GNUNET_CONTAINER_multihashmap_put (c->ports, | 498 | GNUNET_CONTAINER_multihashmap_put (c->ports, |
489 | &pmsg->port, | 499 | &op->port, |
490 | c, | 500 | op, |
491 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 501 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
492 | { | 502 | { |
493 | GNUNET_break (0); | 503 | GNUNET_break (0); |
@@ -495,13 +505,13 @@ handle_port_open (void *cls, | |||
495 | return; | 505 | return; |
496 | } | 506 | } |
497 | (void) GNUNET_CONTAINER_multihashmap_put (open_ports, | 507 | (void) GNUNET_CONTAINER_multihashmap_put (open_ports, |
498 | &pmsg->port, | 508 | &op->h_port, |
499 | c, | 509 | op, |
500 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 510 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
501 | GNUNET_CONTAINER_multihashmap_get_multiple (loose_channels, | 511 | GNUNET_CONTAINER_multihashmap_get_multiple (loose_channels, |
502 | &pmsg->port, | 512 | &op->h_port, |
503 | &bind_loose_channel, | 513 | &bind_loose_channel, |
504 | c); | 514 | op); |
505 | GNUNET_SERVICE_client_continue (c->client); | 515 | GNUNET_SERVICE_client_continue (c->client); |
506 | } | 516 | } |
507 | 517 | ||
@@ -520,24 +530,29 @@ handle_port_close (void *cls, | |||
520 | const struct GNUNET_CADET_PortMessage *pmsg) | 530 | const struct GNUNET_CADET_PortMessage *pmsg) |
521 | { | 531 | { |
522 | struct CadetClient *c = cls; | 532 | struct CadetClient *c = cls; |
533 | struct OpenPort *op; | ||
523 | 534 | ||
524 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 535 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
525 | "Closing port %s as requested by %s\n", | 536 | "Closing port %s as requested by %s\n", |
526 | GNUNET_h2s (&pmsg->port), | 537 | GNUNET_h2s (&pmsg->port), |
527 | GSC_2s (c)); | 538 | GSC_2s (c)); |
528 | if (GNUNET_YES != | 539 | op = GNUNET_CONTAINER_multihashmap_get (c->ports, |
529 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | 540 | &pmsg->port); |
530 | &pmsg->port, | 541 | if (NULL == op) |
531 | c)) | ||
532 | { | 542 | { |
533 | GNUNET_break (0); | 543 | GNUNET_break (0); |
534 | GNUNET_SERVICE_client_drop (c->client); | 544 | GNUNET_SERVICE_client_drop (c->client); |
535 | return; | 545 | return; |
536 | } | 546 | } |
537 | GNUNET_assert (GNUNET_YES == | 547 | GNUNET_assert (GNUNET_YES == |
548 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | ||
549 | &op->port, | ||
550 | op)); | ||
551 | GNUNET_assert (GNUNET_YES == | ||
538 | GNUNET_CONTAINER_multihashmap_remove (open_ports, | 552 | GNUNET_CONTAINER_multihashmap_remove (open_ports, |
539 | &pmsg->port, | 553 | &op->h_port, |
540 | c)); | 554 | op)); |
555 | GNUNET_free (op); | ||
541 | GNUNET_SERVICE_client_continue (c->client); | 556 | GNUNET_SERVICE_client_continue (c->client); |
542 | } | 557 | } |
543 | 558 | ||
@@ -1214,16 +1229,16 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c, | |||
1214 | * A client that created a loose channel that was not bound to a port | 1229 | * A client that created a loose channel that was not bound to a port |
1215 | * disconnected, drop it from the #loose_channels list. | 1230 | * disconnected, drop it from the #loose_channels list. |
1216 | * | 1231 | * |
1217 | * @param port the port the channel was trying to bind to | 1232 | * @param h_port the hashed port the channel was trying to bind to |
1218 | * @param ch the channel that was lost | 1233 | * @param ch the channel that was lost |
1219 | */ | 1234 | */ |
1220 | void | 1235 | void |
1221 | GSC_drop_loose_channel (const struct GNUNET_HashCode *port, | 1236 | GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port, |
1222 | struct CadetChannel *ch) | 1237 | struct CadetChannel *ch) |
1223 | { | 1238 | { |
1224 | GNUNET_assert (GNUNET_YES == | 1239 | GNUNET_assert (GNUNET_YES == |
1225 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, | 1240 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, |
1226 | port, | 1241 | h_port, |
1227 | ch)); | 1242 | ch)); |
1228 | } | 1243 | } |
1229 | 1244 | ||
@@ -1264,30 +1279,33 @@ channel_destroy_iterator (void *cls, | |||
1264 | /** | 1279 | /** |
1265 | * Remove client's ports from the global hashmap on disconnect. | 1280 | * Remove client's ports from the global hashmap on disconnect. |
1266 | * | 1281 | * |
1267 | * @param cls Closure (unused). | 1282 | * @param cls the `struct CadetClient` |
1268 | * @param key the port. | 1283 | * @param port the port. |
1269 | * @param value the `struct CadetClient` to remove | 1284 | * @param value the `struct OpenPort` to remove |
1270 | * @return #GNUNET_OK, keep iterating. | 1285 | * @return #GNUNET_OK, keep iterating. |
1271 | */ | 1286 | */ |
1272 | static int | 1287 | static int |
1273 | client_release_ports (void *cls, | 1288 | client_release_ports (void *cls, |
1274 | const struct GNUNET_HashCode *key, | 1289 | const struct GNUNET_HashCode *port, |
1275 | void *value) | 1290 | void *value) |
1276 | { | 1291 | { |
1277 | struct CadetClient *c = value; | 1292 | struct CadetClient *c = cls; |
1293 | struct OpenPort *op = value; | ||
1278 | 1294 | ||
1295 | GNUNET_assert (c == op->c); | ||
1279 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1296 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1280 | "Closing port %s due to %s disconnect.\n", | 1297 | "Closing port %s due to %s disconnect.\n", |
1281 | GNUNET_h2s (key), | 1298 | GNUNET_h2s (port), |
1282 | GSC_2s (c)); | 1299 | GSC_2s (c)); |
1283 | GNUNET_assert (GNUNET_YES == | 1300 | GNUNET_assert (GNUNET_YES == |
1284 | GNUNET_CONTAINER_multihashmap_remove (open_ports, | 1301 | GNUNET_CONTAINER_multihashmap_remove (open_ports, |
1285 | key, | 1302 | &op->h_port, |
1286 | value)); | 1303 | op)); |
1287 | GNUNET_assert (GNUNET_YES == | 1304 | GNUNET_assert (GNUNET_YES == |
1288 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | 1305 | GNUNET_CONTAINER_multihashmap_remove (c->ports, |
1289 | key, | 1306 | port, |
1290 | value)); | 1307 | op)); |
1308 | GNUNET_free (op); | ||
1291 | return GNUNET_OK; | 1309 | return GNUNET_OK; |
1292 | } | 1310 | } |
1293 | 1311 | ||
diff --git a/src/cadet/gnunet-service-cadet.h b/src/cadet/gnunet-service-cadet.h index 2f2d7baf3..162867823 100644 --- a/src/cadet/gnunet-service-cadet.h +++ b/src/cadet/gnunet-service-cadet.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #define GNUNET_SERVICE_CADET_H | 29 | #define GNUNET_SERVICE_CADET_H |
30 | 30 | ||
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | #define NEW_CADET 1 | ||
33 | #include "cadet_protocol.h" | 32 | #include "cadet_protocol.h" |
34 | 33 | ||
35 | /** | 34 | /** |
@@ -146,6 +145,30 @@ struct CadetTConnection | |||
146 | 145 | ||
147 | 146 | ||
148 | /** | 147 | /** |
148 | * Port opened by a client. | ||
149 | */ | ||
150 | struct OpenPort | ||
151 | { | ||
152 | |||
153 | /** | ||
154 | * Client that opened the port. | ||
155 | */ | ||
156 | struct CadetClient *c; | ||
157 | |||
158 | /** | ||
159 | * Port number. | ||
160 | */ | ||
161 | struct GNUNET_HashCode port; | ||
162 | |||
163 | /** | ||
164 | * Port hashed with our PID (matches incoming OPEN messages). | ||
165 | */ | ||
166 | struct GNUNET_HashCode h_port; | ||
167 | |||
168 | }; | ||
169 | |||
170 | |||
171 | /** | ||
149 | * Active path through the network (used by a tunnel). There may | 172 | * Active path through the network (used by a tunnel). There may |
150 | * be at most one connection per path. | 173 | * be at most one connection per path. |
151 | */ | 174 | */ |
@@ -193,7 +216,8 @@ extern struct GNUNET_PeerIdentity my_full_id; | |||
193 | extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; | 216 | extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; |
194 | 217 | ||
195 | /** | 218 | /** |
196 | * All ports clients of this peer have opened. | 219 | * All ports clients of this peer have opened. Maps from |
220 | * a hashed port to a `struct OpenPort`. | ||
197 | */ | 221 | */ |
198 | extern struct GNUNET_CONTAINER_MultiHashMap *open_ports; | 222 | extern struct GNUNET_CONTAINER_MultiHashMap *open_ports; |
199 | 223 | ||
@@ -206,7 +230,7 @@ extern struct GNUNET_CONTAINER_MultiShortmap *connections; | |||
206 | /** | 230 | /** |
207 | * Map from ports to channels where the ports were closed at the | 231 | * Map from ports to channels where the ports were closed at the |
208 | * time we got the inbound connection. | 232 | * time we got the inbound connection. |
209 | * Indexed by port, contains `struct CadetChannel`. | 233 | * Indexed by h_port, contains `struct CadetChannel`. |
210 | */ | 234 | */ |
211 | extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | 235 | extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels; |
212 | 236 | ||
@@ -268,11 +292,11 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c, | |||
268 | * A client that created a loose channel that was not bound to a port | 292 | * A client that created a loose channel that was not bound to a port |
269 | * disconnected, drop it from the #loose_channels list. | 293 | * disconnected, drop it from the #loose_channels list. |
270 | * | 294 | * |
271 | * @param port the port the channel was trying to bind to | 295 | * @param h_port the hashed port the channel was trying to bind to |
272 | * @param ch the channel that was lost | 296 | * @param ch the channel that was lost |
273 | */ | 297 | */ |
274 | void | 298 | void |
275 | GSC_drop_loose_channel (const struct GNUNET_HashCode *port, | 299 | GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port, |
276 | struct CadetChannel *ch); | 300 | struct CadetChannel *ch); |
277 | 301 | ||
278 | 302 | ||
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 68e29b66b..739b68228 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -303,6 +303,11 @@ struct CadetChannel | |||
303 | struct GNUNET_HashCode port; | 303 | struct GNUNET_HashCode port; |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * Hash'ed port of the channel with initiator and destination PID. | ||
307 | */ | ||
308 | struct GNUNET_HashCode h_port; | ||
309 | |||
310 | /** | ||
306 | * Counter for exponential backoff. | 311 | * Counter for exponential backoff. |
307 | */ | 312 | */ |
308 | struct GNUNET_TIME_Relative retry_time; | 313 | struct GNUNET_TIME_Relative retry_time; |
@@ -406,6 +411,37 @@ GCCH_2s (const struct CadetChannel *ch) | |||
406 | 411 | ||
407 | 412 | ||
408 | /** | 413 | /** |
414 | * Hash the @a port and @a initiator and @a listener to | ||
415 | * calculate the "challenge" @a h_port we send to the other | ||
416 | * peer on #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN. | ||
417 | * | ||
418 | * @param[out] h_port set to the hash of @a port, @a initiator and @a listener | ||
419 | * @param port cadet port, as seen by CADET clients | ||
420 | * @param listener peer that is listining on @a port | ||
421 | */ | ||
422 | void | ||
423 | GCCH_hash_port (struct GNUNET_HashCode *h_port, | ||
424 | const struct GNUNET_HashCode *port, | ||
425 | const struct GNUNET_PeerIdentity *listener) | ||
426 | { | ||
427 | struct GNUNET_HashContext *hc; | ||
428 | |||
429 | hc = GNUNET_CRYPTO_hash_context_start (); | ||
430 | GNUNET_CRYPTO_hash_context_read (hc, | ||
431 | port, | ||
432 | sizeof (*port)); | ||
433 | GNUNET_CRYPTO_hash_context_read (hc, | ||
434 | listener, | ||
435 | sizeof (*listener)); | ||
436 | GNUNET_CRYPTO_hash_context_finish (hc, | ||
437 | h_port); | ||
438 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
439 | "Calculated port hash %s\n", | ||
440 | GNUNET_h2s (h_port)); | ||
441 | } | ||
442 | |||
443 | |||
444 | /** | ||
409 | * Get the channel's public ID. | 445 | * Get the channel's public ID. |
410 | * | 446 | * |
411 | * @param ch Channel. | 447 | * @param ch Channel. |
@@ -566,7 +602,7 @@ send_channel_open (void *cls) | |||
566 | msgcc.header.size = htons (sizeof (msgcc)); | 602 | msgcc.header.size = htons (sizeof (msgcc)); |
567 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); | 603 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); |
568 | msgcc.opt = htonl (options); | 604 | msgcc.opt = htonl (options); |
569 | msgcc.port = ch->port; | 605 | msgcc.h_port = ch->h_port; |
570 | msgcc.ctn = ch->ctn; | 606 | msgcc.ctn = ch->ctn; |
571 | ch->state = CADET_CHANNEL_OPEN_SENT; | 607 | ch->state = CADET_CHANNEL_OPEN_SENT; |
572 | if (NULL != ch->last_control_qe) | 608 | if (NULL != ch->last_control_qe) |
@@ -635,21 +671,24 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
635 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ | 671 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ |
636 | ch->owner = ccco; | 672 | ch->owner = ccco; |
637 | ch->port = *port; | 673 | ch->port = *port; |
674 | GCCH_hash_port (&ch->h_port, | ||
675 | port, | ||
676 | GCP_get_id (destination)); | ||
638 | if (0 == memcmp (&my_full_id, | 677 | if (0 == memcmp (&my_full_id, |
639 | GCP_get_id (destination), | 678 | GCP_get_id (destination), |
640 | sizeof (struct GNUNET_PeerIdentity))) | 679 | sizeof (struct GNUNET_PeerIdentity))) |
641 | { | 680 | { |
642 | struct CadetClient *c; | 681 | struct OpenPort *op; |
643 | 682 | ||
644 | ch->is_loopback = GNUNET_YES; | 683 | ch->is_loopback = GNUNET_YES; |
645 | c = GNUNET_CONTAINER_multihashmap_get (open_ports, | 684 | op = GNUNET_CONTAINER_multihashmap_get (open_ports, |
646 | port); | 685 | &ch->h_port); |
647 | if (NULL == c) | 686 | if (NULL == op) |
648 | { | 687 | { |
649 | /* port closed, wait for it to possibly open */ | 688 | /* port closed, wait for it to possibly open */ |
650 | ch->state = CADET_CHANNEL_LOOSE; | 689 | ch->state = CADET_CHANNEL_LOOSE; |
651 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, | 690 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, |
652 | port, | 691 | &ch->h_port, |
653 | ch, | 692 | ch, |
654 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 693 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
655 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 694 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -659,7 +698,8 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
659 | else | 698 | else |
660 | { | 699 | { |
661 | GCCH_bind (ch, | 700 | GCCH_bind (ch, |
662 | c); | 701 | op->c, |
702 | &op->port); | ||
663 | } | 703 | } |
664 | } | 704 | } |
665 | else | 705 | else |
@@ -709,21 +749,21 @@ timeout_closed_cb (void *cls) | |||
709 | * | 749 | * |
710 | * @param t tunnel to the remote peer | 750 | * @param t tunnel to the remote peer |
711 | * @param ctn identifier of this channel in the tunnel | 751 | * @param ctn identifier of this channel in the tunnel |
712 | * @param port desired local port | 752 | * @param h_port desired hash of local port |
713 | * @param options options for the channel | 753 | * @param options options for the channel |
714 | * @return handle to the new channel | 754 | * @return handle to the new channel |
715 | */ | 755 | */ |
716 | struct CadetChannel * | 756 | struct CadetChannel * |
717 | GCCH_channel_incoming_new (struct CadetTunnel *t, | 757 | GCCH_channel_incoming_new (struct CadetTunnel *t, |
718 | struct GNUNET_CADET_ChannelTunnelNumber ctn, | 758 | struct GNUNET_CADET_ChannelTunnelNumber ctn, |
719 | const struct GNUNET_HashCode *port, | 759 | const struct GNUNET_HashCode *h_port, |
720 | uint32_t options) | 760 | uint32_t options) |
721 | { | 761 | { |
722 | struct CadetChannel *ch; | 762 | struct CadetChannel *ch; |
723 | struct CadetClient *c; | 763 | struct OpenPort *op; |
724 | 764 | ||
725 | ch = GNUNET_new (struct CadetChannel); | 765 | ch = GNUNET_new (struct CadetChannel); |
726 | ch->port = *port; | 766 | ch->h_port = *h_port; |
727 | ch->t = t; | 767 | ch->t = t; |
728 | ch->ctn = ctn; | 768 | ch->ctn = ctn; |
729 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; | 769 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; |
@@ -736,14 +776,14 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, | |||
736 | 1, | 776 | 1, |
737 | GNUNET_NO); | 777 | GNUNET_NO); |
738 | 778 | ||
739 | c = GNUNET_CONTAINER_multihashmap_get (open_ports, | 779 | op = GNUNET_CONTAINER_multihashmap_get (open_ports, |
740 | port); | 780 | h_port); |
741 | if (NULL == c) | 781 | if (NULL == op) |
742 | { | 782 | { |
743 | /* port closed, wait for it to possibly open */ | 783 | /* port closed, wait for it to possibly open */ |
744 | ch->state = CADET_CHANNEL_LOOSE; | 784 | ch->state = CADET_CHANNEL_LOOSE; |
745 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, | 785 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, |
746 | port, | 786 | &ch->h_port, |
747 | ch, | 787 | ch, |
748 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 788 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
749 | GNUNET_assert (NULL == ch->retry_control_task); | 789 | GNUNET_assert (NULL == ch->retry_control_task); |
@@ -759,7 +799,8 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, | |||
759 | else | 799 | else |
760 | { | 800 | { |
761 | GCCH_bind (ch, | 801 | GCCH_bind (ch, |
762 | c); | 802 | op->c, |
803 | &op->port); | ||
763 | } | 804 | } |
764 | GNUNET_STATISTICS_update (stats, | 805 | GNUNET_STATISTICS_update (stats, |
765 | "# channels", | 806 | "# channels", |
@@ -830,7 +871,7 @@ static void | |||
830 | send_open_ack (void *cls) | 871 | send_open_ack (void *cls) |
831 | { | 872 | { |
832 | struct CadetChannel *ch = cls; | 873 | struct CadetChannel *ch = cls; |
833 | struct GNUNET_CADET_ChannelManageMessage msg; | 874 | struct GNUNET_CADET_ChannelOpenAckMessage msg; |
834 | 875 | ||
835 | ch->retry_control_task = NULL; | 876 | ch->retry_control_task = NULL; |
836 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 877 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -840,6 +881,7 @@ send_open_ack (void *cls) | |||
840 | msg.header.size = htons (sizeof (msg)); | 881 | msg.header.size = htons (sizeof (msg)); |
841 | msg.reserved = htonl (0); | 882 | msg.reserved = htonl (0); |
842 | msg.ctn = ch->ctn; | 883 | msg.ctn = ch->ctn; |
884 | msg.port = ch->port; | ||
843 | if (NULL != ch->last_control_qe) | 885 | if (NULL != ch->last_control_qe) |
844 | GCT_send_cancel (ch->last_control_qe); | 886 | GCT_send_cancel (ch->last_control_qe); |
845 | ch->last_control_qe = GCT_send (ch->t, | 887 | ch->last_control_qe = GCT_send (ch->t, |
@@ -928,11 +970,13 @@ send_ack_to_client (struct CadetChannel *ch, | |||
928 | * request and establish the link with the client. | 970 | * request and establish the link with the client. |
929 | * | 971 | * |
930 | * @param ch open incoming channel | 972 | * @param ch open incoming channel |
931 | * @param c client listening on the respective port | 973 | * @param c client listening on the respective @a port |
974 | * @param port the port @a is listening on | ||
932 | */ | 975 | */ |
933 | void | 976 | void |
934 | GCCH_bind (struct CadetChannel *ch, | 977 | GCCH_bind (struct CadetChannel *ch, |
935 | struct CadetClient *c) | 978 | struct CadetClient *c, |
979 | const struct GNUNET_HashCode *port) | ||
936 | { | 980 | { |
937 | uint32_t options; | 981 | uint32_t options; |
938 | struct CadetChannelClient *cccd; | 982 | struct CadetChannelClient *cccd; |
@@ -959,6 +1003,7 @@ GCCH_bind (struct CadetChannel *ch, | |||
959 | cccd = GNUNET_new (struct CadetChannelClient); | 1003 | cccd = GNUNET_new (struct CadetChannelClient); |
960 | GNUNET_assert (NULL == ch->dest); | 1004 | GNUNET_assert (NULL == ch->dest); |
961 | ch->dest = cccd; | 1005 | ch->dest = cccd; |
1006 | ch->port = *port; | ||
962 | cccd->c = c; | 1007 | cccd->c = c; |
963 | cccd->client_ready = GNUNET_YES; | 1008 | cccd->client_ready = GNUNET_YES; |
964 | cccd->ccn = GSC_bind (c, | 1009 | cccd->ccn = GSC_bind (c, |
@@ -967,7 +1012,7 @@ GCCH_bind (struct CadetChannel *ch, | |||
967 | ? GCP_get (&my_full_id, | 1012 | ? GCP_get (&my_full_id, |
968 | GNUNET_YES) | 1013 | GNUNET_YES) |
969 | : GCT_get_destination (ch->t), | 1014 | : GCT_get_destination (ch->t), |
970 | &ch->port, | 1015 | port, |
971 | options); | 1016 | options); |
972 | GNUNET_assert (ntohl (cccd->ccn.channel_of_client) < | 1017 | GNUNET_assert (ntohl (cccd->ccn.channel_of_client) < |
973 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | 1018 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); |
@@ -976,7 +1021,8 @@ GCCH_bind (struct CadetChannel *ch, | |||
976 | { | 1021 | { |
977 | ch->state = CADET_CHANNEL_OPEN_SENT; | 1022 | ch->state = CADET_CHANNEL_OPEN_SENT; |
978 | GCCH_handle_channel_open_ack (ch, | 1023 | GCCH_handle_channel_open_ack (ch, |
979 | NULL); | 1024 | NULL, |
1025 | port); | ||
980 | } | 1026 | } |
981 | else | 1027 | else |
982 | { | 1028 | { |
@@ -1092,7 +1138,7 @@ GCCH_channel_local_destroy (struct CadetChannel *ch, | |||
1092 | target, but that never went anywhere. Nothing to do here. */ | 1138 | target, but that never went anywhere. Nothing to do here. */ |
1093 | break; | 1139 | break; |
1094 | case CADET_CHANNEL_LOOSE: | 1140 | case CADET_CHANNEL_LOOSE: |
1095 | GSC_drop_loose_channel (&ch->port, | 1141 | GSC_drop_loose_channel (&ch->h_port, |
1096 | ch); | 1142 | ch); |
1097 | break; | 1143 | break; |
1098 | default: | 1144 | default: |
@@ -1107,14 +1153,17 @@ GCCH_channel_local_destroy (struct CadetChannel *ch, | |||
1107 | 1153 | ||
1108 | /** | 1154 | /** |
1109 | * We got an acknowledgement for the creation of the channel | 1155 | * We got an acknowledgement for the creation of the channel |
1110 | * (the port is open on the other side). Begin transmissions. | 1156 | * (the port is open on the other side). Verify that the |
1157 | * other end really has the right port, and begin transmissions. | ||
1111 | * | 1158 | * |
1112 | * @param ch channel to destroy | 1159 | * @param ch channel to destroy |
1113 | * @param cti identifier of the connection that delivered the message | 1160 | * @param cti identifier of the connection that delivered the message |
1161 | * @param port port number (needed to verify receiver knows the port) | ||
1114 | */ | 1162 | */ |
1115 | void | 1163 | void |
1116 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, | 1164 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, |
1117 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti) | 1165 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, |
1166 | const struct GNUNET_HashCode *port) | ||
1118 | { | 1167 | { |
1119 | switch (ch->state) | 1168 | switch (ch->state) |
1120 | { | 1169 | { |
@@ -1133,6 +1182,15 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch, | |||
1133 | GNUNET_break_op (0); | 1182 | GNUNET_break_op (0); |
1134 | return; | 1183 | return; |
1135 | } | 1184 | } |
1185 | if (0 != memcmp (&ch->port, | ||
1186 | port, | ||
1187 | sizeof (struct GNUNET_HashCode))) | ||
1188 | { | ||
1189 | /* Other peer failed to provide the right port, | ||
1190 | refuse connection. */ | ||
1191 | GNUNET_break_op (0); | ||
1192 | return; | ||
1193 | } | ||
1136 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1194 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1137 | "Received CHANNEL_OPEN_ACK for waiting %s, entering READY state\n", | 1195 | "Received CHANNEL_OPEN_ACK for waiting %s, entering READY state\n", |
1138 | GCCH_2s (ch)); | 1196 | GCCH_2s (ch)); |
diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index a3ef9a06d..16517c457 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
4 | Copyright (C) 2001-2017 GNUnet e.V. | 3 | Copyright (C) 2001-2017 GNUnet e.V. |
@@ -45,6 +44,21 @@ struct CadetChannel; | |||
45 | 44 | ||
46 | 45 | ||
47 | /** | 46 | /** |
47 | * Hash the @a port and @a initiator and @a listener to | ||
48 | * calculate the "challenge" @a h_port we send to the other | ||
49 | * peer on #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN. | ||
50 | * | ||
51 | * @param[out] h_port set to the hash of @a port, @a initiator and @a listener | ||
52 | * @param port cadet port, as seen by CADET clients | ||
53 | * @param listener peer that is listining on @a port | ||
54 | */ | ||
55 | void | ||
56 | GCCH_hash_port (struct GNUNET_HashCode *h_port, | ||
57 | const struct GNUNET_HashCode *port, | ||
58 | const struct GNUNET_PeerIdentity *listener); | ||
59 | |||
60 | |||
61 | /** | ||
48 | * Get the static string for identification of the channel. | 62 | * Get the static string for identification of the channel. |
49 | * | 63 | * |
50 | * @param ch Channel. | 64 | * @param ch Channel. |
@@ -101,11 +115,13 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
101 | * request and establish the link with the client. | 115 | * request and establish the link with the client. |
102 | * | 116 | * |
103 | * @param ch open incoming channel | 117 | * @param ch open incoming channel |
104 | * @param c client listening on the respective port | 118 | * @param c client listening on the respective @a port |
119 | * @param port port number @a c is listening on | ||
105 | */ | 120 | */ |
106 | void | 121 | void |
107 | GCCH_bind (struct CadetChannel *ch, | 122 | GCCH_bind (struct CadetChannel *ch, |
108 | struct CadetClient *c); | 123 | struct CadetClient *c, |
124 | const struct GNUNET_HashCode *port); | ||
109 | 125 | ||
110 | 126 | ||
111 | /** | 127 | /** |
@@ -142,14 +158,14 @@ GCCH_tunnel_up (struct CadetChannel *ch); | |||
142 | * @param t tunnel to the remote peer | 158 | * @param t tunnel to the remote peer |
143 | * @param chid identifier of this channel in the tunnel | 159 | * @param chid identifier of this channel in the tunnel |
144 | * @param origin peer to who initiated the channel | 160 | * @param origin peer to who initiated the channel |
145 | * @param port desired local port | 161 | * @param h_port hash of desired local port |
146 | * @param options options for the channel | 162 | * @param options options for the channel |
147 | * @return handle to the new channel | 163 | * @return handle to the new channel |
148 | */ | 164 | */ |
149 | struct CadetChannel * | 165 | struct CadetChannel * |
150 | GCCH_channel_incoming_new (struct CadetTunnel *t, | 166 | GCCH_channel_incoming_new (struct CadetTunnel *t, |
151 | struct GNUNET_CADET_ChannelTunnelNumber chid, | 167 | struct GNUNET_CADET_ChannelTunnelNumber chid, |
152 | const struct GNUNET_HashCode *port, | 168 | const struct GNUNET_HashCode *h_port, |
153 | uint32_t options); | 169 | uint32_t options); |
154 | 170 | ||
155 | 171 | ||
@@ -201,10 +217,12 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch, | |||
201 | * @param ch channel to destroy | 217 | * @param ch channel to destroy |
202 | * @param cti identifier of the connection that delivered the message, | 218 | * @param cti identifier of the connection that delivered the message, |
203 | * NULL if the ACK was inferred because we got payload or are on loopback | 219 | * NULL if the ACK was inferred because we got payload or are on loopback |
220 | * @param port port number (needed to verify receiver knows the port) | ||
204 | */ | 221 | */ |
205 | void | 222 | void |
206 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, | 223 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, |
207 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti); | 224 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, |
225 | const struct GNUNET_HashCode *port); | ||
208 | 226 | ||
209 | 227 | ||
210 | /** | 228 | /** |
diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h index a2a6c6a92..baa87ea87 100644 --- a/src/cadet/gnunet-service-cadet_peer.h +++ b/src/cadet/gnunet-service-cadet_peer.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
4 | Copyright (C) 2001-2017 GNUnet e.V. | 3 | Copyright (C) 2001-2017 GNUnet e.V. |
@@ -20,7 +19,7 @@ | |||
20 | */ | 19 | */ |
21 | 20 | ||
22 | /** | 21 | /** |
23 | * @file cadet/gnunet-service-cadet-new_peer.h | 22 | * @file cadet/gnunet-service-cadet_peer.h |
24 | * @brief Information we track per peer. | 23 | * @brief Information we track per peer. |
25 | * @author Bartlomiej Polot | 24 | * @author Bartlomiej Polot |
26 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c index bcdeeb4da..28004debc 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.c +++ b/src/cadet/gnunet-service-cadet_tunnels.c | |||
@@ -2723,8 +2723,8 @@ handle_plaintext_channel_open (void *cls, | |||
2723 | if (NULL != ch) | 2723 | if (NULL != ch) |
2724 | { | 2724 | { |
2725 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2725 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2726 | "Received duplicate channel CHANNEL_OPEN on port %s from %s (%s), resending ACK\n", | 2726 | "Received duplicate channel CHANNEL_OPEN on h_port %s from %s (%s), resending ACK\n", |
2727 | GNUNET_h2s (&copen->port), | 2727 | GNUNET_h2s (&copen->h_port), |
2728 | GCT_2s (t), | 2728 | GCT_2s (t), |
2729 | GCCH_2s (ch)); | 2729 | GCCH_2s (ch)); |
2730 | GCCH_handle_duplicate_open (ch, | 2730 | GCCH_handle_duplicate_open (ch, |
@@ -2732,12 +2732,12 @@ handle_plaintext_channel_open (void *cls, | |||
2732 | return; | 2732 | return; |
2733 | } | 2733 | } |
2734 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2734 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2735 | "Received CHANNEL_OPEN on port %s from %s\n", | 2735 | "Received CHANNEL_OPEN on h_port %s from %s\n", |
2736 | GNUNET_h2s (&copen->port), | 2736 | GNUNET_h2s (&copen->h_port), |
2737 | GCT_2s (t)); | 2737 | GCT_2s (t)); |
2738 | ch = GCCH_channel_incoming_new (t, | 2738 | ch = GCCH_channel_incoming_new (t, |
2739 | copen->ctn, | 2739 | copen->ctn, |
2740 | &copen->port, | 2740 | &copen->h_port, |
2741 | ntohl (copen->opt)); | 2741 | ntohl (copen->opt)); |
2742 | if (NULL != t->destroy_task) | 2742 | if (NULL != t->destroy_task) |
2743 | { | 2743 | { |
@@ -2762,7 +2762,7 @@ void | |||
2762 | GCT_send_channel_destroy (struct CadetTunnel *t, | 2762 | GCT_send_channel_destroy (struct CadetTunnel *t, |
2763 | struct GNUNET_CADET_ChannelTunnelNumber ctn) | 2763 | struct GNUNET_CADET_ChannelTunnelNumber ctn) |
2764 | { | 2764 | { |
2765 | struct GNUNET_CADET_ChannelManageMessage msg; | 2765 | struct GNUNET_CADET_ChannelDestroyMessage msg; |
2766 | 2766 | ||
2767 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2767 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2768 | "Sending DESTORY message for channel ID %u\n", | 2768 | "Sending DESTORY message for channel ID %u\n", |
@@ -2788,7 +2788,7 @@ GCT_send_channel_destroy (struct CadetTunnel *t, | |||
2788 | */ | 2788 | */ |
2789 | static void | 2789 | static void |
2790 | handle_plaintext_channel_open_ack (void *cls, | 2790 | handle_plaintext_channel_open_ack (void *cls, |
2791 | const struct GNUNET_CADET_ChannelManageMessage *cm) | 2791 | const struct GNUNET_CADET_ChannelOpenAckMessage *cm) |
2792 | { | 2792 | { |
2793 | struct CadetTunnel *t = cls; | 2793 | struct CadetTunnel *t = cls; |
2794 | struct CadetChannel *ch; | 2794 | struct CadetChannel *ch; |
@@ -2811,7 +2811,8 @@ handle_plaintext_channel_open_ack (void *cls, | |||
2811 | GCCH_2s (ch), | 2811 | GCCH_2s (ch), |
2812 | GCT_2s (t)); | 2812 | GCT_2s (t)); |
2813 | GCCH_handle_channel_open_ack (ch, | 2813 | GCCH_handle_channel_open_ack (ch, |
2814 | GCC_get_id (t->current_ct->cc)); | 2814 | GCC_get_id (t->current_ct->cc), |
2815 | &cm->port); | ||
2815 | } | 2816 | } |
2816 | 2817 | ||
2817 | 2818 | ||
@@ -2824,7 +2825,7 @@ handle_plaintext_channel_open_ack (void *cls, | |||
2824 | */ | 2825 | */ |
2825 | static void | 2826 | static void |
2826 | handle_plaintext_channel_destroy (void *cls, | 2827 | handle_plaintext_channel_destroy (void *cls, |
2827 | const struct GNUNET_CADET_ChannelManageMessage *cm) | 2828 | const struct GNUNET_CADET_ChannelDestroyMessage *cm) |
2828 | { | 2829 | { |
2829 | struct CadetTunnel *t = cls; | 2830 | struct CadetTunnel *t = cls; |
2830 | struct CadetChannel *ch; | 2831 | struct CadetChannel *ch; |
@@ -2915,11 +2916,11 @@ GCT_create_tunnel (struct CadetPeer *destination) | |||
2915 | t), | 2916 | t), |
2916 | GNUNET_MQ_hd_fixed_size (plaintext_channel_open_ack, | 2917 | GNUNET_MQ_hd_fixed_size (plaintext_channel_open_ack, |
2917 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, | 2918 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, |
2918 | struct GNUNET_CADET_ChannelManageMessage, | 2919 | struct GNUNET_CADET_ChannelOpenAckMessage, |
2919 | t), | 2920 | t), |
2920 | GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, | 2921 | GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, |
2921 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, | 2922 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, |
2922 | struct GNUNET_CADET_ChannelManageMessage, | 2923 | struct GNUNET_CADET_ChannelDestroyMessage, |
2923 | t), | 2924 | t), |
2924 | GNUNET_MQ_handler_end () | 2925 | GNUNET_MQ_handler_end () |
2925 | }; | 2926 | }; |