gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r12924 - gnunet/src/transport
Date: Wed, 8 Sep 2010 15:30:01 +0200

Author: nevans
Date: 2010-09-08 15:30:01 +0200 (Wed, 08 Sep 2010)
New Revision: 12924

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
Log:
possible fix for buildbot failure on NAT test case; once a 'NAT' address is 
used and a connection established, the new connection doesn't have a 'NAT' 
address (port 0) any longer, because it was built off of an inbound connection 
from the NAT'd peer.  However, since we initiated the connection we expect that 
whatever address transport gives us should match.

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-09-08 11:57:46 UTC (rev 
12923)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-09-08 13:30:01 UTC (rev 
12924)
@@ -304,6 +304,11 @@
    */
   int inbound;
 
+  /**
+   * Was this session created using NAT traversal?
+   */
+  int is_nat;
+
 };
 
 
@@ -592,6 +597,7 @@
   ret = GNUNET_malloc (sizeof (struct Session));
   ret->last_activity = GNUNET_TIME_absolute_get ();
   ret->plugin = plugin;
+  ret->is_nat = is_nat;
   if (is_nat != GNUNET_YES) /* If not a NAT WAIT conn, add it to global list */
     {
       ret->next = plugin->sessions;
@@ -1078,11 +1084,11 @@
            }
          if (session->inbound == GNUNET_YES)
            continue;
-         if (addrlen != session->connect_alen)
+         if ((addrlen != session->connect_alen) && (session->is_nat == 
GNUNET_NO))
            continue;
-         if (0 != memcmp (session->connect_addr,
+         if ((0 != memcmp (session->connect_addr,
                           addr,
-                          addrlen))
+                          addrlen)) && (session->is_nat == GNUNET_NO))
            continue;
          cand_session = select_better_session (cand_session,
                                                session);       
@@ -1152,7 +1158,7 @@
         return -1; /* NAT client only works with IPv4 addresses */
 
 
-      if ( (plugin->allow_nat == GNUNET_YES) && (is_natd == GNUNET_YES) &&
+      if ((plugin->allow_nat == GNUNET_YES) && (is_natd == GNUNET_YES) &&
            (GNUNET_NO == 
GNUNET_CONTAINER_multihashmap_contains(plugin->nat_wait_conns, 
&target->hashPubKey)))
         {
 #if DEBUG_TCP_NAT




reply via email to

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