aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-09-08 13:30:01 +0000
committerNathan S. Evans <evans@in.tum.de>2010-09-08 13:30:01 +0000
commit8fa400813bab11e04beab9d72f4c41b54b7dc29f (patch)
tree5709c9474a1ba71da503ebad91bc5b466de9a913 /src/transport/plugin_transport_tcp.c
parentf99e141d6cbe5b2c43b835d450270d3a11724f5a (diff)
downloadgnunet-8fa400813bab11e04beab9d72f4c41b54b7dc29f.tar.gz
gnunet-8fa400813bab11e04beab9d72f4c41b54b7dc29f.zip
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.
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 65aea96e0..7d104f371 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -304,6 +304,11 @@ struct Session
304 */ 304 */
305 int inbound; 305 int inbound;
306 306
307 /**
308 * Was this session created using NAT traversal?
309 */
310 int is_nat;
311
307}; 312};
308 313
309 314
@@ -592,6 +597,7 @@ create_session (struct Plugin *plugin,
592 ret = GNUNET_malloc (sizeof (struct Session)); 597 ret = GNUNET_malloc (sizeof (struct Session));
593 ret->last_activity = GNUNET_TIME_absolute_get (); 598 ret->last_activity = GNUNET_TIME_absolute_get ();
594 ret->plugin = plugin; 599 ret->plugin = plugin;
600 ret->is_nat = is_nat;
595 if (is_nat != GNUNET_YES) /* If not a NAT WAIT conn, add it to global list */ 601 if (is_nat != GNUNET_YES) /* If not a NAT WAIT conn, add it to global list */
596 { 602 {
597 ret->next = plugin->sessions; 603 ret->next = plugin->sessions;
@@ -1078,11 +1084,11 @@ tcp_plugin_send (void *cls,
1078 } 1084 }
1079 if (session->inbound == GNUNET_YES) 1085 if (session->inbound == GNUNET_YES)
1080 continue; 1086 continue;
1081 if (addrlen != session->connect_alen) 1087 if ((addrlen != session->connect_alen) && (session->is_nat == GNUNET_NO))
1082 continue; 1088 continue;
1083 if (0 != memcmp (session->connect_addr, 1089 if ((0 != memcmp (session->connect_addr,
1084 addr, 1090 addr,
1085 addrlen)) 1091 addrlen)) && (session->is_nat == GNUNET_NO))
1086 continue; 1092 continue;
1087 cand_session = select_better_session (cand_session, 1093 cand_session = select_better_session (cand_session,
1088 session); 1094 session);
@@ -1152,7 +1158,7 @@ tcp_plugin_send (void *cls,
1152 return -1; /* NAT client only works with IPv4 addresses */ 1158 return -1; /* NAT client only works with IPv4 addresses */
1153 1159
1154 1160
1155 if ( (plugin->allow_nat == GNUNET_YES) && (is_natd == GNUNET_YES) && 1161 if ((plugin->allow_nat == GNUNET_YES) && (is_natd == GNUNET_YES) &&
1156 (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(plugin->nat_wait_conns, &target->hashPubKey))) 1162 (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(plugin->nat_wait_conns, &target->hashPubKey)))
1157 { 1163 {
1158#if DEBUG_TCP_NAT 1164#if DEBUG_TCP_NAT