aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-06-27 15:18:48 +0000
committerNathan S. Evans <evans@in.tum.de>2010-06-27 15:18:48 +0000
commit1d30c882fc54db83900f41b3960ddf5aa4ebc7db (patch)
tree19bbed1ac54196a319f7ce36de08d586becfc0f8
parent50e62b4ff51cec0f102eea6bf91c4f60697ce660 (diff)
downloadgnunet-1d30c882fc54db83900f41b3960ddf5aa4ebc7db.tar.gz
gnunet-1d30c882fc54db83900f41b3960ddf5aa4ebc7db.zip
proper check address behavior
-rw-r--r--src/dv/plugin_transport_dv.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c
index 43e8751c9..a49c27619 100644
--- a/src/dv/plugin_transport_dv.c
+++ b/src/dv/plugin_transport_dv.c
@@ -353,17 +353,24 @@ static const char *address_to_string (void *cls,
353 * @return GNUNET_OK if this is a plausible address for this peer 353 * @return GNUNET_OK if this is a plausible address for this peer
354 * and transport 354 * and transport
355 * 355 *
356 * FIXME: does this mean anything for the DV plugin?
357 */ 356 */
358static int 357static int
359dv_plugin_address_suggested (void *cls, 358dv_plugin_address_suggested (void *cls,
360 void *addr, size_t addrlen) 359 void *addr, size_t addrlen)
361{ 360{
362 /* struct Plugin *plugin = cls; */ 361 struct Plugin *plugin = cls;
363 362 /* Verify that the first peer of this address matches our peer id! */
364 /* check if the address is plausible; if so, 363 if ((addrlen != (2 * sizeof(struct GNUNET_PeerIdentity))) || (0 != memcmp(addr, plugin->env->my_identity, sizeof(struct GNUNET_PeerIdentity))))
365 add it to our list! */ 364 {
366 return GNUNET_NO; 365 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Address not correct size or identity doesn't match ours!\n", GNUNET_i2s(plugin->env->my_identity));
366 if (addrlen == (2 * sizeof(struct GNUNET_PeerIdentity)))
367 {
368 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer in addr is %s\n", GNUNET_i2s(addr));
369 }
370 return GNUNET_NO;
371 }
372 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Address verified!\n", GNUNET_i2s(plugin->env->my_identity));
373 return GNUNET_YES;
367} 374}
368 375
369 376