commit 600744b4be3d83a3e4924c8712bc30b7de1f4d3c Merge: 87c79cf 5f2a1a7 Author: Nick Mathewson nickm@torproject.org Date: Fri May 13 10:48:07 2011 -0400
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts: src/or/config.c src/or/dirserv.c src/or/or.h
changes/feature3076 | 14 +++++++ doc/tor.1.txt | 47 ++++++++++++++++------- src/common/address.c | 30 ++++++++++++++ src/common/address.h | 1 + src/or/config.c | 61 ++++++++++++++--------------- src/or/connection.c | 67 ++++++++++++++++++++++++-------- src/or/control.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/or/control.h | 2 + src/or/dirserv.c | 7 ++- src/or/main.c | 6 ++- src/or/or.h | 9 ++++ src/or/router.c | 38 ++++++++++++++++-- src/or/router.h | 3 + 13 files changed, 320 insertions(+), 70 deletions(-)
diff --cc doc/tor.1.txt index 3b31e60,d95d764..74458ab --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@@ -961,12 -959,12 +977,14 @@@ is non-zero) characters inclusive, and must contain only the characters [a-zA-Z0-9].
**NumCPUs** __num__:: - How many processes to use at once for decrypting onionskins. (Default: 1) + How many processes to use at once for decrypting onionskins and other + parallelizable operations. If this is set to 0, Tor will try to detect + how many CPUs you have, defaulting to 1 if it can't tell. (Default: 0)
- **ORPort** __PORT__:: - Advertise this port to listen for connections from Tor clients and servers. + **ORPort** __PORT__|**auto**:: + Advertise this port to listen for connections from Tor clients and + servers. This option is required to be a Tor server. + Set it to "auto" to have Tor pick a port for you. (Default: 0).
**ORListenAddress** __IP__[:__PORT__]:: Bind to this IP address to listen for connections from Tor clients and diff --cc src/or/config.c index d17ed24,a7ff28f..1a877b8 --- a/src/or/config.c +++ b/src/or/config.c @@@ -43,9 -43,9 +43,11 @@@ typedef enum config_type_t CONFIG_TYPE_STRING = 0, /**< An arbitrary string. */ CONFIG_TYPE_FILENAME, /**< A filename: some prefixes get expanded. */ CONFIG_TYPE_UINT, /**< A non-negative integer less than MAX_INT */ + CONFIG_TYPE_PORT, /**< A port from 1...65535, 0 for "not set", or + * "auto". */ CONFIG_TYPE_INTERVAL, /**< A number of seconds, with optional units*/ + CONFIG_TYPE_MSEC_INTERVAL,/**< A number of milliseconds, with optional + * units */ CONFIG_TYPE_MEMUNIT, /**< A number of bytes, with optional units*/ CONFIG_TYPE_DOUBLE, /**< A floating-point value */ CONFIG_TYPE_BOOL, /**< A boolean value, expressed as 0 or 1. */ @@@ -228,11 -226,10 +232,11 @@@ static config_var_t _option_vars[] = OBSOLETE("DirRecordUsageGranularity"), OBSOLETE("DirRecordUsageRetainIPs"), OBSOLETE("DirRecordUsageSaveInterval"), - V(DirReqStatistics, BOOL, "0"), + V(DirReqStatistics, BOOL, "1"), VAR("DirServer", LINELIST, DirServers, NULL), V(DisableAllSwap, BOOL, "0"), + V(DisableIOCP, BOOL, "1"), - V(DNSPort, UINT, "0"), + V(DNSPort, PORT, "0"), V(DNSListenAddress, LINELIST, NULL), V(DownloadExtraInfo, BOOL, "0"), V(EnforceDistinctSubnets, BOOL, "1"), @@@ -318,10 -313,10 +322,10 @@@ V(WarnUnsafeSocks, BOOL, "1"), OBSOLETE("NoPublish"), VAR("NodeFamily", LINELIST, NodeFamilies, NULL), - V(NumCPUs, UINT, "1"), + V(NumCPUs, UINT, "0"), V(NumEntryGuards, UINT, "3"), V(ORListenAddress, LINELIST, NULL), - V(ORPort, UINT, "0"), + V(ORPort, PORT, "0"), V(OutboundBindAddress, STRING, NULL), OBSOLETE("PathlenCoinWeight"), V(PerConnBWBurst, MEMUNIT, "0"), @@@ -2058,8 -2010,13 +2070,14 @@@ get_assigned_option(config_format_t *fm } escape_val = 0; /* Can't need escape. */ break; + case CONFIG_TYPE_PORT: + if (*(int*)value == CFG_AUTO_PORT) { + result->value = tor_strdup("auto"); + escape_val = 0; + break; + } case CONFIG_TYPE_INTERVAL: + case CONFIG_TYPE_MSEC_INTERVAL: case CONFIG_TYPE_UINT: /* This means every or_options_t uint or bool element * needs to be an int. Not, say, a uint16_t or char. */ @@@ -2295,8 -2244,8 +2313,9 @@@ option_clear(config_format_t *fmt, or_o *(time_t*)lvalue = 0; break; case CONFIG_TYPE_INTERVAL: + case CONFIG_TYPE_MSEC_INTERVAL: case CONFIG_TYPE_UINT: + case CONFIG_TYPE_PORT: case CONFIG_TYPE_BOOL: *(int*)lvalue = 0; break; @@@ -5415,8 -5236,8 +5413,9 @@@ getinfo_helper_config(control_connectio case CONFIG_TYPE_STRING: type = "String"; break; case CONFIG_TYPE_FILENAME: type = "Filename"; break; case CONFIG_TYPE_UINT: type = "Integer"; break; + case CONFIG_TYPE_PORT: type = "Port"; break; case CONFIG_TYPE_INTERVAL: type = "TimeInterval"; break; + case CONFIG_TYPE_MSEC_INTERVAL: type = "TimeMsecInterval"; break; case CONFIG_TYPE_MEMUNIT: type = "DataSize"; break; case CONFIG_TYPE_DOUBLE: type = "Float"; break; case CONFIG_TYPE_BOOL: type = "Boolean"; break; diff --cc src/or/connection.c index 20ab709,01b533d..099482b --- a/src/or/connection.c +++ b/src/or/connection.c @@@ -36,12 -36,8 +36,12 @@@ #include "router.h" #include "routerparse.h"
+#ifdef USE_BUFFEREVENTS +#include <event2/event.h> +#endif + static connection_t *connection_create_listener( - struct sockaddr *listensockaddr, + const struct sockaddr *listensockaddr, socklen_t listensocklen, int type, char* address); static void connection_init(time_t now, connection_t *conn, int type, diff --cc src/or/dirserv.c index d22ef3b,79b68cd..aa2e74b --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@@ -2829,7 -2806,7 +2829,8 @@@ generate_v2_networkstatus_opinion(void "dir-options%s%s%s%s\n" "%s" /* client version line, server version line. */ "dir-signing-key\n%s", - hostname, fmt_addr32(addr), (int)options->DirPort, - hostname, ipaddr, (int)router_get_advertised_dir_port(options), ++ hostname, fmt_addr32(addr), ++ (int)router_get_advertised_dir_port(options), fingerprint, contact, published, diff --cc src/or/or.h index f58876e,a73d98a..74b0244 --- a/src/or/or.h +++ b/src/or/or.h @@@ -3053,10 -2874,11 +3057,15 @@@ typedef struct * the defaults have changed. */ int _UsingTestNetworkDefaults;
+ /** If 1, we try to use microdescriptors to build circuits. If 0, we don't. + * If -1, Tor decides. */ + int UseMicrodescriptors; + + /** File where we should write the ControlPort. */ + char *ControlPortWriteToFile; + /** Should that file be group-readable? */ + int ControlPortFileGroupReadable; + } or_options_t;
/** Persistent state for an onion router, as saved to disk. */
tor-commits@lists.torproject.org