gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11027 - in gnunet: . src/transport


From: gnunet
Subject: [GNUnet-SVN] r11027 - in gnunet: . src/transport
Date: Thu, 22 Apr 2010 11:34:46 +0200

Author: grothoff
Date: 2010-04-22 11:34:46 +0200 (Thu, 22 Apr 2010)
New Revision: 11027

Modified:
   gnunet/TODO
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
Log:
ignore addresses of other peers that are equal to our own

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-04-22 09:21:18 UTC (rev 11026)
+++ gnunet/TODO 2010-04-22 09:34:46 UTC (rev 11027)
@@ -158,11 +158,6 @@
   - should use BIO instead of mmap
 * TRANSPORT:
   - need to periodically probe latency/transport cost changes & possibly 
switch transport
-  - instantly filter addresses from *other* peers that 
-    are *equal* to our own address + port (i.e., localhost:2086).  We 
-    no longer filter those for outgoing (helps with loopback testing
-    and keeps the code clean), but we should filter strictly *impossible*
-    incoming addresses!  This is for efficiency, not correctness.
   - should use hash map to look up Neighbours (service AND plugins!)
 * HOSTLIST:
   - 'server' uses 'GNUNET_PEERINFO_iterate', should probably switch to 
notification API

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-04-22 09:21:18 UTC 
(rev 11026)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-04-22 09:34:46 UTC 
(rev 11027)
@@ -3475,6 +3475,7 @@
   struct ValidationEntry *va;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk;
   struct CheckAddressExistsClosure caec;
+  struct OwnAddressList *oal;
 
   GNUNET_assert (addr != NULL);
   GNUNET_STATISTICS_update (stats,
@@ -3490,11 +3491,29 @@
                   ("Transport `%s' not loaded, will not try to validate peer 
address using this transport.\n"),
                   tname);
       GNUNET_STATISTICS_update (stats,
-                               gettext_noop ("# peer addresses not validated 
(no applicable transport plugin available)"),
+                               gettext_noop ("# peer addresses not validated 
(plugin not available)"),
                                1,
                                GNUNET_NO);      
       return GNUNET_OK;
     }
+  /* check if this is one of our own addresses */
+  oal = tp->addresses;
+  while (NULL != oal)
+    {
+      if ( (oal->addrlen == addrlen) &&
+          (0 == memcmp (oal->addr,
+                        addr,
+                        addrlen)) )
+       {
+         /* not plausible, this address is equivalent to our own address! */
+         GNUNET_STATISTICS_update (stats,
+                                   gettext_noop ("# peer addresses not 
validated (loopback)"),
+                                   1,
+                                   GNUNET_NO);      
+         return GNUNET_OK;
+       }
+      oal = oal->next;
+    }
   GNUNET_HELLO_get_key (chvc->hello, &pk);
   GNUNET_CRYPTO_hash (&pk,
                       sizeof (struct

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-04-22 09:21:18 UTC (rev 
11026)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-04-22 09:34:46 UTC (rev 
11027)
@@ -685,7 +685,7 @@
                            gettext_noop ("# bytes TCP was asked to transmit"),
                            msgbuf_size,
                            GNUNET_NO);      
-  /* FIXME: we could do this a cheaper with a hash table
+  /* FIXME: we could do this cheaper with a hash table
      where we could restrict the iteration to entries that match
      the target peer... */
   if (session == NULL)
@@ -1253,6 +1253,12 @@
 /**
  * Add the IP of our network interface to the list of
  * our external IP addresses.
+ *
+ * @param cls the 'struct Plugin*'
+ * @param name name of the interface
+ * @param isDefault do we think this may be our default interface
+ * @param addr address of the interface
+ * @param addrlen number of bytes in addr
  */
 static int
 process_interfaces (void *cls,





reply via email to

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