From: Christian Grothoff Date: Thu, 9 Jun 2011 13:13:05 +0000 (+0000) Subject: moving NAT options into their own section X-Git-Tag: initial-import-from-subversion-38251~18294 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=39de47ee0338e636c0172236e4021ef491bff4e1;p=oweals%2Fgnunet.git moving NAT options into their own section --- diff --git a/contrib/defaults.conf b/contrib/defaults.conf index 0d1bffab9..6c467f895 100644 --- a/contrib/defaults.conf +++ b/contrib/defaults.conf @@ -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) diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 1c22ce806..2be02d643 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -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; diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index bb814a996..58135803a 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -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)); diff --git a/src/transport/test_quota_compliance_tcp_peer1.conf b/src/transport/test_quota_compliance_tcp_peer1.conf index 0e11af0cb..56c2ebfb8 100644 --- a/src/transport/test_quota_compliance_tcp_peer1.conf +++ b/src/transport/test_quota_compliance_tcp_peer1.conf @@ -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 diff --git a/src/transport/test_quota_compliance_tcp_peer2.conf b/src/transport/test_quota_compliance_tcp_peer2.conf index d881d29f4..8a68be79c 100644 --- a/src/transport/test_quota_compliance_tcp_peer2.conf +++ b/src/transport/test_quota_compliance_tcp_peer2.conf @@ -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 diff --git a/src/transport/test_transport_api_multi_peer1.conf b/src/transport/test_transport_api_multi_peer1.conf index cbfd67587..106ffc4cd 100644 --- a/src/transport/test_transport_api_multi_peer1.conf +++ b/src/transport/test_transport_api_multi_peer1.conf @@ -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 diff --git a/src/transport/test_transport_api_multi_peer2.conf b/src/transport/test_transport_api_multi_peer2.conf index df7a06b24..0453b4929 100644 --- a/src/transport/test_transport_api_multi_peer2.conf +++ b/src/transport/test_transport_api_multi_peer2.conf @@ -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 diff --git a/src/transport/test_transport_api_tcp_nat_peer1.conf b/src/transport/test_transport_api_tcp_nat_peer1.conf index 168a8b115..8856ec1da 100644 --- a/src/transport/test_transport_api_tcp_nat_peer1.conf +++ b/src/transport/test_transport_api_tcp_nat_peer1.conf @@ -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 diff --git a/src/transport/test_transport_api_tcp_nat_peer2.conf b/src/transport/test_transport_api_tcp_nat_peer2.conf index 2f3ccbe4c..cd5aae000 100644 --- a/src/transport/test_transport_api_tcp_nat_peer2.conf +++ b/src/transport/test_transport_api_tcp_nat_peer2.conf @@ -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 diff --git a/src/transport/test_transport_api_tcp_peer1.conf b/src/transport/test_transport_api_tcp_peer1.conf index 6f6945fec..a808df104 100644 --- a/src/transport/test_transport_api_tcp_peer1.conf +++ b/src/transport/test_transport_api_tcp_peer1.conf @@ -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 diff --git a/src/transport/test_transport_api_tcp_peer2.conf b/src/transport/test_transport_api_tcp_peer2.conf index 7636af666..b663bb0f2 100644 --- a/src/transport/test_transport_api_tcp_peer2.conf +++ b/src/transport/test_transport_api_tcp_peer2.conf @@ -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 diff --git a/src/transport/test_transport_api_udp_nat_peer1.conf b/src/transport/test_transport_api_udp_nat_peer1.conf index d65f9ca6d..ca2ee63ad 100644 --- a/src/transport/test_transport_api_udp_nat_peer1.conf +++ b/src/transport/test_transport_api_udp_nat_peer1.conf @@ -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 diff --git a/src/transport/test_transport_api_udp_nat_peer2.conf b/src/transport/test_transport_api_udp_nat_peer2.conf index 26510b510..d702dc46d 100644 --- a/src/transport/test_transport_api_udp_nat_peer2.conf +++ b/src/transport/test_transport_api_udp_nat_peer2.conf @@ -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 diff --git a/src/transport/test_transport_ats_1addr.conf b/src/transport/test_transport_ats_1addr.conf index be57dcda9..b85b09173 100644 --- a/src/transport/test_transport_ats_1addr.conf +++ b/src/transport/test_transport_ats_1addr.conf @@ -29,8 +29,8 @@ DEFAULTSERVICES = core [statistics] PORT = 2567 -[transport-tcp] -#DEBUG=YES + +[nat] DISABLEV6 = YES BINDTO = 127.0.0.1 BEHIND_NAT = NO diff --git a/src/transport/test_transport_ats_2addr.conf b/src/transport/test_transport_ats_2addr.conf index 36575e31b..9ec447c8a 100644 --- a/src/transport/test_transport_ats_2addr.conf +++ b/src/transport/test_transport_ats_2addr.conf @@ -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 diff --git a/src/transport/test_transport_ats_4addr.conf b/src/transport/test_transport_ats_4addr.conf index e96ac3c7c..31456a029 100644 --- a/src/transport/test_transport_ats_4addr.conf +++ b/src/transport/test_transport_ats_4addr.conf @@ -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