moving NAT options into their own section
authorChristian Grothoff <christian@grothoff.org>
Thu, 9 Jun 2011 13:13:05 +0000 (13:13 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 9 Jun 2011 13:13:05 +0000 (13:13 +0000)
16 files changed:
contrib/defaults.conf
src/transport/plugin_transport_tcp.c
src/transport/plugin_transport_udp.c
src/transport/test_quota_compliance_tcp_peer1.conf
src/transport/test_quota_compliance_tcp_peer2.conf
src/transport/test_transport_api_multi_peer1.conf
src/transport/test_transport_api_multi_peer2.conf
src/transport/test_transport_api_tcp_nat_peer1.conf
src/transport/test_transport_api_tcp_nat_peer2.conf
src/transport/test_transport_api_tcp_peer1.conf
src/transport/test_transport_api_tcp_peer2.conf
src/transport/test_transport_api_udp_nat_peer1.conf
src/transport/test_transport_api_udp_nat_peer2.conf
src/transport/test_transport_ats_1addr.conf
src/transport/test_transport_ats_2addr.conf
src/transport/test_transport_ats_4addr.conf

index 0d1bffab9988ef9ce1848cdbd847e6926299ad77..6c467f89553ff80d5fedafa1134414c770c94288 100644 (file)
@@ -21,11 +21,7 @@ MAX_OUTSTANDING_CONNECTIONS = 50
 [client]
 HOME = $SERVICEHOME
 
-[transport-tcp]
-# Use 0 to ONLY advertise as a peer behind NAT (no port binding)
-PORT = 2086
-ADVERTISED_PORT = 2086
-
+[nat]
 # Are we behind NAT?
 BEHIND_NAT = YES
 
@@ -54,29 +50,44 @@ ENABLE_ICMP_SERVER = YES
 # (but use different: this one restricts our bind!)
 # BINDTO =
 
+# Disable IPv6 support
+DISABLEV6 = NO
+
+
+[transport-tcp]
+# Use 0 to ONLY advertise as a peer behind NAT (no port binding)
+PORT = 2086
+ADVERTISED_PORT = 2086
+
 TIMEOUT = 300000
 
-# Disable IPv6 support
-# DISABLEV6 =
+# Allow use of loopback address
+USE_LOCALADDR = NO
+
 # ACCEPT_FROM =
 # ACCEPT_FROM6 =
 # REJECT_FROM =
 # REJECT_FROM6 =
 
+
 [transport-udp]
 PORT = 2086
-# BEHIND_NAT = 
-# BINDTO = 
-# ALLOW_NAT = 
-# ONLY_NAT_ADDRESSES = 
-# INTERNAL_ADDRESS = 
-# EXTERNAL_ADDRESS = 
+
+# Allow use of loopback address
+USE_LOCALADDR = NO
+
 
 [transport-http]
 PORT = 1080
+# Allow use of loopback address
+USE_LOCALADDR = NO
+
 
 [transport-https]
 PORT = 4433
+# Allow use of loopback address
+USE_LOCALADDR = NO
+
 
 [transport-wlan]
 # Name of the interface in monitor mode (typically monX)
index 1c22ce806541580b75e440826dc0f43788aac2ea..2be02d643ca48376d46db26445adcba8580e8ac0 100644 (file)
@@ -2278,7 +2278,7 @@ process_interfaces (void *cls,
     case AF_INET6:      
       if ( (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr)) || 
           (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno(plugin->env->cfg, 
-                                                              "transport-tcp", 
+                                                              "nat", 
                                                               "DISABLEV6")) )
        {
          /* skip link local addresses */
@@ -2829,19 +2829,19 @@ libgnunet_plugin_transport_tcp_init (void *cls)
   struct GNUNET_TIME_Relative idle_timeout;
 
   behind_nat = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                    "transport-tcp",
+                                                    "nat",
                                                     "BEHIND_NAT");
   nat_punched = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                     "transport-tcp",
+                                                     "nat",
                                                      "NAT_PUNCHED");
   enable_nat_client = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                           "transport-tcp",
+                                                           "nat",
                                                            "ENABLE_NAT_CLIENT");
   enable_nat_server = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                           "transport-tcp",
+                                                           "nat",
                                                            "ENABLE_NAT_SERVER");
   enable_upnp = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                     "transport-tcp",
+                                                     "nat",
                                                      "ENABLE_UPNP");
   
   if ( (GNUNET_YES == enable_nat_server) &&
@@ -2865,11 +2865,11 @@ libgnunet_plugin_transport_tcp_init (void *cls)
   external_address = NULL;
   if (GNUNET_OK ==
       GNUNET_CONFIGURATION_have_value (env->cfg,
-                                      "transport-tcp",
+                                      "nat",
                                       "EXTERNAL_ADDRESS"))
     {
       (void) GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                   "transport-tcp",
+                                                   "nat",
                                                    "EXTERNAL_ADDRESS",
                                                    &external_address);
     }
@@ -2902,7 +2902,7 @@ libgnunet_plugin_transport_tcp_init (void *cls)
 
   bind_address = NULL;
   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                          "transport-tcp",
+                                                          "nat",
                                                           "BINDTO",
                                                           &bind_address))
        {
@@ -2915,11 +2915,11 @@ libgnunet_plugin_transport_tcp_init (void *cls)
   internal_address = NULL;
   if (GNUNET_OK ==
       GNUNET_CONFIGURATION_have_value (env->cfg,
-                                      "transport-tcp",
+                                      "nat",
                                       "INTERNAL_ADDRESS"))
     {
       (void) GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                   "transport-tcp",
+                                                   "nat",
                                                    "INTERNAL_ADDRESS",
                                                    &internal_address);
     }
@@ -2975,14 +2975,11 @@ libgnunet_plugin_transport_tcp_init (void *cls)
       return NULL;
     }
 
-  use_localaddresses = GNUNET_NO;
-  if (GNUNET_CONFIGURATION_have_value (env->cfg,
-                                      "transport-tcp", "USE_LOCALADDR"))
-    {
-      use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                                "transport-tcp",
-                                                                "USE_LOCALADDR");
-    }
+  use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+                                                            "transport-tcp",
+                                                            "USE_LOCALADDR");
+  if (use_localaddresses == GNUNET_SYSERR)
+    use_localaddresses = GNUNET_NO;
   
   if (aport == 0)
     aport = bport;
index bb814a9961dd7f698df9f8df06be608938419bb7..58135803ad8454339d4825d1422e8d59c228c016 100644 (file)
@@ -1731,7 +1731,7 @@ udp_transport_server_start (void *cls)
     }
 
   if ( (GNUNET_YES !=
-       GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, "transport-udp",
+       GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, "nat",
                                              "DISABLEV6")))
     {
       plugin->udp_sockv6.desc = GNUNET_NETWORK_socket_create (PF_INET6, SOCK_DGRAM, 0);
@@ -2221,8 +2221,8 @@ libgnunet_plugin_transport_udp_init (void *cls)
   struct IPv4UdpAddress v4_address;
 
   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                         "transport-udp",
-                                                         "BEHIND_NAT"))
+                                                         "nat",
+                                                         "BEHIND_NAT"))
     {
       /* We are behind nat (according to the user) */
       if (check_gnunet_nat_binary("gnunet-nat-server") == GNUNET_YES)
@@ -2237,8 +2237,8 @@ libgnunet_plugin_transport_udp_init (void *cls)
     behind_nat = GNUNET_NO; /* We are not behind nat! */
 
   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                         "transport-udp",
-                                                         "ALLOW_NAT"))
+                                                         "nat",
+                                                         "ALLOW_NAT"))
     {
       if (check_gnunet_nat_binary("gnunet-nat-client") == GNUNET_YES)
         allow_nat = GNUNET_YES; /* We will try to connect to NAT'd peers */
@@ -2253,8 +2253,8 @@ libgnunet_plugin_transport_udp_init (void *cls)
     allow_nat = GNUNET_NO; /* We don't want to try to help NAT'd peers */
 
   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                           "transport-udp",
-                                                           "ONLY_NAT_ADDRESSES"))
+                                                         "nat",
+                                                         "ONLY_NAT_ADDRESSES"))
     only_nat_addresses = GNUNET_YES; /* We will only report our addresses as NAT'd */
   else
     only_nat_addresses = GNUNET_NO; /* We will report our addresses as NAT'd and non-NAT'd */
@@ -2262,7 +2262,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
   external_address = NULL;
   if (((GNUNET_YES == behind_nat) || (GNUNET_YES == allow_nat)) && (GNUNET_OK !=
          GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                "transport-udp",
+                                                "nat",
                                                 "EXTERNAL_ADDRESS",
                                                 &external_address)))
     {
@@ -2280,13 +2280,13 @@ libgnunet_plugin_transport_udp_init (void *cls)
   internal_address = NULL;
   if ((GNUNET_YES == behind_nat) && (GNUNET_OK !=
          GNUNET_CONFIGURATION_get_value_string (env->cfg,
-                                                "transport-udp",
+                                                "nat",
                                                 "INTERNAL_ADDRESS",
                                                 &internal_address)))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                       _("Require INTERNAL_ADDRESS for service `%s' in configuration!\n"),
-                       "transport-udp");
+                 _("Require INTERNAL_ADDRESS for service `%s' in configuration!\n"),
+                 "transport-udp");
       GNUNET_free_non_null(external_address);
       return NULL;
     }
@@ -2325,8 +2325,8 @@ libgnunet_plugin_transport_udp_init (void *cls)
                  "transport-udp", "USE_LOCALADDR"))
     {
       use_localaddresses = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
-                                                                  "transport-udp",
-                                                              "USE_LOCALADDR");
+                                                                "transport-udp",
+                                                                "USE_LOCALADDR");
     }
 
   plugin = GNUNET_malloc (sizeof (struct Plugin));
index 0e11af0cb4c3fcb39bc87d0cc2ece6ca67f018df..56c2ebfb8267e95447658754971081ec04fd771e 100644 (file)
@@ -34,16 +34,18 @@ AUTOSTART = NO
 PORT = 4094
 
 [transport-tcp]
-DISABLEV6 = YES
 TIMEOUT = 300000
 PORT = 4094
+USE_LOCALADDR = YES
+
+[nat]
+DISABLEV6 = YES
 BINDTO = 127.0.0.1
 ENABLE_UPNP = NO
 BEHIND_NAT = NO
 ALLOW_NAT = NO
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [transport]
 plugins = tcp
index d881d29f4ad2f211783019e069a596c6890b8865..8a68be79ca49849aeb655a8061489d6289c5e049 100644 (file)
@@ -6,16 +6,18 @@ DEFAULTCONFIG = test_quota_compliance_tcp_peer2.conf
 PORT = 3094
 
 [transport-tcp]
-DISABLEV6 = YES
 TIMEOUT = 300000
 PORT = 3094
+USE_LOCALADDR = YES
+
+[nat]
+DISABLEV6 = YES
 BINDTO = 127.0.0.1
 ENABLE_UPNP = NO
 BEHIND_NAT = NO
 ALLOW_NAT = NO
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [fs]
 AUTOSTART = NO
index cbfd675874eb4f764f61ccaf08787c289ac13646..106ffc4cd1703e872f3aa15aba35448034b22185 100644 (file)
@@ -1,13 +1,15 @@
 [transport-tcp]
-DISABLEV6 = YES
 PORT = 30001
 BINDTO = 127.0.0.1
+USE_LOCALADDR = YES
+
+[nat]
+DISABLEV6 = YES
 BEHIND_NAT = NO
 ALLOW_NAT = NO
 ENABLE_UPNP = NO
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [transport-udp]
 PORT = 30001
index df7a06b249f4053764ffe4d84888318796d1c397..0453b492945733335360be8c2434a273c32d76c6 100644 (file)
@@ -1,13 +1,15 @@
 [transport-tcp]
-DISABLEV6 = YES
 PORT = 40001
+USE_LOCALADDR = YES
+
+[nat]
 BINDTO = 127.0.0.1
+DISABLEV6 = YES
 BEHIND_NAT = NO
 ALLOW_NAT = NO
 ENABLE_UPNP = NO
 EXTERNAL_ADDRESS = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [transport-udp]
 PORT = 40002
index 168a8b1159215a117c7e9ad47b4b93526ecda75f..8856ec1da285395f9632f748d651801576701a66 100644 (file)
@@ -1,13 +1,15 @@
 [transport-tcp]
-DISABLEV6 = YES
 PORT = 12368
+USE_LOCALADDR = YES
+
+[nat]
+DISABLEV6 = YES
 BINDTO = 127.0.0.1
 BEHIND_NAT = YES
 ENABLE_NAT_SERVER = YES
 #NAT_PUNCHED = YES
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [fs]
 AUTOSTART = NO
index 2f3ccbe4c0dc0f53ac42ab880f7ce732d8f1536e..cd5aae00043465b359e0892dbea6a9f286c51e59 100644 (file)
@@ -1,12 +1,14 @@
 [transport-tcp]
-DISABLEV6 = YES
 PORT = 23000
+USE_LOCALADDR = YES
+
+[nat]
 BINDTO = 127.0.0.1
+DISABLEV6 = YES
 BEHIND_NAT = NO
 ENABLE_NAT_CLIENT = YES
 EXTERNAL_ADDRESS = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [core]
 AUTOSTART = NO
index 6f6945fecd96d7f32df9b20c431ad1723a7b2ab8..a808df104c3a28d47301313c6ba4d30251be4296 100644 (file)
@@ -1,13 +1,15 @@
 [transport-tcp]
-DISABLEV6 = YES
+USE_LOCALADDR = YES
 PORT = 12368
+
+[nat]
+DISABLEV6 = YES
 BINDTO = 127.0.0.1
 BEHIND_NAT = NO
 #ALLOW_NAT = NO
 ENABLE_UPNP = NO
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [fs]
 AUTOSTART = NO
index 7636af6669a72febcf8ad7e453f75c8e26d09752..b663bb0f2d98069c91e987d7d8c4142340a15614 100644 (file)
@@ -1,13 +1,15 @@
 [transport-tcp]
-DISABLEV6 = YES
 PORT = 0
+USE_LOCALADDR = YES
+
+[nat]
+DISABLEV6 = YES
 BINDTO = 127.0.0.1
 BEHIND_NAT = NO
 #ALLOW_NAT = NO
 ENABLE_UPNP = NO
 EXTERNAL_ADDRESS = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [core]
 AUTOSTART = NO
index d65f9ca6d519f9203555065548ec276eeb452c38..ca2ee63ad41a28d4967c066ec1c10539f0fbca7e 100644 (file)
@@ -1,12 +1,14 @@
 [transport-udp]
 PORT = 12368
+USE_LOCALADDR = YES
+
+[nat]
 BEHIND_NAT = YES
 BINDTO = 127.0.0.1
 ALLOW_NAT = NO
 ONLY_NAT_ADDRESSES = YES
 INTERNAL_ADDRESS = 127.0.0.1
 EXTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [fs]
 AUTOSTART = NO
index 26510b5101cf336cb1f98a7a42d96c8c8f600bc2..d702dc46d41840762f586a5cb5354388fc663d29 100644 (file)
@@ -1,11 +1,13 @@
 [transport-udp]
 PORT = 22368
+USE_LOCALADDR = YES
+
+[nat]
 BINDTO = 127.0.0.1
 BEHIND_NAT = NO
 ALLOW_NAT = YES
 EXTERNAL_ADDRESS = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [fs]
 AUTOSTART = NO
index be57dcda99b98139c13759621c25f17fb548fba7..b85b09173c3b69f52d4d2a929d4347268f93c027 100644 (file)
@@ -29,8 +29,8 @@ DEFAULTSERVICES = core
 [statistics]
 PORT = 2567
 
-[transport-tcp]
-#DEBUG=YES
+
+[nat]
 DISABLEV6 = YES
 BINDTO = 127.0.0.1
 BEHIND_NAT = NO
index 36575e31b98e709469d33d095099a919d7b4a544..9ec447c8a8f1da3b39694cafb4c60e77f396d282 100644 (file)
@@ -30,10 +30,9 @@ DEFAULTSERVICES = core
 PORT = 2567
 
 [transport-tcp]
-#DEBUG=YES
-DISABLEV4 = YES
 USE_LOCALADDR = YES
 
+[nat]
 BINDTO = 127.0.0.1
 #BEHIND_NAT = NO
 #ALLOW_NAT = NO
index e96ac3c7c7abf25986ef53cbcef829cfe39adf70..31456a0295be3c2cc2bda21e488651a2f9abc6a1 100644 (file)
@@ -33,7 +33,9 @@ DEFAULTSERVICES = core
 PORT = 2567
 
 [transport-tcp]
-#DEBUG=YES
+USE_LOCALADDR = YES
+
+[nat]
 DISABLEV6 = YES
 BINDTO = 127.0.0.1
 BEHIND_NAT = NO
@@ -41,7 +43,6 @@ ALLOW_NAT = NO
 ENABLE_UPNP = NO
 EXTERNAL_ADDRESS = 127.0.0.1
 INTERNAL_ADDRESS = 127.0.0.1
-USE_LOCALADDR = YES
 
 [transport-unix]
 PORT = 2572