gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11987 - gnunet/src/dv


From: gnunet
Subject: [GNUnet-SVN] r11987 - gnunet/src/dv
Date: Sun, 27 Jun 2010 17:18:48 +0200

Author: nevans
Date: 2010-06-27 17:18:48 +0200 (Sun, 27 Jun 2010)
New Revision: 11987

Modified:
   gnunet/src/dv/plugin_transport_dv.c
Log:
proper check address behavior

Modified: gnunet/src/dv/plugin_transport_dv.c
===================================================================
--- gnunet/src/dv/plugin_transport_dv.c 2010-06-27 14:59:29 UTC (rev 11986)
+++ gnunet/src/dv/plugin_transport_dv.c 2010-06-27 15:18:48 UTC (rev 11987)
@@ -353,17 +353,24 @@
  * @return GNUNET_OK if this is a plausible address for this peer
  *         and transport
  *
- * FIXME: does this mean anything for the DV plugin?
  */
 static int
 dv_plugin_address_suggested (void *cls,
-                                  void *addr, size_t addrlen)
+                             void *addr, size_t addrlen)
 {
-  /* struct Plugin *plugin = cls; */
-
-  /* check if the address is plausible; if so,
-     add it to our list! */
-  return GNUNET_NO;
+  struct Plugin *plugin = cls;
+  /* Verify that the first peer of this address matches our peer id! */
+  if ((addrlen != (2 * sizeof(struct GNUNET_PeerIdentity))) || (0 != 
memcmp(addr, plugin->env->my_identity, sizeof(struct GNUNET_PeerIdentity))))
+  {
+    GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Address not correct size or 
identity doesn't match ours!\n", GNUNET_i2s(plugin->env->my_identity));
+    if (addrlen == (2 * sizeof(struct GNUNET_PeerIdentity)))
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Peer in addr is %s\n", 
GNUNET_i2s(addr));
+    }
+    return GNUNET_NO;
+  }
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s: Address verified!\n", 
GNUNET_i2s(plugin->env->my_identity));
+  return GNUNET_YES;
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]