gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15540 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15540 - gnunet/src/transport
Date: Fri, 10 Jun 2011 17:10:57 +0200

Author: grothoff
Date: 2011-06-10 17:10:57 +0200 (Fri, 10 Jun 2011)
New Revision: 15540

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
Log:
refuse connections from self

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-06-10 15:03:51 UTC 
(rev 15539)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-06-10 15:10:57 UTC 
(rev 15540)
@@ -5332,14 +5332,11 @@
 }
 
 
-
-
-
 /**
- * Function called by the plugin for each received message.
- * Update data volumes, possibly notify plugins about
- * reducing the rate at which they read from the socket
- * and generally forward to our receive callback.
+ * Function called by the plugin for each received message.  Update
+ * data volumes, possibly notify plugins about reducing the rate at
+ * which they read from the socket and generally forward to our
+ * receive callback.
  *
  * @param cls the "struct TransportPlugin *" we gave to the plugin
  * @param peer (claimed) identity of the other peer
@@ -5371,6 +5368,14 @@
   uint32_t distance;
   int c;
 
+  if (0 == memcmp (peer,
+                  &my_identity,
+                  sizeof (struct GNUNET_PeerIdentity)))
+    {
+      /* refuse to receive from myself */
+      GNUNET_break (0); 
+      return GNUNET_TIME_UNIT_FOREVER_REL;
+    }
   if (is_blacklisted (peer, plugin))
     return GNUNET_TIME_UNIT_FOREVER_REL;
   n = find_neighbour (peer);

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2011-06-10 15:03:51 UTC (rev 
15539)
+++ gnunet/src/transport/plugin_transport_tcp.c 2011-06-10 15:10:57 UTC (rev 
15540)
@@ -1810,8 +1810,17 @@
   if (ntohs(message->size) != sizeof(struct TCP_NAT_ProbeMessage))
     {
       GNUNET_break_op(0);
+      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
       return;
     }
+  if (0 == memcmp (&tcp_nat_probe->clientIdentity,
+                  plugin->env->my_identity,
+                  sizeof (struct GNUNET_PeerIdentity)))
+    {
+      /* refuse connections from ourselves */
+      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+      return;
+    }
   tcp_nat_probe = (const struct TCP_NAT_ProbeMessage *)message;
   session = GNUNET_CONTAINER_multihashmap_get(plugin->nat_wait_conns, 
                                              
&tcp_nat_probe->clientIdentity.hashPubKey);
@@ -1921,7 +1930,15 @@
   struct IPv6TcpAddress *t6;
   const struct sockaddr_in *s4;
   const struct sockaddr_in6 *s6;
-
+  
+  if (0 == memcmp (&wm->clientIdentity,
+                  plugin->env->my_identity,
+                  sizeof (struct GNUNET_PeerIdentity)))
+    {
+      /* refuse connections from ourselves */
+      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+      return;
+    }
 #if DEBUG_TCP
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
                   "tcp",




reply via email to

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