diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-09-30 16:22:39 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-09-30 16:22:39 -0400 |
commit | 495e630a498fc4121a9852cad100af41e708cd4c (patch) | |
tree | 7c5209ab9c5a6544b47ee081190262a86891c793 /src/or | |
parent | d39e46c26d6992dcd019fa159981c057c3d24716 (diff) | |
parent | 0e9d969bb2bb4bb9a5f7db1db824c729d7142cbc (diff) | |
download | tor-495e630a498fc4121a9852cad100af41e708cd4c.tar.gz tor-495e630a498fc4121a9852cad100af41e708cd4c.zip |
Merge branch 'tor-fw-squashed2'
Conflicts:
src/common/util.c
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/config.c | 2 | ||||
-rw-r--r-- | src/or/main.c | 12 | ||||
-rw-r--r-- | src/or/or.h | 4 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c index 23cad9268b..4f7077153d 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -317,6 +317,8 @@ static config_var_t _option_vars[] = { V(PerConnBWRate, MEMUNIT, "0"), V(PidFile, STRING, NULL), V(TestingTorNetwork, BOOL, "0"), + V(PortForwarding, BOOL, "0"), + V(PortForwardingHelper, FILENAME, "tor-fw-helper"), V(PreferTunneledDirConns, BOOL, "1"), V(ProtocolWarnings, BOOL, "0"), V(PublishServerDescriptor, CSV, "1"), diff --git a/src/or/main.c b/src/or/main.c index 23daf13661..ddd5da3643 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1026,6 +1026,7 @@ run_scheduled_events(time_t now) static time_t time_to_check_for_expired_networkstatus = 0; static time_t time_to_write_stats_files = 0; static time_t time_to_write_bridge_stats = 0; + static time_t time_to_check_port_forwarding = 0; static int should_init_bridge_stats = 1; static time_t time_to_retry_dns_init = 0; or_options_t *options = get_options(); @@ -1385,6 +1386,17 @@ run_scheduled_events(time_t now) #define BRIDGE_STATUSFILE_INTERVAL (30*60) time_to_write_bridge_status_file = now+BRIDGE_STATUSFILE_INTERVAL; } + + if (time_to_check_port_forwarding < now && + options->PortForwarding && + server_mode(options)) { +#define PORT_FORWARDING_CHECK_INTERVAL 5 + tor_check_port_forwarding(options->PortForwardingHelper, + options->DirPort, + options->ORPort, + now); + time_to_check_port_forwarding = now+PORT_FORWARDING_CHECK_INTERVAL; + } } /** Timer: used to invoke second_elapsed_callback() once per second. */ diff --git a/src/or/or.h b/src/or/or.h index 06845dd60d..673a3920cf 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2772,6 +2772,10 @@ typedef struct { * possible. */ int PreferTunneledDirConns; /**< If true, avoid dirservers that don't * support BEGIN_DIR, when possible. */ + int PortForwarding; /**< If true, use NAT-PMP or UPnP to automatically + * forward the DirPort and ORPort on the NAT device */ + char *PortForwardingHelper; /** < Filename or full path of the port + forwarding helper executable */ int AllowNonRFC953Hostnames; /**< If true, we allow connections to hostnames * with weird characters. */ /** If true, we try resolving hostnames with weird characters. */ |