diff options
-rw-r--r-- | src/cadet/cadet.h | 10 | ||||
-rw-r--r-- | src/cadet/cadet_api_get_path.c | 13 | ||||
-rw-r--r-- | src/cadet/gnunet-cadet.c | 16 | ||||
-rw-r--r-- | src/cadet/gnunet-service-cadet.c | 10 | ||||
-rw-r--r-- | src/include/gnunet_cadet_service.h | 21 | ||||
-rw-r--r-- | src/rps/profiler_rps.conf | 2 |
6 files changed, 43 insertions, 29 deletions
diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index 51296ae50..f6cc860cc 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -323,9 +323,9 @@ struct GNUNET_CADET_LocalInfoPath | |||
323 | struct GNUNET_MessageHeader header; | 323 | struct GNUNET_MessageHeader header; |
324 | 324 | ||
325 | /** | 325 | /** |
326 | * Zero. | 326 | * Offset of the peer that was requested. |
327 | */ | 327 | */ |
328 | uint32_t reserved GNUNET_PACKED; | 328 | uint32_t off GNUNET_PACKED; |
329 | }; | 329 | }; |
330 | 330 | ||
331 | 331 | ||
@@ -338,7 +338,7 @@ struct GNUNET_CADET_LocalInfoPeers | |||
338 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS | 338 | * Type: #GNUNET_MESSAGE_TYPE_CADET_LOCAL_INFO_PEERS |
339 | */ | 339 | */ |
340 | struct GNUNET_MessageHeader header; | 340 | struct GNUNET_MessageHeader header; |
341 | 341 | ||
342 | /** | 342 | /** |
343 | * Number of paths. | 343 | * Number of paths. |
344 | */ | 344 | */ |
@@ -348,7 +348,7 @@ struct GNUNET_CADET_LocalInfoPeers | |||
348 | * Do we have a tunnel toward this peer? | 348 | * Do we have a tunnel toward this peer? |
349 | */ | 349 | */ |
350 | int16_t tunnel GNUNET_PACKED; | 350 | int16_t tunnel GNUNET_PACKED; |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * Shortest known path. | 353 | * Shortest known path. |
354 | */ | 354 | */ |
diff --git a/src/cadet/cadet_api_get_path.c b/src/cadet/cadet_api_get_path.c index 2f35e365e..fcc79c3d5 100644 --- a/src/cadet/cadet_api_get_path.c +++ b/src/cadet/cadet_api_get_path.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -66,7 +66,7 @@ struct GNUNET_CADET_GetPath | |||
66 | * Backoff for reconnect attempts. | 66 | * Backoff for reconnect attempts. |
67 | */ | 67 | */ |
68 | struct GNUNET_TIME_Relative backoff; | 68 | struct GNUNET_TIME_Relative backoff; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Peer we want information about. | 71 | * Peer we want information about. |
72 | */ | 72 | */ |
@@ -109,7 +109,7 @@ check_get_path (void *cls, | |||
109 | /** | 109 | /** |
110 | * Process a local peer info reply, pass info to the user. | 110 | * Process a local peer info reply, pass info to the user. |
111 | * | 111 | * |
112 | * @param cls Closure | 112 | * @param cls Closure |
113 | * @param message Message itself. | 113 | * @param message Message itself. |
114 | */ | 114 | */ |
115 | static void | 115 | static void |
@@ -118,9 +118,10 @@ handle_get_path (void *cls, | |||
118 | { | 118 | { |
119 | struct GNUNET_CADET_GetPath *gp = cls; | 119 | struct GNUNET_CADET_GetPath *gp = cls; |
120 | struct GNUNET_CADET_PeerPathDetail ppd; | 120 | struct GNUNET_CADET_PeerPathDetail ppd; |
121 | 121 | ||
122 | ppd.peer = gp->id; | 122 | ppd.peer = gp->id; |
123 | ppd.path = (const struct GNUNET_PeerIdentity *) &message[1]; | 123 | ppd.path = (const struct GNUNET_PeerIdentity *) &message[1]; |
124 | ppd.target_offset = ntohl (message->off); | ||
124 | ppd.path_length = (ntohs (message->header.size) - sizeof (*message)) | 125 | ppd.path_length = (ntohs (message->header.size) - sizeof (*message)) |
125 | / sizeof (struct GNUNET_PeerIdentity); | 126 | / sizeof (struct GNUNET_PeerIdentity); |
126 | gp->path_cb (gp->path_cb_cls, | 127 | gp->path_cb (gp->path_cb_cls, |
@@ -131,7 +132,7 @@ handle_get_path (void *cls, | |||
131 | /** | 132 | /** |
132 | * Process a local peer info reply, pass info to the user. | 133 | * Process a local peer info reply, pass info to the user. |
133 | * | 134 | * |
134 | * @param cls Closure | 135 | * @param cls Closure |
135 | * @param message Message itself. | 136 | * @param message Message itself. |
136 | */ | 137 | */ |
137 | static void | 138 | static void |
@@ -177,7 +178,7 @@ error_handler (void *cls, | |||
177 | gp); | 178 | gp); |
178 | } | 179 | } |
179 | 180 | ||
180 | 181 | ||
181 | /** | 182 | /** |
182 | * Reconnect to the service and try again. | 183 | * Reconnect to the service and try again. |
183 | * | 184 | * |
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index dba517a7b..932d069a1 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -103,7 +103,7 @@ static struct GNUNET_CADET_GetPath *gpo; | |||
103 | 103 | ||
104 | /** | 104 | /** |
105 | * Active peer listing operation. | 105 | * Active peer listing operation. |
106 | */ | 106 | */ |
107 | static struct GNUNET_CADET_PeersLister *plo; | 107 | static struct GNUNET_CADET_PeersLister *plo; |
108 | 108 | ||
109 | /** | 109 | /** |
@@ -220,7 +220,7 @@ shutdown_task (void *cls) | |||
220 | { | 220 | { |
221 | GNUNET_CADET_channel_destroy (ch); | 221 | GNUNET_CADET_channel_destroy (ch); |
222 | ch = NULL; | 222 | ch = NULL; |
223 | } | 223 | } |
224 | if (NULL != gpo) | 224 | if (NULL != gpo) |
225 | { | 225 | { |
226 | GNUNET_CADET_get_path_cancel (gpo); | 226 | GNUNET_CADET_get_path_cancel (gpo); |
@@ -306,12 +306,12 @@ read_stdio (void *cls) | |||
306 | if (GNUNET_NO == echo) | 306 | if (GNUNET_NO == echo) |
307 | { | 307 | { |
308 | // Use MQ's notification if too much data of stdin is pooring in too fast. | 308 | // Use MQ's notification if too much data of stdin is pooring in too fast. |
309 | if (STREAM_BUFFER_SIZE < sent_pkt) | 309 | if (STREAM_BUFFER_SIZE < sent_pkt) |
310 | { | 310 | { |
311 | GNUNET_MQ_notify_sent (env, mq_cb, cls); | 311 | GNUNET_MQ_notify_sent (env, mq_cb, cls); |
312 | sent_pkt = 0; | 312 | sent_pkt = 0; |
313 | } | 313 | } |
314 | else | 314 | else |
315 | { | 315 | { |
316 | listen_stdio (); | 316 | listen_stdio (); |
317 | } | 317 | } |
@@ -563,7 +563,7 @@ path_callback (void *cls, | |||
563 | ppd->path_length); | 563 | ppd->path_length); |
564 | for (unsigned int i = 0; i < ppd->path_length; i++) | 564 | for (unsigned int i = 0; i < ppd->path_length; i++) |
565 | FPRINTF (stdout, | 565 | FPRINTF (stdout, |
566 | "%s ", | 566 | (i == ppd->target_offset) ? "*%s* " : "%s ", |
567 | GNUNET_i2s (&ppd->path[i])); | 567 | GNUNET_i2s (&ppd->path[i])); |
568 | FPRINTF (stdout, | 568 | FPRINTF (stdout, |
569 | "\n"); | 569 | "\n"); |
@@ -626,7 +626,7 @@ show_peer (void *cls) | |||
626 | GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, | 626 | GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, |
627 | strlen (peer_id), | 627 | strlen (peer_id), |
628 | &pid.public_key)) | 628 | &pid.public_key)) |
629 | { | 629 | { |
630 | fprintf (stderr, | 630 | fprintf (stderr, |
631 | _("Invalid peer ID `%s'\n"), | 631 | _("Invalid peer ID `%s'\n"), |
632 | peer_id); | 632 | peer_id); |
@@ -859,7 +859,7 @@ main (int argc, | |||
859 | GNUNET_GETOPT_option_flag ('e', | 859 | GNUNET_GETOPT_option_flag ('e', |
860 | "echo", | 860 | "echo", |
861 | gettext_noop ("Activate echo mode"), | 861 | gettext_noop ("Activate echo mode"), |
862 | &echo), | 862 | &echo), |
863 | GNUNET_GETOPT_option_string ('o', | 863 | GNUNET_GETOPT_option_string ('o', |
864 | "open-port", | 864 | "open-port", |
865 | "SHARED_SECRET", | 865 | "SHARED_SECRET", |
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index d64242943..e29330f99 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -886,6 +886,13 @@ path_info_iterator (void *cls, | |||
886 | path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; | 886 | path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; |
887 | if (sizeof (*resp) + path_size > UINT16_MAX) | 887 | if (sizeof (*resp) + path_size > UINT16_MAX) |
888 | { | 888 | { |
889 | /* try just giving the relevant path */ | ||
890 | path_length = GNUNET_MIN ((UINT16_MAX - sizeof (*resp)) / sizeof (struct GNUNET_PeerIdentity), | ||
891 | off); | ||
892 | path_size = sizeof (struct GNUNET_PeerIdentity) * path_length; | ||
893 | } | ||
894 | if (sizeof (*resp) + path_size > UINT16_MAX) | ||
895 | { | ||
889 | LOG (GNUNET_ERROR_TYPE_WARNING, | 896 | LOG (GNUNET_ERROR_TYPE_WARNING, |
890 | "Path of %u entries is too long for info message\n", | 897 | "Path of %u entries is too long for info message\n", |
891 | path_length); | 898 | path_length); |
@@ -899,9 +906,10 @@ path_info_iterator (void *cls, | |||
899 | /* Don't copy first peer. First peer is always the local one. Last | 906 | /* Don't copy first peer. First peer is always the local one. Last |
900 | * peer is always the destination (leave as 0, EOL). | 907 | * peer is always the destination (leave as 0, EOL). |
901 | */ | 908 | */ |
902 | for (unsigned int i = 0; i <= off; i++) | 909 | for (unsigned int i = 0; i < path_length; i++) |
903 | id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, | 910 | id[i] = *GCP_get_id (GCPP_get_peer_at_offset (path, |
904 | i)); | 911 | i)); |
912 | resp->off = htonl (off); | ||
905 | GNUNET_MQ_send (mq, | 913 | GNUNET_MQ_send (mq, |
906 | env); | 914 | env); |
907 | return GNUNET_YES; | 915 | return GNUNET_YES; |
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index ac3d11216..b8326657d 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -369,7 +369,7 @@ GNUNET_CADET_channel_get_info (struct GNUNET_CADET_Channel *channel, | |||
369 | 369 | ||
370 | /** | 370 | /** |
371 | * Internal details about a channel. | 371 | * Internal details about a channel. |
372 | */ | 372 | */ |
373 | struct GNUNET_CADET_ChannelInternals | 373 | struct GNUNET_CADET_ChannelInternals |
374 | { | 374 | { |
375 | /** | 375 | /** |
@@ -431,7 +431,7 @@ GNUNET_CADET_get_channel_cancel (struct GNUNET_CADET_ChannelMonitor *cm); | |||
431 | 431 | ||
432 | /** | 432 | /** |
433 | * Information we return per peer. | 433 | * Information we return per peer. |
434 | */ | 434 | */ |
435 | struct GNUNET_CADET_PeerListEntry | 435 | struct GNUNET_CADET_PeerListEntry |
436 | { | 436 | { |
437 | /** | 437 | /** |
@@ -446,7 +446,7 @@ struct GNUNET_CADET_PeerListEntry | |||
446 | 446 | ||
447 | /** | 447 | /** |
448 | * Number of disjoint known paths to @e peer. | 448 | * Number of disjoint known paths to @e peer. |
449 | */ | 449 | */ |
450 | unsigned int n_paths; | 450 | unsigned int n_paths; |
451 | 451 | ||
452 | /** | 452 | /** |
@@ -504,7 +504,7 @@ GNUNET_CADET_list_peers_cancel (struct GNUNET_CADET_PeersLister *pl); | |||
504 | 504 | ||
505 | /** | 505 | /** |
506 | * Detailed information we return per peer. | 506 | * Detailed information we return per peer. |
507 | */ | 507 | */ |
508 | struct GNUNET_CADET_PeerPathDetail | 508 | struct GNUNET_CADET_PeerPathDetail |
509 | { | 509 | { |
510 | /** | 510 | /** |
@@ -513,6 +513,11 @@ struct GNUNET_CADET_PeerPathDetail | |||
513 | struct GNUNET_PeerIdentity peer; | 513 | struct GNUNET_PeerIdentity peer; |
514 | 514 | ||
515 | /** | 515 | /** |
516 | * Offset of the target peer on the @e path. | ||
517 | */ | ||
518 | unsigned int target_offset; | ||
519 | |||
520 | /** | ||
516 | * Number of entries on the @e path. | 521 | * Number of entries on the @e path. |
517 | */ | 522 | */ |
518 | unsigned int path_length; | 523 | unsigned int path_length; |
@@ -583,7 +588,7 @@ struct GNUNET_CADET_TunnelDetails | |||
583 | 588 | ||
584 | /** | 589 | /** |
585 | * How many channels use the tunnel. | 590 | * How many channels use the tunnel. |
586 | */ | 591 | */ |
587 | uint32_t channels; | 592 | uint32_t channels; |
588 | 593 | ||
589 | /** | 594 | /** |
@@ -597,8 +602,8 @@ struct GNUNET_CADET_TunnelDetails | |||
597 | uint16_t estate; | 602 | uint16_t estate; |
598 | 603 | ||
599 | /** | 604 | /** |
600 | * What is our connectivity state? | 605 | * What is our connectivity state? |
601 | */ | 606 | */ |
602 | uint16_t cstate; | 607 | uint16_t cstate; |
603 | }; | 608 | }; |
604 | 609 | ||
diff --git a/src/rps/profiler_rps.conf b/src/rps/profiler_rps.conf index 375015cae..dc156f876 100644 --- a/src/rps/profiler_rps.conf +++ b/src/rps/profiler_rps.conf | |||
@@ -84,7 +84,7 @@ DISABLE_TRY_CONNECT = YES | |||
84 | 84 | ||
85 | [cadet] | 85 | [cadet] |
86 | OPTIONS=-l /tmp/rps_profiler_logs/cadet-[]-%Y-%m-%d.log | 86 | OPTIONS=-l /tmp/rps_profiler_logs/cadet-[]-%Y-%m-%d.log |
87 | PREFIX = valgrind | 87 | PREFIX = valgrind --log-file=/home/grothoff/cadet.%p.log |
88 | 88 | ||
89 | #[arm] | 89 | #[arm] |
90 | #GLOBAL_POSTFIX=-l /tmp/rps_profiler_logs/other-[]-%Y-%m-%d.log | 90 | #GLOBAL_POSTFIX=-l /tmp/rps_profiler_logs/other-[]-%Y-%m-%d.log |