gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r15238 - gnunet/src/transport
Date: Mon, 16 May 2011 15:35:17 +0200

Author: wachs
Date: 2011-05-16 15:35:17 +0200 (Mon, 16 May 2011)
New Revision: 15238

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
Log:
more fixes in address handling


Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2011-05-16 13:15:30 UTC (rev 
15237)
+++ gnunet/src/transport/plugin_transport_tcp.c 2011-05-16 13:35:17 UTC (rev 
15238)
@@ -2730,6 +2730,7 @@
   int enable_upnp;
   char *internal_address;
   char *external_address;
+  char *bind_address;
   struct sockaddr_in in_addr;
   struct GNUNET_TIME_Relative idle_timeout;
 
@@ -2805,6 +2806,18 @@
       enable_upnp = GNUNET_NO;
     }
 
+  bind_address = NULL;
+  if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg,
+                                                          "transport-tcp",
+                                                          "BINDTO",
+                                                          &bind_address))
+       {
+         GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
+                          "tcp",
+                          _("Binding TCP plugin to specific address: `%s'\n"),
+                          bind_address);
+       }
+
   internal_address = NULL;
   if (GNUNET_OK ==
       GNUNET_CONFIGURATION_have_value (env->cfg,
@@ -2830,6 +2843,19 @@
       return NULL;
     }
 
+  if ((bind_address != NULL) && (internal_address != NULL))
+  {
+         if (0 != strcmp(internal_address, bind_address ))
+         {
+                         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                                         "tcp","Specific bind address `%s' and 
internal address `%s' must not differ, forcing internal address to bind 
address!\n", bind_address, internal_address);
+                         GNUNET_free (internal_address);
+                         internal_address = bind_address;
+                         GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+                                         "tcp","New internal address `%s'\n", 
internal_address);
+         }
+  }
+
   aport = 0;
   if ( (GNUNET_OK !=
        GNUNET_CONFIGURATION_get_value_number (env->cfg,
@@ -2875,6 +2901,7 @@
   plugin = GNUNET_malloc (sizeof (struct Plugin));
   plugin->open_port = bport;
   plugin->adv_port = aport;
+  plugin->bind_address = bind_address;
   plugin->external_address = external_address;
   plugin->internal_address = internal_address;
   plugin->behind_nat = behind_nat;
@@ -2927,16 +2954,6 @@
   GNUNET_SERVER_disconnect_notify (plugin->server,
                                   &disconnect_notify,
                                   plugin);    
-  if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                          "transport-tcp",
-                                                          "BINDTO",
-                                                          
&plugin->bind_address))
-       {
-         GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
-                          "tcp",
-                          _("Binding TCP plugin to specific address: `%s'\n"),
-                          plugin->bind_address);
-       }
   GNUNET_OS_network_interfaces_list (&process_interfaces, plugin);
 
   if ( (plugin->behind_nat == GNUNET_YES) &&




reply via email to

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