[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 01/02: Check for cycles in cadet paths
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 01/02: Check for cycles in cadet paths |
Date: |
Sat, 23 Dec 2017 16:58:29 +0100 |
This is an automated email from the git hooks/post-receive script.
david-barksdale pushed a commit to branch master
in repository gnunet.
commit 9def71212263b1fcaaa54795a07c97c5b9118a75
Author: David Barksdale <address@hidden>
AuthorDate: Sat Dec 23 09:54:23 2017 -0600
Check for cycles in cadet paths
I believe this is the underlying issue from commit
012ff13acc0cb2f5d7210aa48819395fecf12a3d. I tested out this change and
saw that cyclic paths were dropped and GCP_set_mq() no longer had to
deal with multiple removals. After this commit I'll revert that one.
---
src/cadet/gnunet-service-cadet_core.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/cadet/gnunet-service-cadet_core.c
b/src/cadet/gnunet-service-cadet_core.c
index a67bbf445..cb213fc54 100644
--- a/src/cadet/gnunet-service-cadet_core.c
+++ b/src/cadet/gnunet-service-cadet_core.c
@@ -773,10 +773,31 @@ handle_connection_create (void *cls,
path_length = size / sizeof (struct GNUNET_PeerIdentity);
if (0 == path_length)
{
- /* bogus request */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Dropping CADET_CONNECTION_CREATE with empty path\n");
GNUNET_break_op (0);
return;
}
+ /* Check for loops */
+ struct GNUNET_CONTAINER_MultiPeerMap *map;
+ map = GNUNET_CONTAINER_multipeermap_create (path_length,
+ GNUNET_YES);
+ GNUNET_assert (NULL != map);
+ for (off = 0; off < path_length; off++) {
+ if (GNUNET_SYSERR ==
+ GNUNET_CONTAINER_multipeermap_put (map,
+ &pids[off],
+ NULL,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) {
+ /* bogus request */
+ GNUNET_CONTAINER_multipeermap_destroy (map);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Dropping CADET_CONNECTION_CREATE with cyclic path\n");
+ GNUNET_break_op (0);
+ return;
+ }
+ }
+ GNUNET_CONTAINER_multipeermap_destroy (map);
/* Initiator is at offset 0. */
for (off=1;off<path_length;off++)
if (0 == memcmp (&my_full_id,
@@ -785,7 +806,8 @@ handle_connection_create (void *cls,
break;
if (off == path_length)
{
- /* We are not on the path, bogus request */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Dropping CADET_CONNECTION_CREATE without us in the path\n");
GNUNET_break_op (0);
return;
}
@@ -793,7 +815,8 @@ handle_connection_create (void *cls,
if (sender != GCP_get (&pids[off - 1],
GNUNET_NO))
{
- /* sender is not on the path, not allowed */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Dropping CADET_CONNECTION_CREATE without sender in the path\n");
GNUNET_break_op (0);
return;
}
--
To stop receiving notification emails like this one, please contact
address@hidden