From: David Barksdale Date: Thu, 28 Dec 2017 00:35:48 +0000 (-0600) Subject: Better cycle checking in path from DHT X-Git-Tag: gnunet-0.11.0rc0~70 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f4f75ed70d46464bf613d87d71552770fab8b6bf;p=oweals%2Fgnunet.git Better cycle checking in path from DHT --- diff --git a/src/cadet/gnunet-service-cadet_paths.c b/src/cadet/gnunet-service-cadet_paths.c index 7b90fe152..0ec7ff3d7 100644 --- a/src/cadet/gnunet-service-cadet_paths.c +++ b/src/cadet/gnunet-service-cadet_paths.c @@ -501,6 +501,14 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path, pid = (off < get_path_length) ? &get_path[get_path_length - off - 1] : &put_path[get_path_length + put_path_length - off - 1]; + /* Check that I am not in the path */ + if (0 == memcmp (&my_full_id, + pid, + sizeof (struct GNUNET_PeerIdentity))) + { + skip = off + 1; + continue; + } cpath[off - skip] = GCP_get (pid, GNUNET_YES); /* Check that no peer is twice on the path */ @@ -513,6 +521,12 @@ GCPP_try_path_from_dht (const struct GNUNET_PeerIdentity *get_path, } } } + if (skip >= total_len) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Path discovered from DHT is one big cycle?\n"); + return; + } total_len -= skip; /* First figure out if this path is a subset of an existing path, an