From 4144b4552b00c25eba9be7a959aa75c1efbe4a18 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 29 Aug 2014 11:33:05 -0400 Subject: [PATCH 001/120] Always event_del() connection events before freeing them Previously, we had done this only in the connection_free() case, but when we called connection_free_() directly from connections_free_all(), we didn't free the connections. --- changes/bug12985 | 4 ++++ src/common/compat_libevent.c | 14 +++++++++++++- src/common/compat_libevent.h | 5 ++--- src/or/connection.c | 6 ++++-- 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 changes/bug12985 diff --git a/changes/bug12985 b/changes/bug12985 new file mode 100644 index 0000000000..dc14cdd375 --- /dev/null +++ b/changes/bug12985 @@ -0,0 +1,4 @@ + o Minor bugfixes (shutdown): + - When shutting down, always call event_del() on lingering read or + write events before freeing them. Fixes bug 12985; bugfix on + 0.1.0.2-rc. diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index 200a7c65fb..2a7386df4a 100644 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@ -144,13 +144,25 @@ tor_evsignal_new(struct event_base * base, int sig, { return tor_event_new(base, sig, EV_SIGNAL|EV_PERSIST, cb, arg); } -/** Work-alike replacement for event_free() on pre-Libevent-2.0 systems. */ +/** Work-alike replacement for event_free() on pre-Libevent-2.0 systems, + * except tolerate tor_event_free(NULL). */ void tor_event_free(struct event *ev) { + if (ev == NULL) + return; event_del(ev); tor_free(ev); } +#else +/* Wrapper for event_free() that tolerates tor_event_free(NULL) */ +void +tor_event_free(struct event *ev) +{ + if (ev == NULL) + return; + event_free(ev); +} #endif /** Global event base for use by the main thread. */ diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h index 2472e2c49e..ab7066beb2 100644 --- a/src/common/compat_libevent.h +++ b/src/common/compat_libevent.h @@ -28,11 +28,9 @@ void suppress_libevent_log_msg(const char *msg); #define tor_event_new event_new #define tor_evtimer_new evtimer_new #define tor_evsignal_new evsignal_new -#define tor_event_free event_free #define tor_evdns_add_server_port(sock, tcp, cb, data) \ evdns_add_server_port_with_base(tor_libevent_get_base(), \ (sock),(tcp),(cb),(data)); - #else struct event *tor_event_new(struct event_base * base, evutil_socket_t sock, short what, void (*cb)(evutil_socket_t, short, void *), void *arg); @@ -40,10 +38,11 @@ struct event *tor_evtimer_new(struct event_base * base, void (*cb)(evutil_socket_t, short, void *), void *arg); struct event *tor_evsignal_new(struct event_base * base, int sig, void (*cb)(evutil_socket_t, short, void *), void *arg); -void tor_event_free(struct event *ev); #define tor_evdns_add_server_port evdns_add_server_port #endif +void tor_event_free(struct event *ev); + typedef struct periodic_timer_t periodic_timer_t; periodic_timer_t *periodic_timer_new(struct event_base *base, diff --git a/src/or/connection.c b/src/or/connection.c index 4f74a1d04b..6d205d143c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -553,8 +553,10 @@ connection_free_(connection_t *conn) tor_free(control_conn->incoming_cmd); } - tor_free(conn->read_event); /* Probably already freed by connection_free. */ - tor_free(conn->write_event); /* Probably already freed by connection_free. */ + /* Probably already freed by connection_free. */ + tor_event_free(conn->read_event); + tor_event_free(conn->write_event); + conn->read_event = conn->write_event = NULL; IF_HAS_BUFFEREVENT(conn, { /* This was a workaround to handle bugs in some old versions of libevent * where callbacks can occur after calling bufferevent_free(). Setting From b82e166bec5fcc468424af1ff71e2e753ac534a2 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 29 Aug 2014 12:21:57 -0400 Subject: [PATCH 002/120] restore the sensible part of ac268a83408e1450544db2f23f364dfa3 We don't want to call event_del() postfork, if cpuworkers are multiprocess. --- src/or/connection.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/or/connection.c b/src/or/connection.c index 6d205d143c..aedb29d4e4 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -553,10 +553,17 @@ connection_free_(connection_t *conn) tor_free(control_conn->incoming_cmd); } +#ifdef TOR_IS_MULTITHREADED /* Probably already freed by connection_free. */ + /* We don't do these frees on the multiprocess case, since in that case we + * don't want to call event_del() postfork or it's likely to mess up. + * Multiprocess builds are deprecated, so let's just have a one-time memory + * leak here. + */ tor_event_free(conn->read_event); tor_event_free(conn->write_event); conn->read_event = conn->write_event = NULL; +#endif IF_HAS_BUFFEREVENT(conn, { /* This was a workaround to handle bugs in some old versions of libevent * where callbacks can occur after calling bufferevent_free(). Setting From d8fe499e08cf6c04fd6bf6230c916dcedf17dc80 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 29 Aug 2014 12:25:05 -0400 Subject: [PATCH 003/120] Revert "restore the sensible part of ac268a83408e1450544db2f23f364dfa3" This reverts commit b82e166bec5fcc468424af1ff71e2e753ac534a2. We don't need that part in 0.2.5, since 0.2.5 no longer supports non-multithreaded builds. --- src/or/connection.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index bcb17376c0..36200e57ea 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -575,17 +575,10 @@ connection_free_(connection_t *conn) tor_free(control_conn->incoming_cmd); } -#ifdef TOR_IS_MULTITHREADED /* Probably already freed by connection_free. */ - /* We don't do these frees on the multiprocess case, since in that case we - * don't want to call event_del() postfork or it's likely to mess up. - * Multiprocess builds are deprecated, so let's just have a one-time memory - * leak here. - */ tor_event_free(conn->read_event); tor_event_free(conn->write_event); conn->read_event = conn->write_event = NULL; -#endif IF_HAS_BUFFEREVENT(conn, { /* This was a workaround to handle bugs in some old versions of libevent * where callbacks can occur after calling bufferevent_free(). Setting From fc62721b06e3ac231b570741e21dba03b5cadaca Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 5 Nov 2014 13:28:29 -0500 Subject: [PATCH 004/120] Fix version number parsing to allow 2- and 3-part versions. Fixes bug 13661; bugfix on 0.0.8pre1. --- changes/bug13661 | 6 +++++ src/or/routerparse.c | 58 ++++++++++++++++++++++++++------------------ src/test/test_dir.c | 36 +++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 24 deletions(-) create mode 100644 changes/bug13661 diff --git a/changes/bug13661 b/changes/bug13661 new file mode 100644 index 0000000000..7f0cb5e706 --- /dev/null +++ b/changes/bug13661 @@ -0,0 +1,6 @@ + o Minor bugfixes: + + - Support two-number and three-number version numbers correctly, in + case we change the Tor versioning system in the future. Fixes bug + 13661; bugfix on 0.0.8pre1. + diff --git a/src/or/routerparse.c b/src/or/routerparse.c index f990cebd82..68dbc707a8 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -4207,40 +4207,50 @@ tor_version_parse(const char *s, tor_version_t *out) char *eos=NULL; const char *cp=NULL; /* Format is: - * "Tor " ? NUM dot NUM dot NUM [ ( pre | rc | dot ) NUM [ - tag ] ] + * "Tor " ? NUM dot NUM [ dot NUM [ ( pre | rc | dot ) NUM ] ] [ - tag ] */ tor_assert(s); tor_assert(out); memset(out, 0, sizeof(tor_version_t)); - + out->status = VER_RELEASE; if (!strcasecmpstart(s, "Tor ")) s += 4; - /* Get major. */ - out->major = (int)strtol(s,&eos,10); - if (!eos || eos==s || *eos != '.') return -1; - cp = eos+1; + cp = s; - /* Get minor */ - out->minor = (int) strtol(cp,&eos,10); - if (!eos || eos==cp || *eos != '.') return -1; - cp = eos+1; +#define NUMBER(m) \ + do { \ + out->m = (int)strtol(cp, &eos, 10); \ + if (!eos || eos == cp) \ + return -1; \ + cp = eos; \ + } while (0) - /* Get micro */ - out->micro = (int) strtol(cp,&eos,10); - if (!eos || eos==cp) return -1; - if (!*eos) { - out->status = VER_RELEASE; - out->patchlevel = 0; +#define DOT() \ + do { \ + if (*cp != '.') \ + return -1; \ + ++cp; \ + } while (0) + + NUMBER(major); + DOT(); + NUMBER(minor); + if (*cp == 0) return 0; - } - cp = eos; + else if (*cp == '-') + goto status_tag; + DOT(); + NUMBER(micro); /* Get status */ - if (*cp == '.') { - out->status = VER_RELEASE; + if (*cp == 0) { + return 0; + } else if (*cp == '.') { ++cp; + } else if (*cp == '-') { + goto status_tag; } else if (0==strncmp(cp, "pre", 3)) { out->status = VER_PRE; cp += 3; @@ -4251,11 +4261,9 @@ tor_version_parse(const char *s, tor_version_t *out) return -1; } - /* Get patchlevel */ - out->patchlevel = (int) strtol(cp,&eos,10); - if (!eos || eos==cp) return -1; - cp = eos; + NUMBER(patchlevel); + status_tag: /* Get status tag. */ if (*cp == '-' || *cp == '.') ++cp; @@ -4291,6 +4299,8 @@ tor_version_parse(const char *s, tor_version_t *out) } return 0; +#undef NUMBER +#undef DOT } /** Compare two tor versions; Return <0 if a < b; 0 if a ==b, >0 if a > diff --git a/src/test/test_dir.c b/src/test/test_dir.c index c03b63be27..61484f5fe1 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -337,6 +337,42 @@ test_dir_versions(void) test_eq(VER_RELEASE, ver1.status); test_streq("", ver1.status_tag); + test_eq(0, tor_version_parse("10.1", &ver1)); + test_eq(10, ver1.major); + test_eq(1, ver1.minor); + test_eq(0, ver1.micro); + test_eq(0, ver1.patchlevel); + test_eq(VER_RELEASE, ver1.status); + test_streq("", ver1.status_tag); + test_eq(0, tor_version_parse("5.99.999", &ver1)); + test_eq(5, ver1.major); + test_eq(99, ver1.minor); + test_eq(999, ver1.micro); + test_eq(0, ver1.patchlevel); + test_eq(VER_RELEASE, ver1.status); + test_streq("", ver1.status_tag); + test_eq(0, tor_version_parse("10.1-alpha", &ver1)); + test_eq(10, ver1.major); + test_eq(1, ver1.minor); + test_eq(0, ver1.micro); + test_eq(0, ver1.patchlevel); + test_eq(VER_RELEASE, ver1.status); + test_streq("alpha", ver1.status_tag); + test_eq(0, tor_version_parse("2.1.700-alpha", &ver1)); + test_eq(2, ver1.major); + test_eq(1, ver1.minor); + test_eq(700, ver1.micro); + test_eq(0, ver1.patchlevel); + test_eq(VER_RELEASE, ver1.status); + test_streq("alpha", ver1.status_tag); + test_eq(0, tor_version_parse("1.6.8-alpha-dev", &ver1)); + test_eq(1, ver1.major); + test_eq(6, ver1.minor); + test_eq(8, ver1.micro); + test_eq(0, ver1.patchlevel); + test_eq(VER_RELEASE, ver1.status); + test_streq("alpha-dev", ver1.status_tag); + #define tt_versionstatus_op(vs1, op, vs2) \ tt_assert_test_type(vs1,vs2,#vs1" "#op" "#vs2,version_status_t, \ (val1_ op val2_),"%d",TT_EXIT_TEST_FUNCTION) From 734ba5cb0a0b6cc5376f8889305835224d814252 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 17 Nov 2014 11:43:50 -0500 Subject: [PATCH 005/120] Use smaller zlib objects when under memory pressure We add a compression level argument to tor_zlib_new, and use it to determine how much memory to allocate for the zlib object. We use the existing level by default, but shift to smaller levels for small requests when we have been over 3/4 of our memory usage in the past half-hour. Closes ticket 11791. --- changes/bug11791 | 4 ++++ src/common/torgzip.c | 50 ++++++++++++++++++++++++++++++++--------- src/common/torgzip.h | 12 +++++++++- src/or/config.c | 1 + src/or/directory.c | 33 ++++++++++++++++++++++----- src/or/dirserv.c | 2 +- src/or/or.h | 2 ++ src/or/relay.c | 24 +++++++++++++++++--- src/or/relay.h | 2 ++ src/test/test_buffers.c | 4 ++-- src/test/test_util.c | 2 +- 11 files changed, 112 insertions(+), 24 deletions(-) create mode 100644 changes/bug11791 diff --git a/changes/bug11791 b/changes/bug11791 new file mode 100644 index 0000000000..51a932743b --- /dev/null +++ b/changes/bug11791 @@ -0,0 +1,4 @@ + o Minor features (directory, memory usage): + - When we have recently been under memory pressure (over 3/4 of + MaxMemInQueues is allocated), then allocate smaller zlib objects for + small requests. Closes ticket 11791. diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 4480e4b747..05a450e3fb 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -92,10 +92,27 @@ tor_zlib_get_header_version_str(void) /** Return the 'bits' value to tell zlib to use method.*/ static INLINE int -method_bits(compress_method_t method) +method_bits(compress_method_t method, zlib_compression_level_t level) { /* Bits+16 means "use gzip" in zlib >= 1.2 */ - return method == GZIP_METHOD ? 15+16 : 15; + const int flag = method == GZIP_METHOD ? 16 : 0; + switch (level) { + default: + case HIGH_COMPRESSION: return flag + 15; + case MEDIUM_COMPRESSION: return flag + 13; + case LOW_COMPRESSION: return flag + 11; + } +} + +static INLINE int +get_memlevel(zlib_compression_level_t level) +{ + switch (level) { + default: + case HIGH_COMPRESSION: return 8; + case MEDIUM_COMPRESSION: return 7; + case LOW_COMPRESSION: return 6; + } } /** @{ */ @@ -162,8 +179,9 @@ tor_gzip_compress(char **out, size_t *out_len, stream->avail_in = (unsigned int)in_len; if (deflateInit2(stream, Z_BEST_COMPRESSION, Z_DEFLATED, - method_bits(method), - 8, Z_DEFAULT_STRATEGY) != Z_OK) { + method_bits(method, HIGH_COMPRESSION), + get_memlevel(HIGH_COMPRESSION), + Z_DEFAULT_STRATEGY) != Z_OK) { log_warn(LD_GENERAL, "Error from deflateInit2: %s", stream->msg?stream->msg:""); goto err; @@ -289,7 +307,7 @@ tor_gzip_uncompress(char **out, size_t *out_len, stream->avail_in = (unsigned int)in_len; if (inflateInit2(stream, - method_bits(method)) != Z_OK) { + method_bits(method, HIGH_COMPRESSION)) != Z_OK) { log_warn(LD_GENERAL, "Error from inflateInit2: %s", stream->msg?stream->msg:""); goto err; @@ -315,7 +333,8 @@ tor_gzip_uncompress(char **out, size_t *out_len, log_warn(LD_BUG, "Error freeing gzip structures"); goto err; } - if (inflateInit2(stream, method_bits(method)) != Z_OK) { + if (inflateInit2(stream, + method_bits(method,HIGH_COMPRESSION)) != Z_OK) { log_warn(LD_GENERAL, "Error from second inflateInit2: %s", stream->msg?stream->msg:""); goto err; @@ -426,10 +445,11 @@ struct tor_zlib_state_t { * compress, it's for compression; otherwise it's for * decompression. */ tor_zlib_state_t * -tor_zlib_new(int compress, compress_method_t method) +tor_zlib_new(int compress, compress_method_t method, + zlib_compression_level_t compression_level) { tor_zlib_state_t *out; - int bits; + int bits, memlevel; if (method == GZIP_METHOD && !is_gzip_supported()) { /* Old zlib version don't support gzip in inflateInit2 */ @@ -437,21 +457,29 @@ tor_zlib_new(int compress, compress_method_t method) return NULL; } + if (! compress) { + /* use this setting for decompression, since we might have the + * max number of window bits */ + compression_level = HIGH_COMPRESSION; + } + out = tor_malloc_zero(sizeof(tor_zlib_state_t)); out->stream.zalloc = Z_NULL; out->stream.zfree = Z_NULL; out->stream.opaque = NULL; out->compress = compress; - bits = method_bits(method); + bits = method_bits(method, compression_level); + memlevel = get_memlevel(compression_level); if (compress) { if (deflateInit2(&out->stream, Z_BEST_COMPRESSION, Z_DEFLATED, - bits, 8, Z_DEFAULT_STRATEGY) != Z_OK) + bits, memlevel, + Z_DEFAULT_STRATEGY) != Z_OK) goto err; } else { if (inflateInit2(&out->stream, bits) != Z_OK) goto err; } - out->allocation = tor_zlib_state_size_precalc(!compress, bits, 8); + out->allocation = tor_zlib_state_size_precalc(!compress, bits, memlevel); total_zlib_allocation += out->allocation; diff --git a/src/common/torgzip.h b/src/common/torgzip.h index 1378d55b76..eaba2712bb 100644 --- a/src/common/torgzip.h +++ b/src/common/torgzip.h @@ -19,6 +19,15 @@ typedef enum { NO_METHOD=0, GZIP_METHOD=1, ZLIB_METHOD=2, UNKNOWN_METHOD=3 } compress_method_t; +/** + * Enumeration to define tradeoffs between memory usage and compression level. + * HIGH_COMPRESSION saves the most bandwidth; LOW_COMPRESSION saves the most + * memory. + **/ +typedef enum { + HIGH_COMPRESSION, MEDIUM_COMPRESSION, LOW_COMPRESSION +} zlib_compression_level_t; + int tor_gzip_compress(char **out, size_t *out_len, const char *in, size_t in_len, @@ -47,7 +56,8 @@ typedef enum { } tor_zlib_output_t; /** Internal state for an incremental zlib compression/decompression. */ typedef struct tor_zlib_state_t tor_zlib_state_t; -tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method); +tor_zlib_state_t *tor_zlib_new(int compress, compress_method_t method, + zlib_compression_level_t level); tor_zlib_output_t tor_zlib_process(tor_zlib_state_t *state, char **out, size_t *out_len, diff --git a/src/or/config.c b/src/or/config.c index 4b8c6834e9..d33829a03f 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2828,6 +2828,7 @@ options_validate(or_options_t *old_options, or_options_t *options, options->MaxMemInQueues = compute_real_max_mem_in_queues(options->MaxMemInQueues_raw, server_mode(options)); + options->MaxMemInQueues_low_threshold = (options->MaxMemInQueues / 4) * 3; options->AllowInvalid_ = 0; diff --git a/src/or/directory.c b/src/or/directory.c index e1f5964e1e..0ab3e6ae23 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -20,6 +20,7 @@ #include "networkstatus.h" #include "nodelist.h" #include "policies.h" +#include "relay.h" #include "rendclient.h" #include "rendcommon.h" #include "rephist.h" @@ -2521,6 +2522,24 @@ client_likes_consensus(networkstatus_t *v, const char *want_url) return (have >= need_at_least); } +/** Return the compression level we should use for sending a compressed + * response of size n_bytes. */ +static zlib_compression_level_t +choose_compression_level(ssize_t n_bytes) +{ + if (! have_been_under_memory_pressure()) { + return HIGH_COMPRESSION; /* we have plenty of RAM. */ + } else if (n_bytes < 0) { + return HIGH_COMPRESSION; /* unknown; might be big. */ + } else if (n_bytes < 1024) { + return LOW_COMPRESSION; + } else if (n_bytes < 2048) { + return MEDIUM_COMPRESSION; + } else { + return HIGH_COMPRESSION; + } +} + /** Helper function: called when a dirserver gets a complete HTTP GET * request. Look for a request for a directory or for a rendezvous * service descriptor. On finding one, write a response into @@ -2703,7 +2722,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, smartlist_len(dir_fps) == 1 ? lifetime : 0); conn->fingerprint_stack = dir_fps; if (! compressed) - conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD, HIGH_COMPRESSION); /* Prime the connection with some data. */ conn->dir_spool_src = DIR_SPOOL_NETWORKSTATUS; @@ -2791,7 +2810,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, if (smartlist_len(items)) { if (compressed) { - conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD, + choose_compression_level(estimated_len)); SMARTLIST_FOREACH(items, const char *, c, connection_write_to_buf_zlib(c, strlen(c), conn, 0)); connection_write_to_buf_zlib("", 0, conn, 1); @@ -2840,7 +2860,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, conn->fingerprint_stack = fps; if (compressed) - conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD, + choose_compression_level(dlen)); connection_dirserv_flushed_some(conn); goto done; @@ -2908,7 +2929,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, } write_http_response_header(conn, -1, compressed, cache_lifetime); if (compressed) - conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD, + choose_compression_level(dlen)); /* Prime the connection with some data. */ connection_dirserv_flushed_some(conn); } @@ -2983,7 +3005,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, write_http_response_header(conn, compressed?-1:len, compressed, 60*60); if (compressed) { - conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(1, ZLIB_METHOD, + choose_compression_level(len)); SMARTLIST_FOREACH(certs, authority_cert_t *, c, connection_write_to_buf_zlib(c->cache_info.signed_descriptor_body, c->cache_info.signed_descriptor_len, diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d31bb72361..635d691afb 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -3182,7 +3182,7 @@ connection_dirserv_add_networkstatus_bytes_to_outbuf(dir_connection_t *conn) if (uncompressing && ! conn->zlib_state && conn->fingerprint_stack && smartlist_len(conn->fingerprint_stack)) { - conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD); + conn->zlib_state = tor_zlib_new(0, ZLIB_METHOD, HIGH_COMPRESSION); } } if (r) return r; diff --git a/src/or/or.h b/src/or/or.h index 5ebe7bfac3..a9371f5768 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3514,6 +3514,8 @@ typedef struct { uint64_t MaxMemInQueues_raw; uint64_t MaxMemInQueues;/**< If we have more memory than this allocated * for queues and buffers, run the OOM handler */ + /** Above this value, consider ourselves low on RAM. */ + uint64_t MaxMemInQueues_low_threshold; /** @name port booleans * diff --git a/src/or/relay.c b/src/or/relay.c index 05c7b3c955..a899fc09cb 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -2432,6 +2432,12 @@ cell_queues_get_total_allocation(void) return total_cells_allocated * packed_cell_mem_cost(); } +/** How long after we've been low on memory should we try to conserve it? */ +#define MEMORY_PRESSURE_INTERVAL (30*60) + +/** The time at which we were last low on memory. */ +static time_t last_time_under_memory_pressure = 0; + /** Check whether we've got too much space used for cells. If so, * call the OOM handler and return 1. Otherwise, return 0. */ STATIC int @@ -2440,13 +2446,25 @@ cell_queues_check_size(void) size_t alloc = cell_queues_get_total_allocation(); alloc += buf_get_total_allocation(); alloc += tor_zlib_get_total_allocation(); - if (alloc >= get_options()->MaxMemInQueues) { - circuits_handle_oom(alloc); - return 1; + if (alloc >= get_options()->MaxMemInQueues_low_threshold) { + last_time_under_memory_pressure = approx_time(); + if (alloc >= get_options()->MaxMemInQueues) { + circuits_handle_oom(alloc); + return 1; + } } return 0; } +/** Return true if we've been under memory pressure in the last + * MEMORY_PRESSURE_INTERVAL seconds. */ +int +have_been_under_memory_pressure(void) +{ + return last_time_under_memory_pressure + MEMORY_PRESSURE_INTERVAL + < approx_time(); +} + /** * Update the number of cells available on the circuit's n_chan or p_chan's * circuit mux. diff --git a/src/or/relay.h b/src/or/relay.h index 73c399154d..3bc668374f 100644 --- a/src/or/relay.h +++ b/src/or/relay.h @@ -50,6 +50,8 @@ void clean_cell_pool(void); void dump_cell_pool_usage(int severity); size_t packed_cell_mem_cost(void); +int have_been_under_memory_pressure(void); + /* For channeltls.c */ void packed_cell_free(packed_cell_t *cell); diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c index cb29ab0a9e..e24aa8ec86 100644 --- a/src/test/test_buffers.c +++ b/src/test/test_buffers.c @@ -611,7 +611,7 @@ test_buffers_zlib_impl(int finalize_with_nil) int done; buf = buf_new_with_capacity(128); /* will round up */ - zlib_state = tor_zlib_new(1, ZLIB_METHOD); + zlib_state = tor_zlib_new(1, ZLIB_METHOD, HIGH_COMPRESSION); msg = tor_malloc(512); crypto_rand(msg, 512); @@ -688,7 +688,7 @@ test_buffers_zlib_fin_at_chunk_end(void *arg) tt_uint_op(buf->head->datalen, OP_EQ, headerjunk); tt_uint_op(buf_datalen(buf), OP_EQ, headerjunk); /* Write an empty string, with finalization on. */ - zlib_state = tor_zlib_new(1, ZLIB_METHOD); + zlib_state = tor_zlib_new(1, ZLIB_METHOD, HIGH_COMPRESSION); tt_int_op(write_to_buf_zlib(buf, zlib_state, "", 0, 1), OP_EQ, 0); in_len = buf_datalen(buf); diff --git a/src/test/test_util.c b/src/test/test_util.c index b952bb2596..3fbe465ece 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1820,7 +1820,7 @@ test_util_gzip(void *arg) tor_free(buf1); tor_free(buf2); tor_free(buf3); - state = tor_zlib_new(1, ZLIB_METHOD); + state = tor_zlib_new(1, ZLIB_METHOD, HIGH_COMPRESSION); tt_assert(state); cp1 = buf1 = tor_malloc(1024); len1 = 1024; From 447ece46f5705770df05bd28e27765dde50063de Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Mon, 1 Dec 2014 16:12:05 +0000 Subject: [PATCH 006/120] Constify crypto_pk_get_digest(). --- src/common/crypto.c | 2 +- src/common/crypto.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/crypto.c b/src/common/crypto.c index 7138ba003e..713e588412 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1293,7 +1293,7 @@ crypto_pk_asn1_decode(const char *str, size_t len) * Return 0 on success, -1 on failure. */ int -crypto_pk_get_digest(crypto_pk_t *pk, char *digest_out) +crypto_pk_get_digest(const crypto_pk_t *pk, char *digest_out) { unsigned char *buf = NULL; int len; diff --git a/src/common/crypto.h b/src/common/crypto.h index d496521849..a8f0fbc975 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -180,7 +180,7 @@ int crypto_pk_private_hybrid_decrypt(crypto_pk_t *env, char *to, int crypto_pk_asn1_encode(crypto_pk_t *pk, char *dest, size_t dest_len); crypto_pk_t *crypto_pk_asn1_decode(const char *str, size_t len); -int crypto_pk_get_digest(crypto_pk_t *pk, char *digest_out); +int crypto_pk_get_digest(const crypto_pk_t *pk, char *digest_out); int crypto_pk_get_all_digests(crypto_pk_t *pk, digests_t *digests_out); int crypto_pk_get_fingerprint(crypto_pk_t *pk, char *fp_out,int add_space); int crypto_pk_get_hashed_fingerprint(crypto_pk_t *pk, char *fp_out); From 7cd53b75c10831e01e288b01f63cab069d3e3035 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Mon, 8 Dec 2014 15:00:58 +0100 Subject: [PATCH 007/120] Add better support to obfuscate statistics. --- src/common/util.c | 45 +++++++++++++++++++++++++++++++++++++ src/common/util.h | 4 ++++ src/test/test_util.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) diff --git a/src/common/util.c b/src/common/util.c index 50097dac93..c52b279f1c 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -513,6 +513,51 @@ round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor) return number; } +/** Return the lowest x in [INT64_MIN, INT64_MAX] such that x is at least + * number, and x modulo divisor == 0. */ +int64_t +round_int64_to_next_multiple_of(int64_t number, int64_t divisor) +{ + tor_assert(divisor > 0); + if (number >= 0 && INT64_MAX - divisor + 1 >= number) + number += divisor - 1; + number -= number % divisor; + return number; +} + +/** Transform a random value p from the uniform distribution in + * [0.0, 1.0[ into a Laplace distributed value with location parameter + * mu and scale parameter b in [-Inf, Inf[. */ +double +sample_laplace_distribution(double mu, double b, double p) +{ + tor_assert(p >= 0.0 && p < 1.0); + /* This is the "inverse cumulative distribution function" from: + * http://en.wikipedia.org/wiki/Laplace_distribution */ + return mu - b * (p > 0.5 ? 1.0 : -1.0) + * tor_mathlog(1.0 - 2.0 * fabs(p - 0.5)); +} + +/** Add random noise between INT64_MIN and INT64_MAX coming from a + * Laplace distribution with mu = 0 and b = delta_f/epsilon + * to signal based on the provided random value in + * [0.0, 1.0[. */ +int64_t +add_laplace_noise(int64_t signal, double random, double delta_f, + double epsilon) +{ + /* cast to int64_t intended */ + int64_t noise = sample_laplace_distribution( + 0.0, /* just add noise, no further signal */ + delta_f / epsilon, random); + if (noise > 0 && INT64_MAX - noise < signal) + return INT64_MAX; + else if (noise < 0 && INT64_MIN - noise > signal) + return INT64_MIN; + else + return signal + noise; +} + /** Return the number of bits set in v. */ int n_bits_set_u8(uint8_t v) diff --git a/src/common/util.h b/src/common/util.h index 921dd79da0..b8fd20fd7d 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -172,6 +172,10 @@ uint64_t round_to_power_of_2(uint64_t u64); unsigned round_to_next_multiple_of(unsigned number, unsigned divisor); uint32_t round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor); uint64_t round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor); +int64_t round_int64_to_next_multiple_of(int64_t number, int64_t divisor); +double sample_laplace_distribution(double mu, double b, double p); +int64_t add_laplace_noise(int64_t signal, double random, double delta_f, + double epsilon); int n_bits_set_u8(uint8_t v); /* Compute the CEIL of a divided by b, for nonnegative a diff --git a/src/test/test_util.c b/src/test/test_util.c index b952bb2596..6e73ccf51e 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -4619,6 +4619,58 @@ test_util_round_to_next_multiple_of(void *arg) tt_assert(round_uint64_to_next_multiple_of(99,7) == 105); tt_assert(round_uint64_to_next_multiple_of(99,9) == 99); + tt_assert(round_int64_to_next_multiple_of(0,1) == 0); + tt_assert(round_int64_to_next_multiple_of(0,7) == 0); + + tt_assert(round_int64_to_next_multiple_of(99,1) == 99); + tt_assert(round_int64_to_next_multiple_of(99,7) == 105); + tt_assert(round_int64_to_next_multiple_of(99,9) == 99); + + tt_assert(round_int64_to_next_multiple_of(-99,1) == -99); + tt_assert(round_int64_to_next_multiple_of(-99,7) == -98); + tt_assert(round_int64_to_next_multiple_of(-99,9) == -99); + + tt_assert(round_int64_to_next_multiple_of(INT64_MIN,2) == INT64_MIN); + tt_assert(round_int64_to_next_multiple_of(INT64_MAX,2) == + INT64_MAX-INT64_MAX%2); + done: + ; +} + +static void +test_util_laplace(void *arg) +{ + /* Sample values produced using Python's SciPy: + * + * >>> from scipy.stats import laplace + * >>> laplace.ppf([-0.01, 0.0, 0.01, 0.5, 0.51, 0.99, 1.0, 1.01], + ... loc = 24, scale = 24) + * array([ nan, -inf, -69.88855213, 24. , + * 24.48486498, 117.88855213, inf, nan]) + */ + const double mu = 24.0, b = 24.0; + const double delta_f = 15.0, epsilon = 0.3; /* b = 15.0 / 0.3 = 50.0 */ + (void)arg; + + tt_assert(isinf(sample_laplace_distribution(mu, b, 0.0))); + test_feq(-69.88855213, sample_laplace_distribution(mu, b, 0.01)); + test_feq(24.0, sample_laplace_distribution(mu, b, 0.5)); + test_feq(24.48486498, sample_laplace_distribution(mu, b, 0.51)); + test_feq(117.88855213, sample_laplace_distribution(mu, b, 0.99)); + + /* >>> laplace.ppf([0.0, 0.1, 0.25, 0.5, 0.75, 0.9, 0.99], + * ... loc = 0, scale = 50) + * array([ -inf, -80.47189562, -34.65735903, 0. , + * 34.65735903, 80.47189562, 195.60115027]) + */ + tt_assert(LONG_MIN + 20 == + add_laplace_noise(20, 0.0, delta_f, epsilon)); + tt_assert(-60 == add_laplace_noise(20, 0.1, delta_f, epsilon)); + tt_assert(-14 == add_laplace_noise(20, 0.25, delta_f, epsilon)); + tt_assert(20 == add_laplace_noise(20, 0.5, delta_f, epsilon)); + tt_assert(54 == add_laplace_noise(20, 0.75, delta_f, epsilon)); + tt_assert(100 == add_laplace_noise(20, 0.9, delta_f, epsilon)); + tt_assert(215 == add_laplace_noise(20, 0.99, delta_f, epsilon)); done: ; } @@ -4880,6 +4932,7 @@ struct testcase_t util_tests[] = { UTIL_LEGACY(strtok), UTIL_LEGACY(di_ops), UTIL_TEST(round_to_next_multiple_of, 0), + UTIL_TEST(laplace, 0), UTIL_TEST(strclear, 0), UTIL_TEST(find_str_at_start_of_line, 0), UTIL_TEST(string_is_C_identifier, 0), From 3d83907ab168dd4b8cfc0919dbbbd188f02dca6b Mon Sep 17 00:00:00 2001 From: David Goulet Date: Wed, 10 Dec 2014 13:05:41 -0500 Subject: [PATCH 008/120] Fix: call circuit_has_opened() for rendezvous circuit In circuit_get_open_circ_or_launch(), for a rendezvous circuit, rend_client_rendcirc_has_opened() but circuit_has_opened() is preferred here since it will call the right function for a specific circuit purpose. Furthermore, a controller event is triggered where the former did not. Signed-off-by: David Goulet --- changes/bug13936 | 6 ++++++ src/or/circuituse.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changes/bug13936 diff --git a/changes/bug13936 b/changes/bug13936 new file mode 100644 index 0000000000..75dc9cd437 --- /dev/null +++ b/changes/bug13936 @@ -0,0 +1,6 @@ + o Minor bugfixes: + - Use circuit_has_opened() instead of rend_client_rendcirc_has_opened() + when a rendezvous circuit is opened because circuit_has_opened() jobs + is to call a specialized function depending on the circuit purpose. + Furthermore, a controller event will be triggered here where the + former did not. diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 714754a672..071aac902b 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -2016,7 +2016,7 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn, circ->rend_data = rend_data_dup(ENTRY_TO_EDGE_CONN(conn)->rend_data); if (circ->base_.purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND && circ->base_.state == CIRCUIT_STATE_OPEN) - rend_client_rendcirc_has_opened(circ); + circuit_has_opened(circ); } } } /* endif (!circ) */ From 14e83e626be84c4f311b8e8f0d80ca141675fa9e Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Tue, 2 Dec 2014 12:20:35 +0000 Subject: [PATCH 009/120] Add two hidden-service related statistics. The two statistics are: 1. number of RELAY cells observed on successfully established rendezvous circuits; and 2. number of .onion addresses observed as hidden-service directory. Both statistics are accumulated over 24 hours, obfuscated by rounding up to the next multiple of a given number and adding random noise, and written to local file stats/hidserv-stats. Notably, no statistics will be gathered on clients or services, but only on relays. --- doc/tor.1.txt | 5 + src/or/command.c | 9 ++ src/or/config.c | 13 +++ src/or/main.c | 5 + src/or/or.h | 8 ++ src/or/rendcommon.c | 7 ++ src/or/rendmid.c | 7 ++ src/or/rephist.c | 216 ++++++++++++++++++++++++++++++++++++++++++++ src/or/rephist.h | 7 ++ src/or/router.c | 5 + 10 files changed, 282 insertions(+) diff --git a/doc/tor.1.txt b/doc/tor.1.txt index e876829cf6..b09f322d3d 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -1764,6 +1764,11 @@ is non-zero): When this option is enabled, Tor writes statistics on the bidirectional use of connections to disk every 24 hours. (Default: 0) +[[HiddenServiceStatistics]] **HiddenServiceStatistics** **0**|**1**:: + When this option is enabled, a Tor relay writes statistics on its role as + hidden-service directory, introduction point, or rendezvous point to disk + every 24 hours. (Default: 0) + [[ExtraInfoStatistics]] **ExtraInfoStatistics** **0**|**1**:: When this option is enabled, Tor includes previously gathered statistics in its extra-info documents that it uploads to the directory authorities. diff --git a/src/or/command.c b/src/or/command.c index 268c495371..8e214bf0a4 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -438,6 +438,7 @@ command_process_created_cell(cell_t *cell, channel_t *chan) static void command_process_relay_cell(cell_t *cell, channel_t *chan) { + const or_options_t *options = get_options(); circuit_t *circ; int reason, direction; @@ -511,6 +512,14 @@ command_process_relay_cell(cell_t *cell, channel_t *chan) direction==CELL_DIRECTION_OUT?"forward":"backward"); circuit_mark_for_close(circ, -reason); } + + /* If this is a cell in an RP circuit, count it as part of the + hidden service stats */ + if (options->HiddenServiceStatistics && + !CIRCUIT_IS_ORIGIN(circ) && + TO_OR_CIRCUIT(circ)->circuit_carries_hs_traffic_stats) { + rep_hist_seen_new_rp_cell(); + } } /** Process a 'destroy' cell that just arrived from diff --git a/src/or/config.c b/src/or/config.c index 28f1df0663..9a6f952a13 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -268,6 +268,7 @@ static config_var_t option_vars_[] = { VAR("HiddenServicePort", LINELIST_S, RendConfigLines, NULL), VAR("HiddenServiceVersion",LINELIST_S, RendConfigLines, NULL), VAR("HiddenServiceAuthorizeClient",LINELIST_S,RendConfigLines, NULL), + V(HiddenServiceStatistics, BOOL, "0"), V(HidServAuth, LINELIST, NULL), V(CloseHSClientCircuitsImmediatelyOnTimeout, BOOL, "0"), V(CloseHSServiceRendCircuitsImmediatelyOnTimeout, BOOL, "0"), @@ -1714,6 +1715,7 @@ options_act(const or_options_t *old_options) if (options->CellStatistics || options->DirReqStatistics || options->EntryStatistics || options->ExitPortStatistics || options->ConnDirectionStatistics || + options->HiddenServiceStatistics || options->BridgeAuthoritativeDir) { time_t now = time(NULL); int print_notice = 0; @@ -1722,6 +1724,7 @@ options_act(const or_options_t *old_options) if (!public_server_mode(options)) { options->CellStatistics = 0; options->EntryStatistics = 0; + options->HiddenServiceStatistics = 0; options->ExitPortStatistics = 0; } @@ -1767,6 +1770,11 @@ options_act(const or_options_t *old_options) options->ConnDirectionStatistics) { rep_hist_conn_stats_init(now); } + if ((!old_options || !old_options->HiddenServiceStatistics) && + options->HiddenServiceStatistics) { + log_info(LD_CONFIG, "Configured to measure hidden service statistics."); + rep_hist_hs_stats_init(now); + } if ((!old_options || !old_options->BridgeAuthoritativeDir) && options->BridgeAuthoritativeDir) { rep_hist_desc_stats_init(now); @@ -1778,6 +1786,8 @@ options_act(const or_options_t *old_options) "data directory in 24 hours from now."); } + /* If we used to have statistics enabled but we just disabled them, + stop gathering them. */ if (old_options && old_options->CellStatistics && !options->CellStatistics) rep_hist_buffer_stats_term(); @@ -1787,6 +1797,9 @@ options_act(const or_options_t *old_options) if (old_options && old_options->EntryStatistics && !options->EntryStatistics) geoip_entry_stats_term(); + if (old_options && old_options->HiddenServiceStatistics && + !options->HiddenServiceStatistics) + rep_hist_hs_stats_term(); if (old_options && old_options->ExitPortStatistics && !options->ExitPortStatistics) rep_hist_exit_stats_term(); diff --git a/src/or/main.c b/src/or/main.c index e78e9bf6a6..160bfa00e0 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1384,6 +1384,11 @@ run_scheduled_events(time_t now) if (next_write && next_write < next_time_to_write_stats_files) next_time_to_write_stats_files = next_write; } + if (options->HiddenServiceStatistics) { + time_t next_write = rep_hist_hs_stats_write(time_to_write_stats_files); + if (next_write && next_write < next_time_to_write_stats_files) + next_time_to_write_stats_files = next_write; + } if (options->ExitPortStatistics) { time_t next_write = rep_hist_exit_stats_write(time_to_write_stats_files); if (next_write && next_write < next_time_to_write_stats_files) diff --git a/src/or/or.h b/src/or/or.h index 0de37452bd..ee86697fd8 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3204,6 +3204,10 @@ typedef struct or_circuit_t { /** True iff this circuit was made with a CREATE_FAST cell. */ unsigned int is_first_hop : 1; + /** If set, this circuit carries HS traffic. Consider it in any HS + * statistics. */ + unsigned int circuit_carries_hs_traffic_stats : 1; + /** Number of cells that were removed from circuit queue; reset every * time when writing buffer stats to disk. */ uint32_t processed_cells; @@ -3961,6 +3965,10 @@ typedef struct { /** If true, the user wants us to collect statistics as entry node. */ int EntryStatistics; + /** If true, the user wants us to collect statistics as hidden service + * directory, introduction point, or rendezvous point. */ + int HiddenServiceStatistics; + /** If true, include statistics file contents in extra-info documents. */ int ExtraInfoStatistics; diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index df74b745a2..e779ecfe90 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -924,6 +924,7 @@ rend_cache_lookup_v2_desc_as_dir(const char *desc_id, const char **desc) rend_cache_store_status_t rend_cache_store_v2_desc_as_dir(const char *desc) { + const or_options_t *options = get_options(); rend_service_descriptor_t *parsed; char desc_id[DIGEST_LEN]; char *intro_content; @@ -1003,6 +1004,12 @@ rend_cache_store_v2_desc_as_dir(const char *desc) log_info(LD_REND, "Successfully stored service descriptor with desc ID " "'%s' and len %d.", safe_str(desc_id_base32), (int)encoded_size); + + /* Statistics: Note down this potentially new HS. */ + if (options->HiddenServiceStatistics) { + rep_hist_stored_maybe_new_hs(e->parsed->pk); + } + number_stored++; goto advance; skip: diff --git a/src/or/rendmid.c b/src/or/rendmid.c index 6a701e7a77..1c56471b8c 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -281,6 +281,7 @@ int rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request, size_t request_len) { + const or_options_t *options = get_options(); or_circuit_t *rend_circ; char hexid[9]; int reason = END_CIRC_REASON_INTERNAL; @@ -316,6 +317,12 @@ rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request, goto err; } + /* Statistics: Mark this circuit as an RP circuit so that we collect + stats from it. */ + if (options->HiddenServiceStatistics) { + circ->circuit_carries_hs_traffic_stats = 1; + } + /* Send the RENDEZVOUS2 cell to Alice. */ if (relay_send_command_from_edge(0, TO_CIRCUIT(rend_circ), RELAY_COMMAND_RENDEZVOUS2, diff --git a/src/or/rephist.c b/src/or/rephist.c index f1e882729b..a190fc8c0a 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -2908,11 +2908,227 @@ rep_hist_log_circuit_handshake_stats(time_t now) memset(onion_handshakes_requested, 0, sizeof(onion_handshakes_requested)); } +/* Hidden service statistics section */ + +/** Start of the current hidden service stats interval or 0 if we're + * not collecting hidden service statistics. */ +static time_t start_of_hs_stats_interval; + +/** Carries the various hidden service statistics, and any other + * information needed. */ +typedef struct hs_stats_t { + /** How many relay cells have we seen as rendezvous points? */ + int64_t rp_relay_cells_seen; + + /** Set of unique public key digests we've seen this stat period + * (could also be implemented as sorted smartlist). */ + digestmap_t *onions_seen_this_period; +} hs_stats_t; + +/** Our statistics structure singleton. */ +static hs_stats_t *hs_stats = NULL; + +/** Allocate, initialize and return an hs_stats_t structure. */ +static hs_stats_t * +hs_stats_new(void) +{ + hs_stats_t * hs_stats = tor_malloc_zero(sizeof(hs_stats_t)); + hs_stats->onions_seen_this_period = digestmap_new(); + + return hs_stats; +} + +/** Free an hs_stats_t structure. */ +static void +hs_stats_free(hs_stats_t *hs_stats) +{ + if (!hs_stats) { + return; + } + + digestmap_free(hs_stats->onions_seen_this_period, NULL); + tor_free(hs_stats); +} + +/** Initialize hidden service statistics. */ +void +rep_hist_hs_stats_init(time_t now) +{ + if (!hs_stats) { + hs_stats = hs_stats_new(); + } + + start_of_hs_stats_interval = now; +} + +/** Clear history of hidden service statistics and set the measurement + * interval start to now. */ +static void +rep_hist_reset_hs_stats(time_t now) +{ + if (!hs_stats) { + hs_stats = hs_stats_new(); + } + + hs_stats->rp_relay_cells_seen = 0; + + digestmap_free(hs_stats->onions_seen_this_period, NULL); + hs_stats->onions_seen_this_period = digestmap_new(); + + start_of_hs_stats_interval = now; +} + +/** Stop collecting hidden service stats in a way that we can re-start + * doing so in rep_hist_buffer_stats_init(). */ +void +rep_hist_hs_stats_term(void) +{ + rep_hist_reset_hs_stats(0); +} + +/** We saw a new HS relay cell, Count it! */ +void +rep_hist_seen_new_rp_cell(void) +{ + if (!hs_stats) { + return; // We're not collecting stats + } + + hs_stats->rp_relay_cells_seen++; +} + +/** As HSDirs, we saw another hidden service with public key + * pubkey. Check whether we have counted it before, if not + * count it now! */ +void +rep_hist_stored_maybe_new_hs(const crypto_pk_t *pubkey) +{ + char pubkey_hash[DIGEST_LEN]; + + if (!hs_stats) { + return; // We're not collecting stats + } + + /* Get the digest of the pubkey which will be used to detect whether + we've seen this hidden service before or not. */ + if (crypto_pk_get_digest(pubkey, pubkey_hash) < 0) { + /* This fail should not happen; key has been validated by + descriptor parsing code first. */ + return; + } + + /* Check if this is the first time we've seen this hidden + service. If it is, count it as new. */ + if (!digestmap_get(hs_stats->onions_seen_this_period, + pubkey_hash)) { + digestmap_set(hs_stats->onions_seen_this_period, + pubkey_hash, (void*)(uintptr_t)1); + } +} + +/* The number of cells that are supposed to be hidden from the adversary + * by adding noise from the Laplace distribution. This value, divided by + * EPSILON, is Laplace parameter b. */ +#define REND_CELLS_DELTA_F 2048 +/* Security parameter for obfuscating number of cells with a value between + * 0 and 1. Smaller values obfuscate observations more, but at the same + * time make statistics less usable. */ +#define REND_CELLS_EPSILON 0.3 +/* The number of cells that are supposed to be hidden from the adversary + * by rounding up to the next multiple of this number. */ +#define REND_CELLS_BIN_SIZE 1024 +/* The number of service identities that are supposed to be hidden from + * the adversary by adding noise from the Laplace distribution. This + * value, divided by EPSILON, is Laplace parameter b. */ +#define ONIONS_SEEN_DELTA_F 8 +/* Security parameter for obfuscating number of service identities with a + * value between 0 and 1. Smaller values obfuscate observations more, but + * at the same time make statistics less usable. */ +#define ONIONS_SEEN_EPSILON 0.3 +/* The number of service identities that are supposed to be hidden from + * the adversary by rounding up to the next multiple of this number. */ +#define ONIONS_SEEN_BIN_SIZE 8 + +/** Allocate and return a string containing hidden service stats that + * are meant to be placed in the extra-info descriptor. */ +static char * +rep_hist_format_hs_stats(time_t now) +{ + char t[ISO_TIME_LEN+1]; + char *hs_stats_string; + int64_t obfuscated_cells_seen; + int64_t obfuscated_onions_seen; + + obfuscated_cells_seen = round_int64_to_next_multiple_of( + hs_stats->rp_relay_cells_seen, + REND_CELLS_BIN_SIZE); + obfuscated_cells_seen = add_laplace_noise(obfuscated_cells_seen, + crypto_rand_double(), + REND_CELLS_DELTA_F, REND_CELLS_EPSILON); + obfuscated_onions_seen = round_int64_to_next_multiple_of(digestmap_size( + hs_stats->onions_seen_this_period), + ONIONS_SEEN_BIN_SIZE); + obfuscated_onions_seen = add_laplace_noise(obfuscated_onions_seen, + crypto_rand_double(), ONIONS_SEEN_DELTA_F, + ONIONS_SEEN_EPSILON); + + format_iso_time(t, now); + tor_asprintf(&hs_stats_string, "hidserv-stats-end %s (%d s)\n" + "hidserv-rend-relayed-cells "I64_FORMAT" delta_f=%d " + "epsilon=%.2f bin_size=%d\n" + "hidserv-dir-onions-seen "I64_FORMAT" delta_f=%d " + "epsilon=%.2f bin_size=%d\n", + t, (unsigned) (now - start_of_hs_stats_interval), + I64_PRINTF_ARG(obfuscated_cells_seen), REND_CELLS_DELTA_F, + REND_CELLS_EPSILON, REND_CELLS_BIN_SIZE, + I64_PRINTF_ARG(obfuscated_onions_seen), + ONIONS_SEEN_DELTA_F, + ONIONS_SEEN_EPSILON, ONIONS_SEEN_BIN_SIZE); + + return hs_stats_string; +} + +/** If 24 hours have passed since the beginning of the current HS + * stats period, write buffer stats to $DATADIR/stats/hidserv-stats + * (possibly overwriting an existing file) and reset counters. Return + * when we would next want to write buffer stats or 0 if we never want to + * write. */ +time_t +rep_hist_hs_stats_write(time_t now) +{ + char *str = NULL; + + if (!start_of_hs_stats_interval) { + return 0; /* Not initialized. */ + } + + if (start_of_hs_stats_interval + WRITE_STATS_INTERVAL > now) { + goto done; /* Not ready to write */ + } + + /* Generate history string. */ + str = rep_hist_format_hs_stats(now); + + /* Reset HS history. */ + rep_hist_reset_hs_stats(now); + + /* Try to write to disk. */ + if (!check_or_create_data_subdir("stats")) { + write_to_data_subdir("stats", "hidserv-stats", str, + "hidden service stats"); + } + + done: + tor_free(str); + return start_of_hs_stats_interval + WRITE_STATS_INTERVAL; +} + /** Free all storage held by the OR/link history caches, by the * bandwidth history arrays, by the port history, or by statistics . */ void rep_hist_free_all(void) { + hs_stats_free(hs_stats); digestmap_free(history_map, free_or_history); tor_free(read_array); tor_free(write_array); diff --git a/src/or/rephist.h b/src/or/rephist.h index d853fe2e00..8fd1599513 100644 --- a/src/or/rephist.h +++ b/src/or/rephist.h @@ -99,6 +99,13 @@ void rep_hist_note_circuit_handshake_requested(uint16_t type); void rep_hist_note_circuit_handshake_assigned(uint16_t type); void rep_hist_log_circuit_handshake_stats(time_t now); +void rep_hist_hs_stats_init(time_t now); +void rep_hist_hs_stats_term(void); +time_t rep_hist_hs_stats_write(time_t now); +char *rep_hist_get_hs_stats_string(void); +void rep_hist_seen_new_rp_cell(void); +void rep_hist_stored_maybe_new_hs(const crypto_pk_t *pubkey); + void rep_hist_free_all(void); #endif diff --git a/src/or/router.c b/src/or/router.c index 01838b4b3e..3e60880cd6 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2654,6 +2654,11 @@ extrainfo_dump_to_string(char **s_out, extrainfo_t *extrainfo, "dirreq-stats-end", now, &contents) > 0) { smartlist_add(chunks, contents); } + if (options->HiddenServiceStatistics && + load_stats_file("stats"PATH_SEPARATOR"hidserv-stats", + "hidserv-stats-end", now, &contents) > 0) { + smartlist_add(chunks, contents); + } if (options->EntryStatistics && load_stats_file("stats"PATH_SEPARATOR"entry-stats", "entry-stats-end", now, &contents) > 0) { From 13a6fb9a2aa499e160e2b7d71794d6f5614bbd19 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Thu, 18 Dec 2014 17:44:47 +0200 Subject: [PATCH 010/120] HS stats: Add changes file and improve man page. --- changes/feature13192 | 13 +++++++++++++ doc/tor.1.txt | 8 +++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 changes/feature13192 diff --git a/changes/feature13192 b/changes/feature13192 new file mode 100644 index 0000000000..8a9741cb47 --- /dev/null +++ b/changes/feature13192 @@ -0,0 +1,13 @@ +m o Major features (hidden services): + - Add a HiddenServiceStatistics option that allows Tor relays to + gather and publish statistics about hidden service usage, to + better understand the size and volume of the hidden service + network. Specifically, if a Tor relay is an HSDir it will + publish the approximate number of hidden services that have + published descriptors to it the past 24 hours. Also, if a relay + has acted as a hidden service rendezvous point, it will publish + the approximate amount of rendezvous cells it has relayed the + past 24 hours. The statistics themselves are obfuscated so that + the exact values cannot be derived. For more details see + proposal 238 "Better hidden service stats from Tor relays". This + feature is currently disabled by default. Implements feature 13192. diff --git a/doc/tor.1.txt b/doc/tor.1.txt index b09f322d3d..6526a89bf8 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -1765,9 +1765,11 @@ is non-zero): of connections to disk every 24 hours. (Default: 0) [[HiddenServiceStatistics]] **HiddenServiceStatistics** **0**|**1**:: - When this option is enabled, a Tor relay writes statistics on its role as - hidden-service directory, introduction point, or rendezvous point to disk - every 24 hours. (Default: 0) + When this option is enabled, a Tor relay writes obfuscated + statistics on its role as hidden-service directory, introduction + point, or rendezvous point to disk every 24 hours. If + ExtraInfoStatistics is also enabled, these statistics are further + published to the directory authorities. (Default: 0) [[ExtraInfoStatistics]] **ExtraInfoStatistics** **0**|**1**:: When this option is enabled, Tor includes previously gathered statistics in From 816e6f2eacca57fc5f9c265b9976510b81e088d2 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Fri, 19 Dec 2014 18:37:43 +0100 Subject: [PATCH 011/120] Fix unit test. Looks like we forgot to update unit tests when we switched from 32-bit to 64-bit ints while tweaking 7cd53b7. --- src/test/test_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test_util.c b/src/test/test_util.c index 6e73ccf51e..d9f2f4f744 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -4663,7 +4663,7 @@ test_util_laplace(void *arg) * array([ -inf, -80.47189562, -34.65735903, 0. , * 34.65735903, 80.47189562, 195.60115027]) */ - tt_assert(LONG_MIN + 20 == + tt_assert(LLONG_MIN + 20 == add_laplace_noise(20, 0.0, delta_f, epsilon)); tt_assert(-60 == add_laplace_noise(20, 0.1, delta_f, epsilon)); tt_assert(-14 == add_laplace_noise(20, 0.25, delta_f, epsilon)); From 357191a0955f2c65b186f76e0e7f3169b2db398f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 19 Dec 2014 14:12:22 -0500 Subject: [PATCH 012/120] Define an int64_min when it is missing --- src/common/torint.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/torint.h b/src/common/torint.h index d0b0ac14a0..487972372c 100644 --- a/src/common/torint.h +++ b/src/common/torint.h @@ -191,6 +191,10 @@ typedef unsigned __int64 uint64_t; #endif #endif +#ifndef INT64_MIN +#define INT64_MIN ((- INT64_MAX) - 1) +#endif + #ifndef SIZE_MAX #if SIZEOF_SIZE_T == 8 #define SIZE_MAX UINT64_MAX From 3d85df956905453413918866ffa4dc07b86e7f1b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 19 Dec 2014 14:12:35 -0500 Subject: [PATCH 013/120] LLONG_MIN => INT64_MIN. --- src/test/test_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test_util.c b/src/test/test_util.c index d9f2f4f744..e9815b12e7 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -4663,7 +4663,7 @@ test_util_laplace(void *arg) * array([ -inf, -80.47189562, -34.65735903, 0. , * 34.65735903, 80.47189562, 195.60115027]) */ - tt_assert(LLONG_MIN + 20 == + tt_assert(INT64_MIN + 20 == add_laplace_noise(20, 0.0, delta_f, epsilon)); tt_assert(-60 == add_laplace_noise(20, 0.1, delta_f, epsilon)); tt_assert(-14 == add_laplace_noise(20, 0.25, delta_f, epsilon)); From d93516c445cfb25904da3d86fd6096cce1179b59 Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 20 Dec 2014 22:27:21 +1100 Subject: [PATCH 014/120] Fix transparent proxy checks to allow OS X to use ipfw or pf OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent proxy option checks to allow for both ipfw and pf on OS X. Fixes bug 14002. --- changes/bug14002-osx-transproxy-ipfw-pf | 4 ++++ src/or/config.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 changes/bug14002-osx-transproxy-ipfw-pf diff --git a/changes/bug14002-osx-transproxy-ipfw-pf b/changes/bug14002-osx-transproxy-ipfw-pf new file mode 100644 index 0000000000..a08bbdcbff --- /dev/null +++ b/changes/bug14002-osx-transproxy-ipfw-pf @@ -0,0 +1,4 @@ + o Minor bugfixes: + - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent + proxy option checks to allow for both ipfw and pf on OS X. + Fixes bug 14002. diff --git a/src/or/config.c b/src/or/config.c index 28f1df0663..da756f6f29 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -2597,20 +2597,24 @@ options_validate(or_options_t *old_options, or_options_t *options, if (!strcasecmp(options->TransProxyType, "default")) { options->TransProxyType_parsed = TPT_DEFAULT; } else if (!strcasecmp(options->TransProxyType, "pf-divert")) { -#ifndef __OpenBSD__ - REJECT("pf-divert is a OpenBSD-specific feature."); +#if !defined(__OpenBSD__) && !defined( DARWIN ) + /* Later versions of OS X have pf */ + REJECT("pf-divert is a OpenBSD-specific " + "and OS X/Darwin-specific feature."); #else options->TransProxyType_parsed = TPT_PF_DIVERT; #endif } else if (!strcasecmp(options->TransProxyType, "tproxy")) { -#ifndef __linux__ +#if !defined(__linux__) REJECT("TPROXY is a Linux-specific feature."); #else options->TransProxyType_parsed = TPT_TPROXY; #endif } else if (!strcasecmp(options->TransProxyType, "ipfw")) { -#ifndef __FreeBSD__ - REJECT("ipfw is a FreeBSD-specific feature."); +#if !defined(__FreeBSD__) && !defined( DARWIN ) + /* Earlier versions of OS X have ipfw */ + REJECT("ipfw is a FreeBSD-specific" + "and OS X/Darwin-specific feature."); #else options->TransProxyType_parsed = TPT_IPFW; #endif From f785723e0b76f1b049b6103d01c316778445b33f Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 21 Dec 2014 19:05:10 +0200 Subject: [PATCH 015/120] Document the case of HiddenServiceDir being defined as relative path. --- changes/bug13913 | 5 +++++ doc/tor.1.txt | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 changes/bug13913 diff --git a/changes/bug13913 b/changes/bug13913 new file mode 100644 index 0000000000..7d908bd5b6 --- /dev/null +++ b/changes/bug13913 @@ -0,0 +1,5 @@ + o Documentation: + - Clarify HiddenServiceDir option description in manpage to make it + clear that directory in question is relative to current working + directory of Tor instance if it is defined as a relative path. Fixes + issue 13913. diff --git a/doc/tor.1.txt b/doc/tor.1.txt index e876829cf6..92f0407918 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -2025,6 +2025,8 @@ The following options are used to configure a hidden service. Store data files for a hidden service in DIRECTORY. Every hidden service must have a separate directory. You may use this option multiple times to specify multiple services. DIRECTORY must be an existing directory. + NB: if DIRECTORY is defined in relative way, it will be relative to current + working directory of Tor instance, not it's DataDirectory. [[HiddenServicePort]] **HiddenServicePort** __VIRTPORT__ [__TARGET__]:: Configure a virtual port VIRTPORT for a hidden service. You may use this From 6fad395300a263badb443bf0feb936d4a554d020 Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 20 Dec 2014 22:20:54 +1100 Subject: [PATCH 016/120] Fix clang warning, IPv6 address comment, buffer size typo The address of an array in the middle of a structure will always be non-NULL. clang recognises this and complains. Disable the tautologous and redundant check to silence this warning. Fixes bug 14001. --- changes/bug14001-clang-warning | 6 ++++++ src/or/connection_edge.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changes/bug14001-clang-warning diff --git a/changes/bug14001-clang-warning b/changes/bug14001-clang-warning new file mode 100644 index 0000000000..b932af6ab7 --- /dev/null +++ b/changes/bug14001-clang-warning @@ -0,0 +1,6 @@ + o Minor bugfixes: + - The address of an array in the middle of a structure will + always be non-NULL. clang recognises this and complains. + Disable the tautologous and redundant check to silence + this warning. + Fixes bug 14001. diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 9ace375d74..a90ca00883 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -744,8 +744,9 @@ connection_ap_fail_onehop(const char *failed_digest, /* we don't know the digest; have to compare addr:port */ tor_addr_t addr; if (!build_state || !build_state->chosen_exit || - !entry_conn->socks_request || !entry_conn->socks_request->address) + !entry_conn->socks_request) { continue; + } if (tor_addr_parse(&addr, entry_conn->socks_request->address)<0 || !tor_addr_eq(&build_state->chosen_exit->addr, &addr) || build_state->chosen_exit->port != entry_conn->socks_request->port) From 769fc5af09f140ff636131e4172bfcbe267d6b42 Mon Sep 17 00:00:00 2001 From: teor Date: Sun, 21 Dec 2014 13:35:42 -0500 Subject: [PATCH 017/120] Fix a comment in tor_addr_parse --- src/common/address.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/address.c b/src/common/address.c index a3b5df66bc..0b475fc9fd 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1119,7 +1119,8 @@ fmt_addr32(uint32_t addr) int tor_addr_parse(tor_addr_t *addr, const char *src) { - char *tmp = NULL; /* Holds substring if we got a dotted quad. */ + /* Holds substring of IPv6 address after removing square brackets */ + char *tmp = NULL; int result; struct in_addr in_tmp; struct in6_addr in6_tmp; From e40591827eea440bac6d90076900da643d21a0bf Mon Sep 17 00:00:00 2001 From: teor Date: Sun, 21 Dec 2014 13:36:06 -0500 Subject: [PATCH 018/120] Make log bufer 10k, not 9.78k. --- src/common/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/log.c b/src/common/log.c index ad0da7da6b..0a21ffbd44 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -451,7 +451,7 @@ MOCK_IMPL(STATIC void, logv,(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap)) { - char buf[10024]; + char buf[10240]; size_t msg_len = 0; int formatted = 0; logfile_t *lf; From b884ae6d98d0fd684bc93aa48a0da656ea1849b7 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 20:52:24 +0200 Subject: [PATCH 019/120] Using macros and inline function for quick lookup of channel state. --- src/or/channel.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/or/channel.h b/src/or/channel.h index 4cd8f4391e..5a2431b30a 100644 --- a/src/or/channel.h +++ b/src/or/channel.h @@ -430,6 +430,39 @@ channel_t * channel_find_by_remote_digest(const char *identity_digest); */ channel_t * channel_next_with_digest(channel_t *chan); +/* + * Helper macros to lookup state of given channel. + */ + +#define CHANNEL_IS_CLOSED(chan) (channel_is_in_state((chan), \ + CHANNEL_STATE_CLOSED)) +#define CHANNEL_IS_OPENING(chan) (channel_is_in_state((chan), \ + CHANNEL_STATE_OPENING)) +#define CHANNEL_IS_OPEN(chan) (channel_is_in_state((chan), \ + CHANNEL_STATE_OPEN)) +#define CHANNEL_IS_MAINT(chan) (channel_is_in_state((chan), \ + CHANNEL_STATE_MAINT)) +#define CHANNEL_IS_CLOSING(chan) (channel_is_in_state((chan), \ + CHANNEL_STATE_CLOSING)) +#define CHANNEL_IS_ERROR(chan) (channel_is_in_state((chan), \ + CHANNEL_STATE_ERROR)) + +#define CHANNEL_FINISHED(chan) (CHANNEL_IS_CLOSED(chan) || \ + CHANNEL_IS_ERROR(chan)) + +#define CHANNEL_CONDEMNED(chan) (CHANNEL_IS_CLOSING(chan) || \ + CHANNEL_FINISHED(chan)) + +#define CHANNEL_CAN_HANDLE_CELLS(chan) (CHANNEL_IS_OPENING(chan) || \ + CHANNEL_IS_OPEN(chan) || \ + CHANNEL_IS_MAINT(chan)) + +static INLINE int +channel_is_in_state(channel_t *chan, channel_state_t state) +{ + return chan->state == state; +} + /* * Metadata queries/updates */ From 032d44226ec618c106c0431c39a79303fb78fc6b Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 20:53:13 +0200 Subject: [PATCH 020/120] Use channel state lookup macros in channel.c --- src/or/channel.c | 119 ++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 78 deletions(-) diff --git a/src/or/channel.c b/src/or/channel.c index 13a122662a..5651bb4b27 100644 --- a/src/or/channel.c +++ b/src/or/channel.c @@ -378,8 +378,7 @@ channel_register(channel_t *chan) smartlist_add(all_channels, chan); /* Is it finished? */ - if (chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) { + if (CHANNEL_FINISHED(chan)) { /* Put it in the finished list, creating it if necessary */ if (!finished_channels) finished_channels = smartlist_new(); smartlist_add(finished_channels, chan); @@ -388,7 +387,7 @@ channel_register(channel_t *chan) if (!active_channels) active_channels = smartlist_new(); smartlist_add(active_channels, chan); - if (chan->state != CHANNEL_STATE_CLOSING) { + if (!CHANNEL_IS_CLOSING(chan)) { /* It should have a digest set */ if (!tor_digest_is_zero(chan->identity_digest)) { /* Yeah, we're good, add it to the map */ @@ -423,8 +422,7 @@ channel_unregister(channel_t *chan) if (!(chan->registered)) return; /* Is it finished? */ - if (chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) { + if (CHANNEL_FINISHED(chan)) { /* Get it out of the finished list */ if (finished_channels) smartlist_remove(finished_channels, chan); } else { @@ -440,9 +438,7 @@ channel_unregister(channel_t *chan) /* Should it be in the digest map? */ if (!tor_digest_is_zero(chan->identity_digest) && - !(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR)) { + !(CHANNEL_CONDEMNED(chan))) { /* Remove it */ channel_remove_from_digest_map(chan); } @@ -542,9 +538,7 @@ channel_add_to_digest_map(channel_t *chan) tor_assert(chan); /* Assert that the state makes sense */ - tor_assert(!(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR)); + tor_assert(!CHANNEL_CONDEMNED(chan)); /* Assert that there is a digest */ tor_assert(!tor_digest_is_zero(chan->identity_digest)); @@ -779,8 +773,8 @@ channel_free(channel_t *chan) if (!chan) return; /* It must be closed or errored */ - tor_assert(chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR); + tor_assert(CHANNEL_FINISHED(chan)); + /* It must be deregistered */ tor_assert(!(chan->registered)); @@ -988,9 +982,7 @@ channel_get_cell_handler(channel_t *chan) { tor_assert(chan); - if (chan->state == CHANNEL_STATE_OPENING || - chan->state == CHANNEL_STATE_OPEN || - chan->state == CHANNEL_STATE_MAINT) + if (CHANNEL_CAN_HANDLE_CELLS(chan)) return chan->cell_handler; return NULL; @@ -1008,9 +1000,7 @@ channel_get_var_cell_handler(channel_t *chan) { tor_assert(chan); - if (chan->state == CHANNEL_STATE_OPENING || - chan->state == CHANNEL_STATE_OPEN || - chan->state == CHANNEL_STATE_MAINT) + if (CHANNEL_CAN_HANDLE_CELLS(chan)) return chan->var_cell_handler; return NULL; @@ -1033,9 +1023,7 @@ channel_set_cell_handlers(channel_t *chan, int try_again = 0; tor_assert(chan); - tor_assert(chan->state == CHANNEL_STATE_OPENING || - chan->state == CHANNEL_STATE_OPEN || - chan->state == CHANNEL_STATE_MAINT); + tor_assert(CHANNEL_CAN_HANDLE_CELLS(chan)); log_debug(LD_CHANNEL, "Setting cell_handler callback for channel %p to %p", @@ -1089,9 +1077,8 @@ channel_mark_for_close(channel_t *chan) tor_assert(chan->close != NULL); /* If it's already in CLOSING, CLOSED or ERROR, this is a no-op */ - if (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) return; + if (CHANNEL_CONDEMNED(chan)) + return; log_debug(LD_CHANNEL, "Closing channel %p (global ID " U64_FORMAT ") " @@ -1170,9 +1157,8 @@ channel_close_from_lower_layer(channel_t *chan) tor_assert(chan != NULL); /* If it's already in CLOSING, CLOSED or ERROR, this is a no-op */ - if (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) return; + if (CHANNEL_CONDEMNED(chan)) + return; log_debug(LD_CHANNEL, "Closing channel %p (global ID " U64_FORMAT ") " @@ -1230,9 +1216,8 @@ channel_close_for_error(channel_t *chan) tor_assert(chan != NULL); /* If it's already in CLOSING, CLOSED or ERROR, this is a no-op */ - if (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) return; + if (CHANNEL_CONDEMNED(chan)) + return; log_debug(LD_CHANNEL, "Closing channel %p due to lower-layer error", @@ -1288,13 +1273,11 @@ void channel_closed(channel_t *chan) { tor_assert(chan); - tor_assert(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR); + tor_assert(CHANNEL_CONDEMNED(chan)); /* No-op if already inactive */ - if (chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) return; + if (CHANNEL_FINISHED(chan)) + return; /* Inform any pending (not attached) circs that they should * give up. */ @@ -1357,10 +1340,7 @@ channel_clear_identity_digest(channel_t *chan) "global ID " U64_FORMAT, chan, U64_PRINTF_ARG(chan->global_identifier)); - state_not_in_map = - (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR); + state_not_in_map = CHANNEL_CONDEMNED(chan); if (!state_not_in_map && chan->registered && !tor_digest_is_zero(chan->identity_digest)) @@ -1393,10 +1373,8 @@ channel_set_identity_digest(channel_t *chan, identity_digest ? hex_str(identity_digest, DIGEST_LEN) : "(null)"); - state_not_in_map = - (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR); + state_not_in_map = CHANNEL_CONDEMNED(chan); + was_in_digest_map = !state_not_in_map && chan->registered && @@ -1446,10 +1424,7 @@ channel_clear_remote_end(channel_t *chan) "global ID " U64_FORMAT, chan, U64_PRINTF_ARG(chan->global_identifier)); - state_not_in_map = - (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR); + state_not_in_map = CHANNEL_CONDEMNED(chan); if (!state_not_in_map && chan->registered && !tor_digest_is_zero(chan->identity_digest)) @@ -1485,10 +1460,8 @@ channel_set_remote_end(channel_t *chan, identity_digest ? hex_str(identity_digest, DIGEST_LEN) : "(null)"); - state_not_in_map = - (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR); + state_not_in_map = CHANNEL_CONDEMNED(chan); + was_in_digest_map = !state_not_in_map && chan->registered && @@ -1682,9 +1655,7 @@ channel_write_cell_queue_entry(channel_t *chan, cell_queue_entry_t *q) tor_assert(q); /* Assert that the state makes sense for a cell write */ - tor_assert(chan->state == CHANNEL_STATE_OPENING || - chan->state == CHANNEL_STATE_OPEN || - chan->state == CHANNEL_STATE_MAINT); + tor_assert(CHANNEL_CAN_HANDLE_CELLS(chan)); { circid_t circ_id; @@ -1695,7 +1666,7 @@ channel_write_cell_queue_entry(channel_t *chan, cell_queue_entry_t *q) /* Can we send it right out? If so, try */ if (TOR_SIMPLEQ_EMPTY(&chan->outgoing_queue) && - chan->state == CHANNEL_STATE_OPEN) { + CHANNEL_IS_OPEN(chan)) { /* Pick the right write function for this cell type and save the result */ switch (q->type) { case CELL_QUEUE_FIXED: @@ -1738,7 +1709,7 @@ channel_write_cell_queue_entry(channel_t *chan, cell_queue_entry_t *q) tmp = cell_queue_entry_dup(q); TOR_SIMPLEQ_INSERT_TAIL(&chan->outgoing_queue, tmp, next); /* Try to process the queue? */ - if (chan->state == CHANNEL_STATE_OPEN) channel_flush_cells(chan); + if (CHANNEL_IS_OPEN(chan)) channel_flush_cells(chan); } } @@ -1759,7 +1730,7 @@ channel_write_cell(channel_t *chan, cell_t *cell) tor_assert(chan); tor_assert(cell); - if (chan->state == CHANNEL_STATE_CLOSING) { + if (CHANNEL_IS_CLOSING(chan)) { log_debug(LD_CHANNEL, "Discarding cell_t %p on closing channel %p with " "global ID "U64_FORMAT, cell, chan, U64_PRINTF_ARG(chan->global_identifier)); @@ -1793,7 +1764,7 @@ channel_write_packed_cell(channel_t *chan, packed_cell_t *packed_cell) tor_assert(chan); tor_assert(packed_cell); - if (chan->state == CHANNEL_STATE_CLOSING) { + if (CHANNEL_IS_CLOSING(chan)) { log_debug(LD_CHANNEL, "Discarding packed_cell_t %p on closing channel %p " "with global ID "U64_FORMAT, packed_cell, chan, U64_PRINTF_ARG(chan->global_identifier)); @@ -1829,7 +1800,7 @@ channel_write_var_cell(channel_t *chan, var_cell_t *var_cell) tor_assert(chan); tor_assert(var_cell); - if (chan->state == CHANNEL_STATE_CLOSING) { + if (CHANNEL_IS_CLOSING(chan)) { log_debug(LD_CHANNEL, "Discarding var_cell_t %p on closing channel %p " "with global ID "U64_FORMAT, var_cell, chan, U64_PRINTF_ARG(chan->global_identifier)); @@ -2069,7 +2040,7 @@ channel_flush_some_cells(channel_t *chan, ssize_t num_cells) if (!unlimited && num_cells <= flushed) goto done; /* If we aren't in CHANNEL_STATE_OPEN, nothing goes through */ - if (chan->state == CHANNEL_STATE_OPEN) { + if (CHANNEL_IS_OPEN(chan)) { /* Try to flush as much as we can that's already queued */ flushed += channel_flush_some_cells_from_outgoing_queue(chan, (unlimited ? -1 : num_cells - flushed)); @@ -2127,7 +2098,7 @@ channel_flush_some_cells_from_outgoing_queue(channel_t *chan, if (!unlimited && num_cells <= flushed) return 0; /* If we aren't in CHANNEL_STATE_OPEN, nothing goes through */ - if (chan->state == CHANNEL_STATE_OPEN) { + if (CHANNEL_IS_OPEN(chan)) { while ((unlimited || num_cells > flushed) && NULL != (q = TOR_SIMPLEQ_FIRST(&chan->outgoing_queue))) { @@ -2462,9 +2433,8 @@ channel_process_cells(channel_t *chan) { cell_queue_entry_t *q; tor_assert(chan); - tor_assert(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_MAINT || - chan->state == CHANNEL_STATE_OPEN); + tor_assert(CHANNEL_IS_CLOSING(chan) || CHANNEL_IS_MAINT(chan) || + CHANNEL_IS_OPEN(chan)); log_debug(LD_CHANNEL, "Processing as many incoming cells as we can for channel %p", @@ -2531,7 +2501,7 @@ channel_queue_cell(channel_t *chan, cell_t *cell) tor_assert(chan); tor_assert(cell); - tor_assert(chan->state == CHANNEL_STATE_OPEN); + tor_assert(CHANNEL_IS_OPEN(chan)); /* Do we need to queue it, or can we just call the handler right away? */ if (!(chan->cell_handler)) need_to_queue = 1; @@ -2584,7 +2554,7 @@ channel_queue_var_cell(channel_t *chan, var_cell_t *var_cell) tor_assert(chan); tor_assert(var_cell); - tor_assert(chan->state == CHANNEL_STATE_OPEN); + tor_assert(CHANNEL_IS_OPEN(chan)); /* Do we need to queue it, or can we just call the handler right away? */ if (!(chan->var_cell_handler)) need_to_queue = 1; @@ -2692,10 +2662,7 @@ channel_send_destroy(circid_t circ_id, channel_t *chan, int reason) } /* Check to make sure we can send on this channel first */ - if (!(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) && - chan->cmux) { + if (!CHANNEL_CONDEMNED(chan) && chan->cmux) { channel_note_destroy_pending(chan, circ_id); circuitmux_append_destroy_cell(chan, chan->cmux, circ_id, reason); log_debug(LD_OR, @@ -2872,9 +2839,7 @@ channel_free_list(smartlist_t *channels, int mark_for_close) } channel_unregister(curr); if (mark_for_close) { - if (!(curr->state == CHANNEL_STATE_CLOSING || - curr->state == CHANNEL_STATE_CLOSED || - curr->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_CONDEMNED(curr)) { channel_mark_for_close(curr); } channel_force_free(curr); @@ -3088,9 +3053,7 @@ channel_get_for_extend(const char *digest, tor_assert(tor_memeq(chan->identity_digest, digest, DIGEST_LEN)); - if (chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR) + if (CHANNEL_CONDEMNED(chan)) continue; /* Never return a channel on which the other end appears to be @@ -3100,7 +3063,7 @@ channel_get_for_extend(const char *digest, } /* Never return a non-open connection. */ - if (chan->state != CHANNEL_STATE_OPEN) { + if (!CHANNEL_IS_OPEN(chan)) { /* If the address matches, don't launch a new connection for this * circuit. */ if (channel_matches_target_addr_for_extend(chan, target_addr)) From 668edc51323e507be88b50fb8a49f20bef779bc8 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:02:00 +0200 Subject: [PATCH 021/120] Using channel state lookup macros in channeltls.c --- src/or/channeltls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/or/channeltls.c b/src/or/channeltls.c index db044aee56..987dd9b31b 100644 --- a/src/or/channeltls.c +++ b/src/or/channeltls.c @@ -855,10 +855,10 @@ channel_tls_handle_state_change_on_orconn(channel_tls_t *chan, /* Make sure the base connection state makes sense - shouldn't be error, * closed or listening. */ - tor_assert(base_chan->state == CHANNEL_STATE_OPENING || - base_chan->state == CHANNEL_STATE_OPEN || - base_chan->state == CHANNEL_STATE_MAINT || - base_chan->state == CHANNEL_STATE_CLOSING); + tor_assert(CHANNEL_IS_OPENING(base_chan) || + CHANNEL_IS_OPEN(base_chan) || + CHANNEL_IS_MAINT(base_chan) || + CHANNEL_IS_CLOSING(base_chan)); /* Did we just go to state open? */ if (state == OR_CONN_STATE_OPEN) { @@ -872,7 +872,7 @@ channel_tls_handle_state_change_on_orconn(channel_tls_t *chan, * Not open, so from CHANNEL_STATE_OPEN we go to CHANNEL_STATE_MAINT, * otherwise no change. */ - if (base_chan->state == CHANNEL_STATE_OPEN) { + if (CHANNEL_IS_OPEN(base_chan)) { channel_change_state(base_chan, CHANNEL_STATE_MAINT); } } From 5a7dd44d6e0996f8dec376f049551fd10b4b6b6c Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:12:47 +0200 Subject: [PATCH 022/120] Using channel state lookup macros in circuitbias.c. --- src/or/circpathbias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c index a6858a3460..e5e3326ca1 100644 --- a/src/or/circpathbias.c +++ b/src/or/circpathbias.c @@ -768,8 +768,8 @@ pathbias_send_usable_probe(circuit_t *circ) /* Can't probe if the channel isn't open */ if (circ->n_chan == NULL || - (circ->n_chan->state != CHANNEL_STATE_OPEN - && circ->n_chan->state != CHANNEL_STATE_MAINT)) { + (!CHANNEL_IS_OPEN(circ->n_chan) + && !CHANNEL_IS_MAINT(circ->n_chan))) { log_info(LD_CIRC, "Skipping pathbias probe for circuit %d: Channel is not open.", ocirc->global_identifier); From 74731607651998bc6bdce9559c3352d57c60008c Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:17:15 +0200 Subject: [PATCH 023/120] Using CHANNEL_IS_OPEN macro in circuitbuild.c --- src/or/circuitbuild.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 42c4870e87..847a0c0112 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -671,7 +671,7 @@ circuit_deliver_create_cell(circuit_t *circ, const create_cell_t *create_cell, if (CIRCUIT_IS_ORIGIN(circ)) { /* Update began timestamp for circuits starting their first hop */ if (TO_ORIGIN_CIRCUIT(circ)->cpath->state == CPATH_STATE_CLOSED) { - if (circ->n_chan->state != CHANNEL_STATE_OPEN) { + if (!CHANNEL_IS_OPEN(circ->n_chan)) { log_warn(LD_CIRC, "Got first hop for a circuit without an opened channel. " "State: %s.", channel_state_to_string(circ->n_chan->state)); From 551221bad6a852750a9f0bd0e4e521192dbc7999 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:27:15 +0200 Subject: [PATCH 024/120] Using channel state lookup macros in circuitlist.c. --- src/or/circuitlist.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index c7287f921d..fad79c116d 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -1752,9 +1752,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line, if (circ->n_chan) { circuit_clear_cell_queue(circ, circ->n_chan); /* Only send destroy if the channel isn't closing anyway */ - if (!(circ->n_chan->state == CHANNEL_STATE_CLOSING || - circ->n_chan->state == CHANNEL_STATE_CLOSED || - circ->n_chan->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_CONDEMNED(circ->n_chan)) { channel_send_destroy(circ->n_circ_id, circ->n_chan, reason); } circuitmux_detach_circuit(circ->n_chan->cmux, circ); @@ -1786,9 +1784,7 @@ circuit_mark_for_close_, (circuit_t *circ, int reason, int line, if (or_circ->p_chan) { circuit_clear_cell_queue(circ, or_circ->p_chan); /* Only send destroy if the channel isn't closing anyway */ - if (!(or_circ->p_chan->state == CHANNEL_STATE_CLOSING || - or_circ->p_chan->state == CHANNEL_STATE_CLOSED || - or_circ->p_chan->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_CONDEMNED(or_circ->p_chan)) { channel_send_destroy(or_circ->p_circ_id, or_circ->p_chan, reason); } circuitmux_detach_circuit(or_circ->p_chan->cmux, circ); From fc7d5e598bb2494bd121e73038cf29854a23d9d5 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:34:41 +0200 Subject: [PATCH 025/120] Using CHANNEL_FINISHED macro in connection.c --- src/or/connection.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/or/connection.c b/src/or/connection.c index c9c371c001..16b359d5ed 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -544,8 +544,7 @@ connection_free_(connection_t *conn) or_conn, TLS_CHAN_TO_BASE(or_conn->chan), U64_PRINTF_ARG( TLS_CHAN_TO_BASE(or_conn->chan)->global_identifier)); - if (!(TLS_CHAN_TO_BASE(or_conn->chan)->state == CHANNEL_STATE_CLOSED || - TLS_CHAN_TO_BASE(or_conn->chan)->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_FINISHED(TLS_CHAN_TO_BASE(or_conn->chan))) { channel_close_for_error(TLS_CHAN_TO_BASE(or_conn->chan)); } From f6cc4d35b0e79a675b56bdb3d919a6e5c6e840b3 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:42:46 +0200 Subject: [PATCH 026/120] Using channel state lookup macros in connection_or.c. --- src/or/connection_or.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 29b88041b7..e26e0bcf2d 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -1144,9 +1144,7 @@ connection_or_notify_error(or_connection_t *conn, if (conn->chan) { chan = TLS_CHAN_TO_BASE(conn->chan); /* Don't transition if we're already in closing, closed or error */ - if (!(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_CONDEMNED(chan)) { channel_close_for_error(chan); } } @@ -1305,9 +1303,7 @@ connection_or_close_normally(or_connection_t *orconn, int flush) if (orconn->chan) { chan = TLS_CHAN_TO_BASE(orconn->chan); /* Don't transition if we're already in closing, closed or error */ - if (!(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_CONDEMNED(chan)) { channel_close_from_lower_layer(chan); } } @@ -1328,9 +1324,7 @@ connection_or_close_for_error(or_connection_t *orconn, int flush) if (orconn->chan) { chan = TLS_CHAN_TO_BASE(orconn->chan); /* Don't transition if we're already in closing, closed or error */ - if (!(chan->state == CHANNEL_STATE_CLOSING || - chan->state == CHANNEL_STATE_CLOSED || - chan->state == CHANNEL_STATE_ERROR)) { + if (!CHANNEL_CONDEMNED(chan)) { channel_close_for_error(chan); } } From ed0b46e71116e510bb24eb2a2b9af81cdb972f62 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sun, 23 Nov 2014 21:52:50 +0200 Subject: [PATCH 027/120] Changes file for 7356 --- changes/bug7356 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changes/bug7356 diff --git a/changes/bug7356 b/changes/bug7356 new file mode 100644 index 0000000000..be31d1fa64 --- /dev/null +++ b/changes/bug7356 @@ -0,0 +1,5 @@ + o Code simplifications and refactoring: + - Add inline functions and convenience macros for quick lookup of + state component of channel_t structure. Refactor various parts of + codebase to use convenience macros instead of checking state + member of channel_t directly. Fixes issue 7356. From af1469b9a3298382de39dca87b02410e829399a2 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Tue, 16 Dec 2014 20:52:05 +0200 Subject: [PATCH 028/120] Fixing mistake in comment. --- src/or/channeltls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/or/channeltls.c b/src/or/channeltls.c index 987dd9b31b..47f5d34bf7 100644 --- a/src/or/channeltls.c +++ b/src/or/channeltls.c @@ -852,8 +852,8 @@ channel_tls_handle_state_change_on_orconn(channel_tls_t *chan, base_chan = TLS_CHAN_TO_BASE(chan); - /* Make sure the base connection state makes sense - shouldn't be error, - * closed or listening. */ + /* Make sure the base connection state makes sense - shouldn't be error + * or closed. */ tor_assert(CHANNEL_IS_OPENING(base_chan) || CHANNEL_IS_OPEN(base_chan) || From 8b532a8c81577701c1af75d4641f7acb1ce5fc91 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 09:34:55 -0500 Subject: [PATCH 029/120] Short python script to lint the changes files --- scripts/maint/lintChanges.py | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 scripts/maint/lintChanges.py diff --git a/scripts/maint/lintChanges.py b/scripts/maint/lintChanges.py new file mode 100755 index 0000000000..43f2f21685 --- /dev/null +++ b/scripts/maint/lintChanges.py @@ -0,0 +1,46 @@ +#!/usr/bin/python + +import sys +import re + + + +def lintfile(fname): + have_warned = [] + def warn(s): + if not have_warned: + have_warned.append(1) + print fname,":" + print "\t",s + + m = re.search(r'(\d{3,})', fname) + if m: + bugnum = m.group(1) + else: + bugnum = None + + with open(fname) as f: + contents = f.read() + + if bugnum and bugnum not in contents: + warn("bug number %s does not appear"%bugnum) + + lines = contents.split("\n") + isBug = ("bug" in lines[0] or "fix" in lines[0]) + + contents = " ".join(contents.split()) + + if isBug and not re.search(r'(\d+)', contents): + warn("bugfix does not mention a number") + elif isBug and not re.search(r'Fixes bug (\d+)', contents): + warn("bugfix does not say 'Fixes bug XXX'") + + if re.search(r'[bB]ug (\d+)', contents) and not re.search(r'Bugfix on ', contents): + warn("bugfix does not say 'bugfix on X.Y.Z'") + + +if __name__=='__main__': + for fname in sys.argv[1:]: + if fname.endswith("~"): + continue + lintfile(fname) From 441a481bb8ad3639d400f304cc4771e099830cfc Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 09:49:33 -0500 Subject: [PATCH 030/120] Resolve issues in changes files --- changes/bug13936 | 3 ++- changes/bug13942 | 3 ++- changes/bug14001-clang-warning | 2 +- changes/bug14002-osx-transproxy-ipfw-pf | 4 ++-- changes/bug7803 | 2 +- changes/spurious-clang-warnings | 14 ++++++-------- changes/ticket-11291 | 1 + scripts/maint/lintChanges.py | 9 ++++++--- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/changes/bug13936 b/changes/bug13936 index 75dc9cd437..fffbe6837c 100644 --- a/changes/bug13936 +++ b/changes/bug13936 @@ -3,4 +3,5 @@ when a rendezvous circuit is opened because circuit_has_opened() jobs is to call a specialized function depending on the circuit purpose. Furthermore, a controller event will be triggered here where the - former did not. + former did not. Fixes bug 13936; bugfix on 0.1.1.5-alpha. + diff --git a/changes/bug13942 b/changes/bug13942 index f9e4504a48..41efe60729 100644 --- a/changes/bug13942 +++ b/changes/bug13942 @@ -1,5 +1,6 @@ o Minor bugfixes (hidden services): - Pre-check directory permissions for new hidden-services to avoid at least one case of "Bug: Acting on config options left us in a - broken state. Dying." Fixes bug 13942. + broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. + diff --git a/changes/bug14001-clang-warning b/changes/bug14001-clang-warning index b932af6ab7..c93a153854 100644 --- a/changes/bug14001-clang-warning +++ b/changes/bug14001-clang-warning @@ -3,4 +3,4 @@ always be non-NULL. clang recognises this and complains. Disable the tautologous and redundant check to silence this warning. - Fixes bug 14001. + Fixes bug 14001; bugfix on 0.2.1.2-alpha. diff --git a/changes/bug14002-osx-transproxy-ipfw-pf b/changes/bug14002-osx-transproxy-ipfw-pf index a08bbdcbff..8b939979d6 100644 --- a/changes/bug14002-osx-transproxy-ipfw-pf +++ b/changes/bug14002-osx-transproxy-ipfw-pf @@ -1,4 +1,4 @@ - o Minor bugfixes: + o Minor features: - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent proxy option checks to allow for both ipfw and pf on OS X. - Fixes bug 14002. + Closes ticket 14002. diff --git a/changes/bug7803 b/changes/bug7803 index 7a2bba70db..ee38a884df 100644 --- a/changes/bug7803 +++ b/changes/bug7803 @@ -2,4 +2,4 @@ - Tor clients no longer support connecting to hidden services running on Tor 0.2.2.x and earlier; the Support022HiddenServices option has been removed. (There shouldn't be any hidden services running these - versions on the network.) + versions on the network.) Closes ticket 7803. diff --git a/changes/spurious-clang-warnings b/changes/spurious-clang-warnings index d039920476..3ee54027f8 100644 --- a/changes/spurious-clang-warnings +++ b/changes/spurious-clang-warnings @@ -1,10 +1,8 @@ o Minor bugfixes: - Silence clang warnings under --enable-expensive-hardening, including: - + implicit truncation of 64 bit values to 32 bit; - + const char assignment to self; - + tautological compare; and - + additional parentheses around equality tests. (gcc uses these to - silence assignment, so clang warns when they're present in an - equality test. But we need to use extra parentheses in macros to - isolate them from other code). - Fixes bug 13577. + implicit truncation of 64 bit values to 32 bit; + const char assignment to self; + tautological compare; and + additional parentheses around equality tests. + Fixes bug 13577; bugfix on 0.2.5.4-alpha. + diff --git a/changes/ticket-11291 b/changes/ticket-11291 index 4c19f3cd0e..400bae8e31 100644 --- a/changes/ticket-11291 +++ b/changes/ticket-11291 @@ -2,3 +2,4 @@ - New HiddenServiceDirGroupReadable option to cause hidden service directories and hostname files to be created group-readable. Patch from "anon", David Stainton, and "meejah". + Closes ticket 11291. diff --git a/scripts/maint/lintChanges.py b/scripts/maint/lintChanges.py index 43f2f21685..2e57295860 100755 --- a/scripts/maint/lintChanges.py +++ b/scripts/maint/lintChanges.py @@ -32,11 +32,14 @@ def lintfile(fname): if isBug and not re.search(r'(\d+)', contents): warn("bugfix does not mention a number") - elif isBug and not re.search(r'Fixes bug (\d+)', contents): + elif isBug and not re.search(r'Fixes ([a-z ]*)bug (\d+)', contents): warn("bugfix does not say 'Fixes bug XXX'") - if re.search(r'[bB]ug (\d+)', contents) and not re.search(r'Bugfix on ', contents): - warn("bugfix does not say 'bugfix on X.Y.Z'") + if re.search(r'[bB]ug (\d+)', contents): + if not re.search(r'[Bb]ugfix on ', contents): + warn("bugfix does not say 'bugfix on X.Y.Z'") + elif not re.search('[fF]ixes ([a-z ]*)bug (\d+); bugfix on ', contents): + warn("bugfix incant is not semicoloned") if __name__=='__main__': From 845d92295f2e4542763d09c74b522a653326006e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:00:34 -0500 Subject: [PATCH 031/120] have lintchanges check header format. --- changes/bug13678 | 1 - changes/feature13192 | 2 +- scripts/maint/lintChanges.py | 3 +++ scripts/maint/sortChanges.py | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/changes/bug13678 b/changes/bug13678 index d71b88a003..74f6a9816c 100644 --- a/changes/bug13678 +++ b/changes/bug13678 @@ -1,4 +1,3 @@ - o Testing: - In the unit tests, use 'chgrp' to change the group of the unit test temporary directory to the current user, so that the sticky bit doesn't diff --git a/changes/feature13192 b/changes/feature13192 index 8a9741cb47..503979e869 100644 --- a/changes/feature13192 +++ b/changes/feature13192 @@ -1,4 +1,4 @@ -m o Major features (hidden services): + o Major features (hidden services): - Add a HiddenServiceStatistics option that allows Tor relays to gather and publish statistics about hidden service usage, to better understand the size and volume of the hidden service diff --git a/scripts/maint/lintChanges.py b/scripts/maint/lintChanges.py index 2e57295860..fcadc5e505 100755 --- a/scripts/maint/lintChanges.py +++ b/scripts/maint/lintChanges.py @@ -28,6 +28,9 @@ def lintfile(fname): lines = contents.split("\n") isBug = ("bug" in lines[0] or "fix" in lines[0]) + if not re.match(r'^ +o (.*)', contents): + warn("header not in format expected") + contents = " ".join(contents.split()) if isBug and not re.search(r'(\d+)', contents): diff --git a/scripts/maint/sortChanges.py b/scripts/maint/sortChanges.py index 726a723f93..e8153e2848 100755 --- a/scripts/maint/sortChanges.py +++ b/scripts/maint/sortChanges.py @@ -18,10 +18,10 @@ def fetch(fn): s = "%s\n" % s.rstrip() return s -def score(s): +def score(s,fname=None): m = re.match(r'^ +o (.*)', s) if not m: - print >>sys.stderr, "Can't score %r"%s + print >>sys.stderr, "Can't score %r from %s"%(s,fname) lw = m.group(1).lower() if lw.startswith("major feature"): score = 0 @@ -41,7 +41,7 @@ def score(s): return (score, lw, s) -changes = [ score(fetch(fn)) for fn in sys.argv[1:] if not fn.endswith('~') ] +changes = [ score(fetch(fn),fn) for fn in sys.argv[1:] if not fn.endswith('~') ] changes.sort() From f645564778e6a7e8d723b7d4e227ed1d46da60de Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:02:18 -0500 Subject: [PATCH 032/120] Start on a changelog for 0.2.6.2-alpha --- ChangeLog | 221 +++++++++++++++++++++++- changes/bug13126 | 10 -- changes/bug13214 | 7 - changes/bug13296 | 5 - changes/bug13315 | 5 - changes/bug13399 | 12 -- changes/bug13399_part1 | 3 - changes/bug13447 | 5 - changes/bug13644 | 4 - changes/bug13678 | 5 - changes/bug13698 | 6 - changes/bug13701 | 4 - changes/bug13707 | 4 - changes/bug13713 | 3 - changes/bug13840 | 3 - changes/bug13936 | 7 - changes/bug13941 | 6 - changes/bug13942 | 6 - changes/bug14001-clang-warning | 6 - changes/bug14002-osx-transproxy-ipfw-pf | 4 - changes/bug7356 | 5 - changes/bug7484 | 4 - changes/bug7803 | 5 - changes/bug9812 | 6 - changes/doc13381 | 5 - changes/feature13192 | 13 -- changes/feature13212 | 4 - changes/feature9503 | 4 - changes/geoip-november2014 | 3 - changes/geoip6-november2014 | 3 - changes/global_scheduler | 12 -- changes/no_global_ccc | 3 - changes/spurious-clang-warnings | 8 - changes/ticket-11291 | 5 - changes/ticket13172 | 4 - changes/tickets6456 | 6 - 36 files changed, 220 insertions(+), 196 deletions(-) delete mode 100644 changes/bug13126 delete mode 100644 changes/bug13214 delete mode 100644 changes/bug13296 delete mode 100644 changes/bug13315 delete mode 100644 changes/bug13399 delete mode 100644 changes/bug13399_part1 delete mode 100644 changes/bug13447 delete mode 100644 changes/bug13644 delete mode 100644 changes/bug13678 delete mode 100644 changes/bug13698 delete mode 100644 changes/bug13701 delete mode 100644 changes/bug13707 delete mode 100644 changes/bug13713 delete mode 100644 changes/bug13840 delete mode 100644 changes/bug13936 delete mode 100644 changes/bug13941 delete mode 100644 changes/bug13942 delete mode 100644 changes/bug14001-clang-warning delete mode 100644 changes/bug14002-osx-transproxy-ipfw-pf delete mode 100644 changes/bug7356 delete mode 100644 changes/bug7484 delete mode 100644 changes/bug7803 delete mode 100644 changes/bug9812 delete mode 100644 changes/doc13381 delete mode 100644 changes/feature13192 delete mode 100644 changes/feature13212 delete mode 100644 changes/feature9503 delete mode 100644 changes/geoip-november2014 delete mode 100644 changes/geoip6-november2014 delete mode 100644 changes/global_scheduler delete mode 100644 changes/no_global_ccc delete mode 100644 changes/spurious-clang-warnings delete mode 100644 changes/ticket-11291 delete mode 100644 changes/ticket13172 delete mode 100644 changes/tickets6456 diff --git a/ChangeLog b/ChangeLog index f40feedb84..2ce2b5372b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,223 @@ -Changes in version 0.2.6.2-alpha - 2014-1?-?? +Changes in version 0.2.6.2-alpha - 2014-12-?? + + Tor 0.2.6.2-alpha is the second alpha release in the 0.2.6.x series. + + o Major features (hidden services): + - Add a HiddenServiceStatistics option that allows Tor relays to + gather and publish statistics about hidden service usage, to + better understand the size and volume of the hidden service + network. Specifically, if a Tor relay is an HSDir it will + publish the approximate number of hidden services that have + published descriptors to it the past 24 hours. Also, if a relay + has acted as a hidden service rendezvous point, it will publish + the approximate amount of rendezvous cells it has relayed the + past 24 hours. The statistics themselves are obfuscated so that + the exact values cannot be derived. For more details see + proposal 238 "Better hidden service stats from Tor relays". This + feature is currently disabled by default. Implements feature 13192. + + o Major features (relay, infrastructure): + - Implement a new inter-cmux comparison API, a global high/low watermark + mechanism and a global scheduler loop for transmission prioritization + across all channels as well as among circuits on one channel. This + schedule is currently tuned to (tolerantly) avoid making changes + in the current network performance, but it should form the basis + major circuit performance increases. Code by Andrea; implements + ticket 9262. + + o Testing: + - New tests for many parts of channel, relay, and circuit mux + functionality. Code by Andrea; part of 9262. + + o Major bugfixes: + - When closing an introduction circuit that was opened in + parallel, don't mark the introduction point as + unreachable. Previously, the first successful connection to an + introduction point would make the other uintroduction points get + marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. + + o Minor feature: + - When re-enabling the network, don't try to build introduction circuits + until we have successfully built a circuit. This makes hidden services + come up faster when the network is re-enabled. Patch from + "akwizgran". Closes ticket 13447. + + o Minor features (controller): + - Add a "SIGNAL HEARTBEAT" Tor controller command that provokes + writing unscheduled heartbeat message to the log. Implements + feature 9503. + + o Minor features (hidden services): + - Inform Tor controller about nature of failure to retrieve + hidden service descriptor by sending reason string with HS_DESC + FAILED controller event. Implements feature 13212. + + o Minor features (hidden services): + - New HiddenServiceDirGroupReadable option to cause hidden service + directories and hostname files to be created group-readable. + Patch from "anon", David Stainton, and "meejah". + Closes ticket 11291. + + o Minor features: + - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent + proxy option checks to allow for both ipfw and pf on OS X. + Closes ticket 14002. + + o Minor features: + - Update geoip to the November 15 2014 Maxmind GeoLite2 Country database. + + o Minor features: + - Update geoip6 to the November 15 2014 Maxmind GeoLite2 Country database. + + o Minor features: + - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks + is enabled, reject requests with IP addresses as hostnames. Resolves + ticket 13315. + + o Minor bugfixes (hidden services): + - Pre-check directory permissions for new hidden-services to avoid + at least one case of "Bug: Acting on config options left us in a + broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. + + o Minor bugfixes (hidden services): + - When adding a new hidden-service (for example, via SETCONF) Tor + no longer logs a congratulations for running a relay. Fixes bug + 13941; bugfix on 0.2.6.1-alpha. + + o Minor bugfixes (hidden services): + - When fetching hidden service descriptors, check not only for + whether we got the hidden service we had in mind, but also + whether we got the particular descriptors we wanted. This + prevents a class of inefficient but annoying DoS attacks by + hidden service directories. Fixes bug 13214; bugfix on + 0.2.1.6-alpha. Reported by "special". + + o Minor bugfixes (logging): + - Downgrade warnings about RSA signature failures to info log + level. Emit a warning when extra info document is found + incompatible with a corresponding router descriptor. Fixes bug + 9812; bugfix on 0.0.6rc3. + + o Minor bugfixes (logging): + - Log the circuit identifier correctly in + connection_ap_handshake_attach_circuit(). Fixes bug 13701; + bugfix on 0.0.6. + + o Minor bugfixes: + - Silence clang warnings under --enable-expensive-hardening, including: + implicit truncation of 64 bit values to 32 bit; + const char assignment to self; + tautological compare; and + additional parentheses around equality tests. + Fixes bug 13577; bugfix on 0.2.5.4-alpha. + + o Minor bugfixes: + - Stop allowing invalid address patterns containing both a wildcard + address and a bit prefix length. This affects all our + address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. + + o Minor bugfixes: + - The address of an array in the middle of a structure will + always be non-NULL. clang recognises this and complains. + Disable the tautologous and redundant check to silence + this warning. + Fixes bug 14001; bugfix on 0.2.1.2-alpha. + + o Minor bugfixes: + - Use a full 256 bits of the SHA256 digest of a microdescriptor when + computing which microdescriptors to download. This keeps us from + erroneous download behavior if two microdescriptor digests ever have + the same first 160 bits. Fixes part of bug 13399; bugfix on + 0.2.3.1-alpha. + + - Reset a router's status if its microdescriptor digest changes, + even if the first 160 bits remain the same. Fixes part of bug + 13399; bugfix on 0.2.3.1-alpha. + + o Minor bugfixes: + - Use circuit_has_opened() instead of rend_client_rendcirc_has_opened() + when a rendezvous circuit is opened because circuit_has_opened() jobs + is to call a specialized function depending on the circuit purpose. + Furthermore, a controller event will be triggered here where the + former did not. Fixes bug 13936; bugfix on 0.1.1.5-alpha. + + o Code Simplification and Refactoring: + - Stop using can_complete_circuits as a global variable; access it with + a function instead. + + o Code simplification and refactoring: + + - Remove our old, non-weighted bandwidth-based node selection code. + Previously, we used it as a fallback when we couldn't perform + weighted bandwidth-based node selection. But that would only + happen in the cases where we had no consensus, or when we had a + consensus generated by buggy or ancient directory authorities. In + either case, it's better to use the more modern, better maintained + algorithm, with reasonable defaults for the weights. Closes + ticket 13126. + + o Code simplification and refactoring: + - Avoid using operators directly as macro arguments: this lets us + apply coccinelle transformations to our codebase more + directly. Closes ticket 13172. + + o Code simplification and refactoring: + - Combine the functions used to parse ClientTransportPlugin and + ServerTransportPlugin into a single function. Closes ticket 6456. + + o Testing: + - New tests for parse_transport_line(). Part of ticket 6456. + + o Code simplifications and refactoring: + - Add inline functions and convenience macros for quick lookup of + state component of channel_t structure. Refactor various parts of + codebase to use convenience macros instead of checking state + member of channel_t directly. Fixes issue 7356. + + o Code simplifications and refactoring: + - Document all members of was_router_added_t enum and rename + ROUTER_WAS_NOT_NEW to ROUTER_IS_ALREADY_KNOWN to make it less + confusable with ROUTER_WAS_TOO_OLD. Fixes issue 13644. + + o Code simplifications and refactoring: + - In connection_exit_begin_conn(), use END_CIRC_REASON_TORPROTOCOL + constant instead of hardcoded value. Fixes issue 13840. + + o Code simplifications and refactoring: + - Refactor our generic strmap and digestmap types into a single + implementation, so that we can add a new digest256map type trivially. + + o Directory authority changes: + - Remove turtles as a directory authority. + - Add longclaw as a new (v3) directory authority. This implements + ticket 13296. This keeps the directory authority count at 9. + + o Documentation: + - Document the bridge-authority-only 'networkstatus-bridges' + file. Closes ticket 13713; patch from "tom". + + o Documentation: + - Fix typo in PredictedPortsRelevanceTime option description in + manpage. Resolves issue 13707. + + o Documentation: + - Stop suggesting that users specify nodes by nickname: it isn't a + good idea. Also, properly cross-reference how to specify nodes + in all parts of the manual for options that take a list of + nodes. Closes ticket 13381. + + o Removed features: + - Tor clients no longer support connecting to hidden services running on + Tor 0.2.2.x and earlier; the Support022HiddenServices option has been + removed. (There shouldn't be any hidden services running these + versions on the network.) Closes ticket 7803. + + o Testing: + - In the unit tests, use 'chgrp' to change the group of the unit test + temporary directory to the current user, so that the sticky bit doesn't + interfere with tests that check directory groups. Closes 13678. + + Changes in version 0.2.6.1-alpha - 2014-10-30 diff --git a/changes/bug13126 b/changes/bug13126 deleted file mode 100644 index 45d22ee3f3..0000000000 --- a/changes/bug13126 +++ /dev/null @@ -1,10 +0,0 @@ - o Code simplification and refactoring: - - - Remove our old, non-weighted bandwidth-based node selection code. - Previously, we used it as a fallback when we couldn't perform - weighted bandwidth-based node selection. But that would only - happen in the cases where we had no consensus, or when we had a - consensus generated by buggy or ancient directory authorities. In - either case, it's better to use the more modern, better maintained - algorithm, with reasonable defaults for the weights. Closes - ticket 13126. \ No newline at end of file diff --git a/changes/bug13214 b/changes/bug13214 deleted file mode 100644 index 5b9758b388..0000000000 --- a/changes/bug13214 +++ /dev/null @@ -1,7 +0,0 @@ - o Minor bugfixes (hidden services): - - When fetching hidden service descriptors, check not only for - whether we got the hidden service we had in mind, but also - whether we got the particular descriptors we wanted. This - prevents a class of inefficient but annoying DoS attacks by - hidden service directories. Fixes bug 13214; bugfix on - 0.2.1.6-alpha. Reported by "special". diff --git a/changes/bug13296 b/changes/bug13296 deleted file mode 100644 index d6fe038c30..0000000000 --- a/changes/bug13296 +++ /dev/null @@ -1,5 +0,0 @@ - o Directory authority changes: - - Remove turtles as a directory authority. - - Add longclaw as a new (v3) directory authority. This implements - ticket 13296. This keeps the directory authority count at 9. - diff --git a/changes/bug13315 b/changes/bug13315 deleted file mode 100644 index c2ae5ff1f8..0000000000 --- a/changes/bug13315 +++ /dev/null @@ -1,5 +0,0 @@ - o Minor features: - - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks - is enabled, reject requests with IP addresses as hostnames. Resolves - ticket 13315. - diff --git a/changes/bug13399 b/changes/bug13399 deleted file mode 100644 index fcaf58a53c..0000000000 --- a/changes/bug13399 +++ /dev/null @@ -1,12 +0,0 @@ - o Minor bugfixes: - - Use a full 256 bits of the SHA256 digest of a microdescriptor when - computing which microdescriptors to download. This keeps us from - erroneous download behavior if two microdescriptor digests ever have - the same first 160 bits. Fixes part of bug 13399; bugfix on - 0.2.3.1-alpha. - - - Reset a router's status if its microdescriptor digest changes, - even if the first 160 bits remain the same. Fixes part of bug - 13399; bugfix on 0.2.3.1-alpha. - - diff --git a/changes/bug13399_part1 b/changes/bug13399_part1 deleted file mode 100644 index 2ad3f8d77e..0000000000 --- a/changes/bug13399_part1 +++ /dev/null @@ -1,3 +0,0 @@ - o Code simplifications and refactoring: - - Refactor our generic strmap and digestmap types into a single - implementation, so that we can add a new digest256map type trivially. diff --git a/changes/bug13447 b/changes/bug13447 deleted file mode 100644 index 90027e8f3a..0000000000 --- a/changes/bug13447 +++ /dev/null @@ -1,5 +0,0 @@ - o Minor feature: - - When re-enabling the network, don't try to build introduction circuits - until we have successfully built a circuit. This makes hidden services - come up faster when the network is re-enabled. Patch from - "akwizgran". Closes ticket 13447. diff --git a/changes/bug13644 b/changes/bug13644 deleted file mode 100644 index 959ce65fc9..0000000000 --- a/changes/bug13644 +++ /dev/null @@ -1,4 +0,0 @@ - o Code simplifications and refactoring: - - Document all members of was_router_added_t enum and rename - ROUTER_WAS_NOT_NEW to ROUTER_IS_ALREADY_KNOWN to make it less - confusable with ROUTER_WAS_TOO_OLD. Fixes issue 13644. diff --git a/changes/bug13678 b/changes/bug13678 deleted file mode 100644 index 74f6a9816c..0000000000 --- a/changes/bug13678 +++ /dev/null @@ -1,5 +0,0 @@ - o Testing: - - In the unit tests, use 'chgrp' to change the group of the unit test - temporary directory to the current user, so that the sticky bit doesn't - interfere with tests that check directory groups. Closes 13678. - diff --git a/changes/bug13698 b/changes/bug13698 deleted file mode 100644 index 9af22345b8..0000000000 --- a/changes/bug13698 +++ /dev/null @@ -1,6 +0,0 @@ - o Major bugfixes: - - When closing an introduction circuit that was opened in - parallel, don't mark the introduction point as - unreachable. Previously, the first successful connection to an - introduction point would make the other uintroduction points get - marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. diff --git a/changes/bug13701 b/changes/bug13701 deleted file mode 100644 index 23a08afa47..0000000000 --- a/changes/bug13701 +++ /dev/null @@ -1,4 +0,0 @@ - o Minor bugfixes (logging): - - Log the circuit identifier correctly in - connection_ap_handshake_attach_circuit(). Fixes bug 13701; - bugfix on 0.0.6. diff --git a/changes/bug13707 b/changes/bug13707 deleted file mode 100644 index 349495c9c7..0000000000 --- a/changes/bug13707 +++ /dev/null @@ -1,4 +0,0 @@ - o Documentation: - - Fix typo in PredictedPortsRelevanceTime option description in - manpage. Resolves issue 13707. - diff --git a/changes/bug13713 b/changes/bug13713 deleted file mode 100644 index 412b406c53..0000000000 --- a/changes/bug13713 +++ /dev/null @@ -1,3 +0,0 @@ - o Documentation: - - Document the bridge-authority-only 'networkstatus-bridges' - file. Closes ticket 13713; patch from "tom". diff --git a/changes/bug13840 b/changes/bug13840 deleted file mode 100644 index a7204e4a9c..0000000000 --- a/changes/bug13840 +++ /dev/null @@ -1,3 +0,0 @@ - o Code simplifications and refactoring: - - In connection_exit_begin_conn(), use END_CIRC_REASON_TORPROTOCOL - constant instead of hardcoded value. Fixes issue 13840. diff --git a/changes/bug13936 b/changes/bug13936 deleted file mode 100644 index fffbe6837c..0000000000 --- a/changes/bug13936 +++ /dev/null @@ -1,7 +0,0 @@ - o Minor bugfixes: - - Use circuit_has_opened() instead of rend_client_rendcirc_has_opened() - when a rendezvous circuit is opened because circuit_has_opened() jobs - is to call a specialized function depending on the circuit purpose. - Furthermore, a controller event will be triggered here where the - former did not. Fixes bug 13936; bugfix on 0.1.1.5-alpha. - diff --git a/changes/bug13941 b/changes/bug13941 deleted file mode 100644 index 6309378510..0000000000 --- a/changes/bug13941 +++ /dev/null @@ -1,6 +0,0 @@ - o Minor bugfixes (hidden services): - - When adding a new hidden-service (for example, via SETCONF) Tor - no longer logs a congratulations for running a relay. Fixes bug - 13941; bugfix on 0.2.6.1-alpha. - - diff --git a/changes/bug13942 b/changes/bug13942 deleted file mode 100644 index 41efe60729..0000000000 --- a/changes/bug13942 +++ /dev/null @@ -1,6 +0,0 @@ - o Minor bugfixes (hidden services): - - Pre-check directory permissions for new hidden-services to avoid - at least one case of "Bug: Acting on config options left us in a - broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. - - diff --git a/changes/bug14001-clang-warning b/changes/bug14001-clang-warning deleted file mode 100644 index c93a153854..0000000000 --- a/changes/bug14001-clang-warning +++ /dev/null @@ -1,6 +0,0 @@ - o Minor bugfixes: - - The address of an array in the middle of a structure will - always be non-NULL. clang recognises this and complains. - Disable the tautologous and redundant check to silence - this warning. - Fixes bug 14001; bugfix on 0.2.1.2-alpha. diff --git a/changes/bug14002-osx-transproxy-ipfw-pf b/changes/bug14002-osx-transproxy-ipfw-pf deleted file mode 100644 index 8b939979d6..0000000000 --- a/changes/bug14002-osx-transproxy-ipfw-pf +++ /dev/null @@ -1,4 +0,0 @@ - o Minor features: - - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent - proxy option checks to allow for both ipfw and pf on OS X. - Closes ticket 14002. diff --git a/changes/bug7356 b/changes/bug7356 deleted file mode 100644 index be31d1fa64..0000000000 --- a/changes/bug7356 +++ /dev/null @@ -1,5 +0,0 @@ - o Code simplifications and refactoring: - - Add inline functions and convenience macros for quick lookup of - state component of channel_t structure. Refactor various parts of - codebase to use convenience macros instead of checking state - member of channel_t directly. Fixes issue 7356. diff --git a/changes/bug7484 b/changes/bug7484 deleted file mode 100644 index 647992af05..0000000000 --- a/changes/bug7484 +++ /dev/null @@ -1,4 +0,0 @@ - o Minor bugfixes: - - Stop allowing invalid address patterns containing both a wildcard - address and a bit prefix length. This affects all our - address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. diff --git a/changes/bug7803 b/changes/bug7803 deleted file mode 100644 index ee38a884df..0000000000 --- a/changes/bug7803 +++ /dev/null @@ -1,5 +0,0 @@ - o Removed features: - - Tor clients no longer support connecting to hidden services running on - Tor 0.2.2.x and earlier; the Support022HiddenServices option has been - removed. (There shouldn't be any hidden services running these - versions on the network.) Closes ticket 7803. diff --git a/changes/bug9812 b/changes/bug9812 deleted file mode 100644 index 8791589faf..0000000000 --- a/changes/bug9812 +++ /dev/null @@ -1,6 +0,0 @@ - o Minor bugfixes (logging): - - Downgrade warnings about RSA signature failures to info log - level. Emit a warning when extra info document is found - incompatible with a corresponding router descriptor. Fixes bug - 9812; bugfix on 0.0.6rc3. - diff --git a/changes/doc13381 b/changes/doc13381 deleted file mode 100644 index acc4bb8a0f..0000000000 --- a/changes/doc13381 +++ /dev/null @@ -1,5 +0,0 @@ - o Documentation: - - Stop suggesting that users specify nodes by nickname: it isn't a - good idea. Also, properly cross-reference how to specify nodes - in all parts of the manual for options that take a list of - nodes. Closes ticket 13381. diff --git a/changes/feature13192 b/changes/feature13192 deleted file mode 100644 index 503979e869..0000000000 --- a/changes/feature13192 +++ /dev/null @@ -1,13 +0,0 @@ - o Major features (hidden services): - - Add a HiddenServiceStatistics option that allows Tor relays to - gather and publish statistics about hidden service usage, to - better understand the size and volume of the hidden service - network. Specifically, if a Tor relay is an HSDir it will - publish the approximate number of hidden services that have - published descriptors to it the past 24 hours. Also, if a relay - has acted as a hidden service rendezvous point, it will publish - the approximate amount of rendezvous cells it has relayed the - past 24 hours. The statistics themselves are obfuscated so that - the exact values cannot be derived. For more details see - proposal 238 "Better hidden service stats from Tor relays". This - feature is currently disabled by default. Implements feature 13192. diff --git a/changes/feature13212 b/changes/feature13212 deleted file mode 100644 index 6f1bce7d8a..0000000000 --- a/changes/feature13212 +++ /dev/null @@ -1,4 +0,0 @@ - o Minor features (hidden services): - - Inform Tor controller about nature of failure to retrieve - hidden service descriptor by sending reason string with HS_DESC - FAILED controller event. Implements feature 13212. diff --git a/changes/feature9503 b/changes/feature9503 deleted file mode 100644 index 58ae67f184..0000000000 --- a/changes/feature9503 +++ /dev/null @@ -1,4 +0,0 @@ - o Minor features (controller): - - Add a "SIGNAL HEARTBEAT" Tor controller command that provokes - writing unscheduled heartbeat message to the log. Implements - feature 9503. diff --git a/changes/geoip-november2014 b/changes/geoip-november2014 deleted file mode 100644 index 52cbeb3e41..0000000000 --- a/changes/geoip-november2014 +++ /dev/null @@ -1,3 +0,0 @@ - o Minor features: - - Update geoip to the November 15 2014 Maxmind GeoLite2 Country database. - diff --git a/changes/geoip6-november2014 b/changes/geoip6-november2014 deleted file mode 100644 index e91fcc0d3b..0000000000 --- a/changes/geoip6-november2014 +++ /dev/null @@ -1,3 +0,0 @@ - o Minor features: - - Update geoip6 to the November 15 2014 Maxmind GeoLite2 Country database. - diff --git a/changes/global_scheduler b/changes/global_scheduler deleted file mode 100644 index df3b464f91..0000000000 --- a/changes/global_scheduler +++ /dev/null @@ -1,12 +0,0 @@ - o Major features (relay, infrastructure): - - Implement a new inter-cmux comparison API, a global high/low watermark - mechanism and a global scheduler loop for transmission prioritization - across all channels as well as among circuits on one channel. This - schedule is currently tuned to (tolerantly) avoid making changes - in the current network performance, but it should form the basis - major circuit performance increases. Code by Andrea; implements - ticket 9262. - - o Testing: - - New tests for many parts of channel, relay, and circuit mux - functionality. Code by Andrea; part of 9262. diff --git a/changes/no_global_ccc b/changes/no_global_ccc deleted file mode 100644 index 614055a845..0000000000 --- a/changes/no_global_ccc +++ /dev/null @@ -1,3 +0,0 @@ - o Code Simplification and Refactoring: - - Stop using can_complete_circuits as a global variable; access it with - a function instead. diff --git a/changes/spurious-clang-warnings b/changes/spurious-clang-warnings deleted file mode 100644 index 3ee54027f8..0000000000 --- a/changes/spurious-clang-warnings +++ /dev/null @@ -1,8 +0,0 @@ - o Minor bugfixes: - - Silence clang warnings under --enable-expensive-hardening, including: - implicit truncation of 64 bit values to 32 bit; - const char assignment to self; - tautological compare; and - additional parentheses around equality tests. - Fixes bug 13577; bugfix on 0.2.5.4-alpha. - diff --git a/changes/ticket-11291 b/changes/ticket-11291 deleted file mode 100644 index 400bae8e31..0000000000 --- a/changes/ticket-11291 +++ /dev/null @@ -1,5 +0,0 @@ - o Minor features (hidden services): - - New HiddenServiceDirGroupReadable option to cause hidden service - directories and hostname files to be created group-readable. - Patch from "anon", David Stainton, and "meejah". - Closes ticket 11291. diff --git a/changes/ticket13172 b/changes/ticket13172 deleted file mode 100644 index a1d47fd9cf..0000000000 --- a/changes/ticket13172 +++ /dev/null @@ -1,4 +0,0 @@ - o Code simplification and refactoring: - - Avoid using operators directly as macro arguments: this lets us - apply coccinelle transformations to our codebase more - directly. Closes ticket 13172. \ No newline at end of file diff --git a/changes/tickets6456 b/changes/tickets6456 deleted file mode 100644 index 68ce2c7dd9..0000000000 --- a/changes/tickets6456 +++ /dev/null @@ -1,6 +0,0 @@ - o Code simplification and refactoring: - - Combine the functions used to parse ClientTransportPlugin and - ServerTransportPlugin into a single function. Closes ticket 6456. - - o Testing: - - New tests for parse_transport_line(). Part of ticket 6456. From 0f5303f08a4c703431259799200e36b1c8cb9eda Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:03:19 -0500 Subject: [PATCH 033/120] Auto-reformat the changelog for 0.2.6.2-alpha --- ChangeLog | 263 +++++++++++++++++++++++------------------------------- 1 file changed, 110 insertions(+), 153 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ce2b5372b..87a0b3d292 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,46 +1,55 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? - Tor 0.2.6.2-alpha is the second alpha release in the 0.2.6.x series. + o Major features (relay, infrastructure): - Implement a new inter-cmux + comparison API, a global high/low watermark mechanism and a global + scheduler loop for transmission prioritization across all channels as + well as among circuits on one channel. This schedule is currently + tuned to (tolerantly) avoid making changes in the current network + performance, but it should form the basis major circuit performance + increases. Code by Andrea; implements ticket 9262. + + o Testing: - New tests for many parts of channel, relay, and circuit + mux functionality. Code by Andrea; part of 9262. + o Major features (hidden services): - Add a HiddenServiceStatistics option that allows Tor relays to gather and publish statistics about hidden service usage, to better understand the size and volume of the hidden service - network. Specifically, if a Tor relay is an HSDir it will - publish the approximate number of hidden services that have - published descriptors to it the past 24 hours. Also, if a relay - has acted as a hidden service rendezvous point, it will publish - the approximate amount of rendezvous cells it has relayed the - past 24 hours. The statistics themselves are obfuscated so that - the exact values cannot be derived. For more details see - proposal 238 "Better hidden service stats from Tor relays". This - feature is currently disabled by default. Implements feature 13192. - - o Major features (relay, infrastructure): - - Implement a new inter-cmux comparison API, a global high/low watermark - mechanism and a global scheduler loop for transmission prioritization - across all channels as well as among circuits on one channel. This - schedule is currently tuned to (tolerantly) avoid making changes - in the current network performance, but it should form the basis - major circuit performance increases. Code by Andrea; implements - ticket 9262. - - o Testing: - - New tests for many parts of channel, relay, and circuit mux - functionality. Code by Andrea; part of 9262. + network. Specifically, if a Tor relay is an HSDir it will publish + the approximate number of hidden services that have published + descriptors to it the past 24 hours. Also, if a relay has acted as + a hidden service rendezvous point, it will publish the approximate + amount of rendezvous cells it has relayed the past 24 hours. The + statistics themselves are obfuscated so that the exact values + cannot be derived. For more details see proposal 238 "Better + hidden service stats from Tor relays". This feature is currently + disabled by default. Implements feature 13192. o Major bugfixes: - - When closing an introduction circuit that was opened in - parallel, don't mark the introduction point as - unreachable. Previously, the first successful connection to an - introduction point would make the other uintroduction points get - marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. + - When closing an introduction circuit that was opened in parallel, + don't mark the introduction point as unreachable. Previously, the + first successful connection to an introduction point would make + the other uintroduction points get marked as having timed out. + Fixes bug 13698; bugfix on 0.0.6rc2. o Minor feature: - - When re-enabling the network, don't try to build introduction circuits - until we have successfully built a circuit. This makes hidden services - come up faster when the network is re-enabled. Patch from - "akwizgran". Closes ticket 13447. + - When re-enabling the network, don't try to build introduction + circuits until we have successfully built a circuit. This makes + hidden services come up faster when the network is re-enabled. + Patch from "akwizgran". Closes ticket 13447. + + o Minor features: + - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent + proxy option checks to allow for both ipfw and pf on OS X. Closes + ticket 14002. + - Update geoip to the November 15 2014 Maxmind GeoLite2 + Country database. + - Update geoip6 to the November 15 2014 Maxmind GeoLite2 + Country database. + - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks + is enabled, reject requests with IP addresses as hostnames. + Resolves ticket 13315. o Minor features (controller): - Add a "SIGNAL HEARTBEAT" Tor controller command that provokes @@ -48,144 +57,96 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? feature 9503. o Minor features (hidden services): - - Inform Tor controller about nature of failure to retrieve - hidden service descriptor by sending reason string with HS_DESC - FAILED controller event. Implements feature 13212. - - o Minor features (hidden services): + - Inform Tor controller about nature of failure to retrieve hidden + service descriptor by sending reason string with HS_DESC FAILED + controller event. Implements feature 13212. - New HiddenServiceDirGroupReadable option to cause hidden service - directories and hostname files to be created group-readable. - Patch from "anon", David Stainton, and "meejah". - Closes ticket 11291. + directories and hostname files to be created group-readable. Patch + from "anon", David Stainton, and "meejah". Closes ticket 11291. - o Minor features: - - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent - proxy option checks to allow for both ipfw and pf on OS X. - Closes ticket 14002. - - o Minor features: - - Update geoip to the November 15 2014 Maxmind GeoLite2 Country database. - - o Minor features: - - Update geoip6 to the November 15 2014 Maxmind GeoLite2 Country database. - - o Minor features: - - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks - is enabled, reject requests with IP addresses as hostnames. Resolves - ticket 13315. + o Minor bugfixes: + - Silence clang warnings under --enable-expensive-hardening, + including: implicit truncation of 64 bit values to 32 bit; const + char assignment to self; tautological compare; and additional + parentheses around equality tests. Fixes bug 13577; bugfix + on 0.2.5.4-alpha. + - Stop allowing invalid address patterns containing both a wildcard + address and a bit prefix length. This affects all our address- + range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. + - The address of an array in the middle of a structure will always + be non-NULL. clang recognises this and complains. Disable the + tautologous and redundant check to silence this warning. Fixes bug + 14001; bugfix on 0.2.1.2-alpha. + - Use a full 256 bits of the SHA256 digest of a microdescriptor when + computing which microdescriptors to download. This keeps us from + erroneous download behavior if two microdescriptor digests ever + have the same first 160 bits. Fixes part of bug 13399; bugfix + on 0.2.3.1-alpha. + - Reset a router's status if its microdescriptor digest changes, + even if the first 160 bits remain the same. Fixes part of bug + 13399; bugfix on 0.2.3.1-alpha. + - Use circuit_has_opened() instead of + rend_client_rendcirc_has_opened() when a rendezvous circuit is + opened because circuit_has_opened() jobs is to call a specialized + function depending on the circuit purpose. Furthermore, a + controller event will be triggered here where the former did not. + Fixes bug 13936; bugfix on 0.1.1.5-alpha. o Minor bugfixes (hidden services): - Pre-check directory permissions for new hidden-services to avoid at least one case of "Bug: Acting on config options left us in a broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. - - o Minor bugfixes (hidden services): - - When adding a new hidden-service (for example, via SETCONF) Tor - no longer logs a congratulations for running a relay. Fixes bug + - When adding a new hidden-service (for example, via SETCONF) Tor no + longer logs a congratulations for running a relay. Fixes bug 13941; bugfix on 0.2.6.1-alpha. - - o Minor bugfixes (hidden services): - When fetching hidden service descriptors, check not only for - whether we got the hidden service we had in mind, but also - whether we got the particular descriptors we wanted. This - prevents a class of inefficient but annoying DoS attacks by - hidden service directories. Fixes bug 13214; bugfix on - 0.2.1.6-alpha. Reported by "special". - - o Minor bugfixes (logging): - - Downgrade warnings about RSA signature failures to info log - level. Emit a warning when extra info document is found - incompatible with a corresponding router descriptor. Fixes bug - 9812; bugfix on 0.0.6rc3. + whether we got the hidden service we had in mind, but also whether + we got the particular descriptors we wanted. This prevents a class + of inefficient but annoying DoS attacks by hidden service + directories. Fixes bug 13214; bugfix on 0.2.1.6-alpha. Reported + by "special". o Minor bugfixes (logging): + - Downgrade warnings about RSA signature failures to info log level. + Emit a warning when extra info document is found incompatible with + a corresponding router descriptor. Fixes bug 9812; bugfix + on 0.0.6rc3. - Log the circuit identifier correctly in - connection_ap_handshake_attach_circuit(). Fixes bug 13701; - bugfix on 0.0.6. - - o Minor bugfixes: - - Silence clang warnings under --enable-expensive-hardening, including: - implicit truncation of 64 bit values to 32 bit; - const char assignment to self; - tautological compare; and - additional parentheses around equality tests. - Fixes bug 13577; bugfix on 0.2.5.4-alpha. - - o Minor bugfixes: - - Stop allowing invalid address patterns containing both a wildcard - address and a bit prefix length. This affects all our - address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. - - o Minor bugfixes: - - The address of an array in the middle of a structure will - always be non-NULL. clang recognises this and complains. - Disable the tautologous and redundant check to silence - this warning. - Fixes bug 14001; bugfix on 0.2.1.2-alpha. - - o Minor bugfixes: - - Use a full 256 bits of the SHA256 digest of a microdescriptor when - computing which microdescriptors to download. This keeps us from - erroneous download behavior if two microdescriptor digests ever have - the same first 160 bits. Fixes part of bug 13399; bugfix on - 0.2.3.1-alpha. - - - Reset a router's status if its microdescriptor digest changes, - even if the first 160 bits remain the same. Fixes part of bug - 13399; bugfix on 0.2.3.1-alpha. - - o Minor bugfixes: - - Use circuit_has_opened() instead of rend_client_rendcirc_has_opened() - when a rendezvous circuit is opened because circuit_has_opened() jobs - is to call a specialized function depending on the circuit purpose. - Furthermore, a controller event will be triggered here where the - former did not. Fixes bug 13936; bugfix on 0.1.1.5-alpha. + connection_ap_handshake_attach_circuit(). Fixes bug 13701; bugfix + on 0.0.6. o Code Simplification and Refactoring: - - Stop using can_complete_circuits as a global variable; access it with - a function instead. + - Stop using can_complete_circuits as a global variable; access it + with a function instead. o Code simplification and refactoring: - - Remove our old, non-weighted bandwidth-based node selection code. Previously, we used it as a fallback when we couldn't perform - weighted bandwidth-based node selection. But that would only + weighted bandwidth-based node selection. But that would only happen in the cases where we had no consensus, or when we had a - consensus generated by buggy or ancient directory authorities. In + consensus generated by buggy or ancient directory authorities. In either case, it's better to use the more modern, better maintained algorithm, with reasonable defaults for the weights. Closes ticket 13126. - - o Code simplification and refactoring: - Avoid using operators directly as macro arguments: this lets us - apply coccinelle transformations to our codebase more - directly. Closes ticket 13172. - - o Code simplification and refactoring: + apply coccinelle transformations to our codebase more directly. + Closes ticket 13172. - Combine the functions used to parse ClientTransportPlugin and ServerTransportPlugin into a single function. Closes ticket 6456. - o Testing: - - New tests for parse_transport_line(). Part of ticket 6456. - o Code simplifications and refactoring: - Add inline functions and convenience macros for quick lookup of state component of channel_t structure. Refactor various parts of codebase to use convenience macros instead of checking state member of channel_t directly. Fixes issue 7356. - - o Code simplifications and refactoring: - - Document all members of was_router_added_t enum and rename + - Document all members of was_router_added_t enum and rename ROUTER_WAS_NOT_NEW to ROUTER_IS_ALREADY_KNOWN to make it less confusable with ROUTER_WAS_TOO_OLD. Fixes issue 13644. - - o Code simplifications and refactoring: - In connection_exit_begin_conn(), use END_CIRC_REASON_TORPROTOCOL constant instead of hardcoded value. Fixes issue 13840. - - o Code simplifications and refactoring: - Refactor our generic strmap and digestmap types into a single - implementation, so that we can add a new digest256map type trivially. + implementation, so that we can add a new digest256map + type trivially. o Directory authority changes: - Remove turtles as a directory authority. @@ -193,31 +154,27 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? ticket 13296. This keeps the directory authority count at 9. o Documentation: - - Document the bridge-authority-only 'networkstatus-bridges' - file. Closes ticket 13713; patch from "tom". - - o Documentation: - - Fix typo in PredictedPortsRelevanceTime option description in + - Document the bridge-authority-only 'networkstatus-bridges' file. + Closes ticket 13713; patch from "tom". + - Fix typo in PredictedPortsRelevanceTime option description in manpage. Resolves issue 13707. - - o Documentation: - Stop suggesting that users specify nodes by nickname: it isn't a - good idea. Also, properly cross-reference how to specify nodes - in all parts of the manual for options that take a list of - nodes. Closes ticket 13381. + good idea. Also, properly cross-reference how to specify nodes in + all parts of the manual for options that take a list of nodes. + Closes ticket 13381. o Removed features: - - Tor clients no longer support connecting to hidden services running on - Tor 0.2.2.x and earlier; the Support022HiddenServices option has been - removed. (There shouldn't be any hidden services running these - versions on the network.) Closes ticket 7803. + - Tor clients no longer support connecting to hidden services + running on Tor 0.2.2.x and earlier; the Support022HiddenServices + option has been removed. (There shouldn't be any hidden services + running these versions on the network.) Closes ticket 7803. o Testing: - - In the unit tests, use 'chgrp' to change the group of the unit test - temporary directory to the current user, so that the sticky bit doesn't - interfere with tests that check directory groups. Closes 13678. - - + - New tests for parse_transport_line(). Part of ticket 6456. + - In the unit tests, use 'chgrp' to change the group of the unit + test temporary directory to the current user, so that the sticky + bit doesn't interfere with tests that check directory groups. + Closes 13678. Changes in version 0.2.6.1-alpha - 2014-10-30 From c12b2e1cce33f2b84788d21e8dabb92b8b19da57 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:06:56 -0500 Subject: [PATCH 034/120] minor teaks fo the changelog --- ChangeLog | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87a0b3d292..fe31a82e94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,6 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? Tor 0.2.6.2-alpha is the second alpha release in the 0.2.6.x series. - o Major features (relay, infrastructure): - Implement a new inter-cmux - comparison API, a global high/low watermark mechanism and a global - scheduler loop for transmission prioritization across all channels as - well as among circuits on one channel. This schedule is currently - tuned to (tolerantly) avoid making changes in the current network - performance, but it should form the basis major circuit performance - increases. Code by Andrea; implements ticket 9262. - - o Testing: - New tests for many parts of channel, relay, and circuit - mux functionality. Code by Andrea; part of 9262. - o Major features (hidden services): - Add a HiddenServiceStatistics option that allows Tor relays to gather and publish statistics about hidden service usage, to @@ -26,11 +15,20 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? hidden service stats from Tor relays". This feature is currently disabled by default. Implements feature 13192. + o Major features (relay, infrastructure): + - Implement a new inter-cmux comparison API, a global high/low + watermark mechanism and a global scheduler loop for transmission + prioritization across all channels as well as among circuits on + one channel. This schedule is currently tuned to (tolerantly) + avoid making changes in the current network performance, but it + should form the basis major circuit performance increases. Code by + Andrea; implements ticket 9262. + o Major bugfixes: - When closing an introduction circuit that was opened in parallel, don't mark the introduction point as unreachable. Previously, the first successful connection to an introduction point would make - the other uintroduction points get marked as having timed out. + the other introduction points get marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. o Minor feature: @@ -170,6 +168,8 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? running these versions on the network.) Closes ticket 7803. o Testing: + - New tests for many parts of channel, relay, and circuit mux + functionality. Code by Andrea; part of 9262. - New tests for parse_transport_line(). Part of ticket 6456. - In the unit tests, use 'chgrp' to change the group of the unit test temporary directory to the current user, so that the sticky From 8f242a72e748b89bb8b5c369e6bfd5173ddb3176 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:12:43 -0500 Subject: [PATCH 035/120] Relabel some changelog items; re-sort them into place --- ChangeLog | 76 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe31a82e94..03b59a8cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,30 +21,17 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? prioritization across all channels as well as among circuits on one channel. This schedule is currently tuned to (tolerantly) avoid making changes in the current network performance, but it - should form the basis major circuit performance increases. Code by - Andrea; implements ticket 9262. + should form the basis for major circuit performance increases. + Code by Andrea; implements ticket 9262. - o Major bugfixes: + o Major bugfixes (hidden services): - When closing an introduction circuit that was opened in parallel, don't mark the introduction point as unreachable. Previously, the first successful connection to an introduction point would make the other introduction points get marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. - o Minor feature: - - When re-enabling the network, don't try to build introduction - circuits until we have successfully built a circuit. This makes - hidden services come up faster when the network is re-enabled. - Patch from "akwizgran". Closes ticket 13447. - - o Minor features: - - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent - proxy option checks to allow for both ipfw and pf on OS X. Closes - ticket 14002. - - Update geoip to the November 15 2014 Maxmind GeoLite2 - Country database. - - Update geoip6 to the November 15 2014 Maxmind GeoLite2 - Country database. + o Minor features (client): - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks is enabled, reject requests with IP addresses as hostnames. Resolves ticket 13315. @@ -54,7 +41,17 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? writing unscheduled heartbeat message to the log. Implements feature 9503. + o Minor features (geoip): + - Update geoip to the November 15 2014 Maxmind GeoLite2 + Country database. + - Update geoip6 to the November 15 2014 Maxmind GeoLite2 + Country database. + o Minor features (hidden services): + - When re-enabling the network, don't try to build introduction + circuits until we have successfully built a circuit. This makes + hidden services come up faster when the network is re-enabled. + Patch from "akwizgran". Closes ticket 13447. - Inform Tor controller about nature of failure to retrieve hidden service descriptor by sending reason string with HS_DESC FAILED controller event. Implements feature 13212. @@ -62,19 +59,12 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? directories and hostname files to be created group-readable. Patch from "anon", David Stainton, and "meejah". Closes ticket 11291. - o Minor bugfixes: - - Silence clang warnings under --enable-expensive-hardening, - including: implicit truncation of 64 bit values to 32 bit; const - char assignment to self; tautological compare; and additional - parentheses around equality tests. Fixes bug 13577; bugfix - on 0.2.5.4-alpha. - - Stop allowing invalid address patterns containing both a wildcard - address and a bit prefix length. This affects all our address- - range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. - - The address of an array in the middle of a structure will always - be non-NULL. clang recognises this and complains. Disable the - tautologous and redundant check to silence this warning. Fixes bug - 14001; bugfix on 0.2.1.2-alpha. + o Minor features (transparent firewall): + - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent + proxy option checks to allow for both ipfw and pf on OS X. Closes + ticket 14002. + + o Minor bugfixes (client): - Use a full 256 bits of the SHA256 digest of a microdescriptor when computing which microdescriptors to download. This keeps us from erroneous download behavior if two microdescriptor digests ever @@ -83,14 +73,25 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? - Reset a router's status if its microdescriptor digest changes, even if the first 160 bits remain the same. Fixes part of bug 13399; bugfix on 0.2.3.1-alpha. + + o Minor bugfixes (compilation): + - Silence clang warnings under --enable-expensive-hardening, + including: implicit truncation of 64 bit values to 32 bit; const + char assignment to self; tautological compare; and additional + parentheses around equality tests. Fixes bug 13577; bugfix + on 0.2.5.4-alpha. + - The address of an array in the middle of a structure will always + be non-NULL. clang recognises this and complains. Disable the + tautologous and redundant check to silence this warning. Fixes bug + 14001; bugfix on 0.2.1.2-alpha. + + o Minor bugfixes (hidden services): - Use circuit_has_opened() instead of rend_client_rendcirc_has_opened() when a rendezvous circuit is opened because circuit_has_opened() jobs is to call a specialized function depending on the circuit purpose. Furthermore, a controller event will be triggered here where the former did not. Fixes bug 13936; bugfix on 0.1.1.5-alpha. - - o Minor bugfixes (hidden services): - Pre-check directory permissions for new hidden-services to avoid at least one case of "Bug: Acting on config options left us in a broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. @@ -113,11 +114,14 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? connection_ap_handshake_attach_circuit(). Fixes bug 13701; bugfix on 0.0.6. - o Code Simplification and Refactoring: - - Stop using can_complete_circuits as a global variable; access it - with a function instead. + o Minor bugfixes (misc): + - Stop allowing invalid address patterns containing both a wildcard + address and a bit prefix length. This affects all our address- + range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. o Code simplification and refactoring: + - Stop using can_complete_circuits as a global variable; access it + with a function instead. - Remove our old, non-weighted bandwidth-based node selection code. Previously, we used it as a fallback when we couldn't perform weighted bandwidth-based node selection. But that would only @@ -131,8 +135,6 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? Closes ticket 13172. - Combine the functions used to parse ClientTransportPlugin and ServerTransportPlugin into a single function. Closes ticket 6456. - - o Code simplifications and refactoring: - Add inline functions and convenience macros for quick lookup of state component of channel_t structure. Refactor various parts of codebase to use convenience macros instead of checking state From fe0ecdcfed67791f248a164c9906da7b4ce45594 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:53:52 -0500 Subject: [PATCH 036/120] Rewrite some changelog entries --- ChangeLog | 130 +++++++++++++++++++++++++++--------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03b59a8cda..7b39f5be63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,31 +1,39 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? Tor 0.2.6.2-alpha is the second alpha release in the 0.2.6.x series. - o Major features (hidden services): - - Add a HiddenServiceStatistics option that allows Tor relays to - gather and publish statistics about hidden service usage, to - better understand the size and volume of the hidden service - network. Specifically, if a Tor relay is an HSDir it will publish - the approximate number of hidden services that have published - descriptors to it the past 24 hours. Also, if a relay has acted as - a hidden service rendezvous point, it will publish the approximate - amount of rendezvous cells it has relayed the past 24 hours. The - statistics themselves are obfuscated so that the exact values - cannot be derived. For more details see proposal 238 "Better - hidden service stats from Tor relays". This feature is currently - disabled by default. Implements feature 13192. - o Major features (relay, infrastructure): - - Implement a new inter-cmux comparison API, a global high/low + + - Completely revision of the code that relays use to decide which cell to + send next. Formerly, we selected the best circuit to write on each + channel, but we didn't select among channels in any sophisticated way. + Now, we choose the best circuits globally from among those whose + channels are ready to deliver traffic. + + This patch implements a new inter-cmux comparison API, a global high/low watermark mechanism and a global scheduler loop for transmission prioritization across all channels as well as among circuits on one channel. This schedule is currently tuned to (tolerantly) avoid making changes in the current network performance, but it should form the basis for major circuit performance increases. - Code by Andrea; implements ticket 9262. + Code by Andrea; tuning by Rob Jansen; implements ticket 9262. + + o Major features (hidden services): + - Add a HiddenServiceStatistics option that allows Tor relays to + gather and publish statistics the overall size and volume of hidden + service usage. + Specifically, when this option is turned on, an HSDir will publish + an approximate number of hidden services that have published + descriptors to it the past 24 hours. Also, if a relay has acted as + a hidden service rendezvous point, it will publish the approximate + amount of rendezvous cells it has relayed the past 24 hours. The + statistics themselves are obfuscated so that the exact values + cannot be derived. For more details see proposal 238, "Better + hidden service stats from Tor relays". This feature is currently + disabled by default. Implements feature 13192. o Major bugfixes (hidden services): - - When closing an introduction circuit that was opened in parallel, + - When closing an introduction circuit that was opened in parallel with + others, don't mark the introduction point as unreachable. Previously, the first successful connection to an introduction point would make the other introduction points get marked as having timed out. @@ -37,14 +45,12 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? Resolves ticket 13315. o Minor features (controller): - - Add a "SIGNAL HEARTBEAT" Tor controller command that provokes - writing unscheduled heartbeat message to the log. Implements + - Add a "SIGNAL HEARTBEAT" Tor controller command that tells Tor to + write an unscheduled heartbeat message to the log. Implements feature 9503. o Minor features (geoip): - - Update geoip to the November 15 2014 Maxmind GeoLite2 - Country database. - - Update geoip6 to the November 15 2014 Maxmind GeoLite2 + - Update geoip and geoip6 to the November 15 2014 Maxmind GeoLite2 Country database. o Minor features (hidden services): @@ -52,19 +58,18 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? circuits until we have successfully built a circuit. This makes hidden services come up faster when the network is re-enabled. Patch from "akwizgran". Closes ticket 13447. - - Inform Tor controller about nature of failure to retrieve hidden - service descriptor by sending reason string with HS_DESC FAILED + - Inform Tor controller about nature of a failure to retrieve hidden + service descriptor by sending reason string with "HS_DESC FAILED" controller event. Implements feature 13212. - New HiddenServiceDirGroupReadable option to cause hidden service directories and hostname files to be created group-readable. Patch from "anon", David Stainton, and "meejah". Closes ticket 11291. o Minor features (transparent firewall): - - OS X uses ipfw (FreeBSD) or pf (OpenBSD). Update the transparent - proxy option checks to allow for both ipfw and pf on OS X. Closes - ticket 14002. + - Update the transparent proxy option checks to allow for both ipfw and + pf on OS X. Closes ticket 14002. - o Minor bugfixes (client): + o Minor bugfixes (client, micordescriptors): - Use a full 256 bits of the SHA256 digest of a microdescriptor when computing which microdescriptors to download. This keeps us from erroneous download behavior if two microdescriptor digests ever @@ -76,29 +81,25 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? o Minor bugfixes (compilation): - Silence clang warnings under --enable-expensive-hardening, - including: implicit truncation of 64 bit values to 32 bit; const - char assignment to self; tautological compare; and additional + including implicit truncation of 64 bit values to 32 bit, const + char assignment to self, tautological compare, and additional parentheses around equality tests. Fixes bug 13577; bugfix on 0.2.5.4-alpha. - - The address of an array in the middle of a structure will always - be non-NULL. clang recognises this and complains. Disable the - tautologous and redundant check to silence this warning. Fixes bug + - Fix a clang warning about checking whether an address in the middle of a + structure is NULL. Fixes bug 14001; bugfix on 0.2.1.2-alpha. o Minor bugfixes (hidden services): - - Use circuit_has_opened() instead of - rend_client_rendcirc_has_opened() when a rendezvous circuit is - opened because circuit_has_opened() jobs is to call a specialized - function depending on the circuit purpose. Furthermore, a - controller event will be triggered here where the former did not. + - Correctly send a controller event when we find that a rendezvous + circuit has finished. Fixes bug 13936; bugfix on 0.1.1.5-alpha. - Pre-check directory permissions for new hidden-services to avoid at least one case of "Bug: Acting on config options left us in a broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. - - When adding a new hidden-service (for example, via SETCONF) Tor no - longer logs a congratulations for running a relay. Fixes bug + - When adding a new hidden service (for example, via SETCONF), Tor no + longer congratulates the user for running a relay. Fixes bug 13941; bugfix on 0.2.6.1-alpha. - - When fetching hidden service descriptors, check not only for + - When fetching hidden service descriptors, we now check not only for whether we got the hidden service we had in mind, but also whether we got the particular descriptors we wanted. This prevents a class of inefficient but annoying DoS attacks by hidden service @@ -110,26 +111,19 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? Emit a warning when extra info document is found incompatible with a corresponding router descriptor. Fixes bug 9812; bugfix on 0.0.6rc3. - - Log the circuit identifier correctly in + - Log the circuit ID correctly in connection_ap_handshake_attach_circuit(). Fixes bug 13701; bugfix on 0.0.6. o Minor bugfixes (misc): - - Stop allowing invalid address patterns containing both a wildcard - address and a bit prefix length. This affects all our address- - range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. + + - Stop allowing invalid address patterns like "*/24" that contain both a wildcard + address and a bit prefix length. This + affects all our address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. o Code simplification and refactoring: - Stop using can_complete_circuits as a global variable; access it with a function instead. - - Remove our old, non-weighted bandwidth-based node selection code. - Previously, we used it as a fallback when we couldn't perform - weighted bandwidth-based node selection. But that would only - happen in the cases where we had no consensus, or when we had a - consensus generated by buggy or ancient directory authorities. In - either case, it's better to use the more modern, better maintained - algorithm, with reasonable defaults for the weights. Closes - ticket 13126. - Avoid using operators directly as macro arguments: this lets us apply coccinelle transformations to our codebase more directly. Closes ticket 13172. @@ -163,7 +157,7 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? all parts of the manual for options that take a list of nodes. Closes ticket 13381. - o Removed features: + o Major removed features: - Tor clients no longer support connecting to hidden services running on Tor 0.2.2.x and earlier; the Support022HiddenServices option has been removed. (There shouldn't be any hidden services @@ -448,7 +442,7 @@ Changes in version 0.2.6.1-alpha - 2014-10-30 ticket 12202. - Refactor and unit-test entry_is_time_to_retry() in entrynodes.c. Resolves ticket 12205. - - Use calloc and reallocarray functions in preference to multiply- + - Use calloc and reallocarray functions instead of multiply- then-malloc. This makes it less likely for us to fall victim to an integer overflow attack when allocating. Resolves ticket 12855. - Use the standard macro name SIZE_MAX, instead of our @@ -457,7 +451,7 @@ Changes in version 0.2.6.1-alpha - 2014-10-30 functions which take them as arguments. Replace 0 with NO_DIRINFO in a function call for clarity. Seeks to prevent future issues like 13163. - - Avoid 4 null pointer errors under clang shallow analysis by using + - Avoid 4 null pointer errors under clang static analysis by using tor_assert() to prove that the pointers aren't null. Fixes bug 13284. - Rework the API of policies_parse_exit_policy() to use a bitmask to @@ -473,23 +467,23 @@ Changes in version 0.2.6.1-alpha - 2014-10-30 operating system is allowing to use simultaneously. Resolves ticket 9708. - o Removed code: + o Removed features: - We no longer remind the user about configuration options that have been obsolete since 0.2.3.x or earlier. Patch by Adrien Bak. - - o Removed features: + - Remove our old, non-weighted bandwidth-based node selection code. + Previously, we used it as a fallback when we couldn't perform + weighted bandwidth-based node selection. But that would only + happen in the cases where we had no consensus, or when we had a + consensus generated by buggy or ancient directory authorities. In + either case, it's better to use the more modern, better maintained + algorithm, with reasonable defaults for the weights. Closes + ticket 13126. - Remove the --disable-curve25519 configure option. Relays and clients now are required to support curve25519 and the ntor handshake. - The old "StrictEntryNodes" and "StrictExitNodes" options, which used to be deprecated synonyms for "StrictNodes", are now marked obsolete. Resolves ticket 12226. - - The "AuthDirRejectUnlisted" option no longer has any effect, as - the fingerprints file (approved-routers) has been deprecated. - - Directory authorities do not support being Naming dirauths anymore. - The "NamingAuthoritativeDir" config option is now obsolete. - - Directory authorities do not support giving out the BadDirectory - flag anymore. - Clients don't understand the BadDirectory flag in the consensus anymore, and ignore it. @@ -526,6 +520,12 @@ Changes in version 0.2.6.1-alpha - 2014-10-30 affected by CVE-2011-2769 as guards. These relays are already rejected altogether due to the minimum version requirement of 0.2.3.16-alpha. Closes ticket 13152. + - The "AuthDirRejectUnlisted" option no longer has any effect, as + the fingerprints file (approved-routers) has been deprecated. + - Directory authorities do not support being Naming dirauths anymore. + The "NamingAuthoritativeDir" config option is now obsolete. + - Directory authorities do not support giving out the BadDirectory + flag anymore. - Directory authorities no longer advertise or support consensus methods 1 through 12 inclusive. These consensus methods were obsolete and/or insecure: maintaining the ability to support them From ec07c3c5c5c4afe19816b1d5363d9b9acd4c484c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 10:54:09 -0500 Subject: [PATCH 037/120] Reflow the changelog again --- ChangeLog | 91 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b39f5be63..d7c9430f8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,42 +2,40 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? Tor 0.2.6.2-alpha is the second alpha release in the 0.2.6.x series. o Major features (relay, infrastructure): + - Completely revision of the code that relays use to decide which + cell to send next. Formerly, we selected the best circuit to write + on each channel, but we didn't select among channels in any + sophisticated way. Now, we choose the best circuits globally from + among those whose channels are ready to deliver traffic. - - Completely revision of the code that relays use to decide which cell to - send next. Formerly, we selected the best circuit to write on each - channel, but we didn't select among channels in any sophisticated way. - Now, we choose the best circuits globally from among those whose - channels are ready to deliver traffic. - - This patch implements a new inter-cmux comparison API, a global high/low - watermark mechanism and a global scheduler loop for transmission - prioritization across all channels as well as among circuits on - one channel. This schedule is currently tuned to (tolerantly) - avoid making changes in the current network performance, but it - should form the basis for major circuit performance increases. - Code by Andrea; tuning by Rob Jansen; implements ticket 9262. + This patch implements a new inter-cmux comparison API, a global + high/low watermark mechanism and a global scheduler loop for + transmission prioritization across all channels as well as among + circuits on one channel. This schedule is currently tuned to + (tolerantly) avoid making changes in the current network + performance, but it should form the basis for major circuit + performance increases. Code by Andrea; tuning by Rob Jansen; + implements ticket 9262. o Major features (hidden services): - Add a HiddenServiceStatistics option that allows Tor relays to - gather and publish statistics the overall size and volume of hidden - service usage. - Specifically, when this option is turned on, an HSDir will publish - an approximate number of hidden services that have published - descriptors to it the past 24 hours. Also, if a relay has acted as - a hidden service rendezvous point, it will publish the approximate - amount of rendezvous cells it has relayed the past 24 hours. The - statistics themselves are obfuscated so that the exact values - cannot be derived. For more details see proposal 238, "Better - hidden service stats from Tor relays". This feature is currently - disabled by default. Implements feature 13192. + gather and publish statistics the overall size and volume of + hidden service usage. Specifically, when this option is turned on, + an HSDir will publish an approximate number of hidden services + that have published descriptors to it the past 24 hours. Also, if + a relay has acted as a hidden service rendezvous point, it will + publish the approximate amount of rendezvous cells it has relayed + the past 24 hours. The statistics themselves are obfuscated so + that the exact values cannot be derived. For more details see + proposal 238, "Better hidden service stats from Tor relays". This + feature is currently disabled by default. Implements feature 13192. o Major bugfixes (hidden services): - - When closing an introduction circuit that was opened in parallel with - others, - don't mark the introduction point as unreachable. Previously, the - first successful connection to an introduction point would make - the other introduction points get marked as having timed out. - Fixes bug 13698; bugfix on 0.0.6rc2. + - When closing an introduction circuit that was opened in parallel + with others, don't mark the introduction point as unreachable. + Previously, the first successful connection to an introduction + point would make the other introduction points get marked as + having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. o Minor features (client): - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks @@ -66,8 +64,8 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? from "anon", David Stainton, and "meejah". Closes ticket 11291. o Minor features (transparent firewall): - - Update the transparent proxy option checks to allow for both ipfw and - pf on OS X. Closes ticket 14002. + - Update the transparent proxy option checks to allow for both ipfw + and pf on OS X. Closes ticket 14002. o Minor bugfixes (client, micordescriptors): - Use a full 256 bits of the SHA256 digest of a microdescriptor when @@ -85,24 +83,23 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? char assignment to self, tautological compare, and additional parentheses around equality tests. Fixes bug 13577; bugfix on 0.2.5.4-alpha. - - Fix a clang warning about checking whether an address in the middle of a - structure is NULL. Fixes bug - 14001; bugfix on 0.2.1.2-alpha. + - Fix a clang warning about checking whether an address in the + middle of a structure is NULL. Fixes bug 14001; bugfix + on 0.2.1.2-alpha. o Minor bugfixes (hidden services): - Correctly send a controller event when we find that a rendezvous - circuit has finished. - Fixes bug 13936; bugfix on 0.1.1.5-alpha. + circuit has finished. Fixes bug 13936; bugfix on 0.1.1.5-alpha. - Pre-check directory permissions for new hidden-services to avoid at least one case of "Bug: Acting on config options left us in a broken state. Dying." Fixes bug 13942; bugfix on 0.0.6pre1. - - When adding a new hidden service (for example, via SETCONF), Tor no - longer congratulates the user for running a relay. Fixes bug + - When adding a new hidden service (for example, via SETCONF), Tor + no longer congratulates the user for running a relay. Fixes bug 13941; bugfix on 0.2.6.1-alpha. - - When fetching hidden service descriptors, we now check not only for - whether we got the hidden service we had in mind, but also whether - we got the particular descriptors we wanted. This prevents a class - of inefficient but annoying DoS attacks by hidden service + - When fetching hidden service descriptors, we now check not only + for whether we got the hidden service we had in mind, but also + whether we got the particular descriptors we wanted. This prevents + a class of inefficient but annoying DoS attacks by hidden service directories. Fixes bug 13214; bugfix on 0.2.1.6-alpha. Reported by "special". @@ -116,10 +113,10 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? on 0.0.6. o Minor bugfixes (misc): - - - Stop allowing invalid address patterns like "*/24" that contain both a wildcard - address and a bit prefix length. This - affects all our address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. + - Stop allowing invalid address patterns like "*/24" that contain + both a wildcard address and a bit prefix length. This affects all + our address-range parsing code. Fixes bug 7484; bugfix + on 0.0.2pre14. o Code simplification and refactoring: - Stop using can_complete_circuits as a global variable; access it From 13f26f41e469ae2fa5d2249c532f7f515195a2a0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 11:13:01 -0500 Subject: [PATCH 038/120] Fix some coverity issues in the unit tests --- src/test/test_channel.c | 10 +++++++++- src/test/test_dir.c | 8 ++++++-- src/test/test_microdesc.c | 3 +-- src/test/test_relay.c | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/test/test_channel.c b/src/test/test_channel.c index f882b99906..b1f1bdb435 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -1566,12 +1566,15 @@ test_channel_write(void *arg) old_count = test_cells_written; channel_write_cell(ch, cell); + cell = NULL; tt_assert(test_cells_written == old_count + 1); channel_write_var_cell(ch, var_cell); + var_cell = NULL; tt_assert(test_cells_written == old_count + 2); channel_write_packed_cell(ch, packed_cell); + packed_cell = NULL; tt_assert(test_cells_written == old_count + 3); /* Now we test queueing; tell it not to accept cells */ @@ -1632,15 +1635,18 @@ test_channel_write(void *arg) cell = tor_malloc_zero(sizeof(cell_t)); make_fake_cell(cell); channel_write_cell(ch, cell); + cell = NULL; tt_assert(test_cells_written == old_count); var_cell = tor_malloc_zero(sizeof(var_cell_t) + CELL_PAYLOAD_SIZE); make_fake_var_cell(var_cell); channel_write_var_cell(ch, var_cell); + var_cell = NULL; tt_assert(test_cells_written == old_count); packed_cell = packed_cell_new(); channel_write_packed_cell(ch, packed_cell); + packed_cell = NULL; tt_assert(test_cells_written == old_count); #ifdef ENABLE_MEMPOOLS @@ -1649,7 +1655,9 @@ test_channel_write(void *arg) done: tor_free(ch); - + tor_free(var_cell); + tor_free(cell); + packed_cell_free(packed_cell); return; } diff --git a/src/test/test_dir.c b/src/test/test_dir.c index e5328fed56..2659fbcfb8 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -605,6 +605,7 @@ test_dir_load_routers(void *arg) smartlist_t *wanted = smartlist_new(); char buf[DIGEST_LEN]; char *mem_op_hex_tmp = NULL; + char *list = NULL; #define ADD(str) \ do { \ @@ -630,7 +631,7 @@ test_dir_load_routers(void *arg) /* Not ADDing BAD_PORTS */ ADD(EX_RI_BAD_TOKENS); - char *list = smartlist_join_strings(chunks, "", 0, NULL); + list = smartlist_join_strings(chunks, "", 0, NULL); tt_int_op(1, OP_EQ, router_load_routers_from_string(list, NULL, SAVED_IN_JOURNAL, wanted, 1, NULL)); @@ -670,6 +671,7 @@ test_dir_load_routers(void *arg) smartlist_free(chunks); SMARTLIST_FOREACH(wanted, char *, cp, tor_free(cp)); smartlist_free(wanted); + tor_free(list); } static int mock_get_by_ei_dd_calls = 0; @@ -722,6 +724,7 @@ test_dir_load_extrainfo(void *arg) smartlist_t *wanted = smartlist_new(); char buf[DIGEST_LEN]; char *mem_op_hex_tmp = NULL; + char *list = NULL; #define ADD(str) \ do { \ @@ -746,7 +749,7 @@ test_dir_load_extrainfo(void *arg) ADD(EX_EI_BAD_TOKENS); ADD(EX_EI_BAD_SIG2); - char *list = smartlist_join_strings(chunks, "", 0, NULL); + list = smartlist_join_strings(chunks, "", 0, NULL); router_load_extrainfo_from_string(list, NULL, SAVED_IN_JOURNAL, wanted, 1); /* The "maximal" router was added. */ @@ -788,6 +791,7 @@ test_dir_load_extrainfo(void *arg) smartlist_free(chunks); SMARTLIST_FOREACH(wanted, char *, cp, tor_free(cp)); smartlist_free(wanted); + tor_free(list); } static void diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c index 4a7c29b747..31ed93b720 100644 --- a/src/test/test_microdesc.c +++ b/src/test/test_microdesc.c @@ -703,8 +703,7 @@ test_md_reject_cache(void *arg) done: UNMOCK(networkstatus_get_latest_consensus_by_flavor); UNMOCK(router_get_mutable_consensus_status_by_descriptor_digest); - if (options) - tor_free(options->DataDirectory); + tor_free(options->DataDirectory); microdesc_free_all(); smartlist_free(added); SMARTLIST_FOREACH(wanted, char *, cp, tor_free(cp)); diff --git a/src/test/test_relay.c b/src/test/test_relay.c index 6907597705..38d1d96703 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -114,6 +114,7 @@ test_relay_append_cell_to_circuit_queue(void *arg) nchan = pchan = NULL; done: + tor_free(cell); tor_free(orcirc); if (nchan && nchan->cmux) circuitmux_free(nchan->cmux); tor_free(nchan); From b94cb401d2185566e7fb52b78c5a5a6747987f99 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 11:13:11 -0500 Subject: [PATCH 039/120] Coverity complained that we were not checking this return value --- src/or/scheduler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/or/scheduler.c b/src/or/scheduler.c index d1a15aacb2..5b4dff2237 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -156,7 +156,9 @@ scheduler_free_all(void) log_debug(LD_SCHED, "Shutting down scheduler"); if (run_sched_ev) { - event_del(run_sched_ev); + if (event_del(run_sched_ev) < 0) { + log_warn(LD_BUG, "Problem deleting run_sched_ev"); + } tor_event_free(run_sched_ev); run_sched_ev = NULL; } From 6830667d58815219476593901334b2e19554d8af Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 12:24:13 -0500 Subject: [PATCH 040/120] Increase bandwidth usage report interval to 4 hours. --- changes/bug13988 | 3 +++ src/or/rephist.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changes/bug13988 diff --git a/changes/bug13988 b/changes/bug13988 new file mode 100644 index 0000000000..e816335a3b --- /dev/null +++ b/changes/bug13988 @@ -0,0 +1,3 @@ + o Minor bugfixes (statistics): + - Increase period over which bandwidth observations are aggregated + from 15 minutes to 4 hours. Fixes bug 13988; bugfix on 0.0.8pre1. diff --git a/src/or/rephist.c b/src/or/rephist.c index 72de54c0c9..cedc56af07 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -1131,9 +1131,7 @@ rep_hist_load_mtbf_data(time_t now) * totals? */ #define NUM_SECS_ROLLING_MEASURE 10 /** How large are the intervals for which we track and report bandwidth use? */ -/* XXXX Watch out! Before Tor 0.2.2.21-alpha, using any other value here would - * generate an unparseable state file. */ -#define NUM_SECS_BW_SUM_INTERVAL (15*60) +#define NUM_SECS_BW_SUM_INTERVAL (4*60*60) /** How far in the past do we remember and publish bandwidth use? */ #define NUM_SECS_BW_SUM_IS_VALID (24*60*60) /** How many bandwidth usage intervals do we remember? (derived) */ From 03d2df62f614f97d2b5cf52518565ce91333ba87 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 12:27:26 -0500 Subject: [PATCH 041/120] Fix a bunch of memory leaks in the unit tests. Found with valgrind --- src/or/channel.c | 3 +-- src/or/channel.h | 2 ++ src/or/transports.c | 4 +--- src/or/transports.h | 2 ++ src/test/fakechans.h | 1 + src/test/test_channel.c | 45 ++++++++++++++++++++++++++++---------- src/test/test_channeltls.c | 7 +++--- src/test/test_config.c | 3 +++ src/test/test_dir.c | 13 +++++++---- src/test/test_relay.c | 9 ++++---- 10 files changed, 60 insertions(+), 29 deletions(-) diff --git a/src/or/channel.c b/src/or/channel.c index 4826bdd0a7..cc609b5b72 100644 --- a/src/or/channel.c +++ b/src/or/channel.c @@ -147,7 +147,6 @@ HT_GENERATE2(channel_idmap, channel_idmap_entry_s, node, channel_idmap_hash, channel_idmap_eq, 0.5, tor_reallocarray_, tor_free_); static cell_queue_entry_t * cell_queue_entry_dup(cell_queue_entry_t *q); -static void cell_queue_entry_free(cell_queue_entry_t *q, int handed_off); #if 0 static int cell_queue_entry_is_padding(cell_queue_entry_t *q); #endif @@ -1569,7 +1568,7 @@ cell_queue_entry_dup(cell_queue_entry_t *q) * them) or not (we should free). */ -static void +STATIC void cell_queue_entry_free(cell_queue_entry_t *q, int handed_off) { if (!q) return; diff --git a/src/or/channel.h b/src/or/channel.h index ec7a15f5f1..c4b909c5ad 100644 --- a/src/or/channel.h +++ b/src/or/channel.h @@ -380,6 +380,8 @@ struct cell_queue_entry_s { /* Cell queue functions for benefit of test suite */ STATIC int chan_cell_queue_len(const chan_cell_queue_t *queue); + +STATIC void cell_queue_entry_free(cell_queue_entry_t *q, int handed_off); #endif /* Channel operations for subclasses and internal use only */ diff --git a/src/or/transports.c b/src/or/transports.c index 2623f807d0..7999be3d33 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -112,8 +112,6 @@ static void parse_method_error(const char *line, int is_server_method); #define parse_server_method_error(l) parse_method_error(l, 1) #define parse_client_method_error(l) parse_method_error(l, 0) -static INLINE void free_execve_args(char **arg); - /** Managed proxy protocol strings */ #define PROTO_ENV_ERROR "ENV-ERROR" #define PROTO_NEG_SUCCESS "VERSION" @@ -1502,7 +1500,7 @@ pt_kickstart_proxy, (const smartlist_t *transport_list, /** Frees the array of pointers in arg used as arguments to execve(2). */ -static INLINE void +STATIC void free_execve_args(char **arg) { char **tmp = arg; diff --git a/src/or/transports.h b/src/or/transports.h index 2958d5e187..8f60760de8 100644 --- a/src/or/transports.h +++ b/src/or/transports.h @@ -131,6 +131,8 @@ STATIC int configure_proxy(managed_proxy_t *mp); STATIC char* get_pt_proxy_uri(void); +STATIC void free_execve_args(char **arg); + #endif #endif diff --git a/src/test/fakechans.h b/src/test/fakechans.h index b129ab49a5..230abe4da6 100644 --- a/src/test/fakechans.h +++ b/src/test/fakechans.h @@ -12,6 +12,7 @@ void make_fake_cell(cell_t *c); void make_fake_var_cell(var_cell_t *c); channel_t * new_fake_channel(void); +void free_fake_channel(channel_t *c); /* Also exposes some a mock used by both test_channel.c and test_relay.c */ void scheduler_channel_has_waiting_cells_mock(channel_t *ch); diff --git a/src/test/test_channel.c b/src/test/test_channel.c index b1f1bdb435..0766415510 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -430,6 +430,27 @@ new_fake_channel(void) return chan; } +void +free_fake_channel(channel_t *chan) +{ + cell_queue_entry_t *cell, *cell_tmp; + + if (! chan) + return; + + if (chan->cmux) + circuitmux_free(chan->cmux); + + TOR_SIMPLEQ_FOREACH_SAFE(cell, &chan->incoming_queue, next, cell_tmp) { + cell_queue_entry_free(cell, 0); + } + TOR_SIMPLEQ_FOREACH_SAFE(cell, &chan->outgoing_queue, next, cell_tmp) { + cell_queue_entry_free(cell, 0); + } + + tor_free(chan); +} + /** * Counter query for scheduler_channel_has_waiting_cells_mock() */ @@ -610,7 +631,7 @@ test_channel_dumpstats(void *arg) done: tor_free(cell); - tor_free(ch); + free_fake_channel(ch); UNMOCK(scheduler_channel_doesnt_want_writes); UNMOCK(scheduler_release_channel); @@ -748,6 +769,8 @@ test_channel_flushmux(void *arg) test_cmux_cells = 0; done: + if (ch) + circuitmux_free(ch->cmux); tor_free(ch); UNMOCK(channel_flush_from_first_active_circuit); @@ -831,7 +854,7 @@ test_channel_incoming(void *arg) ch = NULL; done: - tor_free(ch); + free_fake_channel(ch); tor_free(cell); tor_free(var_cell); @@ -944,8 +967,8 @@ test_channel_lifecycle(void *arg) tt_int_op(test_releases_count, ==, init_releases_count + 4); done: - tor_free(ch1); - tor_free(ch2); + free_fake_channel(ch1); + free_fake_channel(ch2); UNMOCK(scheduler_channel_doesnt_want_writes); UNMOCK(scheduler_release_channel); @@ -1214,6 +1237,7 @@ test_channel_multi(void *arg) cell = tor_malloc_zero(sizeof(cell_t)); make_fake_cell(cell); channel_write_cell(ch2, cell); + cell = NULL; /* Check the estimates */ channel_update_xmit_queue_size(ch1); @@ -1248,8 +1272,8 @@ test_channel_multi(void *arg) UNMOCK(scheduler_release_channel); done: - tor_free(ch1); - tor_free(ch2); + free_fake_channel(ch1); + free_fake_channel(ch2); return; } @@ -1279,9 +1303,6 @@ test_channel_queue_impossible(void *arg) init_cell_pool(); #endif /* ENABLE_MEMPOOLS */ - packed_cell = packed_cell_new(); - tt_assert(packed_cell); - ch = new_fake_channel(); tt_assert(ch); @@ -1403,7 +1424,7 @@ test_channel_queue_impossible(void *arg) tt_int_op(chan_cell_queue_len(&(ch->outgoing_queue)), ==, 0); done: - tor_free(ch); + free_fake_channel(ch); #ifdef ENABLE_MEMPOOLS free_cell_pool(); #endif /* ENABLE_MEMPOOLS */ @@ -1532,7 +1553,7 @@ test_channel_queue_size(void *arg) UNMOCK(scheduler_release_channel); done: - tor_free(ch); + free_fake_channel(ch); return; } @@ -1654,7 +1675,7 @@ test_channel_write(void *arg) #endif /* ENABLE_MEMPOOLS */ done: - tor_free(ch); + free_fake_channel(ch); tor_free(var_cell); tor_free(cell); packed_cell_free(packed_cell); diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c index 45e24dfbec..89c75d8732 100644 --- a/src/test/test_channeltls.c +++ b/src/test/test_channeltls.c @@ -80,7 +80,7 @@ test_channeltls_create(void *arg) */ ch->close = tlschan_fake_close_method; channel_mark_for_close(ch); - tor_free(ch); + free_fake_channel(ch); UNMOCK(scheduler_release_channel); } @@ -167,7 +167,7 @@ test_channeltls_num_bytes_queued(void *arg) */ ch->close = tlschan_fake_close_method; channel_mark_for_close(ch); - tor_free(ch); + free_fake_channel(ch); UNMOCK(scheduler_release_channel); } @@ -241,7 +241,7 @@ test_channeltls_overhead_estimate(void *arg) */ ch->close = tlschan_fake_close_method; channel_mark_for_close(ch); - tor_free(ch); + free_fake_channel(ch); UNMOCK(scheduler_release_channel); } @@ -304,6 +304,7 @@ tlschan_fake_close_method(channel_t *chan) tt_assert(tlschan != NULL); /* Just free the fake orconn */ + tor_free(tlschan->conn->base_.address); tor_free(tlschan->conn); channel_closed(chan); diff --git a/src/test/test_config.c b/src/test/test_config.c index dcb4e92c56..ea0c39759f 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -6,6 +6,7 @@ #include "orconfig.h" #define CONFIG_PRIVATE +#define PT_PRIVATE #include "or.h" #include "addressmap.h" #include "config.h" @@ -578,6 +579,8 @@ pt_kickstart_proxy_mock(const smartlist_t *transport_list, /* XXXX check that args are as expected. */ ++pt_kickstart_proxy_mock_call_count; + + free_execve_args(proxy_argv); } static int diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 2659fbcfb8..4cd8aa8759 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -387,6 +387,12 @@ test_dir_routerparse_bad(void *arg) #include "example_extrainfo.inc" +static void +routerinfo_free_wrapper_(void *arg) +{ + routerinfo_free(arg); +} + static void test_dir_extrainfo_parsing(void *arg) { @@ -455,9 +461,9 @@ test_dir_extrainfo_parsing(void *arg) #undef CHECK_FAIL done: + extrainfo_free(ei); routerinfo_free(ri); - /* XXXX elements should get freed too */ - digestmap_free((digestmap_t*)map, NULL); + digestmap_free((digestmap_t*)map, routerinfo_free_wrapper_); } static void @@ -552,9 +558,8 @@ test_dir_parse_router_list(void *arg) SMARTLIST_FOREACH(chunks, char *, cp, tor_free(cp)); smartlist_free(chunks); routerinfo_free(ri); - /* XXXX this leaks: */ if (map) { - digestmap_free((digestmap_t*)map, NULL); + digestmap_free((digestmap_t*)map, routerinfo_free_wrapper_); router_get_routerlist()->identity_map = (struct digest_ri_map_t*)digestmap_new(); } diff --git a/src/test/test_relay.c b/src/test/test_relay.c index 38d1d96703..fbe7fafc06 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -111,15 +111,14 @@ test_relay_append_cell_to_circuit_queue(void *arg) /* Shut down channels */ channel_free_all(); - nchan = pchan = NULL; done: tor_free(cell); + cell_queue_clear(&orcirc->base_.n_chan_cells); + cell_queue_clear(&orcirc->p_chan_cells); tor_free(orcirc); - if (nchan && nchan->cmux) circuitmux_free(nchan->cmux); - tor_free(nchan); - if (pchan && pchan->cmux) circuitmux_free(pchan->cmux); - tor_free(pchan); + free_fake_channel(nchan); + free_fake_channel(pchan); #ifdef ENABLE_MEMPOOLS free_cell_pool(); #endif /* ENABLE_MEMPOOLS */ From 47760c7ba5f1c87c945f4a018e3b3da6d127a8b9 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 22 Dec 2014 12:56:35 -0500 Subject: [PATCH 042/120] When decoding a base-{16,32,64} value, clear the target buffer first This is a good idea in case the caller stupidly doesn't check the return value from baseX_decode(), and as a workaround for the current inconsistent API of base16_decode. Prevents any fallout from bug 14013. --- src/common/crypto.c | 6 ++++++ src/common/util.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/common/crypto.c b/src/common/crypto.c index 925beb3529..63276146aa 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -2678,6 +2678,8 @@ base64_decode(char *dest, size_t destlen, const char *src, size_t srclen) if (destlen > SIZE_T_CEILING) return -1; + memset(dest, 0, destlen); + EVP_DecodeInit(&ctx); EVP_DecodeUpdate(&ctx, (unsigned char*)dest, &len, (unsigned char*)src, srclen); @@ -2699,6 +2701,8 @@ base64_decode(char *dest, size_t destlen, const char *src, size_t srclen) if (destlen > SIZE_T_CEILING) return -1; + memset(dest, 0, destlen); + /* Iterate over all the bytes in src. Each one will add 0 or 6 bits to the * value we're decoding. Accumulate bits in n, and whenever we have * 24 bits, batch them into 3 bytes and flush those bytes to dest. @@ -2878,6 +2882,8 @@ base32_decode(char *dest, size_t destlen, const char *src, size_t srclen) tor_assert((nbits/8) <= destlen); /* We need enough space. */ tor_assert(destlen < SIZE_T_CEILING); + memset(dest, 0, destlen); + /* Convert base32 encoded chars to the 5-bit values that they represent. */ tmp = tor_malloc_zero(srclen); for (j = 0; j < srclen; ++j) { diff --git a/src/common/util.c b/src/common/util.c index 5eb0f9a69b..036fd2542c 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1076,6 +1076,9 @@ base16_decode(char *dest, size_t destlen, const char *src, size_t srclen) return -1; if (destlen < srclen/2 || destlen > SIZE_T_CEILING) return -1; + + memset(dest, 0, destlen); + end = src+srclen; while (src Date: Mon, 22 Dec 2014 16:06:05 -0500 Subject: [PATCH 043/120] Tweak channel unit tests so we don't see coverity complaints channel_write_*_cell() can delete its argument, so coverity doesn't like us doing pointer comparison against that argument later. Silly. --- src/test/test_channel.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/test_channel.c b/src/test/test_channel.c index 0766415510..59f4596f74 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -1293,6 +1293,7 @@ test_channel_queue_impossible(void *arg) int old_count; cell_queue_entry_t *q = NULL; uint64_t global_queue_estimate; + uintptr_t cellintptr; /* Cache the global queue size (see below) */ global_queue_estimate = channel_get_global_queue_estimate(); @@ -1320,6 +1321,7 @@ test_channel_queue_impossible(void *arg) /* Get a fresh cell and write it to the channel*/ cell = tor_malloc_zero(sizeof(cell_t)); make_fake_cell(cell); + cellintptr = (uintptr_t)(void*)cell; channel_write_cell(ch, cell); /* Now it should be queued */ @@ -1328,7 +1330,7 @@ test_channel_queue_impossible(void *arg) tt_assert(q); if (q) { tt_int_op(q->type, ==, CELL_QUEUE_FIXED); - tt_ptr_op(q->u.fixed.cell, ==, cell); + tt_assert((uintptr_t)q->u.fixed.cell == cellintptr); } /* Do perverse things to it */ tor_free(q->u.fixed.cell); @@ -1349,6 +1351,7 @@ test_channel_queue_impossible(void *arg) ch->state = CHANNEL_STATE_MAINT; var_cell = tor_malloc_zero(sizeof(var_cell_t) + CELL_PAYLOAD_SIZE); make_fake_var_cell(var_cell); + cellintptr = (uintptr_t)(void*)var_cell; channel_write_var_cell(ch, var_cell); /* Check that it's queued */ @@ -1357,7 +1360,7 @@ test_channel_queue_impossible(void *arg) tt_assert(q); if (q) { tt_int_op(q->type, ==, CELL_QUEUE_VAR); - tt_ptr_op(q->u.var.var_cell, ==, var_cell); + tt_assert((uintptr_t)q->u.var.var_cell == cellintptr); } /* Remove the cell from the queue entry */ @@ -1376,6 +1379,7 @@ test_channel_queue_impossible(void *arg) ch->state = CHANNEL_STATE_MAINT; packed_cell = packed_cell_new(); tt_assert(packed_cell); + cellintptr = (uintptr_t)(void*)packed_cell; channel_write_packed_cell(ch, packed_cell); /* Check that it's queued */ @@ -1384,7 +1388,7 @@ test_channel_queue_impossible(void *arg) tt_assert(q); if (q) { tt_int_op(q->type, ==, CELL_QUEUE_PACKED); - tt_ptr_op(q->u.packed.packed_cell, ==, packed_cell); + tt_assert((uintptr_t)q->u.packed.packed_cell == cellintptr); } /* Remove the cell from the queue entry */ From 39e71d8fa54afd906fdcaf2cd496c300362ebb9a Mon Sep 17 00:00:00 2001 From: "Francisco Blas Izquierdo Riera (klondike)" Date: Tue, 23 Dec 2014 10:51:33 -0500 Subject: [PATCH 044/120] Use the appropriate call to getsockopt for IPv6 sockets The original call to getsockopt to know the original address on transparently proxyed sockets using REDIRECT in iptables failed with IPv6 addresses because it assumed all sockets used IPv4. This patch fixes this by using the appropriate options and adding the headers containing the needed definitions for these. This patch is released under the same license as the original file as long as the author iscredited. Signed-off-by: Francisco Blas Izquierdo Riera (klondike) --- configure.ac | 35 +++++++++++++++++++++++++++++++++++ src/or/connection_edge.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e7560b2bfc..88b4da006d 100644 --- a/configure.ac +++ b/configure.ac @@ -937,6 +937,14 @@ AC_CHECK_HEADERS(net/pfvar.h, net_pfvar_found=1, net_pfvar_found=0, #ifdef HAVE_NET_IF_H #include #endif]) + +AC_CHECK_HEADERS(linux/if.h,[],[], +[ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]) + AC_CHECK_HEADERS(linux/netfilter_ipv4.h, linux_netfilter_ipv4=1, linux_netfilter_ipv4=0, [#ifdef HAVE_SYS_TYPES_H @@ -958,6 +966,30 @@ AC_CHECK_HEADERS(linux/netfilter_ipv4.h, #include #endif]) +AC_CHECK_HEADERS(linux/netfilter_ipv6/ip6_tables.h, + linux_netfilter_ipv6_ip6_tables=1, linux_netfilter_ipv6_ip6_tables=0, +[#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_LINUX_TYPES_H +#include +#endif +#ifdef HAVE_NETINET_IN6_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_LINUX_IF_H +#include +#endif]) + if test x$transparent = xtrue ; then transparent_ok=0 if test x$net_if_found = x1 && test x$net_pfvar_found = x1 ; then @@ -966,6 +998,9 @@ if test x$transparent = xtrue ; then if test x$linux_netfilter_ipv4 = x1 ; then transparent_ok=1 fi + if test x$linux_netfilter_ipv6_ip6_tables = x1 ; then + transparent_ok=1 + fi if test x$transparent_ok = x1 ; then AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support") case $host in diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index a90ca00883..09645d04b9 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -46,8 +46,20 @@ #ifdef HAVE_LINUX_NETFILTER_IPV4_H #include #define TRANS_NETFILTER +#define TRANS_NETFILTER_IPV4 #endif +#ifdef HAVE_LINUX_IF_H +#include +#endif + +#ifdef HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H +#include +#define TRANS_NETFILTER +#define TRANS_NETFILTER_IPV6 +#endif + + #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H) #include #include @@ -1401,10 +1413,27 @@ destination_from_socket(entry_connection_t *conn, socks_request_t *req) struct sockaddr_storage orig_dst; socklen_t orig_dst_len = sizeof(orig_dst); tor_addr_t addr; + int rv; #ifdef TRANS_NETFILTER - if (getsockopt(ENTRY_TO_CONN(conn)->s, SOL_IP, SO_ORIGINAL_DST, - (struct sockaddr*)&orig_dst, &orig_dst_len) < 0) { + switch (ENTRY_TO_CONN(conn)->socket_family) { +#ifdef TRANS_NETFILTER_IPV4 + case AF_INET: + rv = getsockopt(ENTRY_TO_CONN(conn)->s, SOL_IP, SO_ORIGINAL_DST, + (struct sockaddr*)&orig_dst, &orig_dst_len); + break; +#endif +#ifdef TRANS_NETFILTER_IPV6 + case AF_INET6: + rv = getsockopt(ENTRY_TO_CONN(conn)->s, SOL_IPV6, IP6T_SO_ORIGINAL_DST, + (struct sockaddr*)&orig_dst, &orig_dst_len); + break; +#endif + default: + log_warn(LD_BUG, "Received transparent data from an unsuported socket family."); + return -1; + } + if (rv < 0) { int e = tor_socket_errno(ENTRY_TO_CONN(conn)->s); log_warn(LD_NET, "getsockopt() failed: %s", tor_socket_strerror(e)); return -1; From cca6ed80bf6814386e3d1640c1849eb20f18b34f Mon Sep 17 00:00:00 2001 From: "Francisco Blas Izquierdo Riera (klondike)" Date: Tue, 23 Dec 2014 10:51:36 -0500 Subject: [PATCH 045/120] Add the transparent proxy getsockopt to the sandbox When receiving a trasnsparently proxied request with tor using iptables tor dies because the appropriate getsockopt calls aren't enabled on the sandbox. This patch fixes this by adding the two getsockopt calls used when doing transparent proxying with tor to the sandbox for the getsockopt policy. This patch is released under the same license as the original file as long as the author is credited. Signed-off-by: Francisco Blas Izquierdo Riera (klondike) --- src/common/sandbox.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/common/sandbox.c b/src/common/sandbox.c index ece56df81f..82117cb2ba 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -58,6 +58,17 @@ #include #include +#ifdef HAVE_LINUX_NETFILTER_IPV4_H +#include +#endif +#ifdef HAVE_LINUX_IF_H +#include +#endif +#ifdef HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H +#include +#endif + + #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \ defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION) #define USE_BACKTRACE @@ -634,6 +645,22 @@ sb_getsockopt(scmp_filter_ctx ctx, sandbox_cfg_t *filter) if (rc) return rc; +#ifdef HAVE_LINUX_NETFILTER_IPV4_H + rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt), + SCMP_CMP(1, SCMP_CMP_EQ, SOL_IP), + SCMP_CMP(2, SCMP_CMP_EQ, SO_ORIGINAL_DST)); + if (rc) + return rc; +#endif + +#ifdef HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H + rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getsockopt), + SCMP_CMP(1, SCMP_CMP_EQ, SOL_IPV6), + SCMP_CMP(2, SCMP_CMP_EQ, IP6T_SO_ORIGINAL_DST)); + if (rc) + return rc; +#endif + return 0; } From d151a069e9a35788874d8aead3e6720a8924e9b5 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 10:53:40 -0500 Subject: [PATCH 046/120] tweak whitespace; log bad socket family if bug occurs --- src/common/sandbox.c | 1 - src/or/connection_edge.c | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/sandbox.c b/src/common/sandbox.c index 82117cb2ba..b1c2a09f14 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -68,7 +68,6 @@ #include #endif - #if defined(HAVE_EXECINFO_H) && defined(HAVE_BACKTRACE) && \ defined(HAVE_BACKTRACE_SYMBOLS_FD) && defined(HAVE_SIGACTION) #define USE_BACKTRACE diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 09645d04b9..5ab9af52c4 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -59,7 +59,6 @@ #define TRANS_NETFILTER_IPV6 #endif - #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H) #include #include @@ -1430,7 +1429,9 @@ destination_from_socket(entry_connection_t *conn, socks_request_t *req) break; #endif default: - log_warn(LD_BUG, "Received transparent data from an unsuported socket family."); + log_warn(LD_BUG, + "Received transparent data from an unsuported socket family %d", + ENTRY_TO_CONN(conn)->socket_family); return -1; } if (rv < 0) { From 184a2dbbdd27f958f5ac290fe030d1fac2959157 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 10:55:25 -0500 Subject: [PATCH 047/120] whoops; missing changes file for 14013 --- changes/bug14013 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changes/bug14013 diff --git a/changes/bug14013 b/changes/bug14013 new file mode 100644 index 0000000000..640cf859f5 --- /dev/null +++ b/changes/bug14013 @@ -0,0 +1,6 @@ + o Major bugfixes: + - When reading a hexadecimal, base-32, or base-64 encoded value + from a string, always overwrite the complete output buffer. This + prevents some bugs where we would look at (but fortunately, not + reveal) uninitialized memory on the stack. Fixes bug 14013; + bugfix on all versions of Tor. From dfebefe68f707c452a3a3f2b1b86c146cf0ca30b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 10:59:48 -0500 Subject: [PATCH 048/120] changs file for 13808 --- changes/bug13808 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 changes/bug13808 diff --git a/changes/bug13808 b/changes/bug13808 new file mode 100644 index 0000000000..b24a01c17b --- /dev/null +++ b/changes/bug13808 @@ -0,0 +1,9 @@ + o Minor features (transparent proxy): + - Use the correct option when using IPv6 with transparent proxy + support on Linux. Resolves 13808. Patch by Francisco Blas + Izquierdo Riera. + + o Minor bugfixes (sandbox): + - Make transparent proxy support work along with the seccomp2 + sandbox. Fixes part of bug 13808; bugfix on 0.2.5.1-alpha. + Patch by Francisco Blas Izquierdo Riera. From aabaed6f497335b81f18347e626ff3d9ae7799d5 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 21 Feb 2014 00:24:25 +0100 Subject: [PATCH 049/120] add support for systemd notification protocol This permit for now to signal readiness in a cleaner way to systemd. --- configure.ac | 35 ++++++++++++++++++++++++++++++++++- src/or/include.am | 4 ++-- src/or/main.c | 9 +++++++++ src/test/include.am | 6 ++++-- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 88b4da006d..bec6196fab 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,8 @@ AC_CONFIG_HEADERS([orconfig.h]) AC_CANONICAL_HOST +PKG_PROG_PKG_CONFIG + if test -f /etc/redhat-release ; then if test -f /usr/kerberos/include ; then CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" @@ -105,6 +107,37 @@ AC_ARG_ENABLE(upnp, * ) AC_MSG_ERROR(bad value for --enable-upnp) ;; esac], [upnp=false]) +# systemd notify support +AC_ARG_ENABLE(systemd, + AS_HELP_STRING(--enable-systemd, enable systemd notification support), + [case "${enableval}" in + yes) systemd=true ;; + no) systemd=false ;; + * ) AC_MSG_ERROR(bad value for --enable-systemd) ;; + esac], [systemd=auto]) + + + +# systemd support +if test x$enable_systemd = xfalse ; then + have_systemd=no; +else + PKG_CHECK_MODULES(SYSTEMD, + [libsystemd-daemon], + have_systemd=yes, + have_systemd=no) +fi + +if test x$have_systemd = xyes; then + AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd]) + TOR_SYSTEMD_LIBS="-lsystemd-daemon" +fi +AC_SUBST(TOR_SYSTEMD_LIBS) + +if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then + AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found]) +fi + case $host in *-*-solaris* ) AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h]) @@ -618,7 +651,7 @@ dnl since sometimes the linker will like an option but not be willing to dnl use it with a build of a library. all_ldflags_for_check="$TOR_LDFLAGS_zlib $TOR_LDFLAGS_openssl $TOR_LDFLAGS_libevent" -all_libs_for_check="$TOR_ZLIB_LIBS $TOR_LIB_MATH $TOR_LIBEVENT_LIBS $TOR_OPENSSL_LIBS $TOR_LIB_WS32 $TOR_LIB_GDI" +all_libs_for_check="$TOR_ZLIB_LIBS $TOR_LIB_MATH $TOR_LIBEVENT_LIBS $TOR_OPENSSL_LIBS $TOR_SYSTEMD_LIBS $TOR_LIB_WS32 $TOR_LIB_GDI" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ #if !defined(__clang__) diff --git a/src/or/include.am b/src/or/include.am index 643f7ce001..fb1581c463 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -111,7 +111,7 @@ src_or_tor_LDADD = src/or/libtor.a src/common/libor.a \ src/common/libor-crypto.a $(LIBDONNA) \ src/common/libor-event.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \ - @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ + @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ if COVERAGE_ENABLED src_or_tor_cov_SOURCES = src/or/tor_main.c @@ -122,7 +122,7 @@ src_or_tor_cov_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \ src/common/libor-crypto-testing.a $(LIBDONNA) \ src/common/libor-event-testing.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \ - @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ + @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ endif ORHEADERS = \ diff --git a/src/or/main.c b/src/or/main.c index 160bfa00e0..9fa62f89ef 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -75,6 +75,10 @@ #include #endif +#ifdef HAVE_SYSTEMD +#include +#endif + void evdns_shutdown(int); /********* PROTOTYPES **********/ @@ -2043,6 +2047,11 @@ do_main_loop(void) } #endif +#ifdef HAVE_SYSTEMD + log_notice(LD_GENERAL, "Signaling readyness to systemd"); + sd_notify(0, "READY=1"); +#endif + for (;;) { if (nt_service_is_stopping()) return 0; diff --git a/src/test/include.am b/src/test/include.am index d7a647940b..9db1587da7 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -68,7 +68,8 @@ src_test_test_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \ src/common/libor-crypto-testing.a $(LIBDONNA) \ src/common/libor-event-testing.a src/trunnel/libor-trunnel-testing.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \ - @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ + @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ \ + @TOR_SYSTEMD_LIBS@ src_test_bench_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \ @TOR_LDFLAGS_libevent@ @@ -76,7 +77,8 @@ src_test_bench_LDADD = src/or/libtor.a src/common/libor.a \ src/common/libor-crypto.a $(LIBDONNA) \ src/common/libor-event.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \ - @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ + @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ \ + @TOR_SYSTEMD_LIBS@ noinst_HEADERS+= \ src/test/fakechans.h \ From 29ac883606d6d5ebfdcc2efceb2b4b60ee6a8916 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 23 Dec 2014 11:22:42 -0500 Subject: [PATCH 050/120] Add support for systemd watchdog protocol It work by notifying systemd on a regular basis. If there is no notification, the daemon is restarted. This requires a version newer than the 209 version of systemd, as it is not supported before. --- configure.ac | 20 ++++++++++++++++++++ src/or/main.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/configure.ac b/configure.ac index bec6196fab..666478f920 100644 --- a/configure.ac +++ b/configure.ac @@ -138,6 +138,26 @@ if test x$enable_systemd = xyes -a x$have_systemd != xyes ; then AC_MSG_ERROR([Explicitly requested systemd support, but systemd not found]) fi +AC_ARG_ENABLE(threads, + AS_HELP_STRING(--disable-threads, disable multi-threading support)) + +if test x$enable_threads = x; then + case $host in + *-*-solaris* ) + # Don't try multithreading on solaris -- cpuworkers seem to lock. + AC_MSG_NOTICE([You are running Solaris; Sometimes threading makes +cpu workers lock up here, so I will disable threads.]) + enable_threads="no";; + *) + enable_threads="yes";; + esac +fi + +ifdef([HAVE_SYSTEMD], [ +AC_SEARCH_LIBS([sd_watchdog_enabled], [systemd-daemon], + [AC_DEFINE(HAVE_SYSTEMD_209,1,[Have systemd v209 or more])], []) +]) + case $host in *-*-solaris* ) AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h]) diff --git a/src/or/main.c b/src/or/main.c index 9fa62f89ef..5a17212da6 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1763,6 +1763,17 @@ second_elapsed_callback(periodic_timer_t *timer, void *arg) current_second = now; /* remember which second it is, for next time */ } +#ifdef HAVE_SYSTEMD_209 +static periodic_timer_t *systemd_watchdog_timer = NULL; + +/** Libevent callback: invoked to reset systemd watchdog. */ +static void +systemd_watchdog_callback(periodic_timer_t *timer, void *arg) +{ + sd_notify(1, "WATCHDOG=1"); +} +#endif + #ifndef USE_BUFFEREVENTS /** Timer: used to invoke refill_callback(). */ static periodic_timer_t *refill_timer = NULL; @@ -2031,6 +2042,24 @@ do_main_loop(void) tor_assert(second_timer); } +#ifdef HAVE_SYSTEMD_209 + uint64_t watchdog_delay; + /* set up systemd watchdog notification. */ + if (sd_watchdog_enabled(1, &watchdog_delay)) { + if (! systemd_watchdog_timer) { + struct timeval watchdog; + watchdog.tv_sec = 0; + watchdog.tv_usec = watchdog_delay/2; + + systemd_watchdog_timer = periodic_timer_new(tor_libevent_get_base(), + &watchdog, + systemd_watchdog_callback, + NULL); + tor_assert(systemd_watchdog_timer); + } + } +#endif + #ifndef USE_BUFFEREVENTS if (!refill_timer) { struct timeval refill_interval; From 2f46e5e7558ca3b7dab16fb970d16c1a3dfd190c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 11:27:16 -0500 Subject: [PATCH 051/120] Adjust systemd watchdog support Document why we divide it by two. Check for > 0 instead of nonzero for success, since that's what the manpage says. Allow watchdog timers greater than 1 second. --- src/or/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/or/main.c b/src/or/main.c index 5a17212da6..58e3ad3e4d 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2045,11 +2045,15 @@ do_main_loop(void) #ifdef HAVE_SYSTEMD_209 uint64_t watchdog_delay; /* set up systemd watchdog notification. */ - if (sd_watchdog_enabled(1, &watchdog_delay)) { + if (sd_watchdog_enabled(1, &watchdog_delay) > 0) { if (! systemd_watchdog_timer) { struct timeval watchdog; - watchdog.tv_sec = 0; - watchdog.tv_usec = watchdog_delay/2; + /* The manager will "act on" us if we don't send them a notification + * every 'watchdog_delay' microseconds. So, send notifications twice + * that often. */ + watchdog_delay /= 2; + watchdog.tv_sec = watchdog_delay / 1000000; + watchdog.tv_usec = watchdog_delay % 1000000; systemd_watchdog_timer = periodic_timer_new(tor_libevent_get_base(), &watchdog, From 7e1289b3eca37d72c87cc9a4a4a623e36095553e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 11:32:10 -0500 Subject: [PATCH 052/120] changes file for ticket11016 --- changes/ticket11016 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changes/ticket11016 diff --git a/changes/ticket11016 b/changes/ticket11016 new file mode 100644 index 0000000000..98d5d49697 --- /dev/null +++ b/changes/ticket11016 @@ -0,0 +1,6 @@ + o Minor features (systemd): + - Where supported, when running with systemd, report successful + startup to systemd. Part of ticket 11016. Patch by Michael + Scherer. + - When running with systemd, support systemd watchdog messages. + Part of ticket 11016. Patch by Michael Scherer. From 6285d9bdcf7f210c56abd25f75133e30d05a7473 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 11:36:27 -0500 Subject: [PATCH 053/120] Fix compilation on platforms without IP6T_SO_ORIGINAL_DST --- src/or/connection_edge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 5ab9af52c4..6c872852b3 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -55,9 +55,11 @@ #ifdef HAVE_LINUX_NETFILTER_IPV6_IP6_TABLES_H #include +#if defined(IP6T_SO_ORIGINAL_DST) #define TRANS_NETFILTER #define TRANS_NETFILTER_IPV6 #endif +#endif #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H) #include From 45b911b79b66d5df700cd3cae0c7c1dcb9cec843 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 11:39:48 -0500 Subject: [PATCH 054/120] Add pkg.m4 to use pkgconfig macros --- LICENSE | 31 +++++++- m4/pkg.m4 | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 244 insertions(+), 1 deletion(-) create mode 100644 m4/pkg.m4 diff --git a/LICENSE b/LICENSE index 7e5094742a..d0fb43a0c3 100644 --- a/LICENSE +++ b/LICENSE @@ -191,7 +191,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT DATABASE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================== m4/pc_from_ucontext.m4 is available under the following license. Note that -it is *not* built into the Tor license. +it is *not* built into the Tor software. Copyright (c) 2005, Google Inc. All rights reserved. @@ -222,6 +222,35 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +=============================================================================== +m4/pkg.m4 is available under the following license. Note that +it is *not* built into the Tor software. + +pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +serial 1 (pkg-config-0.24) + +Copyright © 2004 Scott James Remnant . + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As a special exception to the GNU General Public License, if you +distribute this file as part of a program that contains a +configuration script generated by Autoconf, you may include it under +the same distribution terms that you use for the rest of that program. + + =============================================================================== If you got Tor as a static binary with OpenSSL included, then you should know: "This product includes software developed by the OpenSSL Project diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 0000000000..c5b26b52e6 --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,214 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR From c83f18011697d3b3c3434464280271697f79d20a Mon Sep 17 00:00:00 2001 From: "Francisco Blas Izquierdo Riera (klondike)" Date: Tue, 23 Dec 2014 12:55:48 -0500 Subject: [PATCH 055/120] Fix Matthews code to actually use tmp Matthew's autoaddr code returned an undecorated address when trying to check that the code didn't insert an undecorated one into the map. This patch fixes this by actually storing the undecorated address in tmp instead of buf as it was originally intended. This patch is released under the same license as the original file as long as the author iscredited. Signed-off-by: Francisco Blas Izquierdo Riera (klondike) --- src/or/addressmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index 998770a3db..9062d76eed 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -888,7 +888,7 @@ addressmap_get_virtual_address(int type) /* XXXX This code is to make sure I didn't add an undecorated version * by mistake. I hope it's needless. */ char tmp[TOR_ADDR_BUF_LEN]; - tor_addr_to_str(buf, &addr, sizeof(tmp), 0); + tor_addr_to_str(tmp, &addr, sizeof(tmp), 0); if (strmap_get(addressmap, tmp)) { log_warn(LD_BUG, "%s wasn't in the addressmap, but %s was.", buf, tmp); From c10ff2626502531a3d87989236e932c656e86801 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 23 Dec 2014 13:00:21 -0500 Subject: [PATCH 056/120] Changes file for 13811 --- changes/bug13811 | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changes/bug13811 diff --git a/changes/bug13811 b/changes/bug13811 new file mode 100644 index 0000000000..1b9bd9c68d --- /dev/null +++ b/changes/bug13811 @@ -0,0 +1,6 @@ + o Major bugfixes (client, automap): + - Repair automapping with IPv6 addresses; this automapping should + have worked previously, but one piece of debugging code that we + inserted to detect a regression actually caused the regression + to manifest itself again. Fixes bug 13811; bugfix on + 0.2.4.7-alpha. Diagnosed and fixed by Francisco Blas Izquierdo Riera. \ No newline at end of file From 083c58f126a4390b96b0e3f14d809502d8702f3d Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 20 Dec 2014 21:42:28 +1100 Subject: [PATCH 057/120] Fix TestingMinExitFlagThreshold 0 Stop requiring exits to have non-zero bandwithcapacity in a TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0, ignore exit bandwidthcapacity. This assists in bootstrapping a testing Tor network. Fixes bugs 13718 & 13839. Makes bug 13161's TestingDirAuthVoteExit non-essential. --- .../bug13839-fix-TestingMinExitFlagThreshold | 7 ++++++ src/or/dirserv.c | 24 +++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 changes/bug13839-fix-TestingMinExitFlagThreshold diff --git a/changes/bug13839-fix-TestingMinExitFlagThreshold b/changes/bug13839-fix-TestingMinExitFlagThreshold new file mode 100644 index 0000000000..947614f550 --- /dev/null +++ b/changes/bug13839-fix-TestingMinExitFlagThreshold @@ -0,0 +1,7 @@ + o Minor bugfixes: + - Stop requiring exits to have non-zero bandwithcapacity in a + TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0, + ignore exit bandwidthcapacity. + This assists in bootstrapping a testing Tor network. + Fixes bugs 13718 & 13839. + Makes bug 13161's TestingDirAuthVoteExit non-essential. diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d31bb72361..a1d22b041f 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -887,12 +887,26 @@ static int router_is_active(const routerinfo_t *ri, const node_t *node, time_t now) { time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH; - if (ri->cache_info.published_on < cutoff) + if (ri->cache_info.published_on < cutoff) { return 0; - if (!node->is_running || !node->is_valid || ri->is_hibernating) + } + if (!node->is_running || !node->is_valid || ri->is_hibernating) { return 0; - if (!ri->bandwidthcapacity) + } + /* Only require bandwith capacity in non-test networks, or + * if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */ + if (!ri->bandwidthcapacity) { + if (get_options()->TestingTorNetwork) { + if (get_options()->TestingMinExitFlagThreshold > 0) { + /* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is, + * then require bandwidthcapacity */ + return 0; + } + } else { + /* If we're not in a TestingTorNetwork, then require bandwidthcapacity */ return 0; + } + } return 1; } @@ -1037,7 +1051,7 @@ directory_fetches_dir_info_later(const or_options_t *options) } /** Return true iff we want to fetch and keep certificates for authorities - * that we don't acknowledge as aurthorities ourself. + * that we don't acknowledge as authorities ourself. */ int directory_caches_unknown_auth_certs(const or_options_t *options) @@ -1498,7 +1512,7 @@ dirserv_compute_performance_thresholds(routerlist_t *rl, (unsigned long)guard_tk, (unsigned long)guard_bandwidth_including_exits_kb, (unsigned long)guard_bandwidth_excluding_exits_kb, - enough_mtbf_info ? "" : " don't "); + enough_mtbf_info ? "" : " don't"); tor_free(uptimes); tor_free(mtbfs); From 1ee41b3eef4b5e561c7c73e79885fe858dac6d80 Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 20 Dec 2014 21:53:00 +1100 Subject: [PATCH 058/120] Allow consensus interval of 10 seconds when testing Decrease minimum consensus interval to 10 seconds when TestingTorNetwork is set. (Or 5 seconds for the first consensus.) Fix code that assumes larger interval values. This assists in quickly bootstrapping a testing Tor network. Fixes bugs 13718 & 13823. --- changes/bug13823-decrease-consensus-interval | 8 ++ src/or/config.c | 78 ++++++++++++++++---- src/or/dirvote.c | 8 +- src/or/dirvote.h | 32 +++++++- src/or/networkstatus.c | 12 +++ src/or/router.c | 13 +++- src/or/routerlist.c | 22 +++++- src/or/routerparse.c | 8 +- 8 files changed, 160 insertions(+), 21 deletions(-) create mode 100644 changes/bug13823-decrease-consensus-interval diff --git a/changes/bug13823-decrease-consensus-interval b/changes/bug13823-decrease-consensus-interval new file mode 100644 index 0000000000..1d99bd73cb --- /dev/null +++ b/changes/bug13823-decrease-consensus-interval @@ -0,0 +1,8 @@ + o Minor bugfixes: + - Decrease minimum consensus interval to 10 seconds + when TestingTorNetwork is set. (Or 5 seconds for + the first consensus.) + Fix code that assumes larger interval values. + This assists in quickly bootstrapping a testing + Tor network. + Fixes bugs 13718 & 13823. diff --git a/src/or/config.c b/src/or/config.c index 28f1df0663..a779771c86 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -468,7 +468,7 @@ static const config_var_t testing_tor_network_defaults[] = { V(V3AuthVotingInterval, INTERVAL, "5 minutes"), V(V3AuthVoteDelay, INTERVAL, "20 seconds"), V(V3AuthDistDelay, INTERVAL, "20 seconds"), - V(TestingV3AuthInitialVotingInterval, INTERVAL, "5 minutes"), + V(TestingV3AuthInitialVotingInterval, INTERVAL, "150 seconds"), V(TestingV3AuthInitialVoteDelay, INTERVAL, "20 seconds"), V(TestingV3AuthInitialDistDelay, INTERVAL, "20 seconds"), V(TestingV3AuthVotingStartOffset, INTERVAL, "0"), @@ -3397,19 +3397,68 @@ options_validate(or_options_t *old_options, or_options_t *options, if (options->V3AuthVoteDelay + options->V3AuthDistDelay >= options->V3AuthVotingInterval/2) { - REJECT("V3AuthVoteDelay plus V3AuthDistDelay must be less than half " - "V3AuthVotingInterval"); + /* + This doesn't work, but it seems like it should: + what code is preventing the interval being less than twice the lead-up? + if (options->TestingTorNetwork) { + if (options->V3AuthVoteDelay + options->V3AuthDistDelay >= + options->V3AuthVotingInterval) { + REJECT("V3AuthVoteDelay plus V3AuthDistDelay must be less than " + "V3AuthVotingInterval"); + } else { + COMPLAIN("V3AuthVoteDelay plus V3AuthDistDelay is more than half " + "V3AuthVotingInterval. This may lead to " + "consensus instability, particularly if clocks drift."); + } + } else { + */ + REJECT("V3AuthVoteDelay plus V3AuthDistDelay must be less than half " + "V3AuthVotingInterval"); + /* + } + */ + } + + if (options->V3AuthVoteDelay < MIN_VOTE_SECONDS) { + if (options->TestingTorNetwork) { + if (options->V3AuthVoteDelay < MIN_VOTE_SECONDS_TESTING) { + REJECT("V3AuthVoteDelay is way too low."); + } else { + COMPLAIN("V3AuthVoteDelay is very low. " + "This may lead to failure to vote for a consensus."); + } + } else { + REJECT("V3AuthVoteDelay is way too low."); + } + } + + if (options->V3AuthDistDelay < MIN_DIST_SECONDS) { + if (options->TestingTorNetwork) { + if (options->V3AuthDistDelay < MIN_DIST_SECONDS_TESTING) { + REJECT("V3AuthDistDelay is way too low."); + } else { + COMPLAIN("V3AuthDistDelay is very low. " + "This may lead to missing votes in a consensus."); + } + } else { + REJECT("V3AuthDistDelay is way too low."); + } } - if (options->V3AuthVoteDelay < MIN_VOTE_SECONDS) - REJECT("V3AuthVoteDelay is way too low."); - if (options->V3AuthDistDelay < MIN_DIST_SECONDS) - REJECT("V3AuthDistDelay is way too low."); if (options->V3AuthNIntervalsValid < 2) REJECT("V3AuthNIntervalsValid must be at least 2."); if (options->V3AuthVotingInterval < MIN_VOTE_INTERVAL) { - REJECT("V3AuthVotingInterval is insanely low."); + if (options->TestingTorNetwork) { + if (options->V3AuthVotingInterval < MIN_VOTE_INTERVAL_TESTING) { + REJECT("V3AuthVotingInterval is insanely low."); + } else { + COMPLAIN("V3AuthVotingInterval is very low. " + "This may lead to failure to synchronise for a consensus."); + } + } else { + REJECT("V3AuthVotingInterval is insanely low."); + } } else if (options->V3AuthVotingInterval > 24*60*60) { REJECT("V3AuthVotingInterval is insanely high."); } else if (((24*60*60) % options->V3AuthVotingInterval) != 0) { @@ -3484,26 +3533,27 @@ options_validate(or_options_t *old_options, or_options_t *options, CHECK_DEFAULT(TestingCertMaxDownloadTries); #undef CHECK_DEFAULT - if (options->TestingV3AuthInitialVotingInterval < MIN_VOTE_INTERVAL) { + if (options->TestingV3AuthInitialVotingInterval + < MIN_VOTE_INTERVAL_TESTING_INITIAL) { REJECT("TestingV3AuthInitialVotingInterval is insanely low."); } else if (((30*60) % options->TestingV3AuthInitialVotingInterval) != 0) { REJECT("TestingV3AuthInitialVotingInterval does not divide evenly into " "30 minutes."); } - if (options->TestingV3AuthInitialVoteDelay < MIN_VOTE_SECONDS) { + if (options->TestingV3AuthInitialVoteDelay < MIN_VOTE_SECONDS_TESTING) { REJECT("TestingV3AuthInitialVoteDelay is way too low."); } - if (options->TestingV3AuthInitialDistDelay < MIN_DIST_SECONDS) { + if (options->TestingV3AuthInitialDistDelay < MIN_DIST_SECONDS_TESTING) { REJECT("TestingV3AuthInitialDistDelay is way too low."); } if (options->TestingV3AuthInitialVoteDelay + options->TestingV3AuthInitialDistDelay >= - options->TestingV3AuthInitialVotingInterval/2) { + options->TestingV3AuthInitialVotingInterval) { REJECT("TestingV3AuthInitialVoteDelay plus TestingV3AuthInitialDistDelay " - "must be less than half TestingV3AuthInitialVotingInterval"); + "must be less than TestingV3AuthInitialVotingInterval"); } if (options->TestingV3AuthVotingStartOffset > @@ -3511,6 +3561,8 @@ options_validate(or_options_t *old_options, or_options_t *options, options->V3AuthVotingInterval)) { REJECT("TestingV3AuthVotingStartOffset is higher than the voting " "interval."); + } else if (options->TestingV3AuthVotingStartOffset < 0) { + REJECT("TestingV3AuthVotingStartOffset must be non-negative."); } if (options->TestingAuthDirTimeToLearnReachability < 0) { diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 39505a4f9e..c6068228f9 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -1107,8 +1107,12 @@ networkstatus_compute_consensus(smartlist_t *votes, vote_seconds = median_int(votesec_list, n_votes); dist_seconds = median_int(distsec_list, n_votes); - tor_assert(valid_after+MIN_VOTE_INTERVAL <= fresh_until); - tor_assert(fresh_until+MIN_VOTE_INTERVAL <= valid_until); + tor_assert(valid_after + + (get_options()->TestingTorNetwork ? + MIN_VOTE_INTERVAL_TESTING : MIN_VOTE_INTERVAL) <= fresh_until); + tor_assert(fresh_until + + (get_options()->TestingTorNetwork ? + MIN_VOTE_INTERVAL_TESTING : MIN_VOTE_INTERVAL) <= valid_until); tor_assert(vote_seconds >= MIN_VOTE_SECONDS); tor_assert(dist_seconds >= MIN_DIST_SECONDS); diff --git a/src/or/dirvote.h b/src/or/dirvote.h index 5d44ba4320..b570e9d251 100644 --- a/src/or/dirvote.h +++ b/src/or/dirvote.h @@ -14,12 +14,42 @@ #include "testsupport.h" +/* + * Ideally, assuming synced clocks, we should only need 1 second for each of: + * - Vote + * - Distribute + * - Consensus Publication + * As we can gather descriptors continuously. + * (Could we even go as far as publishing the previous consensus, + * in the same second that we vote for the next one?) + * But we're not there yet: these are the lowest working values at this time. + */ + /** Lowest allowable value for VoteSeconds. */ #define MIN_VOTE_SECONDS 2 +/** Lowest allowable value for VoteSeconds when TestingTorNetwork is 1 */ +#define MIN_VOTE_SECONDS_TESTING 2 + /** Lowest allowable value for DistSeconds. */ #define MIN_DIST_SECONDS 2 -/** Smallest allowable voting interval. */ +/** Lowest allowable value for DistSeconds when TestingTorNetwork is 1 */ +#define MIN_DIST_SECONDS_TESTING 2 + +/** Lowest allowable voting interval. */ #define MIN_VOTE_INTERVAL 300 +/** Lowest allowable voting interval when TestingTorNetwork is 1: + * Voting Interval can be: + * 10, 12, 15, 18, 20, 24, 25, 30, 36, 40, 45, 50, 60, ... + * Testing Initial Voting Interval can be: + * 5, 6, 8, 9, or any of the possible values for Voting Interval, + * as they both need to evenly divide 30 minutes. + * If clock desynchronisation is an issue, use an interval of at least: + * 18 * drift in seconds, to allow for a clock slop factor */ +#define MIN_VOTE_INTERVAL_TESTING \ + (((MIN_VOTE_SECONDS_TESTING)+(MIN_DIST_SECONDS_TESTING)+1)*2) + +#define MIN_VOTE_INTERVAL_TESTING_INITIAL \ + ((MIN_VOTE_SECONDS_TESTING)+(MIN_DIST_SECONDS_TESTING)+1) /** The lowest consensus method that we currently support. */ #define MIN_SUPPORTED_CONSENSUS_METHOD 13 diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 21efdd129d..9b24405951 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -832,6 +832,10 @@ update_consensus_networkstatus_fetch_time_impl(time_t now, int flav) a crazy-fast voting interval, though, 2 minutes may be too much. */ min_sec_before_caching = interval/16; + /* make sure we always delay by at least a second before caching */ + if (min_sec_before_caching == 0) { + min_sec_before_caching = 1; + } } if (directory_fetches_dir_info_early(options)) { @@ -863,8 +867,16 @@ update_consensus_networkstatus_fetch_time_impl(time_t now, int flav) dl_interval = (c->valid_until - start) - min_sec_before_caching; } } + /* catch low dl_interval in crazy-fast networks */ if (dl_interval < 1) dl_interval = 1; + /* catch late start in crazy-fast networks */ + if (start+dl_interval >= c->valid_until) + start = c->valid_until - dl_interval - 1; + log_debug(LD_DIR, + "fresh_until: %ld start: %ld " + "dl_interval: %ld valid_until: %ld ", + c->fresh_until, start, dl_interval, c->valid_until); /* We must not try to replace c while it's still fresh: */ tor_assert(c->fresh_until < start); /* We must download the next one before c is invalid: */ diff --git a/src/or/router.c b/src/or/router.c index 56bb909952..bad5242603 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1223,6 +1223,11 @@ router_orport_found_reachable(void) " Publishing server descriptor." : ""); can_reach_or_port = 1; mark_my_descriptor_dirty("ORPort found reachable"); + /* This is a significant enough change to upload immediately, + * at least in a test network */ + if (get_options()->TestingTorNetwork == 1) { + reschedule_descriptor_update_check(); + } control_event_server_status(LOG_NOTICE, "REACHABILITY_SUCCEEDED ORADDRESS=%s:%d", address, me->or_port); @@ -1240,8 +1245,14 @@ router_dirport_found_reachable(void) log_notice(LD_DIRSERV,"Self-testing indicates your DirPort is reachable " "from the outside. Excellent."); can_reach_dir_port = 1; - if (decide_to_advertise_dirport(get_options(), me->dir_port)) + if (decide_to_advertise_dirport(get_options(), me->dir_port)) { mark_my_descriptor_dirty("DirPort found reachable"); + /* This is a significant enough change to upload immediately, + * at least in a test network */ + if (get_options()->TestingTorNetwork == 1) { + reschedule_descriptor_update_check(); + } + } control_event_server_status(LOG_NOTICE, "REACHABILITY_SUCCEEDED DIRADDRESS=%s:%d", address, me->dir_port); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 8379bc80b3..60d8e71a28 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2210,11 +2210,29 @@ router_choose_random_node(smartlist_t *excludedsmartlist, router_add_running_nodes_to_smartlist(sl, allow_invalid, need_uptime, need_capacity, need_guard, need_desc); + log_debug(LD_CIRC, + "We found %d running nodes.", + smartlist_len(sl)); + smartlist_subtract(sl,excludednodes); - if (excludedsmartlist) + log_debug(LD_CIRC, + "We removed %d excludednodes, leaving %d nodes.", + smartlist_len(excludednodes), + smartlist_len(sl)); + + if (excludedsmartlist) { smartlist_subtract(sl,excludedsmartlist); - if (excludedset) + log_debug(LD_CIRC, + "We removed %d excludedsmartlist, leaving %d nodes.", + smartlist_len(excludedsmartlist), + smartlist_len(sl)); + } + if (excludedset) { routerset_subtract_nodes(sl,excludedset); + log_debug(LD_CIRC, + "We removed excludedset, leaving %d nodes.", + smartlist_len(sl)); + } // Always weight by bandwidth choice = node_sl_choose_by_bandwidth(sl, rule); diff --git a/src/or/routerparse.c b/src/or/routerparse.c index bc3b00226a..8176d47262 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -2598,11 +2598,15 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out, (int) tor_parse_long(tok->args[1], 10, 0, INT_MAX, &ok, NULL); if (!ok) goto err; - if (ns->valid_after + MIN_VOTE_INTERVAL > ns->fresh_until) { + if (ns->valid_after + + (get_options()->TestingTorNetwork ? + MIN_VOTE_INTERVAL_TESTING : MIN_VOTE_INTERVAL) > ns->fresh_until) { log_warn(LD_DIR, "Vote/consensus freshness interval is too short"); goto err; } - if (ns->valid_after + MIN_VOTE_INTERVAL*2 > ns->valid_until) { + if (ns->valid_after + + (get_options()->TestingTorNetwork ? + MIN_VOTE_INTERVAL_TESTING : MIN_VOTE_INTERVAL)*2 > ns->valid_until) { log_warn(LD_DIR, "Vote/consensus liveness interval is too short"); goto err; } From 8a8797f1e45e6124ac93e3a8fb277b5758d7c935 Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 20 Dec 2014 21:59:17 +1100 Subject: [PATCH 059/120] Fix If-Modified-Since in rapidly updating Tor networks When V3AuthVotingInterval is low, decrease the delay on the If-Modified-Since header passed to directory servers. This allows us to obtain consensuses promptly when the consensus interval is very short. This assists in bootstrapping a testing Tor network. Fixes bugs 13718 & 13963. --- .../bug13963-decrease-if-modified-since-delay | 7 +++++ src/or/directory.c | 27 ++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 changes/bug13963-decrease-if-modified-since-delay diff --git a/changes/bug13963-decrease-if-modified-since-delay b/changes/bug13963-decrease-if-modified-since-delay new file mode 100644 index 0000000000..62371444c4 --- /dev/null +++ b/changes/bug13963-decrease-if-modified-since-delay @@ -0,0 +1,7 @@ + o Minor bugfixes: + - When V3AuthVotingInterval is low, decrease the delay on the + If-Modified-Since header passed to directory servers. + This allows us to obtain consensuses promptly when the consensus + interval is very short. + This assists in bootstrapping a testing Tor network. + Fixes bugs 13718 & 13963. diff --git a/src/or/directory.c b/src/or/directory.c index cca4b54e24..b88c9d9f10 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -433,18 +433,33 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose, if (resource) flav = networkstatus_parse_flavor_name(resource); + /* DEFAULT_IF_MODIFIED_SINCE_DELAY is 1/20 of the default consensus + * period of 1 hour. + */ +#define DEFAULT_IF_MODIFIED_SINCE_DELAY (180) if (flav != -1) { /* IF we have a parsed consensus of this type, we can do an * if-modified-time based on it. */ v = networkstatus_get_latest_consensus_by_flavor(flav); - if (v) - if_modified_since = v->valid_after + 180; + if (v) { + /* In networks with particularly short V3AuthVotingIntervals, + * ask for the consensus if it's been modified since half the + * V3AuthVotingInterval of the most recent consensus. */ + time_t ims_delay = DEFAULT_IF_MODIFIED_SINCE_DELAY; + if (v->fresh_until > v->valid_after + && ims_delay > (v->fresh_until - v->valid_after)/2) { + ims_delay = (v->fresh_until - v->valid_after)/2; + } + if_modified_since = v->valid_after + ims_delay; + } } else { /* Otherwise it might be a consensus we don't parse, but which we * do cache. Look at the cached copy, perhaps. */ cached_dir_t *cd = dirserv_get_consensus(resource); + /* We have no method of determining the voting interval from an + * unparsed consensus, so we use the default. */ if (cd) - if_modified_since = cd->published + 180; + if_modified_since = cd->published + DEFAULT_IF_MODIFIED_SINCE_DELAY; } } @@ -2258,6 +2273,7 @@ write_http_status_line(dir_connection_t *conn, int status, log_warn(LD_BUG,"status line too long."); return; } + log_debug(LD_DIRSERV,"Wrote status 'HTTP/1.0 %d %s'", status, reason_phrase); connection_write_to_buf(buf, strlen(buf), TO_CONN(conn)); } @@ -2554,8 +2570,11 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, if ((header = http_get_header(headers, "If-Modified-Since: "))) { struct tm tm; if (parse_http_time(header, &tm) == 0) { - if (tor_timegm(&tm, &if_modified_since)<0) + if (tor_timegm(&tm, &if_modified_since)<0) { if_modified_since = 0; + } else { + log_debug(LD_DIRSERV, "If-Modified-Since is '%s'.", escaped(header)); + } } /* The correct behavior on a malformed If-Modified-Since header is to * act as if no If-Modified-Since header had been given. */ From 0275b687648aa88ffda38e45db1cab1b55010125 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 25 Dec 2014 22:23:54 +1100 Subject: [PATCH 060/120] Fix log messages in channeltls.c Add hop number in debug "Contemplating intermediate hop..." Fix capitalisation on warn "Failed to choose an exit server" --- src/or/circuitbuild.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index faddc08e03..36ccdc9d5f 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1863,7 +1863,7 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit) choose_good_exit_server(circ->base_.purpose, state->need_uptime, state->need_capacity, state->is_internal); if (!node) { - log_warn(LD_CIRC,"failed to choose an exit server"); + log_warn(LD_CIRC,"Failed to choose an exit server"); return -1; } exit = extend_info_from_node(node, 0); @@ -1990,7 +1990,8 @@ choose_good_middle_server(uint8_t purpose, tor_assert(CIRCUIT_PURPOSE_MIN_ <= purpose && purpose <= CIRCUIT_PURPOSE_MAX_); - log_debug(LD_CIRC, "Contemplating intermediate hop: random choice."); + log_debug(LD_CIRC, "Contemplating intermediate hop %d: random choice.", + cur_len); excluded = smartlist_new(); if ((r = build_state_get_exit_node(state))) { nodelist_add_node_and_family(excluded, r); From 5710b83d5d4939a819e1d254aee21a8fe2688fec Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 25 Dec 2014 22:26:04 +1100 Subject: [PATCH 061/120] Fix a function name in a comment in config.c --- src/or/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/config.c b/src/or/config.c index e7891a5bd3..376270a688 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1832,7 +1832,7 @@ options_act(const or_options_t *old_options) directory_fetches_dir_info_early(old_options)) || !bool_eq(directory_fetches_dir_info_later(options), directory_fetches_dir_info_later(old_options))) { - /* Make sure update_router_have_min_dir_info gets called. */ + /* Make sure update_router_have_minimum_dir_info() gets called. */ router_dir_info_changed(); /* We might need to download a new consensus status later or sooner than * we had expected. */ From 2d199bdffecb83be684d8c7667d1880bd40243bc Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 25 Dec 2014 21:34:54 +1100 Subject: [PATCH 062/120] Fix grammar in comment on running_long_enough_to_decide_unreachable --- src/or/dirserv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/dirserv.c b/src/or/dirserv.c index a1d22b041f..45d12ed3b1 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -733,7 +733,7 @@ running_long_enough_to_decide_unreachable(void) } /** Each server needs to have passed a reachability test no more - * than this number of seconds ago, or he is listed as down in + * than this number of seconds ago, or it is listed as down in * the directory. */ #define REACHABLE_TIMEOUT (45*60) From 38af3b983fd4a80787d0ccd7c459084f2214464b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 26 Dec 2014 19:14:56 -0500 Subject: [PATCH 063/120] Improve a notice message in dirvote.c. (Roger asked for this.) --- src/or/dirvote.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/dirvote.c b/src/or/dirvote.c index c6068228f9..322596eb0a 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -2710,7 +2710,7 @@ dirvote_add_vote(const char *vote_body, const char **msg_out, int *status_out) goto discard; } else if (v->vote->published < vote->published) { log_notice(LD_DIR, "Replacing an older pending vote from this " - "directory."); + "directory (%s)", vi->address); cached_dir_decref(v->vote_body); networkstatus_vote_free(v->vote); v->vote_body = new_cached_dir(tor_strndup(vote_body, From eda5cebd6c334c3e6fa82c6623f33592a8f77e60 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 26 Dec 2014 19:17:24 -0500 Subject: [PATCH 064/120] Add another cellintptr use; fixes 14031 --- src/test/test_channel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/test_channel.c b/src/test/test_channel.c index 59f4596f74..82a5f44437 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -1406,6 +1406,7 @@ test_channel_queue_impossible(void *arg) ch->state = CHANNEL_STATE_MAINT; cell = tor_malloc_zero(sizeof(cell_t)); make_fake_cell(cell); + cellintptr = (uintptr_t)(void*)cell; channel_write_cell(ch, cell); /* Check that it's queued */ @@ -1414,7 +1415,7 @@ test_channel_queue_impossible(void *arg) tt_assert(q); if (q) { tt_int_op(q->type, ==, CELL_QUEUE_FIXED); - tt_ptr_op(q->u.fixed.cell, ==, cell); + tt_assert((uintptr_t)q->u.fixed.cell == cellintptr); } /* Clobber it, including the queue entry type */ tor_free(q->u.fixed.cell); From 4d6a971ba94f22a86577840cdf1b4935cd445a9b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 29 Dec 2014 08:41:30 -0500 Subject: [PATCH 065/120] Tweak 13913 fix: clarify that the behavior is not promised Also, it's->its. The apostrophe is used if and only if it's a contraction for "it is". --- changes/bug13913 | 6 ++++-- doc/tor.1.txt | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/changes/bug13913 b/changes/bug13913 index 7d908bd5b6..9a23180eb3 100644 --- a/changes/bug13913 +++ b/changes/bug13913 @@ -1,5 +1,7 @@ o Documentation: - Clarify HiddenServiceDir option description in manpage to make it - clear that directory in question is relative to current working - directory of Tor instance if it is defined as a relative path. Fixes + clear that relative paths are taken with respect to the current + working + directory of Tor instance. Also clarify that this behavior is + not guaranteed to remain indefinitely. Fixes issue 13913. diff --git a/doc/tor.1.txt b/doc/tor.1.txt index 6d55a7aed1..4e3e07e2d3 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -2032,8 +2032,11 @@ The following options are used to configure a hidden service. Store data files for a hidden service in DIRECTORY. Every hidden service must have a separate directory. You may use this option multiple times to specify multiple services. DIRECTORY must be an existing directory. - NB: if DIRECTORY is defined in relative way, it will be relative to current - working directory of Tor instance, not it's DataDirectory. + (Note: in current versions of Tor, if DIRECTORY is a relative path, + it will be relative to current + working directory of Tor instance, not to its DataDirectory. Do not + rely on this behavior; it is not guaranteed to remain the same in future + versions.) [[HiddenServicePort]] **HiddenServicePort** __VIRTPORT__ [__TARGET__]:: Configure a virtual port VIRTPORT for a hidden service. You may use this From a56511e594b14e8c97605c8e12084a91028d3747 Mon Sep 17 00:00:00 2001 From: rl1987 Date: Sat, 26 Apr 2014 16:53:28 +0300 Subject: [PATCH 066/120] Fix a few comments --- src/common/compat.c | 4 ++-- src/common/testsupport.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/compat.c b/src/common/compat.c index c5945fbd22..470e860f52 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -2061,8 +2061,8 @@ get_environment(void) #endif } -/** Set *addr to the IP address (in dotted-quad notation) stored in c. - * Return 1 on success, 0 if c is badly formatted. (Like inet_aton(c,addr), +/** Set *addr to the IP address (in dotted-quad notation) stored in *str. + * Return 1 on success, 0 if *str is badly formatted. (Like inet_aton(str,addr), * but works on Windows and Solaris.) */ int diff --git a/src/common/testsupport.h b/src/common/testsupport.h index 4a4f50b69b..59f7b19a03 100644 --- a/src/common/testsupport.h +++ b/src/common/testsupport.h @@ -20,8 +20,8 @@ * * and implement it as: * - * MOCK_IMPL(void - * writebuf,(size_t n, char *buf) + * MOCK_IMPL(void, + * writebuf,(size_t n, char *buf)) * { * ... * } From 28217b969eec213e7eb01bc8382fb1236eb4bbdd Mon Sep 17 00:00:00 2001 From: rl1987 Date: Mon, 28 Apr 2014 23:20:58 +0300 Subject: [PATCH 067/120] Adding comprehensive test cases for resolve_my_address. Also, improve comments on resolve_my_address to explain what it actually does. --- src/common/address.c | 8 +- src/common/address.h | 5 +- src/common/compat.c | 20 +- src/common/compat.h | 3 +- src/or/config.c | 36 ++- src/test/test_config.c | 569 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 628 insertions(+), 13 deletions(-) diff --git a/src/common/address.c b/src/common/address.c index e5930dedca..c9b5cf4d9b 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1354,8 +1354,8 @@ tor_addr_is_multicast(const tor_addr_t *a) * connects to the Internet. This address should only be used in checking * whether our address has changed. Return 0 on success, -1 on failure. */ -int -get_interface_address6(int severity, sa_family_t family, tor_addr_t *addr) +MOCK_IMPL(int, +get_interface_address6,(int severity, sa_family_t family, tor_addr_t *addr)) { /* XXX really, this function should yield a smartlist of addresses. */ smartlist_t *addrs; @@ -1684,8 +1684,8 @@ tor_dup_ip(uint32_t addr) * checking whether our address has changed. Return 0 on success, -1 on * failure. */ -int -get_interface_address(int severity, uint32_t *addr) +MOCK_IMPL(int, +get_interface_address,(int severity, uint32_t *addr)) { tor_addr_t local_addr; int r; diff --git a/src/common/address.h b/src/common/address.h index 8dc63b71c1..ecb7adcf52 100644 --- a/src/common/address.h +++ b/src/common/address.h @@ -148,7 +148,8 @@ char *tor_dup_addr(const tor_addr_t *addr) ATTR_MALLOC; const char *fmt_addr_impl(const tor_addr_t *addr, int decorate); const char *fmt_addrport(const tor_addr_t *addr, uint16_t port); const char * fmt_addr32(uint32_t addr); -int get_interface_address6(int severity, sa_family_t family, tor_addr_t *addr); +MOCK_DECL(int,get_interface_address6,(int severity, sa_family_t family, +tor_addr_t *addr)); /** Flag to specify how to do a comparison between addresses. In an "exact" * comparison, addresses are equivalent only if they are in the same family @@ -225,7 +226,7 @@ int addr_mask_get_bits(uint32_t mask); #define INET_NTOA_BUF_LEN 16 int tor_inet_ntoa(const struct in_addr *in, char *buf, size_t buf_len); char *tor_dup_ip(uint32_t addr) ATTR_MALLOC; -int get_interface_address(int severity, uint32_t *addr); +MOCK_DECL(int,get_interface_address,(int severity, uint32_t *addr)); tor_addr_port_t *tor_addr_port_new(const tor_addr_t *addr, uint16_t port); diff --git a/src/common/compat.c b/src/common/compat.c index 470e860f52..9b040f1877 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -2061,9 +2061,20 @@ get_environment(void) #endif } +/** Get name of current host and write it to name array, whose + * length is specified by namelen argument. Return 0 upon + * successfull completion; otherwise return return -1. (Currently, + * this function is merely a mockable wrapper for POSIX gethostname().) + */ +MOCK_IMPL(int, +tor_gethostname,(char *name, size_t namelen)) +{ + return gethostname(name,namelen); +} + /** Set *addr to the IP address (in dotted-quad notation) stored in *str. - * Return 1 on success, 0 if *str is badly formatted. (Like inet_aton(str,addr), - * but works on Windows and Solaris.) + * Return 1 on success, 0 if *str is badly formatted. + * (Like inet_aton(str,addr), but works on Windows and Solaris.) */ int tor_inet_aton(const char *str, struct in_addr* addr) @@ -2281,8 +2292,9 @@ tor_inet_pton(int af, const char *src, void *dst) * (This function exists because standard windows gethostbyname * doesn't treat raw IP addresses properly.) */ -int -tor_lookup_hostname(const char *name, uint32_t *addr) + +MOCK_IMPL(int, +tor_lookup_hostname,(const char *name, uint32_t *addr)) { tor_addr_t myaddr; int ret; diff --git a/src/common/compat.h b/src/common/compat.h index 9a381fb97f..4e614c0580 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -537,10 +537,11 @@ struct sockaddr_in6 { }; #endif +MOCK_DECL(int,tor_gethostname,(char *name, size_t namelen)); int tor_inet_aton(const char *cp, struct in_addr *addr) ATTR_NONNULL((1,2)); const char *tor_inet_ntop(int af, const void *src, char *dst, size_t len); int tor_inet_pton(int af, const char *src, void *dst); -int tor_lookup_hostname(const char *name, uint32_t *addr) ATTR_NONNULL((1,2)); +MOCK_DECL(int,tor_lookup_hostname,(const char *name, uint32_t *addr)); int set_socket_nonblocking(tor_socket_t socket); int tor_socketpair(int family, int type, int protocol, tor_socket_t fd[2]); int network_init(void); diff --git a/src/or/config.c b/src/or/config.c index a5407dd4ea..e0a2460685 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -11,6 +11,7 @@ #define CONFIG_PRIVATE #include "or.h" +#include "compat.h" #include "addressmap.h" #include "channel.h" #include "circuitbuild.h" @@ -2051,7 +2052,33 @@ get_last_resolved_addr(void) } /** - * Use options-\>Address to guess our public IP address. + * Attempt getting our non-local (as judged by tor_addr_is_internal() + * function) IP address using following techniques, listed in + * order from best (most desirable, try first) to worst (least + * desirable, try if everything else fails). + * + * First, attempt using options-\>Address to get our + * non-local IP address. + * + * If options-\>Address represents a non-local IP address, + * consider it ours. + * + * If options-\>Address is a DNS name that resolves to + * a non-local IP address, consider this IP address ours. + * + * If options-\>Address is NULL, fall back to getting local + * hostname and using it in above-described ways to try and + * get our IP address. + * + * In case local hostname cannot be resolved to a non-local IP + * address, try getting an IP address of network interface + * in hopes it will be non-local one. + * + * Fail if one or more of the following is true: + * - DNS name in options-\>Address cannot be resolved. + * - options-\>Address is a local host address. + * - Attempt to getting local hostname fails. + * - Attempt to getting network interface address fails. * * Return 0 if all is well, or -1 if we can't find a suitable * public IP address. @@ -2060,6 +2087,11 @@ get_last_resolved_addr(void) * - Put our public IP address (in host order) into *addr_out. * - If method_out is non-NULL, set *method_out to a static * string describing how we arrived at our answer. + * - "CONFIGURED" - parsed from IP address string in + * options-\>Address + * - "RESOLVED" - resolved from DNS name in options-\>Address + * - "GETHOSTNAME" - resolved from a local hostname. + * - "INTERFACE" - retrieved from a network interface. * - If hostname_out is non-NULL, and we resolved a hostname to * get our address, set *hostname_out to a newly allocated string * holding that hostname. (If we didn't get our address by resolving a @@ -2098,7 +2130,7 @@ resolve_my_address(int warn_severity, const or_options_t *options, explicit_ip = 0; /* it's implicit */ explicit_hostname = 0; /* it's implicit */ - if (gethostname(hostname, sizeof(hostname)) < 0) { + if (tor_gethostname(hostname, sizeof(hostname)) < 0) { log_fn(warn_severity, LD_NET,"Error obtaining local hostname"); return -1; } diff --git a/src/test/test_config.c b/src/test/test_config.c index dbb50798b8..fa68129126 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -578,10 +578,579 @@ test_config_fix_my_family(void *arg) or_options_free(defaults); } +static int n_hostname_01010101 = 0; + +/** This mock function is meant to replace tor_lookup_hostname(). + * It answers with 1.1.1.1 as IP adddress that resulted from lookup. + * This function increments n_hostname_01010101 counter by one + * every time it is called. + */ +static int +tor_lookup_hostname_01010101(const char *name, uint32_t *addr) +{ + n_hostname_01010101++; + + if (name && addr) { + *addr = ntohl(0x01010101); + } + + return 0; +} + +static int n_hostname_localhost = 0; + +/** This mock function is meant to replace tor_lookup_hostname(). + * It answers with 127.0.0.1 as IP adddress that resulted from lookup. + * This function increments n_hostname_localhost counter by one + * every time it is called. + */ +static int +tor_lookup_hostname_localhost(const char *name, uint32_t *addr) +{ + n_hostname_localhost++; + + if (name && addr) { + *addr = 0x7f000001; + } + + return 0; +} + +static int n_hostname_failure = 0; + +/** This mock function is meant to replace tor_lookup_hostname(). + * It pretends to fail by returning -1 to caller. Also, this function + * increments n_hostname_failure every time it is called. + */ +static int +tor_lookup_hostname_failure(const char *name, uint32_t *addr) +{ + (void)name; + (void)addr; + + n_hostname_failure++; + + return -1; +} + +static int n_gethostname_replacement = 0; + +/** This mock function is meant to replace tor_gethostname(). It + * responds with string "onionrouter" as hostname. This function + * increments n_gethostname_replacement by one every time + * it is called. + */ +static int +tor_gethostname_replacement(char *name, size_t namelen) +{ + n_gethostname_replacement++; + + if (name && namelen) { + strlcpy(name,"onionrouter",namelen); + } + + return 0; +} + +static int n_gethostname_localhost = 0; + +/** This mock function is meant to replace tor_gethostname(). It + * responds with string "127.0.0.1" as hostname. This function + * increments n_gethostname_localhost by one every time + * it is called. + */ +static int +tor_gethostname_localhost(char *name, size_t namelen) +{ + n_gethostname_localhost++; + + if (name && namelen) { + strlcpy(name,"127.0.0.1",namelen); + } + + return 0; +} + +static int n_gethostname_failure = 0; + +/** This mock function is meant to replace tor_gethostname. + * It pretends to fail by returning -1. This function increments + * n_gethostname_failure by one every time it is called. + */ +static int +tor_gethostname_failure(char *name, size_t namelen) +{ + n_gethostname_failure++; + + return -1; +} + +static int n_get_interface_address = 0; + +/** This mock function is meant to replace get_interface_address(). + * It answers with address 8.8.8.8. This function increments + * n_get_interface_address by one every time it is called. + */ +static int +get_interface_address_08080808(int severity, uint32_t *addr) +{ + (void)severity; + + n_get_interface_address++; + + if (addr) { + *addr = ntohl(0x08080808); + } + + return 0; +} + +static int n_get_interface_address6 = 0; +static sa_family_t last_address6_family; + +/** This mock function is meant to replace get_interface_address6(). + * It answers with IP address 9.9.9.9 iff both of the following are true: + * - family is AF_INET + * - addr pointer is not NULL. + * This function increments n_get_interface_address6 by one every + * time it is called. + */ +static int +get_interface_address6_replacement(int severity, sa_family_t family, + tor_addr_t *addr) +{ + (void)severity; + + last_address6_family = family; + n_get_interface_address6++; + + if ((family != AF_INET) || !addr) { + return -1; + } + + tor_addr_from_ipv4h(addr,0x09090909); + + return 0; +} + +static int n_get_interface_address_failure = 0; + +/** + * This mock function is meant to replace get_interface_address(). + * It pretends to fail getting interface address by returning -1. + * n_get_interface_address_failure is incremented by one + * every time this function is called. + */ +static int +get_interface_address_failure(int severity, uint32_t *addr) +{ + (void)severity; + (void)addr; + + n_get_interface_address_failure++; + + return -1; +} + +static int n_get_interface_address6_failure = 0; + +/** + * This mock function is meant to replace get_interface_addres6(). + * It will pretent to fail by return -1. + * n_get_interface_address6_failure is incremented by one + * every time this function is called and last_address6_family + * is assigned the value of family argument. + */ +static int +get_interface_address6_failure(int severity, sa_family_t family, + tor_addr_t *addr) +{ + n_get_interface_address6_failure++; + last_address6_family = family; + + return -1; +} + +static void +test_config_resolve_my_address(void *arg) +{ + (void)arg; + + or_options_t *options; + uint32_t resolved_addr; + const char *method_used; + char *hostname_out; + int retval; + int prev_n_hostname_01010101; + int prev_n_hostname_localhost; + int prev_n_hostname_failure; + int prev_n_gethostname_replacement; + int prev_n_gethostname_failure; + int prev_n_gethostname_localhost; + int prev_n_get_interface_address; + int prev_n_get_interface_address_failure; + int prev_n_get_interface_address6; + int prev_n_get_interface_address6_failure; + + options = options_new(); + + options_init(options); + + /* + * CASE 1: + * If options->Address is a valid IPv4 address string, we want + * the corresponding address to be parsed and returned. + */ + + options->Address = tor_strdup("128.52.128.105"); + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(retval == 0); + tt_want_str_op(method_used,==,"CONFIGURED"); + tt_want(hostname_out == NULL); + tt_assert(htonl(resolved_addr) == 0x69803480); + + tor_free(options->Address); + +/* + * CASE 2: + * If options->Address is a valid DNS address, we want resolve_my_address() + * function to ask tor_lookup_hostname() for help with resolving it + * and return the address that was resolved (in host order). + */ + + MOCK(tor_lookup_hostname,tor_lookup_hostname_01010101); + + tor_free(options->Address); + options->Address = tor_strdup("www.torproject.org"); + + prev_n_hostname_01010101 = n_hostname_01010101; + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(retval == 0); + tt_want(n_hostname_01010101 == prev_n_hostname_01010101 + 1); + tt_want_str_op(method_used,==,"RESOLVED"); + tt_want_str_op(hostname_out,==,"www.torproject.org"); + tt_assert(htonl(resolved_addr) == 0x01010101); + + UNMOCK(tor_lookup_hostname); + + tor_free(options->Address); + +/* + * CASE 3: + * Given that options->Address is NULL, we want resolve_my_address() + * to try and use tor_gethostname() to get hostname AND use + * tor_lookup_hostname() to get IP address. + */ + + resolved_addr = 0; + tor_free(options->Address); + options->Address = NULL; + + MOCK(tor_gethostname,tor_gethostname_replacement); + MOCK(tor_lookup_hostname,tor_lookup_hostname_01010101); + + prev_n_gethostname_replacement = n_gethostname_replacement; + prev_n_hostname_01010101 = n_hostname_01010101; + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(retval == 0); + tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); + tt_want(n_hostname_01010101 == prev_n_hostname_01010101 + 1); + tt_want_str_op(method_used,==,"GETHOSTNAME"); + tt_want_str_op(hostname_out,==,"onionrouter"); + tt_assert(htonl(resolved_addr) == 0x01010101); + + UNMOCK(tor_gethostname); + UNMOCK(tor_lookup_hostname); + +/* + * CASE 4: + * Given that options->Address is a local host address, we want + * resolve_my_address() function to fail. + */ + + resolved_addr = 0; + tor_free(options->Address); + options->Address = tor_strdup("127.0.0.1"); + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(resolved_addr == 0); + tt_assert(retval == -1); + + tor_free(options->Address); + +/* + * CASE 5: + * We want resolve_my_address() to fail if DNS address in options->Address + * cannot be resolved. + */ + + MOCK(tor_lookup_hostname,tor_lookup_hostname_failure); + + prev_n_hostname_failure = n_hostname_failure; + + tor_free(options->Address); + options->Address = tor_strdup("www.tor-project.org"); + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(n_hostname_failure == prev_n_hostname_failure + 1); + tt_assert(retval == -1); + + UNMOCK(tor_lookup_hostname); + + tor_free(options->Address); + options->Address = NULL; + +/* + * CASE 6: + * If options->Address is NULL AND gettting local hostname fails, we want + * resolve_my_address() to fail as well. + */ + + MOCK(tor_gethostname,tor_gethostname_failure); + + prev_n_gethostname_failure = n_gethostname_failure; + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(n_gethostname_failure == prev_n_gethostname_failure + 1); + tt_assert(retval == -1); + + UNMOCK(tor_gethostname); + +/* + * CASE 7: + * We want resolve_my_address() to try and get network interface address via + * get_interface_address() if hostname returned by tor_gethostname() cannot be + * resolved into IP address. + */ + + MOCK(tor_gethostname,tor_gethostname_replacement); + MOCK(get_interface_address,get_interface_address_08080808); + + prev_n_gethostname_replacement = n_gethostname_replacement; + prev_n_get_interface_address = n_get_interface_address; + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(retval == 0); + tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); + tt_want(n_get_interface_address == prev_n_get_interface_address + 1); + tt_want_str_op(method_used,==,"INTERFACE"); + tt_want(hostname_out == NULL); + tt_assert(resolved_addr == ntohl(0x08080808)); + + UNMOCK(get_interface_address); + +/* + * CASE 8: + * Suppose options->Address is NULL AND hostname returned by tor_gethostname() + * is unresolvable. We want resolve_my_address to fail if + * get_interface_address() fails. + */ + + MOCK(get_interface_address,get_interface_address_failure); + + prev_n_get_interface_address_failure = n_get_interface_address_failure; + prev_n_gethostname_replacement = n_gethostname_replacement; + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(n_get_interface_address_failure == + prev_n_get_interface_address_failure + 1); + tt_want(n_gethostname_replacement == + prev_n_gethostname_replacement + 1); + tt_assert(retval == -1); + + UNMOCK(get_interface_address); + +/* + * CASE 9: + * Given that options->Address is NULL AND tor_lookup_hostname() + * fails AND hostname returned by gethostname() resolves + * to local IP address, we want resolve_my_address() function to + * call get_interface_address6(.,AF_INET,.) and return IP address + * the latter function has found. + */ + + MOCK(tor_lookup_hostname,tor_lookup_hostname_failure); + MOCK(tor_gethostname,tor_gethostname_replacement); + MOCK(get_interface_address6,get_interface_address6_replacement); + + prev_n_gethostname_replacement = n_gethostname_replacement; + prev_n_hostname_failure = n_hostname_failure; + prev_n_get_interface_address6 = n_get_interface_address6; + + retval = resolve_my_address(LOG_NOTICE,options,&resolved_addr, + &method_used,&hostname_out); + + tt_want(last_address6_family == AF_INET); + tt_want(n_get_interface_address6 == prev_n_get_interface_address6 + 1); + tt_want(n_hostname_failure == prev_n_hostname_failure + 1); + tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); + tt_want(retval == 0); + tt_want_str_op(method_used,==,"INTERFACE"); + tt_assert(htonl(resolved_addr) == 0x09090909); + + UNMOCK(tor_lookup_hostname); + UNMOCK(tor_gethostname); + UNMOCK(get_interface_address6); + + /* + * CASE 10: We want resolve_my_address() to fail if all of the following + * are true: + * 1. options->Address is not NULL + * 2. ... but it cannot be converted to struct in_addr by + * tor_inet_aton() + * 3. ... and tor_lookup_hostname() fails to resolve the + * options->Address + */ + + MOCK(tor_lookup_hostname,tor_lookup_hostname_failure); + + prev_n_hostname_failure = n_hostname_failure; + + tor_free(options->Address); + options->Address = tor_strdup("some_hostname"); + + retval = resolve_my_address(LOG_NOTICE, options, &resolved_addr, + &method_used,&hostname_out); + + tt_want(n_hostname_failure == prev_n_hostname_failure + 1); + tt_assert(retval == -1); + + UNMOCK(tor_gethostname); + UNMOCK(tor_lookup_hostname); + + /* + * CASE 11: + * Suppose the following sequence of events: + * 1. options->Address is NULL + * 2. tor_gethostname() succeeds to get hostname of machine Tor + * if running on. + * 3. Hostname from previous step cannot be converted to + * address by using tor_inet_aton() function. + * 4. However, tor_lookup_hostname() succeds in resolving the + * hostname from step 2. + * 5. Unfortunately, tor_addr_is_internal() deems this address + * to be internal. + * 6. get_interface_address6(.,AF_INET,.) returns non-internal + * IPv4 + * + * We want resolve_my_addr() to succeed with method "INTERFACE" + * and address from step 6. + */ + + tor_free(options->Address); + options->Address = NULL; + + MOCK(tor_gethostname,tor_gethostname_replacement); + MOCK(tor_lookup_hostname,tor_lookup_hostname_localhost); + MOCK(get_interface_address6,get_interface_address6_replacement); + + prev_n_gethostname_replacement = n_gethostname_replacement; + prev_n_hostname_localhost = n_hostname_localhost; + prev_n_get_interface_address6 = n_get_interface_address6; + + retval = resolve_my_address(LOG_DEBUG, options, &resolved_addr, + &method_used,&hostname_out); + + tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); + tt_want(n_hostname_localhost == prev_n_hostname_localhost + 1); + tt_want(n_get_interface_address6 == prev_n_get_interface_address6 + 1); + + tt_str_op(method_used,==,"INTERFACE"); + tt_assert(!hostname_out); + tt_assert(retval == 0); + + /* + * CASE 11b: + * 1-5 as above. + * 6. get_interface_address6() fails. + * + * In this subcase, we want resolve_my_address() to fail. + */ + + UNMOCK(get_interface_address6); + MOCK(get_interface_address6,get_interface_address6_failure); + + prev_n_gethostname_replacement = n_gethostname_replacement; + prev_n_hostname_localhost = n_hostname_localhost; + prev_n_get_interface_address6_failure = n_get_interface_address6_failure; + + retval = resolve_my_address(LOG_DEBUG, options, &resolved_addr, + &method_used,&hostname_out); + + tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); + tt_want(n_hostname_localhost == prev_n_hostname_localhost + 1); + tt_want(n_get_interface_address6_failure == + prev_n_get_interface_address6_failure + 1); + + tt_assert(retval == -1); + + UNMOCK(tor_gethostname); + UNMOCK(tor_lookup_hostname); + UNMOCK(get_interface_address6); + + /* CASE 12: + * Suppose the following happens: + * 1. options->Address is NULL AND options->DirAuthorities is 1. + * 2. tor_gethostname() succeeds in getting hostname of a machine ... + * 3. ... which is successfully parsed by tor_inet_aton() ... + * 4. into IPv4 address that tor_addr_is_inernal() considers to be + * internal. + * + * In this case, we want resolve_my_address() to fail. + */ + + tor_free(options->Address); + options->Address = NULL; + options->DirAuthorities = tor_malloc_zero(sizeof(config_line_t)); + + MOCK(tor_gethostname,tor_gethostname_localhost); + + prev_n_gethostname_localhost = n_gethostname_localhost; + + retval = resolve_my_address(LOG_DEBUG, options, &resolved_addr, + &method_used,&hostname_out); + + tt_want(n_gethostname_localhost == prev_n_gethostname_localhost + 1); + tt_assert(retval == -1); + + UNMOCK(tor_gethostname); + + done: + tor_free(options->Address); + tor_free(options->DirAuthorities); + or_options_free(options); + + UNMOCK(tor_gethostname); + UNMOCK(tor_lookup_hostname); + UNMOCK(get_interface_address); + UNMOCK(get_interface_address6); + UNMOCK(tor_gethostname); +} + #define CONFIG_TEST(name, flags) \ { #name, test_config_ ## name, flags, NULL, NULL } struct testcase_t config_tests[] = { + CONFIG_TEST(resolve_my_address, TT_FORK), CONFIG_TEST(addressmap, 0), CONFIG_TEST(parse_bridge_line, 0), CONFIG_TEST(parse_transport_options_line, 0), From c07747be2e5bd4b9311c260b49f4007975138005 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 29 Dec 2014 09:29:32 -0500 Subject: [PATCH 068/120] Fix compilation errors in resolvemyaddr tests --- src/test/test_config.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/test_config.c b/src/test/test_config.c index fa68129126..4217720174 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -680,6 +680,8 @@ static int n_gethostname_failure = 0; static int tor_gethostname_failure(char *name, size_t namelen) { + (void)name; + (void)namelen; n_gethostname_failure++; return -1; @@ -765,6 +767,8 @@ static int get_interface_address6_failure(int severity, sa_family_t family, tor_addr_t *addr) { + (void)severity; + (void)addr; n_get_interface_address6_failure++; last_address6_family = family; @@ -774,8 +778,6 @@ get_interface_address6_failure(int severity, sa_family_t family, static void test_config_resolve_my_address(void *arg) { - (void)arg; - or_options_t *options; uint32_t resolved_addr; const char *method_used; @@ -792,6 +794,8 @@ test_config_resolve_my_address(void *arg) int prev_n_get_interface_address6; int prev_n_get_interface_address6_failure; + (void)arg; + options = options_new(); options_init(options); From 3538dfc91fa34c1cf4e34a334c76de65883bbc0e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 29 Dec 2014 09:33:36 -0500 Subject: [PATCH 069/120] Fix memory leaks in resolvemyaddr tests --- src/test/test_config.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/test/test_config.c b/src/test/test_config.c index 4217720174..b9a0672aba 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -781,7 +781,7 @@ test_config_resolve_my_address(void *arg) or_options_t *options; uint32_t resolved_addr; const char *method_used; - char *hostname_out; + char *hostname_out = NULL; int retval; int prev_n_hostname_01010101; int prev_n_hostname_localhost; @@ -844,6 +844,7 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_lookup_hostname); tor_free(options->Address); + tor_free(hostname_out); /* * CASE 3: @@ -875,6 +876,8 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_gethostname); UNMOCK(tor_lookup_hostname); + tor_free(hostname_out); + /* * CASE 4: * Given that options->Address is a local host address, we want @@ -892,6 +895,7 @@ test_config_resolve_my_address(void *arg) tt_assert(retval == -1); tor_free(options->Address); + tor_free(hostname_out); /* * CASE 5: @@ -915,7 +919,7 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_lookup_hostname); tor_free(options->Address); - options->Address = NULL; + tor_free(hostname_out); /* * CASE 6: @@ -934,6 +938,8 @@ test_config_resolve_my_address(void *arg) tt_assert(retval == -1); UNMOCK(tor_gethostname); + tor_free(hostname_out); + /* * CASE 7: @@ -959,6 +965,7 @@ test_config_resolve_my_address(void *arg) tt_assert(resolved_addr == ntohl(0x08080808)); UNMOCK(get_interface_address); + tor_free(hostname_out); /* * CASE 8: @@ -982,6 +989,7 @@ test_config_resolve_my_address(void *arg) tt_assert(retval == -1); UNMOCK(get_interface_address); + tor_free(hostname_out); /* * CASE 9: @@ -1015,6 +1023,8 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_gethostname); UNMOCK(get_interface_address6); + tor_free(hostname_out); + /* * CASE 10: We want resolve_my_address() to fail if all of the following * are true: @@ -1041,6 +1051,8 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_gethostname); UNMOCK(tor_lookup_hostname); + tor_free(hostname_out); + /* * CASE 11: * Suppose the following sequence of events: @@ -1138,10 +1150,11 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_gethostname); - done: + done: tor_free(options->Address); tor_free(options->DirAuthorities); or_options_free(options); + tor_free(hostname_out); UNMOCK(tor_gethostname); UNMOCK(tor_lookup_hostname); From feed26d037608a3a40c1f4fd8450ea59f0091321 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 29 Dec 2014 09:41:37 -0500 Subject: [PATCH 070/120] Make the resolvemyaddr unit tests pass when local dns is hijacked If you are in a coffee shop that returns a helpful redirect page for "onionrouter", or on an ISP that does the same, the test as written would fail. --- src/test/test_config.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/test/test_config.c b/src/test/test_config.c index b9a0672aba..f8161b1c58 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -636,7 +636,7 @@ tor_lookup_hostname_failure(const char *name, uint32_t *addr) static int n_gethostname_replacement = 0; /** This mock function is meant to replace tor_gethostname(). It - * responds with string "onionrouter" as hostname. This function + * responds with string "onionrouter!" as hostname. This function * increments n_gethostname_replacement by one every time * it is called. */ @@ -646,7 +646,7 @@ tor_gethostname_replacement(char *name, size_t namelen) n_gethostname_replacement++; if (name && namelen) { - strlcpy(name,"onionrouter",namelen); + strlcpy(name,"onionrouter!",namelen); } return 0; @@ -870,7 +870,7 @@ test_config_resolve_my_address(void *arg) tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); tt_want(n_hostname_01010101 == prev_n_hostname_01010101 + 1); tt_want_str_op(method_used,==,"GETHOSTNAME"); - tt_want_str_op(hostname_out,==,"onionrouter"); + tt_want_str_op(hostname_out,==,"onionrouter!"); tt_assert(htonl(resolved_addr) == 0x01010101); UNMOCK(tor_gethostname); @@ -949,6 +949,7 @@ test_config_resolve_my_address(void *arg) */ MOCK(tor_gethostname,tor_gethostname_replacement); + MOCK(tor_lookup_hostname,tor_lookup_hostname_failure); MOCK(get_interface_address,get_interface_address_08080808); prev_n_gethostname_replacement = n_gethostname_replacement; @@ -958,8 +959,10 @@ test_config_resolve_my_address(void *arg) &method_used,&hostname_out); tt_want(retval == 0); - tt_want(n_gethostname_replacement == prev_n_gethostname_replacement + 1); - tt_want(n_get_interface_address == prev_n_get_interface_address + 1); + tt_want_int_op(n_gethostname_replacement, ==, + prev_n_gethostname_replacement + 1); + tt_want_int_op(n_get_interface_address, ==, + prev_n_get_interface_address + 1); tt_want_str_op(method_used,==,"INTERFACE"); tt_want(hostname_out == NULL); tt_assert(resolved_addr == ntohl(0x08080808)); From de432d55657ee124bce0e9a4d5f5842088e2e13b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 29 Dec 2014 09:44:28 -0500 Subject: [PATCH 071/120] changes file for resolvemyaddr tests --- changes/resolvemyaddr-tests | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changes/resolvemyaddr-tests diff --git a/changes/resolvemyaddr-tests b/changes/resolvemyaddr-tests new file mode 100644 index 0000000000..c019bb831e --- /dev/null +++ b/changes/resolvemyaddr-tests @@ -0,0 +1,3 @@ + o Testing: + - Add unit tests for resolve_my_addr(). Part of ticket 12376; + patch by 'rl1987'. From d7ecdd645a68eeb7a5ab8c839479a05cc8a1e10e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 29 Dec 2014 10:06:12 -0500 Subject: [PATCH 072/120] Wipe all of the target space in tor_addr_{to,from}_sockaddr() Otherwise we risk a subsequent memdup or memcpy copying uninitialized RAM into some other place that might eventually expose it. Let's make sure that doesn't happen. Closes ticket 14041 --- changes/bug14041 | 5 +++++ src/common/address.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changes/bug14041 diff --git a/changes/bug14041 b/changes/bug14041 new file mode 100644 index 0000000000..d3d6538483 --- /dev/null +++ b/changes/bug14041 @@ -0,0 +1,5 @@ + o Minor features (security): + - Clear all memory targetted by tor_addr_{to,from}_sockaddr(), + not just the part that's used. This makes it harder for data leak + bugs to occur in the event of other programming failures. + Resolves ticket 14041. diff --git a/src/common/address.c b/src/common/address.c index b2431eeba4..267b4e38aa 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -89,13 +89,14 @@ tor_addr_to_sockaddr(const tor_addr_t *a, struct sockaddr *sa_out, socklen_t len) { + memset(sa_out, 0, len); + sa_family_t family = tor_addr_family(a); if (family == AF_INET) { struct sockaddr_in *sin; if (len < (int)sizeof(struct sockaddr_in)) return 0; sin = (struct sockaddr_in *)sa_out; - memset(sin, 0, sizeof(struct sockaddr_in)); #ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); #endif @@ -108,7 +109,6 @@ tor_addr_to_sockaddr(const tor_addr_t *a, if (len < (int)sizeof(struct sockaddr_in6)) return 0; sin6 = (struct sockaddr_in6 *)sa_out; - memset(sin6, 0, sizeof(struct sockaddr_in6)); #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN sin6->sin6_len = sizeof(struct sockaddr_in6); #endif @@ -129,6 +129,9 @@ tor_addr_from_sockaddr(tor_addr_t *a, const struct sockaddr *sa, { tor_assert(a); tor_assert(sa); + + memset(a, 0, sizeof(*a)); + if (sa->sa_family == AF_INET) { struct sockaddr_in *sin = (struct sockaddr_in *) sa; tor_addr_from_ipv4n(a, sin->sin_addr.s_addr); From 88901c39673aade6eecbf0b5a11a0b5c9acfd9f7 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 25 Nov 2014 10:37:55 -0500 Subject: [PATCH 073/120] Fix: mitigate as much as we can HS port scanning Make hidden service port scanning harder by sending back REASON_DONE which does not disclose that it was in fact an exit policy issue. After that, kill the circuit immediately to avoid more bad requests on it. This means that everytime an hidden service exit policy does match, the user (malicious or not) needs to build a new circuit. Fixes #13667. Signed-off-by: David Goulet --- changes/bug13667 | 5 +++++ src/or/connection_edge.c | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 changes/bug13667 diff --git a/changes/bug13667 b/changes/bug13667 new file mode 100644 index 0000000000..3714753df4 --- /dev/null +++ b/changes/bug13667 @@ -0,0 +1,5 @@ + o Major bugfixes: + - Make HS port scanning more difficult by sending back REASON_DONE if the + exit policy didn't match. Furthermore, immediately close the circuit to + avoid other connection attempts on it from the possible attacker trying + multiple ports on that same circuit. diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 49f9ba4978..2d8842c11c 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2579,12 +2579,23 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ) if (rend_service_set_connection_addr_port(n_stream, origin_circ) < 0) { log_info(LD_REND,"Didn't find rendezvous service (port %d)", n_stream->base_.port); + /* Send back reason DONE because we want to make hidden service port + * scanning harder thus instead of returning that the exit policy + * didn't match, which makes it obvious that the port is closed, + * return DONE and kill the circuit. That way, a user (malicious or + * not) needs one circuit per bad port unless it matches the policy of + * the hidden service. */ relay_send_end_cell_from_edge(rh.stream_id, circ, - END_STREAM_REASON_EXITPOLICY, + END_STREAM_REASON_DONE, origin_circ->cpath->prev); connection_free(TO_CONN(n_stream)); tor_free(address); - return 0; + + /* Drop the circuit here since it might be someone deliberately + * scanning the hidden service ports. Note that this mitigates port + * scanning by adding more work on the attacker side to successfully + * scan but does not fully solve it. */ + return END_CIRC_AT_ORIGIN; } assert_circuit_ok(circ); log_debug(LD_REND,"Finished assigning addr/port"); From dc1aaa5b969e0fc8c7ce1eab2676588aab44abe2 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 08:54:01 -0500 Subject: [PATCH 074/120] Make lintChanges happier --- changes/bug13667 | 5 +++-- changes/bug13823-decrease-consensus-interval | 11 ++++++----- changes/bug13839-fix-TestingMinExitFlagThreshold | 5 +++-- changes/bug13963-decrease-if-modified-since-delay | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/changes/bug13667 b/changes/bug13667 index 3714753df4..852e61fa2a 100644 --- a/changes/bug13667 +++ b/changes/bug13667 @@ -1,5 +1,6 @@ - o Major bugfixes: + o Major features (security, hidden services): - Make HS port scanning more difficult by sending back REASON_DONE if the exit policy didn't match. Furthermore, immediately close the circuit to avoid other connection attempts on it from the possible attacker trying - multiple ports on that same circuit. + multiple ports on that same circuits. Closes ticket 13667. + diff --git a/changes/bug13823-decrease-consensus-interval b/changes/bug13823-decrease-consensus-interval index 1d99bd73cb..67f0b9fe62 100644 --- a/changes/bug13823-decrease-consensus-interval +++ b/changes/bug13823-decrease-consensus-interval @@ -1,8 +1,9 @@ - o Minor bugfixes: + o Minor bugfixes (Testing networks): - Decrease minimum consensus interval to 10 seconds - when TestingTorNetwork is set. (Or 5 seconds for - the first consensus.) - Fix code that assumes larger interval values. + when TestingTorNetwork is set, or 5 seconds for + the first consensus. + Fix assumptions throughout the code that assume larger interval values. This assists in quickly bootstrapping a testing Tor network. - Fixes bugs 13718 & 13823. + Fixes bugs 13718 and 13823; bugfix on 0.2.0.3-alpha. + diff --git a/changes/bug13839-fix-TestingMinExitFlagThreshold b/changes/bug13839-fix-TestingMinExitFlagThreshold index 947614f550..e0fa270243 100644 --- a/changes/bug13839-fix-TestingMinExitFlagThreshold +++ b/changes/bug13839-fix-TestingMinExitFlagThreshold @@ -1,7 +1,8 @@ - o Minor bugfixes: + o Minor bugfixes (Testing networks) - Stop requiring exits to have non-zero bandwithcapacity in a TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0, ignore exit bandwidthcapacity. This assists in bootstrapping a testing Tor network. - Fixes bugs 13718 & 13839. + Fixes bugs parts of bugs 13718 and 13839; Makes bug 13161's TestingDirAuthVoteExit non-essential. + Bugfix on 0.2.0.3-alpha. diff --git a/changes/bug13963-decrease-if-modified-since-delay b/changes/bug13963-decrease-if-modified-since-delay index 62371444c4..d4bbc1bbd4 100644 --- a/changes/bug13963-decrease-if-modified-since-delay +++ b/changes/bug13963-decrease-if-modified-since-delay @@ -4,4 +4,4 @@ This allows us to obtain consensuses promptly when the consensus interval is very short. This assists in bootstrapping a testing Tor network. - Fixes bugs 13718 & 13963. + Fixes parts of bugs 13718 and 13963; bugfix on 0.2.0.3-alpha. From 22a1e9cac18f69e6e14c0e84785460f2074d8575 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 25 Dec 2014 23:42:38 +1100 Subject: [PATCH 075/120] Avoid excluding guards from path building in minimal test networks choose_good_entry_server() now excludes current entry guards and their families, unless we're in a test network, and excluding guards would exclude all nodes. This typically occurs in incredibly small tor networks, and those using TestingAuthVoteGuard * This is an incomplete fix, but is no worse than the previous behaviour, and only applies to minimal, testing tor networks (so it's no less secure). Discovered as part of #13718. --- changes/bug13718-avoid-excluding-guards | 8 ++++++++ src/or/circuitbuild.c | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 changes/bug13718-avoid-excluding-guards diff --git a/changes/bug13718-avoid-excluding-guards b/changes/bug13718-avoid-excluding-guards new file mode 100644 index 0000000000..bf80d2a7e7 --- /dev/null +++ b/changes/bug13718-avoid-excluding-guards @@ -0,0 +1,8 @@ + o Minor bugfixes: + - Avoid excluding guards from path building in minimal test networks, + when we're in a test network, and excluding guards would exclude + all nodes. This typically occurs in incredibly small tor networks, + and those using TestingAuthVoteGuard * + This fix only applies to minimal, testing tor networks, + so it's no less secure. + Discovered as part of #13718. diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 36ccdc9d5f..a834e7b7fc 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2053,9 +2053,18 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state) smartlist_add(excluded, (void*)node); }); } - /* and exclude current entry guards and their families, if applicable */ + /* and exclude current entry guards and their families, + * unless we're in a test network, and excluding guards + * would exclude all nodes (i.e. we're in an incredibly small tor network, + * or we're using TestingAuthVoteGuard *). + * This is an incomplete fix, but is no worse than the previous behaviour, + * and only applies to minimal, testing tor networks + * (so it's no less secure) */ /*XXXX025 use the using_as_guard flag to accomplish this.*/ - if (options->UseEntryGuards) { + if (options->UseEntryGuards + && (!options->TestingTorNetwork || + smartlist_len(nodelist_get_list()) > smartlist_len(get_entry_guards()) + )) { SMARTLIST_FOREACH(get_entry_guards(), const entry_guard_t *, entry, { if ((node = node_get_by_id(entry->identity))) { From d812baf54c7539d1b7be26aaa3890697c618c0a6 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 25 Dec 2014 23:15:38 +1100 Subject: [PATCH 076/120] Refactor count_usable_descriptors to use named enums for exit_only count_usable_descriptors now uses named exit_only values: USABLE_DESCRIPTOR_ALL USABLE_DESCRIPTOR_EXIT_ONLY Add debug logging code for descriptor counts. This (hopefully) resolves nickm's request in bug 13718 to improve argument readability in nodelist.c. --- changes/bug13718-make-nodelist-args-readable | 8 ++ src/or/nodelist.c | 85 ++++++++++++++++---- 2 files changed, 79 insertions(+), 14 deletions(-) create mode 100644 changes/bug13718-make-nodelist-args-readable diff --git a/changes/bug13718-make-nodelist-args-readable b/changes/bug13718-make-nodelist-args-readable new file mode 100644 index 0000000000..7377a81d38 --- /dev/null +++ b/changes/bug13718-make-nodelist-args-readable @@ -0,0 +1,8 @@ + o Minor refactoring: + - Refactor count_usable_descriptors to use named enums for exit_only. + count_usable_descriptors now uses named exit_only values: + * USABLE_DESCRIPTOR_ALL + * USABLE_DESCRIPTOR_EXIT_ONLY + - Add debug logging code for descriptor counts. + This resolves nickm's request in bug 13718 to improve argument + readability. diff --git a/src/or/nodelist.c b/src/or/nodelist.c index e0e01ec190..796d0ec193 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -24,6 +24,23 @@ static void nodelist_drop_node(node_t *node, int remove_from_ht); static void node_free(node_t *node); + +/** count_usable_descriptors counts descriptors with these flag(s) + */ +typedef enum { + /* All descriptors regardless of flags */ + USABLE_DESCRIPTOR_ALL = 0, + /* Only descriptors with the Exit flag */ + USABLE_DESCRIPTOR_EXIT_ONLY = 1 +} usable_descriptor_t; +static void count_usable_descriptors(int *num_present, + int *num_usable, + smartlist_t *descs_out, + const networkstatus_t *consensus, + const or_options_t *options, + time_t now, + routerset_t *in_set, + usable_descriptor_t exit_only); static void update_router_have_minimum_dir_info(void); static double get_frac_paths_needed_for_circs(const or_options_t *options, const networkstatus_t *ns); @@ -1313,20 +1330,23 @@ get_dir_info_status_string(void) /** Iterate over the servers listed in consensus, and count how many of * them seem like ones we'd use, and how many of those we have * descriptors for. Store the former in *num_usable and the latter in - * *num_present. If in_set is non-NULL, only consider those - * routers in in_set. If exit_only is true, only consider nodes - * with the Exit flag. If *descs_out is present, add a node_t for each - * usable descriptor to it. + * *num_present. + * If in_set is non-NULL, only consider those routers in in_set. + * If exit_only is USABLE_DESCRIPTOR_EXIT_ONLY, only consider nodes + * with the Exit flag. + * If *descs_out is present, add a node_t for each usable descriptor + * to it. */ static void count_usable_descriptors(int *num_present, int *num_usable, smartlist_t *descs_out, const networkstatus_t *consensus, const or_options_t *options, time_t now, - routerset_t *in_set, int exit_only) + routerset_t *in_set, + usable_descriptor_t exit_only) { const int md = (consensus->flavor == FLAV_MICRODESC); - *num_present = 0, *num_usable=0; + *num_present = 0, *num_usable = 0; SMARTLIST_FOREACH_BEGIN(consensus->routerstatus_list, routerstatus_t *, rs) { @@ -1334,7 +1354,7 @@ count_usable_descriptors(int *num_present, int *num_usable, if (!node) continue; /* This would be a bug: every entry in the consensus is * supposed to have a node. */ - if (exit_only && ! rs->is_exit) + if (exit_only == USABLE_DESCRIPTOR_EXIT_ONLY && ! rs->is_exit) continue; if (in_set && ! routerset_contains_routerstatus(in_set, rs, -1)) continue; @@ -1358,7 +1378,8 @@ count_usable_descriptors(int *num_present, int *num_usable, log_debug(LD_DIR, "%d usable, %d present (%s%s).", *num_usable, *num_present, - md ? "microdesc" : "desc", exit_only ? " exits" : "s"); + md ? "microdesc" : "desc", + exit_only == USABLE_DESCRIPTOR_EXIT_ONLY ? " exits" : "s"); } /** Return an estimate of which fraction of usable paths through the Tor @@ -1379,10 +1400,11 @@ compute_frac_paths_available(const networkstatus_t *consensus, const int authdir = authdir_mode_v3(options); count_usable_descriptors(num_present_out, num_usable_out, - mid, consensus, options, now, NULL, 0); + mid, consensus, options, now, NULL, + USABLE_DESCRIPTOR_ALL); if (options->EntryNodes) { count_usable_descriptors(&np, &nu, guards, consensus, options, now, - options->EntryNodes, 0); + options->EntryNodes, USABLE_DESCRIPTOR_ALL); } else { SMARTLIST_FOREACH(mid, const node_t *, node, { if (authdir) { @@ -1397,20 +1419,49 @@ compute_frac_paths_available(const networkstatus_t *consensus, /* All nodes with exit flag */ count_usable_descriptors(&np, &nu, exits, consensus, options, now, - NULL, 1); + NULL, USABLE_DESCRIPTOR_EXIT_ONLY); + log_debug(LD_NET, + "%s: %d present, %d usable", + "exits", + np, + nu); + /* All nodes with exit flag in ExitNodes option */ count_usable_descriptors(&np, &nu, myexits, consensus, options, now, - options->ExitNodes, 1); + options->ExitNodes, USABLE_DESCRIPTOR_EXIT_ONLY); + log_debug(LD_NET, + "%s: %d present, %d usable", + "myexits", + np, + nu); + /* Now compute the nodes in the ExitNodes option where which we don't know * what their exit policy is, or we know it permits something. */ count_usable_descriptors(&np, &nu, myexits_unflagged, consensus, options, now, - options->ExitNodes, 0); + options->ExitNodes, USABLE_DESCRIPTOR_ALL); + log_debug(LD_NET, + "%s: %d present, %d usable", + "myexits_unflagged (initial)", + np, + nu); + SMARTLIST_FOREACH_BEGIN(myexits_unflagged, const node_t *, node) { - if (node_has_descriptor(node) && node_exit_policy_rejects_all(node)) + if (node_has_descriptor(node) && node_exit_policy_rejects_all(node)) { SMARTLIST_DEL_CURRENT(myexits_unflagged, node); + /* this node is not actually an exit */ + np--; + /* this node is unusable as an exit */ + nu--; + } } SMARTLIST_FOREACH_END(node); + log_debug(LD_NET, + "%s: %d present, %d usable", + "myexits_unflagged (final)", + np, + nu); + f_guard = frac_nodes_with_descriptors(guards, WEIGHT_FOR_GUARD); f_mid = frac_nodes_with_descriptors(mid, WEIGHT_FOR_MID); f_exit = frac_nodes_with_descriptors(exits, WEIGHT_FOR_EXIT); @@ -1418,6 +1469,12 @@ compute_frac_paths_available(const networkstatus_t *consensus, f_myexit_unflagged= frac_nodes_with_descriptors(myexits_unflagged,WEIGHT_FOR_EXIT); + log_debug(LD_NET, + "f_exit: %.2f, f_myexit: %.2f, f_myexit_unflagged: %.2f", + f_exit, + f_myexit, + f_myexit_unflagged); + /* If our ExitNodes list has eliminated every possible Exit node, and there * were some possible Exit nodes, then instead consider nodes that permit * exiting to some ports. */ From 9b2d106e49ba4ea12f31af9cea02910869f19a4b Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 26 Dec 2014 00:10:40 +1100 Subject: [PATCH 077/120] Check if there are exits in the consensus Add router_have_consensus_path() which reports whether the consensus has exit paths, internal paths, or whether it just doesn't know. Used by #13718 and #13814. --- changes/bug13718-check-consensus-exits | 6 +++ src/or/nodelist.c | 59 ++++++++++++++++++++++++-- src/or/nodelist.h | 22 ++++++++++ 3 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 changes/bug13718-check-consensus-exits diff --git a/changes/bug13718-check-consensus-exits b/changes/bug13718-check-consensus-exits new file mode 100644 index 0000000000..5ca4b115eb --- /dev/null +++ b/changes/bug13718-check-consensus-exits @@ -0,0 +1,6 @@ + o Minor enhancement: + - Check if there are exits in the consensus. + Add router_have_consensus_path() which reports whether + the consensus has exit paths, internal paths, or whether it + just doesn't know. + Used by #13718 and #13814. diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 796d0ec193..77196a41bb 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -1275,6 +1275,10 @@ router_set_status(const char *digest, int up) /** True iff, the last time we checked whether we had enough directory info * to build circuits, the answer was "yes". */ static int have_min_dir_info = 0; + +/** Does the consensus contain nodes that can exit? */ +static consensus_path_type_t have_consensus_path = CONSENSUS_PATH_UNKNOWN; + /** True iff enough has changed since the last time we checked whether we had * enough directory info to build circuits that our old answer can no longer * be trusted. */ @@ -1308,6 +1312,24 @@ router_have_minimum_dir_info(void) return have_min_dir_info; } +/** Set to CONSENSUS_PATH_EXIT if there is at least one exit node + * in the consensus. We update this flag in compute_frac_paths_available if + * there is at least one relay that has an Exit flag in the consensus. + * Used to avoid building exit circuits when they will almost certainly fail. + * Set to CONSENSUS_PATH_INTERNAL if there are no exits in the consensus. + * (This situation typically occurs during bootstrap of a test network.) + * Set to CONSENSUS_PATH_UNKNOWN if we have never checked, or have + * reason to believe our last known value was invalid or has expired. + * If we're in a network with TestingDirAuthVoteExit set, + * this can cause router_have_consensus_path() to be set to + * CONSENSUS_PATH_EXIT, even if there are no nodes with accept exit policies. + */ +consensus_path_type_t +router_have_consensus_path(void) +{ + return have_consensus_path; +} + /** Called when our internal view of the directory has changed. This can be * when the authorities change, networkstatuses change, the list of routerdescs * changes, or number of running routers changes. @@ -1396,7 +1418,11 @@ compute_frac_paths_available(const networkstatus_t *consensus, smartlist_t *myexits= smartlist_new(); smartlist_t *myexits_unflagged = smartlist_new(); double f_guard, f_mid, f_exit, f_myexit, f_myexit_unflagged; - int np, nu; /* Ignored */ + double f_path = 0.0; + /* Used to determine whether there are any exits in the consensus */ + int np = 0; + /* Used to determine whether there are any exits with descriptors */ + int nu = 0; const int authdir = authdir_mode_v3(options); count_usable_descriptors(num_present_out, num_usable_out, @@ -1417,7 +1443,13 @@ compute_frac_paths_available(const networkstatus_t *consensus, }); } - /* All nodes with exit flag */ + /* All nodes with exit flag + * If we're in a network with TestingDirAuthVoteExit set, + * this can cause false positives on have_consensus_path, + * incorrectly setting it to CONSENSUS_PATH_EXIT. This is + * an unavoidable feature of forcing authorities to declare + * certain nodes as exits. + */ count_usable_descriptors(&np, &nu, exits, consensus, options, now, NULL, USABLE_DESCRIPTOR_EXIT_ONLY); log_debug(LD_NET, @@ -1426,6 +1458,27 @@ compute_frac_paths_available(const networkstatus_t *consensus, np, nu); + /* We need at least 1 exit present in the consensus to consider + * building exit paths */ + /* Update our understanding of whether the consensus has exits */ + consensus_path_type_t old_have_consensus_path = have_consensus_path; + have_consensus_path = ((np > 0) ? + CONSENSUS_PATH_EXIT : + CONSENSUS_PATH_INTERNAL); + + if (have_consensus_path == CONSENSUS_PATH_INTERNAL + && old_have_consensus_path != have_consensus_path) { + log_notice(LD_NET, + "The current consensus has no exit nodes. " + "Tor can only build internal paths, " + "such as paths to hidden services."); + + /* However, exit nodes can reachability self-test using this consensus, + * join the network, and appear in a later consensus. This will allow + * the network to build exit paths, such as paths for world wide web + * browsing (as distinct from hidden service web browsing). */ + } + /* All nodes with exit flag in ExitNodes option */ count_usable_descriptors(&np, &nu, myexits, consensus, options, now, options->ExitNodes, USABLE_DESCRIPTOR_EXIT_ONLY); @@ -1620,7 +1673,7 @@ update_router_have_minimum_dir_info(void) * should only do while circuits are working, like reachability tests * and fetching bridge descriptors only over circuits. */ note_that_we_maybe_cant_complete_circuits(); - + have_consensus_path = CONSENSUS_PATH_UNKNOWN; control_event_client_status(LOG_NOTICE, "NOT_ENOUGH_DIR_INFO"); } have_min_dir_info = res; diff --git a/src/or/nodelist.h b/src/or/nodelist.h index 48b0e94be0..56cfffa9f1 100644 --- a/src/or/nodelist.h +++ b/src/or/nodelist.h @@ -80,6 +80,28 @@ int router_exit_policy_all_nodes_reject(const tor_addr_t *addr, uint16_t port, int need_uptime); void router_set_status(const char *digest, int up); int router_have_minimum_dir_info(void); + +/** Set to CONSENSUS_PATH_EXIT if there is at least one exit node + * in the consensus. We update this flag in compute_frac_paths_available if + * there is at least one relay that has an Exit flag in the consensus. + * Used to avoid building exit circuits when they will almost certainly fail. + * Set to CONSENSUS_PATH_INTERNAL if there are no exits in the consensus. + * (This situation typically occurs during bootstrap of a test network.) + * Set to CONSENSUS_PATH_UNKNOWN if we have never checked, or have + * reason to believe our last known value was invalid or has expired. + */ +typedef enum { + /* we haven't checked yet, or we have invalidated our previous check */ + CONSENSUS_PATH_UNKNOWN = -1, + /* The consensus only has internal relays, and we should only + * create internal paths, circuits, streams, ... */ + CONSENSUS_PATH_INTERNAL = 0, + /* The consensus has at least one exit, and can therefore (potentially) + * create exit and internal paths, circuits, streams, ... */ + CONSENSUS_PATH_EXIT = 1 +} consensus_path_type_t; +consensus_path_type_t router_have_consensus_path(void); + void router_dir_info_changed(void); const char *get_dir_info_status_string(void); int count_loading_descriptors_progress(void); From 55ad54e0146234578072080842ec0f4ca628e4c7 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 26 Dec 2014 00:17:08 +1100 Subject: [PATCH 078/120] Allow tor to build circuits using a consensus with no exits If the consensus has no exits (typical of a bootstrapping test network), allow tor to build circuits once enough descriptors have been downloaded. When there are no exits, we always have "enough" exit descriptors. (We treat the proportion of available exit descriptors as 100%.) This assists in bootstrapping a testing Tor network. Fixes bug 13718. Makes bug 13161's TestingDirAuthVoteExit non-essential. (But still useful for speeding up a bootstrap.) --- changes/bug13814-reachability-without-exits | 15 ++++ src/or/nodelist.c | 85 +++++++++++++++++---- src/or/nodelist.h | 8 ++ 3 files changed, 92 insertions(+), 16 deletions(-) create mode 100644 changes/bug13814-reachability-without-exits diff --git a/changes/bug13814-reachability-without-exits b/changes/bug13814-reachability-without-exits new file mode 100644 index 0000000000..43a326b847 --- /dev/null +++ b/changes/bug13814-reachability-without-exits @@ -0,0 +1,15 @@ + o Minor bugfixes: + - Allow tor to build circuits using a consensus with + no exits. If the consensus has no exits (typical of + a bootstrapping test network), allow tor to build + circuits once enough descriptors have been + downloaded. + When there are no exits, we always have "enough" + exit descriptors. (We treat the proportion of + available exit descriptors as 100%.) + This assists in bootstrapping a testing Tor + network. + Fixes bug 13718. + Makes bug 13161's TestingDirAuthVoteExit + non-essential. + (But still useful for speeding up a bootstrap.) diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 77196a41bb..34d1d5f4d7 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -1273,7 +1273,8 @@ router_set_status(const char *digest, int up) } /** True iff, the last time we checked whether we had enough directory info - * to build circuits, the answer was "yes". */ + * to build circuits, the answer was "yes". If there are no exits in the + * consensus, we act as if we have 100% of the exit directory info. */ static int have_min_dir_info = 0; /** Does the consensus contain nodes that can exit? */ @@ -1285,12 +1286,15 @@ static consensus_path_type_t have_consensus_path = CONSENSUS_PATH_UNKNOWN; static int need_to_update_have_min_dir_info = 1; /** String describing what we're missing before we have enough directory * info. */ -static char dir_info_status[256] = ""; +static char dir_info_status[512] = ""; -/** Return true iff we have enough networkstatus and router information to - * start building circuits. Right now, this means "more than half the - * networkstatus documents, and at least 1/4 of expected routers." */ -//XXX should consider whether we have enough exiting nodes here. +/** Return true iff we have enough consensus information to + * start building circuits. Right now, this means "a consensus that's + * less than a day old, and at least 60% of router descriptors (configurable), + * weighted by bandwidth. Treat the exit fraction as 100% if there are + * no exits in the consensus." + * To obtain the final weighted bandwidth, we multiply the + * weighted bandwidth fraction for each position (guard, middle, exit). */ int router_have_minimum_dir_info(void) { @@ -1405,7 +1409,16 @@ count_usable_descriptors(int *num_present, int *num_usable, } /** Return an estimate of which fraction of usable paths through the Tor - * network we have available for use. */ + * network we have available for use. + * Count how many routers seem like ones we'd use, and how many of + * those we have descriptors for. Store the former in + * *num_usable_out and the latter in *num_present_out. + * If **status_out is present, allocate a new string and print the + * available percentages of guard, middle, and exit nodes to it, noting + * whether there are exits in the consensus. + * If there are no guards in the consensus, + * we treat the exit fraction as 100%. + */ static double compute_frac_paths_available(const networkstatus_t *consensus, const or_options_t *options, time_t now, @@ -1549,16 +1562,28 @@ compute_frac_paths_available(const networkstatus_t *consensus, if (f_myexit < f_exit) f_exit = f_myexit; + /* if the consensus has no exits, treat the exit fraction as 100% */ + if (router_have_consensus_path() != CONSENSUS_PATH_EXIT) { + f_exit = 1.0; + } + + f_path = f_guard * f_mid * f_exit; + if (status_out) tor_asprintf(status_out, "%d%% of guards bw, " "%d%% of midpoint bw, and " - "%d%% of exit bw", + "%d%% of exit bw%s = " + "%d%% of path bw", (int)(f_guard*100), (int)(f_mid*100), - (int)(f_exit*100)); + (int)(f_exit*100), + (router_have_consensus_path() == CONSENSUS_PATH_EXIT ? + "" : + " (no exits in consensus)"), + (int)(f_path*100)); - return f_guard * f_mid * f_exit; + return f_path; } /** We just fetched a new set of descriptors. Compute how far through @@ -1631,6 +1656,9 @@ update_router_have_minimum_dir_info(void) using_md = consensus->flavor == FLAV_MICRODESC; +#define NOTICE_DIR_INFO_STATUS_INTERVAL (60) + + /* Check fraction of available paths */ { char *status = NULL; int num_present=0, num_usable=0; @@ -1639,16 +1667,37 @@ update_router_have_minimum_dir_info(void) &status); if (paths < get_frac_paths_needed_for_circs(options,consensus)) { - tor_snprintf(dir_info_status, sizeof(dir_info_status), - "We need more %sdescriptors: we have %d/%d, and " - "can only build %d%% of likely paths. (We have %s.)", - using_md?"micro":"", num_present, num_usable, - (int)(paths*100), status); - /* log_notice(LD_NET, "%s", dir_info_status); */ + /* these messages can be excessive in testing networks */ + static ratelim_t last_warned = + RATELIM_INIT(NOTICE_DIR_INFO_STATUS_INTERVAL); + char *suppression_msg = NULL; + if ((suppression_msg = rate_limit_log(&last_warned, time(NULL)))) { + tor_snprintf(dir_info_status, sizeof(dir_info_status), + "We need more %sdescriptors: we have %d/%d, and " + "can only build %d%% of likely paths. (We have %s.)", + using_md?"micro":"", num_present, num_usable, + (int)(paths*100), status); + log_warn(LD_NET, "%s%s", dir_info_status, suppression_msg); + tor_free(suppression_msg); + } tor_free(status); res = 0; control_event_bootstrap(BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS, 0); goto done; + } else { + /* these messages can be excessive in testing networks */ + static ratelim_t last_warned = + RATELIM_INIT(NOTICE_DIR_INFO_STATUS_INTERVAL); + char *suppression_msg = NULL; + if ((suppression_msg = rate_limit_log(&last_warned, time(NULL)))) { + tor_snprintf(dir_info_status, sizeof(dir_info_status), + "We have enough %sdescriptors: we have %d/%d, and " + "can build %d%% of likely paths. (We have %s.)", + using_md?"micro":"", num_present, num_usable, + (int)(paths*100), status); + log_info(LD_NET, "%s%s", dir_info_status, suppression_msg); + tor_free(suppression_msg); + } } tor_free(status); @@ -1656,12 +1705,16 @@ update_router_have_minimum_dir_info(void) } done: + + /* If paths have just become available in this update. */ if (res && !have_min_dir_info) { log_notice(LD_DIR, "We now have enough directory information to build circuits."); control_event_client_status(LOG_NOTICE, "ENOUGH_DIR_INFO"); control_event_bootstrap(BOOTSTRAP_STATUS_CONN_OR, 0); } + + /* If paths have just become unavailable in this update. */ if (!res && have_min_dir_info) { int quiet = directory_too_idle_to_fetch_descriptors(options, now); tor_log(quiet ? LOG_INFO : LOG_NOTICE, LD_DIR, diff --git a/src/or/nodelist.h b/src/or/nodelist.h index 56cfffa9f1..2e59da673e 100644 --- a/src/or/nodelist.h +++ b/src/or/nodelist.h @@ -79,6 +79,14 @@ int node_is_unreliable(const node_t *router, int need_uptime, int router_exit_policy_all_nodes_reject(const tor_addr_t *addr, uint16_t port, int need_uptime); void router_set_status(const char *digest, int up); + +/** router_have_minimum_dir_info tests to see if we have enough + * descriptor information to create circuits. + * If there are exits in the consensus, we wait until we have enough + * info to create exit paths before creating any circuits. If there are + * no exits in the consensus, we wait for enough info to create internal + * paths, and should avoid creating exit paths, as they will simply fail. + * We make sure we create all available circuit types at the same time. */ int router_have_minimum_dir_info(void); /** Set to CONSENSUS_PATH_EXIT if there is at least one exit node From cb94f7534dfd666eb02fd8560621d713177b0f62 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 26 Dec 2014 00:31:16 +1100 Subject: [PATCH 079/120] Avoid building exit circuits from a consensus with no exits Tor can now build circuits from a consensus with no exits. But if it tries to build exit circuits, they fail and flood the logs. The circuit types in the Exit Circuits list below will only be built if the current consensus has exits. If it doesn't, only the Internal Circuits will be built. (This can change with each new consensus.) Fixes bug #13814, causes fewer path failures due to #13817. Exit Circuits: Predicted Exit Circuits User Traffic Circuits Most AP Streams Circuits Marked Exit Build Timeout Circuits (with exits) Internal Circuits: Hidden Service Server Circuits Hidden Service Client Circuits Hidden Service AP Streams Hidden Service Intro Point Streams Circuits Marked Internal Build Timeout Circuits (with no exits) Other Circuits? --- changes/bug13814-avoid-exit-paths-no-exits | 25 ++++++ src/or/circuituse.c | 96 ++++++++++++++++------ 2 files changed, 94 insertions(+), 27 deletions(-) create mode 100644 changes/bug13814-avoid-exit-paths-no-exits diff --git a/changes/bug13814-avoid-exit-paths-no-exits b/changes/bug13814-avoid-exit-paths-no-exits new file mode 100644 index 0000000000..8b0446f5f0 --- /dev/null +++ b/changes/bug13814-avoid-exit-paths-no-exits @@ -0,0 +1,25 @@ + o Minor bugfixes: + - Avoid building exit circuits from a consensus with no exits + Tor can now build circuits from a consensus with no exits. + But if it tries to build exit circuits, they fail and flood the logs. + The circuit types in the Exit Circuits list below will only be + built if the current consensus has exits. If it doesn't, + only the Internal Circuits will be built. (This can change + with each new consensus.) + Fixes bug #13814, causes fewer path failures due to #13817. + + Exit Circuits: + Predicted Exit Circuits + User Traffic Circuits + Most AP Streams + Circuits Marked Exit + Build Timeout Circuits (with exits) + + Internal Circuits: + Hidden Service Server Circuits + Hidden Service Client Circuits + Hidden Service AP Streams + Hidden Service Intro Point Streams + Circuits Marked Internal + Build Timeout Circuits (with no exits) + Other Circuits? diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 90571360de..015270cd25 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1024,9 +1024,11 @@ circuit_predict_and_launch_new(void) /* Second, see if we need any more exit circuits. */ /* check if we know of a port that's been requested recently - * and no circuit is currently available that can handle it. */ + * and no circuit is currently available that can handle it. + * Exits (obviously) require an exit circuit. */ if (!circuit_all_predicted_ports_handled(now, &port_needs_uptime, - &port_needs_capacity)) { + &port_needs_capacity) + && router_have_consensus_path() == CONSENSUS_PATH_EXIT) { if (port_needs_uptime) flags |= CIRCLAUNCH_NEED_UPTIME; if (port_needs_capacity) @@ -1038,8 +1040,10 @@ circuit_predict_and_launch_new(void) return; } - /* Third, see if we need any more hidden service (server) circuits. */ - if (num_rend_services() && num_uptime_internal < 3) { + /* Third, see if we need any more hidden service (server) circuits. + * HS servers only need an internal circuit. */ + if (num_rend_services() && num_uptime_internal < 3 + && router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN) { flags = (CIRCLAUNCH_NEED_CAPACITY | CIRCLAUNCH_NEED_UPTIME | CIRCLAUNCH_IS_INTERNAL); log_info(LD_CIRC, @@ -1050,11 +1054,13 @@ circuit_predict_and_launch_new(void) return; } - /* Fourth, see if we need any more hidden service (client) circuits. */ + /* Fourth, see if we need any more hidden service (client) circuits. + * HS clients only need an internal circuit. */ if (rep_hist_get_predicted_internal(now, &hidserv_needs_uptime, &hidserv_needs_capacity) && ((num_uptime_internal<2 && hidserv_needs_uptime) || - num_internal<2)) { + num_internal<2) + && router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN) { if (hidserv_needs_uptime) flags |= CIRCLAUNCH_NEED_UPTIME; if (hidserv_needs_capacity) @@ -1071,15 +1077,23 @@ circuit_predict_and_launch_new(void) /* Finally, check to see if we still need more circuits to learn * a good build timeout. But if we're close to our max number we * want, don't do another -- we want to leave a few slots open so - * we can still build circuits preemptively as needed. */ - if (num < MAX_UNUSED_OPEN_CIRCUITS-2 && - ! circuit_build_times_disabled() && - circuit_build_times_needs_circuits_now(get_circuit_build_times())) { - flags = CIRCLAUNCH_NEED_CAPACITY; - log_info(LD_CIRC, - "Have %d clean circs need another buildtime test circ.", num); - circuit_launch(CIRCUIT_PURPOSE_C_GENERAL, flags); - return; + * we can still build circuits preemptively as needed. + * XXXX make the assumption that build timeout streams should be + * created whenever we can build internal circuits. */ + if (router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN) { + if (num < MAX_UNUSED_OPEN_CIRCUITS-2 && + ! circuit_build_times_disabled() && + circuit_build_times_needs_circuits_now(get_circuit_build_times())) { + flags = CIRCLAUNCH_NEED_CAPACITY; + /* if there are no exits in the consensus, make timeout + * circuits internal */ + if (router_have_consensus_path() == CONSENSUS_PATH_INTERNAL) + flags |= CIRCLAUNCH_IS_INTERNAL; + log_info(LD_CIRC, + "Have %d clean circs need another buildtime test circ.", num); + circuit_launch(CIRCUIT_PURPOSE_C_GENERAL, flags); + return; + } } } @@ -1096,11 +1110,17 @@ circuit_build_needed_circs(time_t now) { const or_options_t *options = get_options(); - /* launch a new circ for any pending streams that need one */ - connection_ap_attach_pending(); + /* launch a new circ for any pending streams that need one + * XXXX make the assumption that (some) AP streams (i.e. HS clients) + * don't require an exit circuit, review in #13814. + * This allows HSs to function in a consensus without exits. */ + if (router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN) + connection_ap_attach_pending(); - /* make sure any hidden services have enough intro points */ - rend_services_introduce(); + /* make sure any hidden services have enough intro points + * HS intro point streams only require an internal circuit */ + if (router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN) + rend_services_introduce(); circuit_expire_old_circs_as_needed(now); @@ -1632,6 +1652,16 @@ circuit_launch(uint8_t purpose, int flags) return circuit_launch_by_extend_info(purpose, NULL, flags); } +/** DOCDOC */ +static int +have_enough_path_info(int need_exit) +{ + if (need_exit) + return router_have_consensus_path() == CONSENSUS_PATH_EXIT; + else + return router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN +} + /** Launch a new circuit with purpose purpose and exit node * extend_info (or NULL to select a random exit node). If flags * contains CIRCLAUNCH_NEED_UPTIME, choose among routers with high uptime. If @@ -1646,10 +1676,14 @@ circuit_launch_by_extend_info(uint8_t purpose, { origin_circuit_t *circ; int onehop_tunnel = (flags & CIRCLAUNCH_ONEHOP_TUNNEL) != 0; + int have_path = have_enough_path_info(! (flags & CIRCLAUNCH_IS_INTERNAL) ); - if (!onehop_tunnel && !router_have_minimum_dir_info()) { - log_debug(LD_CIRC,"Haven't fetched enough directory info yet; canceling " - "circuit launch."); + if (!onehop_tunnel && (!router_have_minimum_dir_info() || !have_path)) { + log_debug(LD_CIRC,"Haven't %s yet; canceling " + "circuit launch.", + !router_have_minimum_dir_info() ? + "fetched enough directory info" : + "received a consensus with exits"); return NULL; } @@ -1806,7 +1840,9 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn, return 1; /* we're happy */ } - if (!want_onehop && !router_have_minimum_dir_info()) { + int have_path = have_enough_path_info(!need_internal); + + if (!want_onehop && (!router_have_minimum_dir_info() || !have_path)) { if (!connection_get_by_type(CONN_TYPE_DIR)) { int severity = LOG_NOTICE; /* FFFF if this is a tunneled directory fetch, don't yell @@ -1814,14 +1850,20 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn, if (entry_list_is_constrained(options) && entries_known_but_down(options)) { log_fn(severity, LD_APP|LD_DIR, - "Application request when we haven't used client functionality " - "lately. Optimistically trying known %s again.", + "Application request when we haven't %s. " + "Optimistically trying known %s again.", + !router_have_minimum_dir_info() ? + "used client functionality lately" : + "received a consensus with exits", options->UseBridges ? "bridges" : "entrynodes"); entries_retry_all(options); } else if (!options->UseBridges || any_bridge_descriptors_known()) { log_fn(severity, LD_APP|LD_DIR, - "Application request when we haven't used client functionality " - "lately. Optimistically trying directory fetches again."); + "Application request when we haven't %s. " + "Optimistically trying directory fetches again.", + !router_have_minimum_dir_info() ? + "used client functionality lately" : + "received a consensus with exits"); routerlist_retry_directory_downloads(time(NULL)); } } From c3a4201faa389ce95b263045a855a556be25f3f2 Mon Sep 17 00:00:00 2001 From: teor Date: Fri, 26 Dec 2014 00:43:58 +1100 Subject: [PATCH 080/120] Add "internal" to some bootstrap statuses when no exits are available. If the consensus does not contain Exits, Tor will only build internal circuits. In this case, relevant statuses will contain the word "internal" as indicated in the Tor control-spec.txt. When bootstrap completes, Tor will be ready to handle an application requesting an internal circuit to hidden services at ".onion" addresses. If a future consensus contains Exits, exit circuits may become available. Tor already notifies the user at "notice" level if they have no exits in the consensus, and can therefor only build internal paths. Consequential change from #13718. --- .../bug13718-add-internal-bootstrap-statuses | 9 ++++++ src/or/control.c | 30 +++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 changes/bug13718-add-internal-bootstrap-statuses diff --git a/changes/bug13718-add-internal-bootstrap-statuses b/changes/bug13718-add-internal-bootstrap-statuses new file mode 100644 index 0000000000..d3e9a7709c --- /dev/null +++ b/changes/bug13718-add-internal-bootstrap-statuses @@ -0,0 +1,9 @@ + o Minor bugfixes: + - Add "internal" to some bootstrap statuses when no exits are available. + If the consensus does not contain Exits, Tor will only build internal + circuits. In this case, relevant statuses will contain the word + "internal" as indicated in the Tor control-spec.txt. When bootstrap + completes, Tor will be ready to handle an application requesting an + internal circuit to hidden services at ".onion" addresses. + If a future consensus contains Exits, exit circuits may become available. + Consequential change from #13718. diff --git a/src/or/control.c b/src/or/control.c index dc67588d6a..7214559136 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -4807,23 +4807,43 @@ bootstrap_status_to_string(bootstrap_status_t s, const char **tag, break; case BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS: *tag = "requesting_descriptors"; - *summary = "Asking for relay descriptors"; + /* XXXX this appears to incorrectly report internal on most loads */ + *summary = router_have_consensus_path() == CONSENSUS_PATH_INTERNAL ? + "Asking for relay descriptors for internal paths" : + "Asking for relay descriptors"; break; + /* If we're sure there are no exits in the consensus, + * inform the controller by adding "internal" + * to the status summaries. + * (We only check this while loading descriptors, + * so we may not know in the earlier stages.) + * But if there are exits, we can't be sure whether + * we're creating internal or exit paths/circuits. + * XXXX Or should be use different tags or statuses + * for internal and exit/all? */ case BOOTSTRAP_STATUS_LOADING_DESCRIPTORS: *tag = "loading_descriptors"; - *summary = "Loading relay descriptors"; + *summary = router_have_consensus_path() == CONSENSUS_PATH_INTERNAL ? + "Loading relay descriptors for internal paths" : + "Loading relay descriptors"; break; case BOOTSTRAP_STATUS_CONN_OR: *tag = "conn_or"; - *summary = "Connecting to the Tor network"; + *summary = router_have_consensus_path() == CONSENSUS_PATH_INTERNAL ? + "Connecting to the Tor network internally" : + "Connecting to the Tor network"; break; case BOOTSTRAP_STATUS_HANDSHAKE_OR: *tag = "handshake_or"; - *summary = "Finishing handshake with first hop"; + *summary = router_have_consensus_path() == CONSENSUS_PATH_INTERNAL ? + "Finishing handshake with first hop of internal circuit" : + "Finishing handshake with first hop"; break; case BOOTSTRAP_STATUS_CIRCUIT_CREATE: *tag = "circuit_create"; - *summary = "Establishing a Tor circuit"; + *summary = router_have_consensus_path() == CONSENSUS_PATH_INTERNAL ? + "Establishing an internal Tor circuit" : + "Establishing a Tor circuit"; break; case BOOTSTRAP_STATUS_DONE: *tag = "done"; From 2b8e1f91336db7297803f4e7d2f324d6960a676c Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 20 Dec 2014 21:44:16 +1100 Subject: [PATCH 081/120] Fix Reachability self-tests in test networks Stop assuming that private addresses are local when checking reachability in a TestingTorNetwork. Instead, when testing, assume all OR connections are remote. (This is necessary due to many test scenarios running all nodes on localhost.) This assists in bootstrapping a testing Tor network. Fixes bugs 13718 & 13924. --- changes/bug13924-fix-testing-reachability | 7 +++++++ src/or/circuitbuild.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changes/bug13924-fix-testing-reachability diff --git a/changes/bug13924-fix-testing-reachability b/changes/bug13924-fix-testing-reachability new file mode 100644 index 0000000000..914a159007 --- /dev/null +++ b/changes/bug13924-fix-testing-reachability @@ -0,0 +1,7 @@ + o Minor bugfixes: + - Stop assuming that private addresses are local when checking + reachability in a TestingTorNetwork. Instead, when testing, assume + all OR connections are remote. (This is necessary due to many test + scenarios running all nodes on localhost.) + This assists in bootstrapping a testing Tor network. + Fixes bugs 13718 & 13924. diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index a834e7b7fc..7061ab0e0b 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1378,8 +1378,10 @@ onionskin_answer(or_circuit_t *circ, log_debug(LD_CIRC,"Finished sending '%s' cell.", circ->is_first_hop ? "created_fast" : "created"); - if (!channel_is_local(circ->p_chan) && - !channel_is_outgoing(circ->p_chan)) { + /* Ignore the local bit when testing - many test networks run on local + * addresses */ + if ((!channel_is_local(circ->p_chan) || get_options()->TestingTorNetwork) + && !channel_is_outgoing(circ->p_chan)) { /* record that we could process create cells from a non-local conn * that we didn't initiate; presumably this means that create cells * can reach us too. */ From b32e10253cb3698245aab632b43e98165f09c186 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 09:39:12 -0500 Subject: [PATCH 082/120] Lintchanges some more. --- .../bug13718-add-internal-bootstrap-statuses | 4 +-- changes/bug13718-avoid-excluding-guards | 4 +-- changes/bug13718-check-consensus-exits | 6 ---- changes/bug13718-make-nodelist-args-readable | 8 ----- changes/bug13814-avoid-exit-paths-no-exits | 31 +++++-------------- changes/bug13814-reachability-without-exits | 14 +++------ changes/bug13823-decrease-consensus-interval | 2 +- .../bug13839-fix-TestingMinExitFlagThreshold | 5 ++- changes/bug13924-fix-testing-reachability | 4 +-- .../bug13963-decrease-if-modified-since-delay | 1 + 10 files changed, 21 insertions(+), 58 deletions(-) delete mode 100644 changes/bug13718-check-consensus-exits delete mode 100644 changes/bug13718-make-nodelist-args-readable diff --git a/changes/bug13718-add-internal-bootstrap-statuses b/changes/bug13718-add-internal-bootstrap-statuses index d3e9a7709c..add2e8ef07 100644 --- a/changes/bug13718-add-internal-bootstrap-statuses +++ b/changes/bug13718-add-internal-bootstrap-statuses @@ -1,4 +1,4 @@ - o Minor bugfixes: + o Minor bugfixes (Testing networks): - Add "internal" to some bootstrap statuses when no exits are available. If the consensus does not contain Exits, Tor will only build internal circuits. In this case, relevant statuses will contain the word @@ -6,4 +6,4 @@ completes, Tor will be ready to handle an application requesting an internal circuit to hidden services at ".onion" addresses. If a future consensus contains Exits, exit circuits may become available. - Consequential change from #13718. + Fixes part of bug 13718; bugfix on 0.2.4.10-alpha. Patch by "teor". diff --git a/changes/bug13718-avoid-excluding-guards b/changes/bug13718-avoid-excluding-guards index bf80d2a7e7..8bb4fa311f 100644 --- a/changes/bug13718-avoid-excluding-guards +++ b/changes/bug13718-avoid-excluding-guards @@ -1,8 +1,8 @@ - o Minor bugfixes: + o Minor bugfixes (Test networks): - Avoid excluding guards from path building in minimal test networks, when we're in a test network, and excluding guards would exclude all nodes. This typically occurs in incredibly small tor networks, and those using TestingAuthVoteGuard * This fix only applies to minimal, testing tor networks, so it's no less secure. - Discovered as part of #13718. + Fixes part of bug 13718; bugfix on 0.1.1.11-alpha. Patch by "teor". diff --git a/changes/bug13718-check-consensus-exits b/changes/bug13718-check-consensus-exits deleted file mode 100644 index 5ca4b115eb..0000000000 --- a/changes/bug13718-check-consensus-exits +++ /dev/null @@ -1,6 +0,0 @@ - o Minor enhancement: - - Check if there are exits in the consensus. - Add router_have_consensus_path() which reports whether - the consensus has exit paths, internal paths, or whether it - just doesn't know. - Used by #13718 and #13814. diff --git a/changes/bug13718-make-nodelist-args-readable b/changes/bug13718-make-nodelist-args-readable deleted file mode 100644 index 7377a81d38..0000000000 --- a/changes/bug13718-make-nodelist-args-readable +++ /dev/null @@ -1,8 +0,0 @@ - o Minor refactoring: - - Refactor count_usable_descriptors to use named enums for exit_only. - count_usable_descriptors now uses named exit_only values: - * USABLE_DESCRIPTOR_ALL - * USABLE_DESCRIPTOR_EXIT_ONLY - - Add debug logging code for descriptor counts. - This resolves nickm's request in bug 13718 to improve argument - readability. diff --git a/changes/bug13814-avoid-exit-paths-no-exits b/changes/bug13814-avoid-exit-paths-no-exits index 8b0446f5f0..82761214b8 100644 --- a/changes/bug13814-avoid-exit-paths-no-exits +++ b/changes/bug13814-avoid-exit-paths-no-exits @@ -1,25 +1,8 @@ - o Minor bugfixes: - - Avoid building exit circuits from a consensus with no exits - Tor can now build circuits from a consensus with no exits. - But if it tries to build exit circuits, they fail and flood the logs. - The circuit types in the Exit Circuits list below will only be - built if the current consensus has exits. If it doesn't, - only the Internal Circuits will be built. (This can change - with each new consensus.) - Fixes bug #13814, causes fewer path failures due to #13817. + o Minor features (Testing networks): + - Avoid building exit circuits from a consensus with no exits. + Now thanks to our fix for 13718, + we accept a no-exit network as not wholly lost, but + we need to remember not to try to build exit circuits on it. + Closes ticket 13814; + patch by "teor". - Exit Circuits: - Predicted Exit Circuits - User Traffic Circuits - Most AP Streams - Circuits Marked Exit - Build Timeout Circuits (with exits) - - Internal Circuits: - Hidden Service Server Circuits - Hidden Service Client Circuits - Hidden Service AP Streams - Hidden Service Intro Point Streams - Circuits Marked Internal - Build Timeout Circuits (with no exits) - Other Circuits? diff --git a/changes/bug13814-reachability-without-exits b/changes/bug13814-reachability-without-exits index 43a326b847..07f2d8ae37 100644 --- a/changes/bug13814-reachability-without-exits +++ b/changes/bug13814-reachability-without-exits @@ -1,15 +1,9 @@ - o Minor bugfixes: - - Allow tor to build circuits using a consensus with + o Minor bugfixes (Testing networks): + - Allow Tor to build circuits using a consensus with no exits. If the consensus has no exits (typical of - a bootstrapping test network), allow tor to build + a bootstrapping test network), allow Tor to build circuits once enough descriptors have been downloaded. - When there are no exits, we always have "enough" - exit descriptors. (We treat the proportion of - available exit descriptors as 100%.) This assists in bootstrapping a testing Tor network. - Fixes bug 13718. - Makes bug 13161's TestingDirAuthVoteExit - non-essential. - (But still useful for speeding up a bootstrap.) + Fixes bug 13718; bugfix on 0.2.4.10-alpha. Patch by "teor". diff --git a/changes/bug13823-decrease-consensus-interval b/changes/bug13823-decrease-consensus-interval index 67f0b9fe62..cc0e6c7c61 100644 --- a/changes/bug13823-decrease-consensus-interval +++ b/changes/bug13823-decrease-consensus-interval @@ -6,4 +6,4 @@ This assists in quickly bootstrapping a testing Tor network. Fixes bugs 13718 and 13823; bugfix on 0.2.0.3-alpha. - + Patch by "teor". diff --git a/changes/bug13839-fix-TestingMinExitFlagThreshold b/changes/bug13839-fix-TestingMinExitFlagThreshold index e0fa270243..86315de1f6 100644 --- a/changes/bug13839-fix-TestingMinExitFlagThreshold +++ b/changes/bug13839-fix-TestingMinExitFlagThreshold @@ -3,6 +3,5 @@ TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0, ignore exit bandwidthcapacity. This assists in bootstrapping a testing Tor network. - Fixes bugs parts of bugs 13718 and 13839; - Makes bug 13161's TestingDirAuthVoteExit non-essential. - Bugfix on 0.2.0.3-alpha. + Fixes parts of bugs 13718 and 13839; + bugfix on 0.2.0.3-alpha. Patch by "teor". diff --git a/changes/bug13924-fix-testing-reachability b/changes/bug13924-fix-testing-reachability index 914a159007..e10dda81a3 100644 --- a/changes/bug13924-fix-testing-reachability +++ b/changes/bug13924-fix-testing-reachability @@ -1,7 +1,7 @@ - o Minor bugfixes: + o Minor bugfixes (Testing networks) - Stop assuming that private addresses are local when checking reachability in a TestingTorNetwork. Instead, when testing, assume all OR connections are remote. (This is necessary due to many test scenarios running all nodes on localhost.) This assists in bootstrapping a testing Tor network. - Fixes bugs 13718 & 13924. + Fixes bug 13924; bugfix on 0.1.0.1-rc. Patch by "teor". diff --git a/changes/bug13963-decrease-if-modified-since-delay b/changes/bug13963-decrease-if-modified-since-delay index d4bbc1bbd4..26bda82ac4 100644 --- a/changes/bug13963-decrease-if-modified-since-delay +++ b/changes/bug13963-decrease-if-modified-since-delay @@ -5,3 +5,4 @@ interval is very short. This assists in bootstrapping a testing Tor network. Fixes parts of bugs 13718 and 13963; bugfix on 0.2.0.3-alpha. + Patch by "teor". \ No newline at end of file From 03e9aa094185e55e120f2fffa01da62b5a7b44df Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 09:53:13 -0500 Subject: [PATCH 083/120] Fold more things into the 0.2.6.2-alpha changelog --- ChangeLog | 106 ++++++++++++++++-- changes/bug13667 | 6 - .../bug13718-add-internal-bootstrap-statuses | 9 -- changes/bug13718-avoid-excluding-guards | 8 -- changes/bug13808 | 9 -- changes/bug13811 | 6 - changes/bug13814-avoid-exit-paths-no-exits | 8 -- changes/bug13814-reachability-without-exits | 9 -- changes/bug13823-decrease-consensus-interval | 9 -- .../bug13839-fix-TestingMinExitFlagThreshold | 7 -- changes/bug13913 | 7 -- changes/bug13924-fix-testing-reachability | 7 -- .../bug13963-decrease-if-modified-since-delay | 8 -- changes/bug14013 | 6 - changes/bug14041 | 5 - changes/resolvemyaddr-tests | 3 - changes/ticket11016 | 6 - 17 files changed, 99 insertions(+), 120 deletions(-) delete mode 100644 changes/bug13667 delete mode 100644 changes/bug13718-add-internal-bootstrap-statuses delete mode 100644 changes/bug13718-avoid-excluding-guards delete mode 100644 changes/bug13808 delete mode 100644 changes/bug13811 delete mode 100644 changes/bug13814-avoid-exit-paths-no-exits delete mode 100644 changes/bug13814-reachability-without-exits delete mode 100644 changes/bug13823-decrease-consensus-interval delete mode 100644 changes/bug13839-fix-TestingMinExitFlagThreshold delete mode 100644 changes/bug13913 delete mode 100644 changes/bug13924-fix-testing-reachability delete mode 100644 changes/bug13963-decrease-if-modified-since-delay delete mode 100644 changes/bug14013 delete mode 100644 changes/bug14041 delete mode 100644 changes/resolvemyaddr-tests delete mode 100644 changes/ticket11016 diff --git a/ChangeLog b/ChangeLog index d7c9430f8d..18bd536abe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,10 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? implements ticket 9262. o Major features (hidden services): + - Make HS port scanning more difficult by sending back REASON_DONE + if the exit policy didn't match. Furthermore, immediately close + the circuit to slow down port scanning attempts. Closes + ticket 13667. - Add a HiddenServiceStatistics option that allows Tor relays to gather and publish statistics the overall size and volume of hidden service usage. Specifically, when this option is turned on, @@ -30,6 +34,13 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? proposal 238, "Better hidden service stats from Tor relays". This feature is currently disabled by default. Implements feature 13192. + o Major bugfixes (client, automap): + - Repair automapping with IPv6 addresses; this automapping should + have worked previously, but one piece of debugging code that we + inserted to detect a regression actually caused the regression to + manifest itself again. Fixes bug 13811; bugfix on 0.2.4.7-alpha. + Diagnosed and fixed by Francisco Blas Izquierdo Riera. + o Major bugfixes (hidden services): - When closing an introduction circuit that was opened in parallel with others, don't mark the introduction point as unreachable. @@ -37,6 +48,12 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? point would make the other introduction points get marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. + o Major removed features: + - Tor clients no longer support connecting to hidden services + running on Tor 0.2.2.x and earlier; the Support022HiddenServices + option has been removed. (There shouldn't be any hidden services + running these versions on the network.) Closes ticket 7803. + o Minor features (client): - Validate hostnames in SOCKS5 requests more strictly. If SafeSocks is enabled, reject requests with IP addresses as hostnames. @@ -63,9 +80,29 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? directories and hostname files to be created group-readable. Patch from "anon", David Stainton, and "meejah". Closes ticket 11291. - o Minor features (transparent firewall): + o Minor features (systemd): + - Where supported, when running with systemd, report successful + startup to systemd. Part of ticket 11016. Patch by Michael Scherer. + - When running with systemd, support systemd watchdog messages. Part + of ticket 11016. Patch by Michael Scherer. + + o Minor features (transparent proxy): - Update the transparent proxy option checks to allow for both ipfw and pf on OS X. Closes ticket 14002. + - Use the correct option when using IPv6 with transparent proxy + support on Linux. Resolves 13808. Patch by Francisco Blas + Izquierdo Riera. + + o Minor bugfixes (preventative security, C safety): + - When reading a hexadecimal, base-32, or base-64 encoded value from + a string, always overwrite the complete output buffer. This + prevents some bugs where we would look at (but fortunately, not + reveal) uninitialized memory on the stack. Fixes bug 14013; bugfix + on all versions of Tor. + - Clear all memory targetted by tor_addr_{to,from}_sockaddr(), not + just the part that's used. This makes it harder for data leak bugs + to occur in the event of other programming failures. Resolves + ticket 14041. o Minor bugfixes (client, micordescriptors): - Use a full 256 bits of the SHA256 digest of a microdescriptor when @@ -103,6 +140,11 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? directories. Fixes bug 13214; bugfix on 0.2.1.6-alpha. Reported by "special". + o Minor bugfixes (Linux seccomp2 sandbox): + - Make transparent proxy support work along with the seccomp2 + sandbox. Fixes part of bug 13808; bugfix on 0.2.5.1-alpha. Patch + by Francisco Blas Izquierdo Riera. + o Minor bugfixes (logging): - Downgrade warnings about RSA signature failures to info log level. Emit a warning when extra info document is found incompatible with @@ -118,6 +160,56 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? our address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. + o Minor bugfixes (testing networks): + - Allow Tor to build circuits using a consensus with no exits. If + the consensus has no exits (typical of a bootstrapping test + network), allow Tor to build circuits once enough descriptors have + been downloaded. This assists in bootstrapping a testing Tor + network. Fixes bug 13718; bugfix on 0.2.4.10-alpha. Patch + by "teor". + - When V3AuthVotingInterval is low, give a lower If-Modified-Since + header to directory servers. This allows us to obtain consensuses + promptly when the consensus interval is very short. This assists + in bootstrapping a testing Tor network. Fixes parts of bugs 13718 + and 13963; bugfix on 0.2.0.3-alpha. Patch by "teor". + - Stop assuming that private addresses are local when checking + reachability in a TestingTorNetwork. Instead, when testing, assume + all OR connections are remote. (This is necessary due to many test + scenarios running all nodes on localhost.) This assists in + bootstrapping a testing Tor network. Fixes bug 13924; bugfix on + 0.1.0.1-rc. Patch by "teor". + - Avoid building exit circuits from a consensus with no exits. Now + thanks to our fix for 13718, we accept a no-exit network as not + wholly lost, but we need to remember not to try to build exit + circuits on it. Closes ticket 13814; patch by "teor". + - Stop requiring exits to have non-zero bandwithcapacity in a + TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0, + ignore exit bandwidthcapacity. This assists in bootstrapping a + testing Tor network. Fixes parts of bugs 13718 and 13839; bugfix + on 0.2.0.3-alpha. Patch by "teor". + - Add "internal" to some bootstrap statuses when no exits are + available. If the consensus does not contain Exits, Tor will only + build internal circuits. In this case, relevant statuses will + contain the word "internal" as indicated in the Tor control- + spec.txt. When bootstrap completes, Tor will be ready to handle an + application requesting an internal circuit to hidden services at + ".onion" addresses. If a future consensus contains Exits, exit + circuits may become available. Fixes part of bug 13718; bugfix on + 0.2.4.10-alpha. Patch by "teor". + - Decrease minimum consensus interval to 10 seconds when + TestingTorNetwork is set, or 5 seconds for the first consensus. + Fix assumptions throughout the code that assume larger interval + values. This assists in quickly bootstrapping a testing Tor + network. Fixes bugs 13718 and 13823; bugfix on 0.2.0.3-alpha. + Patch by "teor". + - Avoid excluding guards from path building in minimal test + networks, when we're in a test network, and excluding guards would + exclude all nodes. This typically occurs in incredibly small tor + networks, and those using TestingAuthVoteGuard * This fix only + applies to minimal, testing tor networks, so it's no less secure. + Fixes part of bug 13718; bugfix on 0.1.1.11-alpha. Patch + by "teor". + o Code simplification and refactoring: - Stop using can_complete_circuits as a global variable; access it with a function instead. @@ -153,12 +245,10 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? good idea. Also, properly cross-reference how to specify nodes in all parts of the manual for options that take a list of nodes. Closes ticket 13381. - - o Major removed features: - - Tor clients no longer support connecting to hidden services - running on Tor 0.2.2.x and earlier; the Support022HiddenServices - option has been removed. (There shouldn't be any hidden services - running these versions on the network.) Closes ticket 7803. + - Clarify HiddenServiceDir option description in manpage to make it + clear that relative paths are taken with respect to the current + working directory of Tor instance. Also clarify that this behavior + is not guaranteed to remain indefinitely. Fixes issue 13913. o Testing: - New tests for many parts of channel, relay, and circuit mux @@ -168,6 +258,8 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? test temporary directory to the current user, so that the sticky bit doesn't interfere with tests that check directory groups. Closes 13678. + - Add unit tests for resolve_my_addr(). Part of ticket 12376; patch + by 'rl1987'. Changes in version 0.2.6.1-alpha - 2014-10-30 diff --git a/changes/bug13667 b/changes/bug13667 deleted file mode 100644 index 852e61fa2a..0000000000 --- a/changes/bug13667 +++ /dev/null @@ -1,6 +0,0 @@ - o Major features (security, hidden services): - - Make HS port scanning more difficult by sending back REASON_DONE if the - exit policy didn't match. Furthermore, immediately close the circuit to - avoid other connection attempts on it from the possible attacker trying - multiple ports on that same circuits. Closes ticket 13667. - diff --git a/changes/bug13718-add-internal-bootstrap-statuses b/changes/bug13718-add-internal-bootstrap-statuses deleted file mode 100644 index add2e8ef07..0000000000 --- a/changes/bug13718-add-internal-bootstrap-statuses +++ /dev/null @@ -1,9 +0,0 @@ - o Minor bugfixes (Testing networks): - - Add "internal" to some bootstrap statuses when no exits are available. - If the consensus does not contain Exits, Tor will only build internal - circuits. In this case, relevant statuses will contain the word - "internal" as indicated in the Tor control-spec.txt. When bootstrap - completes, Tor will be ready to handle an application requesting an - internal circuit to hidden services at ".onion" addresses. - If a future consensus contains Exits, exit circuits may become available. - Fixes part of bug 13718; bugfix on 0.2.4.10-alpha. Patch by "teor". diff --git a/changes/bug13718-avoid-excluding-guards b/changes/bug13718-avoid-excluding-guards deleted file mode 100644 index 8bb4fa311f..0000000000 --- a/changes/bug13718-avoid-excluding-guards +++ /dev/null @@ -1,8 +0,0 @@ - o Minor bugfixes (Test networks): - - Avoid excluding guards from path building in minimal test networks, - when we're in a test network, and excluding guards would exclude - all nodes. This typically occurs in incredibly small tor networks, - and those using TestingAuthVoteGuard * - This fix only applies to minimal, testing tor networks, - so it's no less secure. - Fixes part of bug 13718; bugfix on 0.1.1.11-alpha. Patch by "teor". diff --git a/changes/bug13808 b/changes/bug13808 deleted file mode 100644 index b24a01c17b..0000000000 --- a/changes/bug13808 +++ /dev/null @@ -1,9 +0,0 @@ - o Minor features (transparent proxy): - - Use the correct option when using IPv6 with transparent proxy - support on Linux. Resolves 13808. Patch by Francisco Blas - Izquierdo Riera. - - o Minor bugfixes (sandbox): - - Make transparent proxy support work along with the seccomp2 - sandbox. Fixes part of bug 13808; bugfix on 0.2.5.1-alpha. - Patch by Francisco Blas Izquierdo Riera. diff --git a/changes/bug13811 b/changes/bug13811 deleted file mode 100644 index 1b9bd9c68d..0000000000 --- a/changes/bug13811 +++ /dev/null @@ -1,6 +0,0 @@ - o Major bugfixes (client, automap): - - Repair automapping with IPv6 addresses; this automapping should - have worked previously, but one piece of debugging code that we - inserted to detect a regression actually caused the regression - to manifest itself again. Fixes bug 13811; bugfix on - 0.2.4.7-alpha. Diagnosed and fixed by Francisco Blas Izquierdo Riera. \ No newline at end of file diff --git a/changes/bug13814-avoid-exit-paths-no-exits b/changes/bug13814-avoid-exit-paths-no-exits deleted file mode 100644 index 82761214b8..0000000000 --- a/changes/bug13814-avoid-exit-paths-no-exits +++ /dev/null @@ -1,8 +0,0 @@ - o Minor features (Testing networks): - - Avoid building exit circuits from a consensus with no exits. - Now thanks to our fix for 13718, - we accept a no-exit network as not wholly lost, but - we need to remember not to try to build exit circuits on it. - Closes ticket 13814; - patch by "teor". - diff --git a/changes/bug13814-reachability-without-exits b/changes/bug13814-reachability-without-exits deleted file mode 100644 index 07f2d8ae37..0000000000 --- a/changes/bug13814-reachability-without-exits +++ /dev/null @@ -1,9 +0,0 @@ - o Minor bugfixes (Testing networks): - - Allow Tor to build circuits using a consensus with - no exits. If the consensus has no exits (typical of - a bootstrapping test network), allow Tor to build - circuits once enough descriptors have been - downloaded. - This assists in bootstrapping a testing Tor - network. - Fixes bug 13718; bugfix on 0.2.4.10-alpha. Patch by "teor". diff --git a/changes/bug13823-decrease-consensus-interval b/changes/bug13823-decrease-consensus-interval deleted file mode 100644 index cc0e6c7c61..0000000000 --- a/changes/bug13823-decrease-consensus-interval +++ /dev/null @@ -1,9 +0,0 @@ - o Minor bugfixes (Testing networks): - - Decrease minimum consensus interval to 10 seconds - when TestingTorNetwork is set, or 5 seconds for - the first consensus. - Fix assumptions throughout the code that assume larger interval values. - This assists in quickly bootstrapping a testing - Tor network. - Fixes bugs 13718 and 13823; bugfix on 0.2.0.3-alpha. - Patch by "teor". diff --git a/changes/bug13839-fix-TestingMinExitFlagThreshold b/changes/bug13839-fix-TestingMinExitFlagThreshold deleted file mode 100644 index 86315de1f6..0000000000 --- a/changes/bug13839-fix-TestingMinExitFlagThreshold +++ /dev/null @@ -1,7 +0,0 @@ - o Minor bugfixes (Testing networks) - - Stop requiring exits to have non-zero bandwithcapacity in a - TestingTorNetwork. Instead, when TestingMinExitFlagThreshold is 0, - ignore exit bandwidthcapacity. - This assists in bootstrapping a testing Tor network. - Fixes parts of bugs 13718 and 13839; - bugfix on 0.2.0.3-alpha. Patch by "teor". diff --git a/changes/bug13913 b/changes/bug13913 deleted file mode 100644 index 9a23180eb3..0000000000 --- a/changes/bug13913 +++ /dev/null @@ -1,7 +0,0 @@ - o Documentation: - - Clarify HiddenServiceDir option description in manpage to make it - clear that relative paths are taken with respect to the current - working - directory of Tor instance. Also clarify that this behavior is - not guaranteed to remain indefinitely. Fixes - issue 13913. diff --git a/changes/bug13924-fix-testing-reachability b/changes/bug13924-fix-testing-reachability deleted file mode 100644 index e10dda81a3..0000000000 --- a/changes/bug13924-fix-testing-reachability +++ /dev/null @@ -1,7 +0,0 @@ - o Minor bugfixes (Testing networks) - - Stop assuming that private addresses are local when checking - reachability in a TestingTorNetwork. Instead, when testing, assume - all OR connections are remote. (This is necessary due to many test - scenarios running all nodes on localhost.) - This assists in bootstrapping a testing Tor network. - Fixes bug 13924; bugfix on 0.1.0.1-rc. Patch by "teor". diff --git a/changes/bug13963-decrease-if-modified-since-delay b/changes/bug13963-decrease-if-modified-since-delay deleted file mode 100644 index 26bda82ac4..0000000000 --- a/changes/bug13963-decrease-if-modified-since-delay +++ /dev/null @@ -1,8 +0,0 @@ - o Minor bugfixes: - - When V3AuthVotingInterval is low, decrease the delay on the - If-Modified-Since header passed to directory servers. - This allows us to obtain consensuses promptly when the consensus - interval is very short. - This assists in bootstrapping a testing Tor network. - Fixes parts of bugs 13718 and 13963; bugfix on 0.2.0.3-alpha. - Patch by "teor". \ No newline at end of file diff --git a/changes/bug14013 b/changes/bug14013 deleted file mode 100644 index 640cf859f5..0000000000 --- a/changes/bug14013 +++ /dev/null @@ -1,6 +0,0 @@ - o Major bugfixes: - - When reading a hexadecimal, base-32, or base-64 encoded value - from a string, always overwrite the complete output buffer. This - prevents some bugs where we would look at (but fortunately, not - reveal) uninitialized memory on the stack. Fixes bug 14013; - bugfix on all versions of Tor. diff --git a/changes/bug14041 b/changes/bug14041 deleted file mode 100644 index d3d6538483..0000000000 --- a/changes/bug14041 +++ /dev/null @@ -1,5 +0,0 @@ - o Minor features (security): - - Clear all memory targetted by tor_addr_{to,from}_sockaddr(), - not just the part that's used. This makes it harder for data leak - bugs to occur in the event of other programming failures. - Resolves ticket 14041. diff --git a/changes/resolvemyaddr-tests b/changes/resolvemyaddr-tests deleted file mode 100644 index c019bb831e..0000000000 --- a/changes/resolvemyaddr-tests +++ /dev/null @@ -1,3 +0,0 @@ - o Testing: - - Add unit tests for resolve_my_addr(). Part of ticket 12376; - patch by 'rl1987'. diff --git a/changes/ticket11016 b/changes/ticket11016 deleted file mode 100644 index 98d5d49697..0000000000 --- a/changes/ticket11016 +++ /dev/null @@ -1,6 +0,0 @@ - o Minor features (systemd): - - Where supported, when running with systemd, report successful - startup to systemd. Part of ticket 11016. Patch by Michael - Scherer. - - When running with systemd, support systemd watchdog messages. - Part of ticket 11016. Patch by Michael Scherer. From 9765ae44479b35ed96e1f9ff88e10cd07b86c5d4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 10:00:11 -0500 Subject: [PATCH 084/120] Missing semicolon; my bad --- src/or/circuituse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 015270cd25..3322d31e2f 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1659,7 +1659,7 @@ have_enough_path_info(int need_exit) if (need_exit) return router_have_consensus_path() == CONSENSUS_PATH_EXIT; else - return router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN + return router_have_consensus_path() != CONSENSUS_PATH_UNKNOWN; } /** Launch a new circuit with purpose purpose and exit node From d87d4183eee40d172eda5265feb0fddfe723dd06 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Tue, 30 Dec 2014 16:36:16 +0000 Subject: [PATCH 085/120] Allow IPv4 and IPv6 addresses in SOCKS5 FQDN requests. Supposedly there are a decent number of applications that "support" IPv6 and SOCKS5 using the FQDN address type. While said applications should be using the IPv6 address type, allow the connection if SafeSocks is not set. Bug not in any released version. --- src/or/buffers.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/or/buffers.c b/src/or/buffers.c index 4cdc03bc03..f0d7e60794 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -2063,9 +2063,7 @@ parse_socks(const char *data, size_t datalen, socks_request_t *req, socks_request_set_socks5_error(req, SOCKS5_NOT_ALLOWED); return -1; } - } - - if (!string_is_valid_hostname(req->address)) { + } else if (!string_is_valid_hostname(req->address)) { socks_request_set_socks5_error(req, SOCKS5_GENERAL_ERROR); log_warn(LD_PROTOCOL, From a4cf2ae24bf77c3c277a50b166fed0a09558d398 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 11:45:01 -0500 Subject: [PATCH 086/120] Note fix for bug 12831 --- ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18bd536abe..4b7f35f546 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,8 +38,9 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? - Repair automapping with IPv6 addresses; this automapping should have worked previously, but one piece of debugging code that we inserted to detect a regression actually caused the regression to - manifest itself again. Fixes bug 13811; bugfix on 0.2.4.7-alpha. - Diagnosed and fixed by Francisco Blas Izquierdo Riera. + manifest itself again. Fixes bug 13811 and bug 12831; bugfix on + 0.2.4.7-alpha. Diagnosed and fixed by Francisco Blas + Izquierdo Riera. o Major bugfixes (hidden services): - When closing an introduction circuit that was opened in parallel From ac632a784cdeecaef81e5f1fe45a20f43a93aea7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 12:07:28 -0500 Subject: [PATCH 087/120] Coalesce v0 and v1 fields of rend_intro_cell_t This saves a tiny bit of code, and makes a longstanding coverity false positive go away. --- src/or/rendservice.c | 9 ++------- src/or/rendservice.h | 6 +----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/or/rendservice.c b/src/or/rendservice.c index 196145e210..d4fbe739fe 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1527,8 +1527,7 @@ find_rp_for_intro(const rend_intro_cell_t *intro, } if (intro->version == 0 || intro->version == 1) { - if (intro->version == 1) rp_nickname = (const char *)(intro->u.v1.rp); - else rp_nickname = (const char *)(intro->u.v0.rp); + rp_nickname = (const char *)(intro->u.v0_v1.rp); node = node_get_by_nickname(rp_nickname, 0); if (!node) { @@ -1777,11 +1776,7 @@ rend_service_parse_intro_for_v0_or_v1( goto err; } - if (intro->version == 1) { - memcpy(intro->u.v1.rp, rp_nickname, endptr - rp_nickname + 1); - } else { - memcpy(intro->u.v0.rp, rp_nickname, endptr - rp_nickname + 1); - } + memcpy(intro->u.v0_v1.rp, rp_nickname, endptr - rp_nickname + 1); return ver_specific_len; diff --git a/src/or/rendservice.h b/src/or/rendservice.h index c2342ef573..05502cac5d 100644 --- a/src/or/rendservice.h +++ b/src/or/rendservice.h @@ -37,14 +37,10 @@ struct rend_intro_cell_s { uint8_t version; /* Version-specific parts */ union { - struct { - /* Rendezvous point nickname */ - uint8_t rp[20]; - } v0; struct { /* Rendezvous point nickname or hex-encoded key digest */ uint8_t rp[42]; - } v1; + } v0_v1; struct { /* The extend_info_t struct has everything v2 uses */ extend_info_t *extend_info; From b3b840443ddbf126c5a9c25533986e9b9ea33585 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 12:10:30 -0500 Subject: [PATCH 088/120] Remove a logically dead check to please coverity --- src/common/address.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/address.c b/src/common/address.c index 267b4e38aa..8a0e96ddde 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1026,7 +1026,6 @@ tor_addr_compare_masked(const tor_addr_t *addr1, const tor_addr_t *addr2, } else { a2 = tor_addr_to_ipv4h(addr2); } - if (mbits <= 0) return 0; if (mbits > 32) mbits = 32; a1 >>= (32-mbits); a2 >>= (32-mbits); From 6e689aed756fb3d96fa70e9138aedc93be8f35de Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 30 Dec 2014 12:35:01 -0500 Subject: [PATCH 089/120] Fix a memory leak in tor-resolve Resolves bug 14050 --- ChangeLog | 2 ++ src/common/sandbox.c | 7 +++++++ src/common/sandbox.h | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4b7f35f546..b125d9d853 100644 --- a/ChangeLog +++ b/ChangeLog @@ -145,6 +145,8 @@ Changes in version 0.2.6.2-alpha - 2014-12-?? - Make transparent proxy support work along with the seccomp2 sandbox. Fixes part of bug 13808; bugfix on 0.2.5.1-alpha. Patch by Francisco Blas Izquierdo Riera. + - Fix a memory leak in tor-resolve when running with the sandbox + enabled. Fixes bug 14050; bugfix on 0.2.5.9-rc. o Minor bugfixes (logging): - Downgrade warnings about RSA signature failures to info log level. diff --git a/src/common/sandbox.c b/src/common/sandbox.c index b1c2a09f14..a06d38608f 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -1335,6 +1335,13 @@ sandbox_disable_getaddrinfo_cache(void) sandbox_getaddrinfo_cache_disabled = 1; } +void +sandbox_freeaddrinfo(struct addrinfo *ai) +{ + if (sandbox_getaddrinfo_cache_disabled) + freeaddrinfo(ai); +} + int sandbox_getaddrinfo(const char *name, const char *servname, const struct addrinfo *hints, diff --git a/src/common/sandbox.h b/src/common/sandbox.h index ad001865a7..f1c99ac02d 100644 --- a/src/common/sandbox.h +++ b/src/common/sandbox.h @@ -115,7 +115,7 @@ struct addrinfo; int sandbox_getaddrinfo(const char *name, const char *servname, const struct addrinfo *hints, struct addrinfo **res); -#define sandbox_freeaddrinfo(addrinfo) ((void)0) +void sandbox_freeaddrinfo(struct addrinfo *addrinfo); void sandbox_free_getaddrinfo_cache(void); #else #define sandbox_getaddrinfo(name, servname, hints, res) \ From 6ed95baa0c6dde9e07fd6e9c8d1fea950f2e1840 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Dec 2014 08:45:01 -0500 Subject: [PATCH 090/120] Pick a date, write a blurb. --- ChangeLog | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b125d9d853..1b4f78bc61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ -Changes in version 0.2.6.2-alpha - 2014-12-?? +Changes in version 0.2.6.2-alpha - 2014-12-31 Tor 0.2.6.2-alpha is the second alpha release in the 0.2.6.x series. + It introduces a major new backend for deciding when to send cells on + channels, which should lead down the road to big performance + increases. It contains security and statistics features for better + work on hidden services, and numerous bugfixes. + + This release contains many new unit tests, along with major + performance improvements for running testing networks using Chutney. + Thanks to a series of patches contributed by "teor", testing networks + should now bootstrap in seconds, rather than minutes. o Major features (relay, infrastructure): - Completely revision of the code that relays use to decide which From a4193252e944022cbb614f9bae44f7c87dbfd64a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Dec 2014 08:58:26 -0500 Subject: [PATCH 091/120] bump the version to 0.2.6.2-alpha --- configure.ac | 2 +- contrib/win32build/tor-mingw.nsi.in | 2 +- src/win32/orconfig.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 666478f920..65b4b3d619 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson dnl Copyright (c) 2007-2014, The Tor Project, Inc. dnl See LICENSE for licensing information -AC_INIT([tor],[0.2.6.1-alpha-dev]) +AC_INIT([tor],[0.2.6.2-alpha]) AC_CONFIG_SRCDIR([src/or/main.c]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE diff --git a/contrib/win32build/tor-mingw.nsi.in b/contrib/win32build/tor-mingw.nsi.in index d675c2cc09..000fcc2f66 100644 --- a/contrib/win32build/tor-mingw.nsi.in +++ b/contrib/win32build/tor-mingw.nsi.in @@ -8,7 +8,7 @@ !include "LogicLib.nsh" !include "FileFunc.nsh" !insertmacro GetParameters -!define VERSION "0.2.6.1-alpha-dev" +!define VERSION "0.2.6.2-alpha" !define INSTALLER "tor-${VERSION}-win32.exe" !define WEBSITE "https://www.torproject.org/" !define LICENSE "LICENSE" diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h index cee81b31eb..f091fd8636 100644 --- a/src/win32/orconfig.h +++ b/src/win32/orconfig.h @@ -232,7 +232,7 @@ #define USING_TWOS_COMPLEMENT /* Version number of package */ -#define VERSION "0.2.6.1-alpha-dev" +#define VERSION "0.2.6.2-alpha" From 8b508393315c89d64d6329e902f7a44eba95f7d1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Dec 2014 10:35:32 -0500 Subject: [PATCH 092/120] Fix a changelog typo --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1b4f78bc61..050c7bfc01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -466,7 +466,7 @@ Changes in version 0.2.6.1-alpha - 2014-10-30 Browser users to write "DirReqStatistics 0" in their torrc files as if they had chosen to change the config. Fixes bug 4244; bugfix on 0.2.3.1-alpha. - - When GeoIPExcludeUnkonwn is enabled, do not incorrectly decide + - When GeoIPExcludeUnknown is enabled, do not incorrectly decide that our options have changed every time we SIGHUP. Fixes bug 9801; bugfix on 0.2.4.10-alpha. Patch from "qwerty1". From ecd5868ae856f64fae6db2685bb2fca82eb7c1ca Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Dec 2014 11:24:47 -0500 Subject: [PATCH 093/120] tweak changelog usage --- ChangeLog | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 050c7bfc01..f1d338eece 100644 --- a/ChangeLog +++ b/ChangeLog @@ -172,7 +172,7 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 our address-range parsing code. Fixes bug 7484; bugfix on 0.0.2pre14. - o Minor bugfixes (testing networks): + o Minor bugfixes (testing networks, fast startup): - Allow Tor to build circuits using a consensus with no exits. If the consensus has no exits (typical of a bootstrapping test network), allow Tor to build circuits once enough descriptors have @@ -187,7 +187,7 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 - Stop assuming that private addresses are local when checking reachability in a TestingTorNetwork. Instead, when testing, assume all OR connections are remote. (This is necessary due to many test - scenarios running all nodes on localhost.) This assists in + scenarios running all relays on localhost.) This assists in bootstrapping a testing Tor network. Fixes bug 13924; bugfix on 0.1.0.1-rc. Patch by "teor". - Avoid building exit circuits from a consensus with no exits. Now @@ -216,7 +216,7 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 Patch by "teor". - Avoid excluding guards from path building in minimal test networks, when we're in a test network, and excluding guards would - exclude all nodes. This typically occurs in incredibly small tor + exclude all relays. This typically occurs in incredibly small tor networks, and those using TestingAuthVoteGuard * This fix only applies to minimal, testing tor networks, so it's no less secure. Fixes part of bug 13718; bugfix on 0.1.1.11-alpha. Patch @@ -253,9 +253,9 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 Closes ticket 13713; patch from "tom". - Fix typo in PredictedPortsRelevanceTime option description in manpage. Resolves issue 13707. - - Stop suggesting that users specify nodes by nickname: it isn't a - good idea. Also, properly cross-reference how to specify nodes in - all parts of the manual for options that take a list of nodes. + - Stop suggesting that users specify relays by nickname: it isn't a + good idea. Also, properly cross-reference how to specify relays in + all parts of the manual for options that take a list of relays. Closes ticket 13381. - Clarify HiddenServiceDir option description in manpage to make it clear that relative paths are taken with respect to the current @@ -263,10 +263,10 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 is not guaranteed to remain indefinitely. Fixes issue 13913. o Testing: - - New tests for many parts of channel, relay, and circuit mux + - New tests for many parts of channel, relay, and circuitmux functionality. Code by Andrea; part of 9262. - New tests for parse_transport_line(). Part of ticket 6456. - - In the unit tests, use 'chgrp' to change the group of the unit + - In the unit tests, use chgrp() to change the group of the unit test temporary directory to the current user, so that the sticky bit doesn't interfere with tests that check directory groups. Closes 13678. From 6cb1daf062df525224ee7e3f7cd63ee858aacf9f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Dec 2014 13:09:09 -0500 Subject: [PATCH 094/120] edit the changelog one last time --- ChangeLog | 105 +++++++++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1d338eece..70e42de334 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,9 +11,9 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 should now bootstrap in seconds, rather than minutes. o Major features (relay, infrastructure): - - Completely revision of the code that relays use to decide which - cell to send next. Formerly, we selected the best circuit to write - on each channel, but we didn't select among channels in any + - Complete revision of the code that relays use to decide which cell + to send next. Formerly, we selected the best circuit to write on + each channel, but we didn't select among channels in any sophisticated way. Now, we choose the best circuits globally from among those whose channels are ready to deliver traffic. @@ -21,18 +21,17 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 high/low watermark mechanism and a global scheduler loop for transmission prioritization across all channels as well as among circuits on one channel. This schedule is currently tuned to - (tolerantly) avoid making changes in the current network - performance, but it should form the basis for major circuit - performance increases. Code by Andrea; tuning by Rob Jansen; - implements ticket 9262. + (tolerantly) avoid making changes in network performance, but it + should form the basis for major circuit performance increases in + the future. Code by Andrea; tuning by Rob Jansen; implements + ticket 9262. o Major features (hidden services): - - Make HS port scanning more difficult by sending back REASON_DONE - if the exit policy didn't match. Furthermore, immediately close - the circuit to slow down port scanning attempts. Closes - ticket 13667. + - Make HS port scanning more difficult by immediately closing the + circuit when a user attempts to connect to a nonexistent port. + Closes ticket 13667. - Add a HiddenServiceStatistics option that allows Tor relays to - gather and publish statistics the overall size and volume of + gather and publish statistics about the overall size and volume of hidden service usage. Specifically, when this option is turned on, an HSDir will publish an approximate number of hidden services that have published descriptors to it the past 24 hours. Also, if @@ -44,7 +43,7 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 feature is currently disabled by default. Implements feature 13192. o Major bugfixes (client, automap): - - Repair automapping with IPv6 addresses; this automapping should + - Repair automapping with IPv6 addresses. This automapping should have worked previously, but one piece of debugging code that we inserted to detect a regression actually caused the regression to manifest itself again. Fixes bug 13811 and bug 12831; bugfix on @@ -58,6 +57,11 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 point would make the other introduction points get marked as having timed out. Fixes bug 13698; bugfix on 0.0.6rc2. + o Directory authority changes: + - Remove turtles as a directory authority. + - Add longclaw as a new (v3) directory authority. This implements + ticket 13296. This keeps the directory authority count at 9. + o Major removed features: - Tor clients no longer support connecting to hidden services running on Tor 0.2.2.x and earlier; the Support022HiddenServices @@ -70,7 +74,7 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 Resolves ticket 13315. o Minor features (controller): - - Add a "SIGNAL HEARTBEAT" Tor controller command that tells Tor to + - Add a "SIGNAL HEARTBEAT" controller command that tells Tor to write an unscheduled heartbeat message to the log. Implements feature 9503. @@ -83,9 +87,9 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 circuits until we have successfully built a circuit. This makes hidden services come up faster when the network is re-enabled. Patch from "akwizgran". Closes ticket 13447. - - Inform Tor controller about nature of a failure to retrieve hidden - service descriptor by sending reason string with "HS_DESC FAILED" - controller event. Implements feature 13212. + - When we fail to a retrieve hidden service descriptor, send the + controller an "HS_DESC FAILED" controller event. Implements + feature 13212. - New HiddenServiceDirGroupReadable option to cause hidden service directories and hostname files to be created group-readable. Patch from "anon", David Stainton, and "meejah". Closes ticket 11291. @@ -105,16 +109,16 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 o Minor bugfixes (preventative security, C safety): - When reading a hexadecimal, base-32, or base-64 encoded value from - a string, always overwrite the complete output buffer. This - prevents some bugs where we would look at (but fortunately, not - reveal) uninitialized memory on the stack. Fixes bug 14013; bugfix - on all versions of Tor. + a string, always overwrite the whole output buffer. This prevents + some bugs where we would look at (but fortunately, not reveal) + uninitialized memory on the stack. Fixes bug 14013; bugfix on all + versions of Tor. - Clear all memory targetted by tor_addr_{to,from}_sockaddr(), not just the part that's used. This makes it harder for data leak bugs to occur in the event of other programming failures. Resolves ticket 14041. - o Minor bugfixes (client, micordescriptors): + o Minor bugfixes (client, microdescriptors): - Use a full 256 bits of the SHA256 digest of a microdescriptor when computing which microdescriptors to download. This keeps us from erroneous download behavior if two microdescriptor digests ever @@ -159,12 +163,11 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 o Minor bugfixes (logging): - Downgrade warnings about RSA signature failures to info log level. - Emit a warning when extra info document is found incompatible with - a corresponding router descriptor. Fixes bug 9812; bugfix + Emit a warning when an extra info document is found incompatible + with a corresponding router descriptor. Fixes bug 9812; bugfix on 0.0.6rc3. - - Log the circuit ID correctly in - connection_ap_handshake_attach_circuit(). Fixes bug 13701; bugfix - on 0.0.6. + - Make connection_ap_handshake_attach_circuit() log the circuit ID + correctly. Fixes bug 13701; bugfix on 0.0.6. o Minor bugfixes (misc): - Stop allowing invalid address patterns like "*/24" that contain @@ -203,24 +206,20 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 available. If the consensus does not contain Exits, Tor will only build internal circuits. In this case, relevant statuses will contain the word "internal" as indicated in the Tor control- - spec.txt. When bootstrap completes, Tor will be ready to handle an - application requesting an internal circuit to hidden services at - ".onion" addresses. If a future consensus contains Exits, exit + spec.txt. When bootstrap completes, Tor will be ready to build + internal circuits. If a future consensus contains Exits, exit circuits may become available. Fixes part of bug 13718; bugfix on 0.2.4.10-alpha. Patch by "teor". - Decrease minimum consensus interval to 10 seconds when TestingTorNetwork is set, or 5 seconds for the first consensus. - Fix assumptions throughout the code that assume larger interval - values. This assists in quickly bootstrapping a testing Tor - network. Fixes bugs 13718 and 13823; bugfix on 0.2.0.3-alpha. - Patch by "teor". - - Avoid excluding guards from path building in minimal test - networks, when we're in a test network, and excluding guards would - exclude all relays. This typically occurs in incredibly small tor - networks, and those using TestingAuthVoteGuard * This fix only - applies to minimal, testing tor networks, so it's no less secure. - Fixes part of bug 13718; bugfix on 0.1.1.11-alpha. Patch + Fix assumptions throughout the code that assume larger intervals. + Fixes bugs 13718 and 13823; bugfix on 0.2.0.3-alpha. Patch by "teor". + - Avoid excluding guards from path building in minimal test + networks, when we're in a test network and excluding guards would + exclude all relays. This typically occurs in incredibly small tor + networks, and those using "TestingAuthVoteGuard *". Fixes part of + bug 13718; bugfix on 0.1.1.11-alpha. Patch by "teor". o Code simplification and refactoring: - Stop using can_complete_circuits as a global variable; access it @@ -230,11 +229,10 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 Closes ticket 13172. - Combine the functions used to parse ClientTransportPlugin and ServerTransportPlugin into a single function. Closes ticket 6456. - - Add inline functions and convenience macros for quick lookup of - state component of channel_t structure. Refactor various parts of - codebase to use convenience macros instead of checking state - member of channel_t directly. Fixes issue 7356. - - Document all members of was_router_added_t enum and rename + - Add inline functions and convenience macros for inspecting channel + state. Refactor the code to use convenience macros instead of + checking channel state directly. Fixes issue 7356. + - Document all members of was_router_added_t and rename ROUTER_WAS_NOT_NEW to ROUTER_IS_ALREADY_KNOWN to make it less confusable with ROUTER_WAS_TOO_OLD. Fixes issue 13644. - In connection_exit_begin_conn(), use END_CIRC_REASON_TORPROTOCOL @@ -243,11 +241,6 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 implementation, so that we can add a new digest256map type trivially. - o Directory authority changes: - - Remove turtles as a directory authority. - - Add longclaw as a new (v3) directory authority. This implements - ticket 13296. This keeps the directory authority count at 9. - o Documentation: - Document the bridge-authority-only 'networkstatus-bridges' file. Closes ticket 13713; patch from "tom". @@ -255,12 +248,12 @@ Changes in version 0.2.6.2-alpha - 2014-12-31 manpage. Resolves issue 13707. - Stop suggesting that users specify relays by nickname: it isn't a good idea. Also, properly cross-reference how to specify relays in - all parts of the manual for options that take a list of relays. - Closes ticket 13381. - - Clarify HiddenServiceDir option description in manpage to make it - clear that relative paths are taken with respect to the current - working directory of Tor instance. Also clarify that this behavior - is not guaranteed to remain indefinitely. Fixes issue 13913. + all parts of manual documenting options that take a list of + relays. Closes ticket 13381. + - Clarify the HiddenServiceDir option description in manpage to make + it clear that relative paths are taken with respect to the current + working directory. Also clarify that this behavior is not + guaranteed to remain indefinitely. Fixes issue 13913. o Testing: - New tests for many parts of channel, relay, and circuitmux From 563bb1ad81db3f0f5b7066b76531db1a43dfe857 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 31 Dec 2014 13:24:12 -0500 Subject: [PATCH 095/120] Bump version to 0.2.6.2-alpha-dev --- configure.ac | 2 +- contrib/win32build/tor-mingw.nsi.in | 2 +- src/win32/orconfig.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 65b4b3d619..c223dc6e7f 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson dnl Copyright (c) 2007-2014, The Tor Project, Inc. dnl See LICENSE for licensing information -AC_INIT([tor],[0.2.6.2-alpha]) +AC_INIT([tor],[0.2.6.2-alpha-dev]) AC_CONFIG_SRCDIR([src/or/main.c]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE diff --git a/contrib/win32build/tor-mingw.nsi.in b/contrib/win32build/tor-mingw.nsi.in index 000fcc2f66..df1a46536c 100644 --- a/contrib/win32build/tor-mingw.nsi.in +++ b/contrib/win32build/tor-mingw.nsi.in @@ -8,7 +8,7 @@ !include "LogicLib.nsh" !include "FileFunc.nsh" !insertmacro GetParameters -!define VERSION "0.2.6.2-alpha" +!define VERSION "0.2.6.2-alpha-dev" !define INSTALLER "tor-${VERSION}-win32.exe" !define WEBSITE "https://www.torproject.org/" !define LICENSE "LICENSE" diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h index f091fd8636..d1a5b4b3e2 100644 --- a/src/win32/orconfig.h +++ b/src/win32/orconfig.h @@ -232,7 +232,7 @@ #define USING_TWOS_COMPLEMENT /* Version number of package */ -#define VERSION "0.2.6.2-alpha" +#define VERSION "0.2.6.2-alpha-dev" From f54e54b0b454b42ed22f2f2feec0b952d9bcb199 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 2 Jan 2015 14:27:39 -0500 Subject: [PATCH 096/120] Bump copyright dates to 2015, in case someday this matters. --- LICENSE | 2 +- Makefile.am | 2 +- acinclude.m4 | 2 +- configure.ac | 2 +- scripts/codegen/gen_server_ciphers.py | 2 +- scripts/codegen/get_mozilla_ciphers.py | 2 +- scripts/codegen/makedesc.py | 2 +- scripts/maint/format_changelog.py | 2 +- scripts/maint/redox.py | 2 +- scripts/maint/sortChanges.py | 2 +- src/common/address.c | 2 +- src/common/address.h | 2 +- src/common/aes.c | 2 +- src/common/aes.h | 2 +- src/common/backtrace.c | 2 +- src/common/backtrace.h | 2 +- src/common/compat.c | 2 +- src/common/compat.h | 2 +- src/common/compat_libevent.c | 2 +- src/common/compat_libevent.h | 2 +- src/common/container.c | 2 +- src/common/container.h | 2 +- src/common/crypto.c | 2 +- src/common/crypto.h | 2 +- src/common/crypto_curve25519.c | 2 +- src/common/crypto_curve25519.h | 2 +- src/common/crypto_ed25519.c | 2 +- src/common/crypto_ed25519.h | 2 +- src/common/crypto_format.c | 2 +- src/common/crypto_s2k.c | 2 +- src/common/crypto_s2k.h | 2 +- src/common/di_ops.c | 2 +- src/common/di_ops.h | 2 +- src/common/log.c | 2 +- src/common/memarea.c | 2 +- src/common/memarea.h | 2 +- src/common/mempool.c | 2 +- src/common/mempool.h | 2 +- src/common/procmon.c | 2 +- src/common/procmon.h | 2 +- src/common/sandbox.c | 2 +- src/common/sandbox.h | 2 +- src/common/testsupport.h | 2 +- src/common/torgzip.c | 2 +- src/common/torgzip.h | 2 +- src/common/torint.h | 2 +- src/common/torlog.h | 2 +- src/common/tortls.c | 2 +- src/common/tortls.h | 2 +- src/common/util.c | 2 +- src/common/util.h | 2 +- src/common/util_process.c | 2 +- src/common/util_process.h | 2 +- src/ext/ht.h | 2 +- src/ext/trunnel/trunnel-impl.h | 2 +- src/ext/trunnel/trunnel.c | 2 +- src/ext/trunnel/trunnel.h | 2 +- src/or/addressmap.c | 2 +- src/or/addressmap.h | 2 +- src/or/buffers.c | 2 +- src/or/buffers.h | 2 +- src/or/channel.c | 2 +- src/or/channel.h | 2 +- src/or/channeltls.c | 2 +- src/or/channeltls.h | 2 +- src/or/circpathbias.c | 2 +- src/or/circpathbias.h | 2 +- src/or/circuitbuild.c | 2 +- src/or/circuitbuild.h | 2 +- src/or/circuitlist.c | 2 +- src/or/circuitlist.h | 2 +- src/or/circuitmux.c | 2 +- src/or/circuitmux.h | 2 +- src/or/circuitmux_ewma.c | 2 +- src/or/circuitmux_ewma.h | 2 +- src/or/circuitstats.c | 2 +- src/or/circuitstats.h | 2 +- src/or/circuituse.c | 2 +- src/or/circuituse.h | 2 +- src/or/command.c | 2 +- src/or/command.h | 2 +- src/or/config.c | 4 ++-- src/or/config.h | 2 +- src/or/confparse.c | 2 +- src/or/confparse.h | 2 +- src/or/connection.c | 2 +- src/or/connection.h | 2 +- src/or/connection_edge.c | 2 +- src/or/connection_edge.h | 2 +- src/or/connection_or.c | 2 +- src/or/connection_or.h | 2 +- src/or/control.c | 2 +- src/or/control.h | 2 +- src/or/cpuworker.c | 2 +- src/or/cpuworker.h | 2 +- src/or/directory.c | 2 +- src/or/directory.h | 2 +- src/or/dirserv.c | 2 +- src/or/dirserv.h | 2 +- src/or/dirvote.c | 2 +- src/or/dirvote.h | 2 +- src/or/dns.c | 2 +- src/or/dns.h | 2 +- src/or/dnsserv.c | 2 +- src/or/dnsserv.h | 2 +- src/or/entrynodes.c | 2 +- src/or/entrynodes.h | 2 +- src/or/eventdns_tor.h | 2 +- src/or/ext_orport.c | 2 +- src/or/ext_orport.h | 2 +- src/or/fp_pair.c | 2 +- src/or/fp_pair.h | 2 +- src/or/geoip.c | 2 +- src/or/geoip.h | 2 +- src/or/hibernate.c | 2 +- src/or/hibernate.h | 2 +- src/or/main.c | 2 +- src/or/main.h | 2 +- src/or/microdesc.c | 2 +- src/or/microdesc.h | 2 +- src/or/networkstatus.c | 2 +- src/or/networkstatus.h | 2 +- src/or/nodelist.c | 2 +- src/or/nodelist.h | 2 +- src/or/ntmain.c | 2 +- src/or/ntmain.h | 2 +- src/or/onion.c | 2 +- src/or/onion.h | 2 +- src/or/onion_fast.c | 2 +- src/or/onion_fast.h | 2 +- src/or/onion_ntor.c | 2 +- src/or/onion_ntor.h | 2 +- src/or/onion_tap.c | 2 +- src/or/onion_tap.h | 2 +- src/or/or.h | 2 +- src/or/policies.c | 2 +- src/or/policies.h | 2 +- src/or/reasons.c | 2 +- src/or/reasons.h | 2 +- src/or/relay.c | 2 +- src/or/relay.h | 2 +- src/or/rendclient.c | 2 +- src/or/rendclient.h | 2 +- src/or/rendcommon.c | 2 +- src/or/rendcommon.h | 2 +- src/or/rendmid.c | 2 +- src/or/rendmid.h | 2 +- src/or/rendservice.c | 2 +- src/or/rendservice.h | 2 +- src/or/rephist.c | 2 +- src/or/rephist.h | 2 +- src/or/replaycache.c | 2 +- src/or/replaycache.h | 2 +- src/or/router.c | 2 +- src/or/router.h | 2 +- src/or/routerlist.c | 2 +- src/or/routerlist.h | 2 +- src/or/routerparse.c | 2 +- src/or/routerparse.h | 2 +- src/or/routerset.c | 2 +- src/or/routerset.h | 2 +- src/or/scheduler.c | 2 +- src/or/scheduler.h | 2 +- src/or/statefile.c | 2 +- src/or/statefile.h | 2 +- src/or/status.c | 2 +- src/or/status.h | 2 +- src/or/tor_main.c | 2 +- src/or/transports.c | 2 +- src/or/transports.h | 2 +- src/test/bench.c | 2 +- src/test/bt_test.py | 2 +- src/test/ed25519_exts_ref.py | 2 +- src/test/fakechans.h | 2 +- src/test/ntor_ref.py | 2 +- src/test/test-child.c | 2 +- src/test/test.c | 2 +- src/test/test.h | 2 +- src/test/test_addr.c | 2 +- src/test/test_bt_cl.c | 2 +- src/test/test_buffers.c | 2 +- src/test/test_cell_formats.c | 2 +- src/test/test_cell_queue.c | 2 +- src/test/test_channel.c | 2 +- src/test/test_channeltls.c | 2 +- src/test/test_checkdir.c | 2 +- src/test/test_circuitlist.c | 2 +- src/test/test_circuitmux.c | 2 +- src/test/test_config.c | 2 +- src/test/test_containers.c | 2 +- src/test/test_controller_events.c | 2 +- src/test/test_crypto.c | 2 +- src/test/test_data.c | 2 +- src/test/test_dir.c | 2 +- src/test/test_entrynodes.c | 2 +- src/test/test_extorport.c | 2 +- src/test/test_hs.c | 2 +- src/test/test_introduce.c | 2 +- src/test/test_logging.c | 2 +- src/test/test_microdesc.c | 2 +- src/test/test_nodelist.c | 2 +- src/test/test_ntor_cl.c | 2 +- src/test/test_oom.c | 2 +- src/test/test_options.c | 2 +- src/test/test_policy.c | 2 +- src/test/test_pt.c | 2 +- src/test/test_relay.c | 2 +- src/test/test_relaycell.c | 2 +- src/test/test_replay.c | 2 +- src/test/test_routerkeys.c | 2 +- src/test/test_scheduler.c | 2 +- src/test/test_socks.c | 2 +- src/test/test_util.c | 2 +- src/tools/tor-checkkey.c | 2 +- src/tools/tor-fw-helper/tor-fw-helper-natpmp.c | 2 +- src/tools/tor-fw-helper/tor-fw-helper-natpmp.h | 2 +- src/tools/tor-fw-helper/tor-fw-helper-upnp.c | 2 +- src/tools/tor-fw-helper/tor-fw-helper-upnp.h | 2 +- src/tools/tor-fw-helper/tor-fw-helper.c | 2 +- src/tools/tor-fw-helper/tor-fw-helper.h | 2 +- src/tools/tor-gencert.c | 2 +- src/tools/tor-resolve.c | 2 +- 222 files changed, 223 insertions(+), 223 deletions(-) diff --git a/LICENSE b/LICENSE index d0fb43a0c3..48602c13c6 100644 --- a/LICENSE +++ b/LICENSE @@ -13,7 +13,7 @@ Tor is distributed under this license: Copyright (c) 2001-2004, Roger Dingledine Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson -Copyright (c) 2007-2014, The Tor Project, Inc. +Copyright (c) 2007-2015, The Tor Project, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/Makefile.am b/Makefile.am index 7125c7701c..3de7f7a827 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ # Copyright (c) 2001-2004, Roger Dingledine # Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson -# Copyright (c) 2007-2011, The Tor Project, Inc. +# Copyright (c) 2007-2015, The Tor Project, Inc. # See LICENSE for licensing information # "foreign" means we don't follow GNU package layout standards diff --git a/acinclude.m4 b/acinclude.m4 index 06f4b19e54..8782a3eeaa 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,7 +2,7 @@ dnl Helper macros for Tor configure.ac dnl Copyright (c) 2001-2004, Roger Dingledine dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson dnl Copyright (c) 2007-2008, Roger Dingledine, Nick Mathewson -dnl Copyright (c) 2007-2014, The Tor Project, Inc. +dnl Copyright (c) 2007-2015, The Tor Project, Inc. dnl See LICENSE for licensing information AC_DEFUN([TOR_EXTEND_CODEPATH], diff --git a/configure.ac b/configure.ac index c223dc6e7f..ea8d6b601a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl Copyright (c) 2001-2004, Roger Dingledine dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson -dnl Copyright (c) 2007-2014, The Tor Project, Inc. +dnl Copyright (c) 2007-2015, The Tor Project, Inc. dnl See LICENSE for licensing information AC_INIT([tor],[0.2.6.2-alpha-dev]) diff --git a/scripts/codegen/gen_server_ciphers.py b/scripts/codegen/gen_server_ciphers.py index 97ed9d0469..0dca8a6734 100755 --- a/scripts/codegen/gen_server_ciphers.py +++ b/scripts/codegen/gen_server_ciphers.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2014, The Tor Project, Inc +# Copyright 2014-2015, The Tor Project, Inc # See LICENSE for licensing information # This script parses openssl headers to find ciphersuite names, determines diff --git a/scripts/codegen/get_mozilla_ciphers.py b/scripts/codegen/get_mozilla_ciphers.py index 0636eb3658..e0a662bea0 100644 --- a/scripts/codegen/get_mozilla_ciphers.py +++ b/scripts/codegen/get_mozilla_ciphers.py @@ -1,6 +1,6 @@ #!/usr/bin/python # coding=utf-8 -# Copyright 2011, The Tor Project, Inc +# Copyright 2011-2015, The Tor Project, Inc # original version by Arturo Filastò # See LICENSE for licensing information diff --git a/scripts/codegen/makedesc.py b/scripts/codegen/makedesc.py index e0b2aed3f4..833951945b 100644 --- a/scripts/codegen/makedesc.py +++ b/scripts/codegen/makedesc.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2014, The Tor Project, Inc. +# Copyright 2014-2015, The Tor Project, Inc. # See LICENSE for license information # This is a kludgey python script that uses ctypes and openssl to sign diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py index 3fe5161433..d1b4a3dff3 100755 --- a/scripts/maint/format_changelog.py +++ b/scripts/maint/format_changelog.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2014, The Tor Project, Inc. +# Copyright (c) 2014-2015, The Tor Project, Inc. # See LICENSE for licensing information # # This script reformats a section of the changelog to wrap everything to diff --git a/scripts/maint/redox.py b/scripts/maint/redox.py index fa816a7267..5933d49773 100755 --- a/scripts/maint/redox.py +++ b/scripts/maint/redox.py @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Copyright (c) 2008-2013, The Tor Project, Inc. +# Copyright (c) 2008-2015, The Tor Project, Inc. # See LICENSE for licensing information. # # Hi! diff --git a/scripts/maint/sortChanges.py b/scripts/maint/sortChanges.py index e8153e2848..ad28c79d9d 100755 --- a/scripts/maint/sortChanges.py +++ b/scripts/maint/sortChanges.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2014, The Tor Project, Inc. +# Copyright (c) 2014-2015, The Tor Project, Inc. # See LICENSE for licensing information """This script sorts a bunch of changes files listed on its command diff --git a/src/common/address.c b/src/common/address.c index 8a0e96ddde..a80926049a 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/address.h b/src/common/address.h index 042daa782a..d70bb9c508 100644 --- a/src/common/address.h +++ b/src/common/address.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/aes.c b/src/common/aes.c index 877dce625c..7651f1d93a 100644 --- a/src/common/aes.c +++ b/src/common/aes.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/aes.h b/src/common/aes.h index f014e3a424..df2f3aa65d 100644 --- a/src/common/aes.h +++ b/src/common/aes.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Implements a minimal interface to counter-mode AES. */ diff --git a/src/common/backtrace.c b/src/common/backtrace.c index e6fb8938ac..1033c7e5de 100644 --- a/src/common/backtrace.c +++ b/src/common/backtrace.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define __USE_GNU diff --git a/src/common/backtrace.h b/src/common/backtrace.h index 4938745b3d..a9151d7956 100644 --- a/src/common/backtrace.h +++ b/src/common/backtrace.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_BACKTRACE_H diff --git a/src/common/compat.c b/src/common/compat.c index e466efdcc5..11e2545709 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/compat.h b/src/common/compat.h index 454a516968..04e8cb267c 100644 --- a/src/common/compat.h +++ b/src/common/compat.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_COMPAT_H diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index 85ed58456e..6a8281d35f 100644 --- a/src/common/compat_libevent.c +++ b/src/common/compat_libevent.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2014, The Tor Project, Inc. */ +/* Copyright (c) 2009-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h index 57d0c4da1b..9296851132 100644 --- a/src/common/compat_libevent.h +++ b/src/common/compat_libevent.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2014, The Tor Project, Inc. */ +/* Copyright (c) 2009-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_COMPAT_LIBEVENT_H diff --git a/src/common/container.c b/src/common/container.c index ab4e22de52..37e28004ae 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/container.h b/src/common/container.h index d3d20af5b2..377cdf5dba 100644 --- a/src/common/container.h +++ b/src/common/container.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_CONTAINER_H diff --git a/src/common/crypto.c b/src/common/crypto.c index f4946aa8f9..370c04a315 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/crypto.h b/src/common/crypto.h index a8f0fbc975..d305bc17a0 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/crypto_curve25519.c b/src/common/crypto_curve25519.c index c04b715abd..5bb14b0d95 100644 --- a/src/common/crypto_curve25519.c +++ b/src/common/crypto_curve25519.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Wrapper code for a curve25519 implementation. */ diff --git a/src/common/crypto_curve25519.h b/src/common/crypto_curve25519.h index e8f885227e..48e8a6d962 100644 --- a/src/common/crypto_curve25519.h +++ b/src/common/crypto_curve25519.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_CRYPTO_CURVE25519_H diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c index 340fb4956f..f2e6945ac8 100644 --- a/src/common/crypto_ed25519.c +++ b/src/common/crypto_ed25519.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Wrapper code for an ed25519 implementation. */ diff --git a/src/common/crypto_ed25519.h b/src/common/crypto_ed25519.h index 8c3663e0dd..7efa74bff5 100644 --- a/src/common/crypto_ed25519.h +++ b/src/common/crypto_ed25519.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_CRYPTO_ED25519_H diff --git a/src/common/crypto_format.c b/src/common/crypto_format.c index 63dd391914..00e0e9ea85 100644 --- a/src/common/crypto_format.c +++ b/src/common/crypto_format.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Formatting and parsing code for crypto-related data structures. */ diff --git a/src/common/crypto_s2k.c b/src/common/crypto_s2k.c index 6d9ee497ab..99f3b2ebbc 100644 --- a/src/common/crypto_s2k.c +++ b/src/common/crypto_s2k.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CRYPTO_S2K_PRIVATE diff --git a/src/common/crypto_s2k.h b/src/common/crypto_s2k.h index a33dc96e46..66df24c3c4 100644 --- a/src/common/crypto_s2k.h +++ b/src/common/crypto_s2k.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_CRYPTO_S2K_H_INCLUDED diff --git a/src/common/di_ops.c b/src/common/di_ops.c index 0dcd6924e7..c9d1350880 100644 --- a/src/common/di_ops.c +++ b/src/common/di_ops.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Tor Project, Inc. */ +/* Copyright (c) 2011-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/di_ops.h b/src/common/di_ops.h index 935f93fc1a..bbb1caa00c 100644 --- a/src/common/di_ops.h +++ b/src/common/di_ops.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/log.c b/src/common/log.c index 0a21ffbd44..2e7c711413 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/memarea.c b/src/common/memarea.c index 40c09bd0e6..6841ba54e7 100644 --- a/src/common/memarea.c +++ b/src/common/memarea.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2014, The Tor Project, Inc. */ +/* Copyright (c) 2008-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** \file memarea.c diff --git a/src/common/memarea.h b/src/common/memarea.h index fb261d11fa..d14f3a2bae 100644 --- a/src/common/memarea.h +++ b/src/common/memarea.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2014, The Tor Project, Inc. */ +/* Copyright (c) 2008-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Tor dependencies */ diff --git a/src/common/mempool.c b/src/common/mempool.c index 695a110d3d..55a34070d7 100644 --- a/src/common/mempool.c +++ b/src/common/mempool.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #if 1 /* Tor dependencies */ diff --git a/src/common/mempool.h b/src/common/mempool.h index 1e7a3121de..5cbeb8f482 100644 --- a/src/common/mempool.h +++ b/src/common/mempool.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/procmon.c b/src/common/procmon.c index ee27e97f79..2d0f021724 100644 --- a/src/common/procmon.c +++ b/src/common/procmon.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Tor Project, Inc. */ +/* Copyright (c) 2011-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/procmon.h b/src/common/procmon.h index 6c487648bb..ccee6bfac6 100644 --- a/src/common/procmon.h +++ b/src/common/procmon.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Tor Project, Inc. */ +/* Copyright (c) 2011-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/sandbox.c b/src/common/sandbox.c index a06d38608f..450b04a6f7 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/sandbox.h b/src/common/sandbox.h index f1c99ac02d..36d25d6516 100644 --- a/src/common/sandbox.h +++ b/src/common/sandbox.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/testsupport.h b/src/common/testsupport.h index 92de5a2ec9..db7700aeb0 100644 --- a/src/common/testsupport.h +++ b/src/common/testsupport.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_TESTSUPPORT_H diff --git a/src/common/torgzip.c b/src/common/torgzip.c index 4480e4b747..7c3adeb8f0 100644 --- a/src/common/torgzip.c +++ b/src/common/torgzip.c @@ -1,6 +1,6 @@ /* Copyright (c) 2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/torgzip.h b/src/common/torgzip.h index 1378d55b76..89ca6a6613 100644 --- a/src/common/torgzip.h +++ b/src/common/torgzip.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/torint.h b/src/common/torint.h index 487972372c..6171700898 100644 --- a/src/common/torint.h +++ b/src/common/torint.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/torlog.h b/src/common/torlog.h index 483a97935f..8923a9e213 100644 --- a/src/common/torlog.h +++ b/src/common/torlog.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001, Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/tortls.c b/src/common/tortls.c index cca2d420b6..dd33b330dc 100644 --- a/src/common/tortls.c +++ b/src/common/tortls.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/tortls.h b/src/common/tortls.h index 235d801202..f8c6d5913b 100644 --- a/src/common/tortls.h +++ b/src/common/tortls.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_TORTLS_H diff --git a/src/common/util.c b/src/common/util.c index 6226dd74e9..1de5edc52c 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/util.h b/src/common/util.h index b8fd20fd7d..a1da53890e 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/util_process.c b/src/common/util_process.c index 1924c19509..849a5c0b63 100644 --- a/src/common/util_process.c +++ b/src/common/util_process.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/common/util_process.h b/src/common/util_process.h index e7c55ed33d..c55cd8c5fa 100644 --- a/src/common/util_process.h +++ b/src/common/util_process.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Tor Project, Inc. */ +/* Copyright (c) 2011-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/ext/ht.h b/src/ext/ht.h index 09f5dcccd5..e7a76196f5 100644 --- a/src/ext/ht.h +++ b/src/ext/ht.h @@ -1,6 +1,6 @@ /* Copyright (c) 2002, Christopher Clark. * Copyright (c) 2005-2006, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See license at end. */ /* Based on ideas by Christopher Clark and interfaces from Niels Provos. */ diff --git a/src/ext/trunnel/trunnel-impl.h b/src/ext/trunnel/trunnel-impl.h index c88ee3988e..8714fded9f 100644 --- a/src/ext/trunnel/trunnel-impl.h +++ b/src/ext/trunnel/trunnel-impl.h @@ -5,7 +5,7 @@ /* trunnel-impl.h -- Implementation helpers for trunnel, included by * generated trunnel files * - * Copyright 2014, The Tor Project, Inc. + * Copyright 2014-2015, The Tor Project, Inc. * See license at the end of this file for copying information. */ diff --git a/src/ext/trunnel/trunnel.c b/src/ext/trunnel/trunnel.c index a18d67584e..735323798f 100644 --- a/src/ext/trunnel/trunnel.c +++ b/src/ext/trunnel/trunnel.c @@ -4,7 +4,7 @@ */ /* trunnel.c -- Helper functions to implement trunnel. * - * Copyright 2014, The Tor Project, Inc. + * Copyright 2014-2015, The Tor Project, Inc. * See license at the end of this file for copying information. * * See trunnel-impl.h for documentation of these functions. diff --git a/src/ext/trunnel/trunnel.h b/src/ext/trunnel/trunnel.h index f51cade03f..22c1ed80c9 100644 --- a/src/ext/trunnel/trunnel.h +++ b/src/ext/trunnel/trunnel.h @@ -5,7 +5,7 @@ /* trunnel.h -- Public declarations for trunnel, to be included * in trunnel header files. - * Copyright 2014, The Tor Project, Inc. + * Copyright 2014-2015, The Tor Project, Inc. * See license at the end of this file for copying information. */ diff --git a/src/or/addressmap.c b/src/or/addressmap.c index e28b5e3341..08f7075407 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ADDRESSMAP_PRIVATE diff --git a/src/or/addressmap.h b/src/or/addressmap.h index 598f7b0e3e..bb737e47f4 100644 --- a/src/or/addressmap.h +++ b/src/or/addressmap.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_ADDRESSMAP_H diff --git a/src/or/buffers.c b/src/or/buffers.c index f0d7e60794..ca0e815e33 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/buffers.h b/src/or/buffers.h index 4687fbefd7..6dd3d1762b 100644 --- a/src/or/buffers.h +++ b/src/or/buffers.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/channel.c b/src/or/channel.c index cc609b5b72..062ae3370e 100644 --- a/src/or/channel.c +++ b/src/or/channel.c @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/channel.h b/src/or/channel.h index c4b909c5ad..ecc2a092e4 100644 --- a/src/or/channel.h +++ b/src/or/channel.h @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/channeltls.c b/src/or/channeltls.c index b02acdb159..e194c1c4df 100644 --- a/src/or/channeltls.c +++ b/src/or/channeltls.c @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/channeltls.h b/src/or/channeltls.h index 133ad43bb4..507429420b 100644 --- a/src/or/channeltls.h +++ b/src/or/channeltls.h @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circpathbias.c b/src/or/circpathbias.c index e5e3326ca1..a0115cc6ec 100644 --- a/src/or/circpathbias.c +++ b/src/or/circpathbias.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/circpathbias.h b/src/or/circpathbias.h index bb8846353c..9e973850d5 100644 --- a/src/or/circpathbias.h +++ b/src/or/circpathbias.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 7061ab0e0b..0ad026b2d3 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h index e70cdc5825..442afe8451 100644 --- a/src/or/circuitbuild.h +++ b/src/or/circuitbuild.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index affb015177..36ba3bffb7 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -1,7 +1,7 @@ /* Copyright 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index ea1076d53f..4e600da57d 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c index 443dad0a54..a77bffac90 100644 --- a/src/or/circuitmux.c +++ b/src/or/circuitmux.c @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitmux.h b/src/or/circuitmux.h index 53092cd66c..837e3961bf 100644 --- a/src/or/circuitmux.h +++ b/src/or/circuitmux.h @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitmux_ewma.c b/src/or/circuitmux_ewma.c index 0d7d6ef197..1c0318de06 100644 --- a/src/or/circuitmux_ewma.c +++ b/src/or/circuitmux_ewma.c @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitmux_ewma.h b/src/or/circuitmux_ewma.h index ce78a8ef0d..3feef834dd 100644 --- a/src/or/circuitmux_ewma.h +++ b/src/or/circuitmux_ewma.h @@ -1,4 +1,4 @@ -/* * Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* * Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c index a136278e58..18cb1c8484 100644 --- a/src/or/circuitstats.c +++ b/src/or/circuitstats.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITSTATS_PRIVATE diff --git a/src/or/circuitstats.h b/src/or/circuitstats.h index 7cef4f7fb1..fe05a24e97 100644 --- a/src/or/circuitstats.h +++ b/src/or/circuitstats.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 3322d31e2f..612b536bad 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/circuituse.h b/src/or/circuituse.h index ce044d30dc..a59f478ac8 100644 --- a/src/or/circuituse.h +++ b/src/or/circuituse.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/command.c b/src/or/command.c index 8e214bf0a4..6dde2a9b7e 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/command.h b/src/or/command.h index 509b4a0e9f..bea96261bb 100644 --- a/src/or/command.h +++ b/src/or/command.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/config.c b/src/or/config.c index 9f5bd3b957..d70d6acb59 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** @@ -2047,7 +2047,7 @@ print_usage(void) printf( "Copyright (c) 2001-2004, Roger Dingledine\n" "Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson\n" -"Copyright (c) 2007-2014, The Tor Project, Inc.\n\n" +"Copyright (c) 2007-2015, The Tor Project, Inc.\n\n" "tor -f [args]\n" "See man page for options, or https://www.torproject.org/ for " "documentation.\n"); diff --git a/src/or/config.h b/src/or/config.h index 133b472eb2..6bd3eb5734 100644 --- a/src/or/config.h +++ b/src/or/config.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/confparse.c b/src/or/confparse.c index 8ee985c92a..ac21df25cb 100644 --- a/src/or/confparse.c +++ b/src/or/confparse.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/confparse.h b/src/or/confparse.h index 3712924ac7..83c0f75b52 100644 --- a/src/or/confparse.h +++ b/src/or/confparse.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_CONFPARSE_H diff --git a/src/or/connection.c b/src/or/connection.c index d6edc4ab91..c77d29b536 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/connection.h b/src/or/connection.h index 7cdfd3e253..ce6ed284c1 100644 --- a/src/or/connection.h +++ b/src/or/connection.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index a691239b6e..d8f397bd90 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h index 5071086a41..e6adad91d8 100644 --- a/src/or/connection_edge.h +++ b/src/or/connection_edge.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 2232a1b565..85462d899d 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/connection_or.h b/src/or/connection_or.h index b82896e26d..fc261c6bac 100644 --- a/src/or/connection_or.h +++ b/src/or/connection_or.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/control.c b/src/or/control.c index 7214559136..d21682a19c 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/control.h b/src/or/control.h index f62084b931..0af09ae653 100644 --- a/src/or/control.h +++ b/src/or/control.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 568d9e42d8..340fbec620 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/cpuworker.h b/src/or/cpuworker.h index f7f1d8346b..2a2b37a975 100644 --- a/src/or/cpuworker.h +++ b/src/or/cpuworker.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/directory.c b/src/or/directory.c index b88c9d9f10..ceea410313 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/directory.h b/src/or/directory.h index d78046912c..1458ad2cc7 100644 --- a/src/or/directory.h +++ b/src/or/directory.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 45d12ed3b1..fbb2156515 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define DIRSERV_PRIVATE diff --git a/src/or/dirserv.h b/src/or/dirserv.h index 57cec3401f..d4ce54260c 100644 --- a/src/or/dirserv.h +++ b/src/or/dirserv.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/dirvote.c b/src/or/dirvote.c index 322596eb0a..f0dcc88070 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define DIRVOTE_PRIVATE diff --git a/src/or/dirvote.h b/src/or/dirvote.h index b570e9d251..8908336fa1 100644 --- a/src/or/dirvote.h +++ b/src/or/dirvote.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/dns.c b/src/or/dns.c index 7bf64dc4ff..129ca395b6 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/dns.h b/src/or/dns.h index cabbb9ba09..b13ab0f890 100644 --- a/src/or/dns.h +++ b/src/or/dns.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c index 3d63874a65..7b5068199b 100644 --- a/src/or/dnsserv.c +++ b/src/or/dnsserv.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/dnsserv.h b/src/or/dnsserv.h index c8074dfaa0..09ad5d7759 100644 --- a/src/or/dnsserv.h +++ b/src/or/dnsserv.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index b18aabe1f4..9eb0efd670 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 5416398430..7f3a4fb29c 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/eventdns_tor.h b/src/or/eventdns_tor.h index b135a534fc..9d51f0960e 100644 --- a/src/or/eventdns_tor.h +++ b/src/or/eventdns_tor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_EVENTDNS_TOR_H diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c index 9b550ee90e..e8c8aa60a4 100644 --- a/src/or/ext_orport.c +++ b/src/or/ext_orport.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/ext_orport.h b/src/or/ext_orport.h index 277bbfdbcf..8b2542f937 100644 --- a/src/or/ext_orport.h +++ b/src/or/ext_orport.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef EXT_ORPORT_H diff --git a/src/or/fp_pair.c b/src/or/fp_pair.c index fc7d107ba7..42bebcd847 100644 --- a/src/or/fp_pair.c +++ b/src/or/fp_pair.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/fp_pair.h b/src/or/fp_pair.h index 67b94fb6b4..0830ab1f36 100644 --- a/src/or/fp_pair.h +++ b/src/or/fp_pair.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/geoip.c b/src/or/geoip.c index c02343d489..5564b72a04 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/geoip.h b/src/or/geoip.h index cec19ea564..683ec073b2 100644 --- a/src/or/geoip.h +++ b/src/or/geoip.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/hibernate.c b/src/or/hibernate.c index 4f0660c2dc..356e11f6ec 100644 --- a/src/or/hibernate.c +++ b/src/or/hibernate.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/hibernate.h b/src/or/hibernate.h index 0616e11c57..b9e619c5ad 100644 --- a/src/or/hibernate.h +++ b/src/or/hibernate.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/main.c b/src/or/main.c index 58e3ad3e4d..44469ebe71 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/main.h b/src/or/main.h index 7d98983100..f77b4711c5 100644 --- a/src/or/main.h +++ b/src/or/main.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/microdesc.c b/src/or/microdesc.c index 7b826008b5..0511e870d1 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2014, The Tor Project, Inc. */ +/* Copyright (c) 2009-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/microdesc.h b/src/or/microdesc.h index fdfe8922ab..08571e4bd5 100644 --- a/src/or/microdesc.h +++ b/src/or/microdesc.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index 9b24405951..fdab03d05a 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h index a087a79ac3..d6e9e37013 100644 --- a/src/or/networkstatus.h +++ b/src/or/networkstatus.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 34d1d5f4d7..249c198214 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/nodelist.h b/src/or/nodelist.h index 2e59da673e..a131e0dd4e 100644 --- a/src/or/nodelist.h +++ b/src/or/nodelist.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/ntmain.c b/src/or/ntmain.c index ea6ec3b03e..833d870041 100644 --- a/src/or/ntmain.c +++ b/src/or/ntmain.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/or/ntmain.h b/src/or/ntmain.h index 68565e17ca..eb55a296f6 100644 --- a/src/or/ntmain.h +++ b/src/or/ntmain.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/onion.c b/src/or/onion.c index b8f85f9194..3723a3e11e 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/onion.h b/src/or/onion.h index 2fd86206e4..35619879e4 100644 --- a/src/or/onion.h +++ b/src/or/onion.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/onion_fast.c b/src/or/onion_fast.c index 0ca3e3a5a0..a52a11357c 100644 --- a/src/or/onion_fast.c +++ b/src/or/onion_fast.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/onion_fast.h b/src/or/onion_fast.h index 2fc605fc42..da3c217ae9 100644 --- a/src/or/onion_fast.h +++ b/src/or/onion_fast.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/onion_ntor.c b/src/or/onion_ntor.c index c028ed0ff9..7f58f4d758 100644 --- a/src/or/onion_ntor.c +++ b/src/or/onion_ntor.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/or/onion_ntor.h b/src/or/onion_ntor.h index 29178e942d..230941c3c5 100644 --- a/src/or/onion_ntor.h +++ b/src/or/onion_ntor.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_ONION_NTOR_H diff --git a/src/or/onion_tap.c b/src/or/onion_tap.c index b3b2a008bc..8879a22ca2 100644 --- a/src/or/onion_tap.c +++ b/src/or/onion_tap.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/onion_tap.h b/src/or/onion_tap.h index 36fb649d60..f02a4f6f51 100644 --- a/src/or/onion_tap.h +++ b/src/or/onion_tap.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/or.h b/src/or/or.h index ee86697fd8..4a014c1321 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/policies.c b/src/or/policies.c index d10bebd79a..2095907025 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/policies.h b/src/or/policies.h index 90d94190dd..0225b57a2c 100644 --- a/src/or/policies.h +++ b/src/or/policies.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/reasons.c b/src/or/reasons.c index b0f1b65131..c65acb54ae 100644 --- a/src/or/reasons.c +++ b/src/or/reasons.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/reasons.h b/src/or/reasons.h index 8b3694b05a..00a099061b 100644 --- a/src/or/reasons.h +++ b/src/or/reasons.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/relay.c b/src/or/relay.c index b95e5841e7..4915fbcd98 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/relay.h b/src/or/relay.h index 351516aada..df3edfbdb1 100644 --- a/src/or/relay.h +++ b/src/or/relay.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendclient.c b/src/or/rendclient.c index f351ae7161..8cace92b2c 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendclient.h b/src/or/rendclient.h index 40d388c489..098c61d0a1 100644 --- a/src/or/rendclient.h +++ b/src/or/rendclient.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index e779ecfe90..e54ca40a25 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h index 186326a0c1..4b910d2729 100644 --- a/src/or/rendcommon.h +++ b/src/or/rendcommon.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendmid.c b/src/or/rendmid.c index 1c56471b8c..9f6ff86c47 100644 --- a/src/or/rendmid.c +++ b/src/or/rendmid.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendmid.h b/src/or/rendmid.h index 25c711fa7b..6bd691a740 100644 --- a/src/or/rendmid.h +++ b/src/or/rendmid.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendservice.c b/src/or/rendservice.c index d4fbe739fe..b9d98755ea 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rendservice.h b/src/or/rendservice.h index 05502cac5d..754f7c358c 100644 --- a/src/or/rendservice.h +++ b/src/or/rendservice.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rephist.c b/src/or/rephist.c index a190fc8c0a..bc29378bea 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/rephist.h b/src/or/rephist.h index 8fd1599513..42710c4ed6 100644 --- a/src/or/rephist.h +++ b/src/or/rephist.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/replaycache.c b/src/or/replaycache.c index 6d1b59101d..569e0736cb 100644 --- a/src/or/replaycache.c +++ b/src/or/replaycache.c @@ -1,4 +1,4 @@ - /* Copyright (c) 2012-2014, The Tor Project, Inc. */ + /* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* diff --git a/src/or/replaycache.h b/src/or/replaycache.h index 904fd45ff1..9b9daf3831 100644 --- a/src/or/replaycache.h +++ b/src/or/replaycache.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/router.c b/src/or/router.c index f6b2250a47..00c365ffa5 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ROUTER_PRIVATE diff --git a/src/or/router.h b/src/or/router.h index b5d7f11053..8108ffb22f 100644 --- a/src/or/router.h +++ b/src/or/router.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 60d8e71a28..6cb052c03e 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/routerlist.h b/src/or/routerlist.h index e73e69b63a..d7e15db87e 100644 --- a/src/or/routerlist.h +++ b/src/or/routerlist.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 8176d47262..840350dab2 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/routerparse.h b/src/or/routerparse.h index e950548f8c..15fd03b810 100644 --- a/src/or/routerparse.h +++ b/src/or/routerparse.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/routerset.c b/src/or/routerset.c index 38aed77ee9..99de11ed5e 100644 --- a/src/or/routerset.c +++ b/src/or/routerset.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ROUTERSET_PRIVATE diff --git a/src/or/routerset.h b/src/or/routerset.h index a741eb5fda..8d41de8b6b 100644 --- a/src/or/routerset.h +++ b/src/or/routerset.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/scheduler.c b/src/or/scheduler.c index 5b4dff2237..f3fbc4ad4e 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -1,4 +1,4 @@ -/* * Copyright (c) 2013, The Tor Project, Inc. */ +/* * Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/scheduler.h b/src/or/scheduler.h index 404776b18b..70f6a39d4c 100644 --- a/src/or/scheduler.h +++ b/src/or/scheduler.h @@ -1,4 +1,4 @@ -/* * Copyright (c) 2013, The Tor Project, Inc. */ +/* * Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/statefile.c b/src/or/statefile.c index 2ce53fdfca..c279858de6 100644 --- a/src/or/statefile.c +++ b/src/or/statefile.c @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define STATEFILE_PRIVATE diff --git a/src/or/statefile.h b/src/or/statefile.h index 1f3aebee4f..8c790ea206 100644 --- a/src/or/statefile.h +++ b/src/or/statefile.h @@ -1,7 +1,7 @@ /* Copyright (c) 2001 Matej Pfajfar. * Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_STATEFILE_H diff --git a/src/or/status.c b/src/or/status.c index c11d99ba7f..0717070a05 100644 --- a/src/or/status.c +++ b/src/or/status.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2014, The Tor Project, Inc. */ +/* Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/status.h b/src/or/status.h index 451f343963..3dd8206e0f 100644 --- a/src/or/status.h +++ b/src/or/status.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2014, The Tor Project, Inc. */ +/* Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_STATUS_H diff --git a/src/or/tor_main.c b/src/or/tor_main.c index 9489cdca7f..af03b8c06a 100644 --- a/src/or/tor_main.c +++ b/src/or/tor_main.c @@ -1,6 +1,6 @@ /* Copyright 2001-2004 Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** String describing which Tor Git repository version the source was diff --git a/src/or/transports.c b/src/or/transports.c index 7999be3d33..6f07054ea8 100644 --- a/src/or/transports.c +++ b/src/or/transports.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Tor Project, Inc. */ +/* Copyright (c) 2011-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/or/transports.h b/src/or/transports.h index 8f60760de8..7c69941496 100644 --- a/src/or/transports.h +++ b/src/or/transports.h @@ -1,6 +1,6 @@ /* Copyright (c) 2003-2004, Roger Dingledine * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/bench.c b/src/test/bench.c index 74af06c6e6..68870f8657 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Ordinarily defined in tor_main.c; this bit is just here to provide one diff --git a/src/test/bt_test.py b/src/test/bt_test.py index 8290509fa7..0afe797a6d 100755 --- a/src/test/bt_test.py +++ b/src/test/bt_test.py @@ -1,4 +1,4 @@ -# Copyright 2013, The Tor Project, Inc +# Copyright 2013-2015, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/ed25519_exts_ref.py b/src/test/ed25519_exts_ref.py index 93dc49ee93..d5a3a79910 100644 --- a/src/test/ed25519_exts_ref.py +++ b/src/test/ed25519_exts_ref.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2014, The Tor Project, Inc +# Copyright 2014-2015, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/fakechans.h b/src/test/fakechans.h index 230abe4da6..8fb8f420a8 100644 --- a/src/test/fakechans.h +++ b/src/test/fakechans.h @@ -1,4 +1,4 @@ - /* Copyright (c) 2014, The Tor Project, Inc. */ + /* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_FAKECHANS_H diff --git a/src/test/ntor_ref.py b/src/test/ntor_ref.py index 7d6e43e716..e37637d92a 100755 --- a/src/test/ntor_ref.py +++ b/src/test/ntor_ref.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright 2012-2013, The Tor Project, Inc +# Copyright 2012-2015, The Tor Project, Inc # See LICENSE for licensing information """ diff --git a/src/test/test-child.c b/src/test/test-child.c index 91ae5a66a5..2ce01ea9bb 100644 --- a/src/test/test-child.c +++ b/src/test/test-child.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Tor Project, Inc. */ +/* Copyright (c) 2011-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include diff --git a/src/test/test.c b/src/test/test.c index fbe5625300..513ec3c597 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Ordinarily defined in tor_main.c; this bit is just here to provide one diff --git a/src/test/test.h b/src/test/test.h index 5518ca3f60..48037a5ba3 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2003, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #ifndef TOR_TEST_H diff --git a/src/test/test_addr.c b/src/test/test_addr.c index c9c47bdaee..2c25c1ef7d 100644 --- a/src/test/test_addr.c +++ b/src/test/test_addr.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define ADDRESSMAP_PRIVATE diff --git a/src/test/test_bt_cl.c b/src/test/test_bt_cl.c index c0c334656d..0fa0cd5c0a 100644 --- a/src/test/test_bt_cl.c +++ b/src/test/test_bt_cl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c index cb29ab0a9e..875da7028f 100644 --- a/src/test/test_buffers.c +++ b/src/test/test_buffers.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define BUFFERS_PRIVATE diff --git a/src/test/test_cell_formats.c b/src/test/test_cell_formats.c index e1f6bd71f7..e86dc0934f 100644 --- a/src/test/test_cell_formats.c +++ b/src/test/test_cell_formats.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_cell_queue.c b/src/test/test_cell_queue.c index e2fc95ccd6..effd316f34 100644 --- a/src/test/test_cell_queue.c +++ b/src/test/test_cell_queue.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CIRCUITLIST_PRIVATE diff --git a/src/test/test_channel.c b/src/test/test_channel.c index 82a5f44437..99633a4026 100644 --- a/src/test/test_channel.c +++ b/src/test/test_channel.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_channeltls.c b/src/test/test_channeltls.c index 89c75d8732..016e504ab3 100644 --- a/src/test/test_channeltls.c +++ b/src/test/test_channeltls.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include diff --git a/src/test/test_checkdir.c b/src/test/test_checkdir.c index 6c520656e0..882e3b3a61 100644 --- a/src/test/test_checkdir.c +++ b/src/test/test_checkdir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_circuitlist.c b/src/test/test_circuitlist.c index 181aec20a9..0760accfc1 100644 --- a/src/test/test_circuitlist.c +++ b/src/test/test_circuitlist.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_circuitmux.c b/src/test/test_circuitmux.c index 20c106ab9d..2a2a7ba145 100644 --- a/src/test/test_circuitmux.c +++ b/src/test/test_circuitmux.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define TOR_CHANNEL_INTERNAL_ diff --git a/src/test/test_config.c b/src/test/test_config.c index 98d91aa7a1..0b411e3354 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_containers.c b/src/test/test_containers.c index 1eb8c15fd5..79085a748e 100644 --- a/src/test/test_containers.c +++ b/src/test/test_containers.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_controller_events.c b/src/test/test_controller_events.c index dd9d590ec7..e36314da45 100644 --- a/src/test/test_controller_events.c +++ b/src/test/test_controller_events.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONNECTION_PRIVATE diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 5352b9fdb4..4a5a12c50a 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_data.c b/src/test/test_data.c index 0e6f79f33c..6afba65757 100644 --- a/src/test/test_data.c +++ b/src/test/test_data.c @@ -1,6 +1,6 @@ /* Copyright 2001-2004 Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Our unit test expect that the AUTHORITY_CERT_* public keys will sort diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 4cd8aa8759..69933896dd 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c index 5bf2985d2f..19071a1550 100644 --- a/src/test/test_entrynodes.c +++ b/src/test/test_entrynodes.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c index d99961dd4a..2e5a32eef3 100644 --- a/src/test/test_extorport.c +++ b/src/test/test_extorport.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONNECTION_PRIVATE diff --git a/src/test/test_hs.c b/src/test/test_hs.c index a5cd841a55..0246eaf648 100644 --- a/src/test/test_hs.c +++ b/src/test/test_hs.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_introduce.c b/src/test/test_introduce.c index fe8ffbfa4b..0cab8ef4cc 100644 --- a/src/test/test_introduce.c +++ b/src/test/test_introduce.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_logging.c b/src/test/test_logging.c index 17f1ed566c..6205b3bdc5 100644 --- a/src/test/test_logging.c +++ b/src/test/test_logging.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c index 31ed93b720..fb3df77edc 100644 --- a/src/test/test_microdesc.c +++ b/src/test/test_microdesc.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2014, The Tor Project, Inc. */ +/* Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_nodelist.c b/src/test/test_nodelist.c index 2fba3da7e0..9bd8b4a7ea 100644 --- a/src/test/test_nodelist.c +++ b/src/test/test_nodelist.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/test/test_ntor_cl.c b/src/test/test_ntor_cl.c index 2899ad6710..955b508ef0 100644 --- a/src/test/test_ntor_cl.c +++ b/src/test/test_ntor_cl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_oom.c b/src/test/test_oom.c index 1f21f65c60..28b4c0435a 100644 --- a/src/test/test_oom.c +++ b/src/test/test_oom.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Unit tests for OOM handling logic */ diff --git a/src/test/test_options.c b/src/test/test_options.c index 44349b3800..a8ebadb14b 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define CONFIG_PRIVATE diff --git a/src/test/test_policy.c b/src/test/test_policy.c index e77e16c99e..33f90c7da5 100644 --- a/src/test/test_policy.c +++ b/src/test/test_policy.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Tor Project, Inc. */ +/* Copyright (c) 2013-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/test/test_pt.c b/src/test/test_pt.c index dba880ee19..996ef8666b 100644 --- a/src/test/test_pt.c +++ b/src/test/test_pt.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_relay.c b/src/test/test_relay.c index fbe7fafc06..2144ef335e 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c index 834dfeface..fafb5bbbea 100644 --- a/src/test/test_relaycell.c +++ b/src/test/test_relaycell.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /* Unit tests for handling different kinds of relay cell */ diff --git a/src/test/test_replay.c b/src/test/test_replay.c index b1f637a43b..a02c160365 100644 --- a/src/test/test_replay.c +++ b/src/test/test_replay.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2014, The Tor Project, Inc. */ +/* Copyright (c) 2012-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #define REPLAYCACHE_PRIVATE diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c index d8ad59a58b..60b6bb5a72 100644 --- a/src/test/test_routerkeys.c +++ b/src/test/test_routerkeys.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/test/test_scheduler.c b/src/test/test_scheduler.c index a7a1acc83e..73a422088f 100644 --- a/src/test/test_scheduler.c +++ b/src/test/test_scheduler.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Tor Project, Inc. */ +/* Copyright (c) 2014-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include diff --git a/src/test/test_socks.c b/src/test/test_socks.c index fbb8b25980..465e427930 100644 --- a/src/test/test_socks.c +++ b/src/test/test_socks.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "or.h" diff --git a/src/test/test_util.c b/src/test/test_util.c index e9815b12e7..f821c6e612 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -1,6 +1,6 @@ /* Copyright (c) 2001-2004, Roger Dingledine. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. - * Copyright (c) 2007-2014, The Tor Project, Inc. */ + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/tools/tor-checkkey.c b/src/tools/tor-checkkey.c index f6c6508c33..e404b682cf 100644 --- a/src/tools/tor-checkkey.c +++ b/src/tools/tor-checkkey.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2014, The Tor Project, Inc. */ +/* Copyright (c) 2008-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c index 74485f9803..6369966869 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c +++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.c @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch. - * Copyright (c) 2010-2014, The Tor Project, Inc. */ + * Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h index 1bfebd91f9..abc5e11857 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h +++ b/src/tools/tor-fw-helper/tor-fw-helper-natpmp.h @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch. - * Copyright (c) 2010-2014, The Tor Project, Inc. */ + * Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c index 59bc232dd3..e5495c906e 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-upnp.c +++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.c @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch. - * Copyright (c) 2010-2014, The Tor Project, Inc. */ + * Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/tools/tor-fw-helper/tor-fw-helper-upnp.h b/src/tools/tor-fw-helper/tor-fw-helper-upnp.h index 9a5123e09f..bc9476eb98 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper-upnp.h +++ b/src/tools/tor-fw-helper/tor-fw-helper-upnp.h @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch. - * Copyright (c) 2010-2014, The Tor Project, Inc. */ + * Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/tools/tor-fw-helper/tor-fw-helper.c b/src/tools/tor-fw-helper/tor-fw-helper.c index 9a32b0cbe2..fdc0e1adea 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.c +++ b/src/tools/tor-fw-helper/tor-fw-helper.c @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch. - * Copyright (c) 2010-2014, The Tor Project, Inc. */ + * Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/tools/tor-fw-helper/tor-fw-helper.h b/src/tools/tor-fw-helper/tor-fw-helper.h index 71bc11e168..4ebc75d8f7 100644 --- a/src/tools/tor-fw-helper/tor-fw-helper.h +++ b/src/tools/tor-fw-helper/tor-fw-helper.h @@ -1,5 +1,5 @@ /* Copyright (c) 2010, Jacob Appelbaum, Steven J. Murdoch. - * Copyright (c) 2010-2014, The Tor Project, Inc. */ + * Copyright (c) 2010-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ /** diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c index f6805c1193..c599822e07 100644 --- a/src/tools/tor-gencert.c +++ b/src/tools/tor-gencert.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2014, The Tor Project, Inc. */ +/* Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ #include "orconfig.h" diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c index 6ee155ade5..e6eadf1dd3 100644 --- a/src/tools/tor-resolve.c +++ b/src/tools/tor-resolve.c @@ -1,5 +1,5 @@ /* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson - * Copyright (c) 2007-2014, The Tor Project, Inc. + * Copyright (c) 2007-2015, The Tor Project, Inc. */ /* See LICENSE for licensing information */ From fc0febc5c62a8c5ad2373b43641a70a8d793a469 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 2 Jan 2015 14:28:21 -0500 Subject: [PATCH 097/120] Commit the update-copyrights script. (I'm tired of rewriting this by hand every January) --- scripts/maint/updateCopyright.pl | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 scripts/maint/updateCopyright.pl diff --git a/scripts/maint/updateCopyright.pl b/scripts/maint/updateCopyright.pl new file mode 100755 index 0000000000..ec82616a19 --- /dev/null +++ b/scripts/maint/updateCopyright.pl @@ -0,0 +1,7 @@ +#!/usr/bin/perl -i -w -p + +$NEWYEAR=2015; + +s/Copyright(.*) (201[^5]), The Tor Project/Copyright$1 $2-${NEWYEAR}, The Tor Project/; + +s/Copyright(.*)-(20..), The Tor Project/Copyright$1-${NEWYEAR}, The Tor Project/; From 8ef6cdc39f047a7579858a6e23629c1c2718fc0a Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 4 Jan 2015 17:28:54 -0500 Subject: [PATCH 098/120] Prevent changes to other options from removing . from AutomapHostsSuffixes This happened because we changed AutomapHostsSuffixes to replace "." with "", since a suffix of "" means "match everything." But our option handling code for CSV options likes to remove empty entries when it re-parses stuff. Instead, let "." remain ".", and treat it specially when we're checking for a match. Fixes bug 12509; bugfix on 0.2.0.1-alpha. --- changes/bug12509 | 4 ++++ src/or/addressmap.c | 2 ++ src/or/config.c | 9 --------- src/or/or.h | 5 +++-- 4 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 changes/bug12509 diff --git a/changes/bug12509 b/changes/bug12509 new file mode 100644 index 0000000000..8d5c1dd484 --- /dev/null +++ b/changes/bug12509 @@ -0,0 +1,4 @@ + + o Minor bugfixes (automapping): + - Prevent changes to other optoins from removing the wildcard value "." + from "AutomapHostsSuffixes". diff --git a/src/or/addressmap.c b/src/or/addressmap.c index 998770a3db..279132e97c 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -226,6 +226,8 @@ addressmap_address_should_automap(const char *address, return 0; SMARTLIST_FOREACH_BEGIN(suffix_list, const char *, suffix) { + if (!strcmp(suffix, ".")) + return 1; if (!strcasecmpend(address, suffix)) return 1; } SMARTLIST_FOREACH_END(suffix); diff --git a/src/or/config.c b/src/or/config.c index 892108278e..b047b12717 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3398,15 +3398,6 @@ options_validate(or_options_t *old_options, or_options_t *options, AF_INET6, 1, msg)<0) return -1; - if (options->AutomapHostsSuffixes) { - SMARTLIST_FOREACH(options->AutomapHostsSuffixes, char *, suf, - { - size_t len = strlen(suf); - if (len && suf[len-1] == '.') - suf[len-1] = '\0'; - }); - } - if (options->TestingTorNetwork && !(options->DirAuthorities || (options->AlternateDirAuthority && diff --git a/src/or/or.h b/src/or/or.h index 1609587717..66d10ac436 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3646,8 +3646,9 @@ typedef struct { * hostname ending with one of the suffixes in * AutomapHostsSuffixes, map it to a * virtual address. */ - smartlist_t *AutomapHostsSuffixes; /**< List of suffixes for - * AutomapHostsOnResolve. */ + /** List of suffixes for AutomapHostsOnResolve. The special value + * "." means "match everything." */ + smartlist_t *AutomapHostsSuffixes; int RendPostPeriod; /**< How often do we post each rendezvous service * descriptor? Remember to publish them independently. */ int KeepalivePeriod; /**< How often do we send padding cells to keep From 276700131a14697aa84d95a867782bbfd612277f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 5 Jan 2015 11:39:38 -0500 Subject: [PATCH 099/120] Tolerate starting up with missing hidden service directory Fixes bug 14106; bugfix on 0.2.6.2-alpha Found by stem tests. --- changes/bug14106 | 4 ++++ src/or/rendservice.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changes/bug14106 diff --git a/changes/bug14106 b/changes/bug14106 new file mode 100644 index 0000000000..cf6e568dcc --- /dev/null +++ b/changes/bug14106 @@ -0,0 +1,4 @@ + o Minor bugfixes (hidden services): + - Successfully launch Tor with a nonexistent hidden service directory. + Our fix for bug 13942 didn't catch this case. Fixes bug 14106; + bugfix on 0.2.6.2-alpha. diff --git a/src/or/rendservice.c b/src/or/rendservice.c index b9d98755ea..3b73674691 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -531,7 +531,7 @@ rend_config_services(const or_options_t *options, int validate_only) } } if (service) { - cpd_check_t check_opts = CPD_CHECK_MODE_ONLY; + cpd_check_t check_opts = CPD_CHECK_MODE_ONLY|CPD_CHECK; if (service->dir_group_readable) { check_opts |= CPD_GROUP_READ; } From 6d6643298dfda1b146c635e3858faec7e9c9631c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 08:49:57 -0500 Subject: [PATCH 100/120] Don't crash on malformed EXTENDCIRCUIT. Fixes 14116; bugfix on ac68704f in 0.2.2.9-alpha. --- changes/bug14116_025 | 3 +++ src/or/control.c | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 changes/bug14116_025 diff --git a/changes/bug14116_025 b/changes/bug14116_025 new file mode 100644 index 0000000000..0859f626a5 --- /dev/null +++ b/changes/bug14116_025 @@ -0,0 +1,3 @@ + o Minor bugfixes (controller): + - Avoid crashing on a malformed EXTENDCIRCUIT command. Fixes bug 14116; + bugfix on 0.2.2.9-alpha. diff --git a/src/or/control.c b/src/or/control.c index 9378f38f40..bdd91fc4be 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -2451,6 +2451,14 @@ handle_control_extendcircuit(control_connection_t *conn, uint32_t len, goto done; } + if (smartlist_len(args) < 2) { + connection_printf_to_buf(conn, + "512 syntax error: not enough arguments.\r\n"); + SMARTLIST_FOREACH(args, char *, cp, tor_free(cp)); + smartlist_free(args); + goto done; + } + smartlist_split_string(router_nicknames, smartlist_get(args,1), ",", 0, 0); SMARTLIST_FOREACH(args, char *, cp, tor_free(cp)); From d74f0cff92322174e19c5cbd98462bd25e14fc3c Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 5 Jan 2015 11:52:36 -0500 Subject: [PATCH 101/120] make "make test-stem" run stem tests on tor Closes ticket 14107. --- Makefile.am | 9 +++++++++ changes/ticket14107 | 6 ++++++ src/or/include.am | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 changes/ticket14107 diff --git a/Makefile.am b/Makefile.am index 3de7f7a827..f6a1bcf520 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,6 +70,15 @@ test: all test-network: all ./src/test/test-network.sh +test-stem: $(TESTING_TOR_BINARY) + @if test -d "$$STEM_SOURCE_DIR"; then \ + "$$STEM_SOURCE_DIR"/run_tests.py --tor $(TESTING_TOR_BINARY) --all --log notice --target RUN_ALL; \ + else \ + echo '$$STEM_SOURCE_DIR was not set.'; echo; \ + echo "To run these tests, git clone https://git.torproject.org/stem.git/ ; export STEM_SOURCE_DIR=\`pwd\`/stem"; \ + fi + + reset-gcov: rm -f src/*/*.gcda diff --git a/changes/ticket14107 b/changes/ticket14107 new file mode 100644 index 0000000000..e4ba6becb3 --- /dev/null +++ b/changes/ticket14107 @@ -0,0 +1,6 @@ + o Testing: + + - New "make test-stem" target to run stem integration tests. + Requires that the "STEM_SOURCE_DIR" environment variable be set. + Closes ticket 14107. + diff --git a/src/or/include.am b/src/or/include.am index fb1581c463..b44e1099dc 100644 --- a/src/or/include.am +++ b/src/or/include.am @@ -123,6 +123,9 @@ src_or_tor_cov_LDADD = src/or/libtor-testing.a src/common/libor-testing.a \ src/common/libor-event-testing.a \ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \ @TOR_LIB_WS32@ @TOR_LIB_GDI@ @CURVE25519_LIBS@ @TOR_SYSTEMD_LIBS@ +TESTING_TOR_BINARY = ./src/or/tor-cov +else +TESTING_TOR_BINARY = ./src/or/tor endif ORHEADERS = \ From 839076ab00e8b67bc627847aef3ee9b5ab8c66f6 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 09:01:59 -0500 Subject: [PATCH 102/120] have 'make {clean,reset_gcov}' remove gcov files in subdirectories --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f6a1bcf520..f105464b71 100644 --- a/Makefile.am +++ b/Makefile.am @@ -80,7 +80,7 @@ test-stem: $(TESTING_TOR_BINARY) reset-gcov: - rm -f src/*/*.gcda + rm -f src/*/*.gcda src/*/*/*.gcda HTML_COVER_DIR=./coverage_html coverage-html: all @@ -118,4 +118,4 @@ version: fi mostlyclean-local: - rm -f src/*/*.gc{da,no} + rm -f src/*/*.gc{da,no} src/*/*/*.gc{da,no} From f4221a809a71077cacda67fbeaee7cad064db602 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 13:26:52 -0500 Subject: [PATCH 103/120] Make test_cmdline_args.py work on Windows Patch from Gisle Vanem on tor-dev ml --- changes/fix-test-cmdline-args | 4 ++++ src/test/test_cmdline_args.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changes/fix-test-cmdline-args diff --git a/changes/fix-test-cmdline-args b/changes/fix-test-cmdline-args new file mode 100644 index 0000000000..6902d19b27 --- /dev/null +++ b/changes/fix-test-cmdline-args @@ -0,0 +1,4 @@ + o Testing: + - Make the test_cmdline_args.py script work correctly on Windows. + Patch from Gisle Vanem. + \ No newline at end of file diff --git a/src/test/test_cmdline_args.py b/src/test/test_cmdline_args.py index 55d1cdb805..c8e68e8240 100755 --- a/src/test/test_cmdline_args.py +++ b/src/test/test_cmdline_args.py @@ -57,14 +57,14 @@ def run_tor(args, failure=False): raise UnexpectedFailure() elif not result and failure: raise UnexpectedSuccess() - return b2s(output) + return b2s(output.replace('\r\n','\n')) def spaceify_fp(fp): for i in range(0, len(fp), 4): yield fp[i:i+4] def lines(s): - out = s.split("\n") + out = s.splitlines() if out and out[-1] == '': del out[-1] return out @@ -151,7 +151,7 @@ class CmdlineTests(unittest.TestCase): if os.stat(TOR).st_mtime < os.stat(main_c).st_mtime: self.skipTest(TOR+" not up to date") out = run_tor(["--digests"]) - main_line = [ l for l in lines(out) if l.endswith("/main.c") ] + main_line = [ l for l in lines(out) if l.endswith("/main.c") or l.endswith(" main.c") ] digest, name = main_line[0].split() f = open(main_c, 'rb') actual = hashlib.sha1(f.read()).hexdigest() From f5f80790d2abc1e418158827b1c8e398611d573a Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Tue, 6 Jan 2015 19:39:52 +0100 Subject: [PATCH 104/120] Minor documentation fixes --- src/or/addressmap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index e28b5e3341..33f11cb0ec 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -94,7 +94,7 @@ addressmap_ent_free(void *_ent) tor_free(ent); } -/** Free storage held by a virtaddress_entry_t* entry in ent. */ +/** Free storage held by a virtaddress_entry_t* entry in _ent. */ static void addressmap_virtaddress_ent_free(void *_ent) { @@ -108,7 +108,8 @@ addressmap_virtaddress_ent_free(void *_ent) tor_free(ent); } -/** Free storage held by a virtaddress_entry_t* entry in ent. */ +/** Remove address (which must map to ent) from the + * virtual address map. */ static void addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent) { @@ -131,7 +132,7 @@ addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent) } /** Remove ent (which must be mapped to by address) from the - * client address maps. */ + * client address maps, and then free it. */ static void addressmap_ent_remove(const char *address, addressmap_entry_t *ent) { @@ -496,7 +497,7 @@ addressmap_have_mapping(const char *address, int update_expiry) * equal to address, or any address ending with a period followed by * address. If wildcard_addr and wildcard_new_addr are * both true, the mapping will rewrite addresses that end with - * ".address" into ones that end with ".new_address." + * ".address" into ones that end with ".new_address". * * If new_address is NULL, or new_address is equal to * address and wildcard_addr is equal to @@ -839,8 +840,8 @@ get_random_virtual_addr(const virtual_addr_conf_t *conf, tor_addr_t *addr_out) } /** Return a newly allocated string holding an address of type - * (one of RESOLVED_TYPE_{IPV4|HOSTNAME}) that has not yet been mapped, - * and that is very unlikely to be the address of any real host. + * (one of RESOLVED_TYPE_{IPV4|IPV6|HOSTNAME}) that has not yet been + * mapped, and that is very unlikely to be the address of any real host. * * May return NULL if we have run out of virtual addresses. */ From 4385211caf6ad4cf34c0a3aaaba42d81048fddf6 Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Tue, 6 Jan 2015 19:40:23 +0100 Subject: [PATCH 105/120] Minor IPv6-related memory leak fixes --- src/or/addressmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index 33f11cb0ec..ece69ea6e6 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -104,6 +104,7 @@ addressmap_virtaddress_ent_free(void *_ent) ent = _ent; tor_free(ent->ipv4_address); + tor_free(ent->ipv6_address); tor_free(ent->hostname_address); tor_free(ent); } @@ -121,9 +122,11 @@ addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent) if (ve) { if (!strcmp(address, ve->ipv4_address)) tor_free(ve->ipv4_address); + if (!strcmp(address, ve->ipv6_address)) + tor_free(ve->ipv6_address); if (!strcmp(address, ve->hostname_address)) tor_free(ve->hostname_address); - if (!ve->ipv4_address && !ve->hostname_address) { + if (!ve->ipv4_address && !ve->ipv6_address && !ve->hostname_address) { tor_free(ve); strmap_remove(virtaddress_reversemap, ent->new_address); } From 5d322e6ef6b43c587f7f9324a4d28b8446b07add Mon Sep 17 00:00:00 2001 From: Tom van der Woerdt Date: Tue, 6 Jan 2015 19:41:29 +0100 Subject: [PATCH 106/120] Whitespace fix --- src/or/addressmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/or/addressmap.c b/src/or/addressmap.c index ece69ea6e6..4b3583b660 100644 --- a/src/or/addressmap.c +++ b/src/or/addressmap.c @@ -539,9 +539,9 @@ addressmap_register(const char *address, char *new_address, time_t expires, if (expires > 1) { log_info(LD_APP,"Temporary addressmap ('%s' to '%s') not performed, " "since it's already mapped to '%s'", - safe_str_client(address), - safe_str_client(new_address), - safe_str_client(ent->new_address)); + safe_str_client(address), + safe_str_client(new_address), + safe_str_client(ent->new_address)); tor_free(new_address); return; } From 6f7a8f84d906a0a9d5fd88e49d352bb748a36b09 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 13:45:57 -0500 Subject: [PATCH 107/120] changes file for 4385211caf6ad4cf34c0a3a --- changes/bug14123 | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/bug14123 diff --git a/changes/bug14123 b/changes/bug14123 new file mode 100644 index 0000000000..1220a044a6 --- /dev/null +++ b/changes/bug14123 @@ -0,0 +1,4 @@ + o Minor bugfixes (small memory leaks): + - Avoid leaking memory when using IPv6 virtual address mappings. + Fixes bug 14123; bugfix on 0.2.4.7-alpha. Patch by Tom van der + Woerdt. \ No newline at end of file From fcc78e5f8a3249eadfea31db1aca6884b31c1873 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 14:05:35 -0500 Subject: [PATCH 108/120] Use package-config output for -lsystemd correctly In systemd 209, they deprecated -lsystemd-daemon in favor of -lsystemd. So we'd better actually look at the pkg-config output, or we'll get warnings on newer distributions. For some as-yet-unknown-to-me reason, setting CFLAGS so early makes it so -O2 -g doesn't get added to it later. So, adding it myself later. Perhaps a better fix here can be found. Fixes 14072; bugfix on 0.2.6.2-alpha. Based on a patch from h.venev --- changes/bug14072 | 3 +++ configure.ac | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 changes/bug14072 diff --git a/changes/bug14072 b/changes/bug14072 new file mode 100644 index 0000000000..c810616cc0 --- /dev/null +++ b/changes/bug14072 @@ -0,0 +1,3 @@ + o Minor bugfixes (build): + - Avoid warnings when building with systemd 209 or later. + Fixes bug 14072; bugfix on 0.2.6.2-alpha. Patch from "h.venev". diff --git a/configure.ac b/configure.ac index ea8d6b601a..2c92a6c409 100644 --- a/configure.ac +++ b/configure.ac @@ -130,7 +130,8 @@ fi if test x$have_systemd = xyes; then AC_DEFINE(HAVE_SYSTEMD,1,[Have systemd]) - TOR_SYSTEMD_LIBS="-lsystemd-daemon" + CFLAGS="${CFLAGS} ${SYSTEMD_CFLAGS}" + TOR_SYSTEMD_LIBS="${SYSTEMD_LIBS}" fi AC_SUBST(TOR_SYSTEMD_LIBS) @@ -1542,10 +1543,9 @@ fi if test "$GCC" = yes; then # Disable GCC's strict aliasing checks. They are an hours-to-debug # accident waiting to happen. - CFLAGS="$CFLAGS -Wall -fno-strict-aliasing" + CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -g -O2" else - # Autoconf sets -g -O2 by default. Override optimization level - # for non-gcc compilers + # Override optimization level for non-gcc compilers CFLAGS="$CFLAGS -O" enable_gcc_warnings=no enable_gcc_warnings_advisory=no From 35efce1f3f517871aaa19d60976a9abb3a67bede Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 13 Nov 2014 10:48:15 -0500 Subject: [PATCH 109/120] Add an ExitRelay option to override ExitPolicy If we're not a relay, we ignore it. If it's set to 1, we obey ExitPolicy. If it's set to 0, we force ExitPolicy to 'reject *:*' And if it's set to auto, then we warn the user if they're running an exit, and tell them how they can stop running an exit if they didn't mean to do that. Fixes ticket 10067 --- doc/tor.1.txt | 13 +++++++++++++ src/or/config.c | 3 ++- src/or/or.h | 7 +++++++ src/or/policies.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/doc/tor.1.txt b/doc/tor.1.txt index eb406e7cb7..1aa0314158 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -1479,6 +1479,19 @@ is non-zero): that it's an email address and/or generate a new address for this purpose. +[[ExitRelay]] **ExitRelay** **0**|**1**|**auto**:: + Tells Tor whether to run as an exit relay. If Tor is running as a + non-bridge server, and ExitRelay is set to 1, then Tor allows traffic to + exit according to the ExitPolicy option (or the default ExitPolicy if + none is specified). + + + If ExitRelay is set to 0, no traffic is allowed to + exit, and the ExitPolicy option is ignored. + + + + If ExitRelay is set to "auto", then Tor behaves as if it were set to 1, but + warns the user if this would cause traffic to exit. In a future version, + the default value will be 0. (Default: auto) + [[ExitPolicy]] **ExitPolicy** __policy__,__policy__,__...__:: Set an exit policy for this server. Each policy is of the form "**accept**|**reject** __ADDR__[/__MASK__][:__PORT__]". If /__MASK__ is diff --git a/src/or/config.c b/src/or/config.c index 4b8c6834e9..fd60d135ad 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -63,7 +63,6 @@ static config_abbrev_t option_abbrevs_[] = { PLURAL(AuthDirBadExitCC), PLURAL(AuthDirInvalidCC), PLURAL(AuthDirRejectCC), - PLURAL(ExitNode), PLURAL(EntryNode), PLURAL(ExcludeNode), PLURAL(FirewallPort), @@ -227,6 +226,7 @@ static config_var_t option_vars_[] = { V(ExitPolicyRejectPrivate, BOOL, "1"), V(ExitPortStatistics, BOOL, "0"), V(ExtendAllowPrivateAddresses, BOOL, "0"), + V(ExitRelay, AUTOBOOL, "auto"), VPORT(ExtORPort, LINELIST, NULL), V(ExtORPortCookieAuthFile, STRING, NULL), V(ExtORPortCookieAuthFileGroupReadable, BOOL, "0"), @@ -3797,6 +3797,7 @@ options_transition_affects_descriptor(const or_options_t *old_options, !opt_streq(old_options->Nickname,new_options->Nickname) || !opt_streq(old_options->Address,new_options->Address) || !config_lines_eq(old_options->ExitPolicy,new_options->ExitPolicy) || + old_options->ExitRelay != new_options->ExitRelay || old_options->ExitPolicyRejectPrivate != new_options->ExitPolicyRejectPrivate || old_options->IPv6Exit != new_options->IPv6Exit || diff --git a/src/or/or.h b/src/or/or.h index 5ebe7bfac3..dadf5561af 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4232,6 +4232,13 @@ typedef struct { /** Should we send the timestamps that pre-023 hidden services want? */ int Support022HiddenServices; + /** Is this an exit node? This is a tristate, where "1" means "yes, and use + * the default exit policy if none is given" and "0" means "no; exit policy + * is 'reject *'" and "auto" (-1) means "same as 1, but warn the user." + * + * XXXX Eventually, the default will be 0. */ + int ExitRelay; + } or_options_t; /** Persistent state for an onion router, as saved to disk. */ diff --git a/src/or/policies.c b/src/or/policies.c index d10bebd79a..dc1a8a32cc 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -434,6 +434,33 @@ validate_addr_policies(const or_options_t *options, char **msg) REJECT("Error in ExitPolicy entry."); } + static int warned_about_exitrelay = 0; + + const int exitrelay_setting_is_auto = options->ExitRelay == -1; + const int policy_accepts_something = + ! (policy_is_reject_star(addr_policy, AF_INET) && + policy_is_reject_star(addr_policy, AF_INET6)); + + if (server_mode(options) && + ! warned_about_exitrelay && + exitrelay_setting_is_auto && + policy_accepts_something) { + /* Policy accepts something */ + warned_about_exitrelay = 1; + log_warn(LD_CONFIG, + "Tor is running as an exit relay%s. If you did not want this " + "behavior, please set the ExitRelay option to 0. If you do " + "want to run an exit Relay, please set the ExitRelay option " + "to 1 to disable this warning, and for forward compatibility.", + options->ExitPolicy == NULL ? + " with the default exit policy" : ""); + if (options->ExitPolicy == NULL) { + log_warn(LD_CONFIG, + "In a future version of Tor, ExitRelay 0 may become the " + "default when no ExitPolicy is given."); + } + } + /* The rest of these calls *append* to addr_policy. So don't actually * use the results for anything other than checking if they parse! */ if (parse_addr_policy(options->DirPolicy, &addr_policy, -1)) @@ -1022,6 +1049,9 @@ policies_parse_exit_policy(config_line_t *cfg, smartlist_t **dest, * * If or_options->BridgeRelay is false, add entries of default * Tor exit policy into result smartlist. + * + * If or_options->ExitRelay is false, then make our exit policy into + * "reject *:*" regardless. */ int policies_parse_exit_policy_from_options(const or_options_t *or_options, @@ -1030,6 +1060,12 @@ policies_parse_exit_policy_from_options(const or_options_t *or_options, { exit_policy_parser_cfg_t parser_cfg = 0; + if (or_options->ExitRelay == 0) { + append_exit_policy_string(result, "reject *4:*"); + append_exit_policy_string(result, "reject *6:*"); + return 0; + } + if (or_options->IPv6Exit) { parser_cfg |= EXIT_POLICY_IPV6_ENABLED; } From d87143f3199fe6be6e0a4907e82b25727622c857 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 13 Nov 2014 10:50:37 -0500 Subject: [PATCH 110/120] changes file for 10067 --- changes/feature10067 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 changes/feature10067 diff --git a/changes/feature10067 b/changes/feature10067 new file mode 100644 index 0000000000..3a387d0497 --- /dev/null +++ b/changes/feature10067 @@ -0,0 +1,12 @@ + o Major features (changed defaults): + - Prevent relay operators from unintentionally running exits: When + a relay is configured as an exit node, we now warn the user + unless the 'ExitRelay' option is set to 1. We warn even more + loudly if the relay is configured with the default exit policy, + since this tends to indicate accidental misconfiguration. + Setting 'ExitRelay' to 0 stops Tor from running as an exit relay. + Closes ticket 10067. + + o Removed features: + - To avoid confusion with the 'ExitRelay' option, 'ExitNode' is no + longer silently accepted as an alias for 'ExitNodes'. From 108808e98ebc76bb8859dcaba213ae3e614e7488 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 15:25:20 -0500 Subject: [PATCH 111/120] Fix obsolete usage of test_{str_},eq macros --- src/test/test_dir.c | 70 ++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 9da44ed546..c6594f8359 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -845,41 +845,41 @@ test_dir_versions(void *arg) tt_int_op(VER_RELEASE,OP_EQ, ver1.status); tt_str_op("",OP_EQ, ver1.status_tag); - test_eq(0, tor_version_parse("10.1", &ver1)); - test_eq(10, ver1.major); - test_eq(1, ver1.minor); - test_eq(0, ver1.micro); - test_eq(0, ver1.patchlevel); - test_eq(VER_RELEASE, ver1.status); - test_streq("", ver1.status_tag); - test_eq(0, tor_version_parse("5.99.999", &ver1)); - test_eq(5, ver1.major); - test_eq(99, ver1.minor); - test_eq(999, ver1.micro); - test_eq(0, ver1.patchlevel); - test_eq(VER_RELEASE, ver1.status); - test_streq("", ver1.status_tag); - test_eq(0, tor_version_parse("10.1-alpha", &ver1)); - test_eq(10, ver1.major); - test_eq(1, ver1.minor); - test_eq(0, ver1.micro); - test_eq(0, ver1.patchlevel); - test_eq(VER_RELEASE, ver1.status); - test_streq("alpha", ver1.status_tag); - test_eq(0, tor_version_parse("2.1.700-alpha", &ver1)); - test_eq(2, ver1.major); - test_eq(1, ver1.minor); - test_eq(700, ver1.micro); - test_eq(0, ver1.patchlevel); - test_eq(VER_RELEASE, ver1.status); - test_streq("alpha", ver1.status_tag); - test_eq(0, tor_version_parse("1.6.8-alpha-dev", &ver1)); - test_eq(1, ver1.major); - test_eq(6, ver1.minor); - test_eq(8, ver1.micro); - test_eq(0, ver1.patchlevel); - test_eq(VER_RELEASE, ver1.status); - test_streq("alpha-dev", ver1.status_tag); + tt_int_op(0, OP_EQ, tor_version_parse("10.1", &ver1)); + tt_int_op(10, OP_EQ, ver1.major); + tt_int_op(1, OP_EQ, ver1.minor); + tt_int_op(0, OP_EQ, ver1.micro); + tt_int_op(0, OP_EQ, ver1.patchlevel); + tt_int_op(VER_RELEASE, OP_EQ, ver1.status); + tt_str_op("", OP_EQ, ver1.status_tag); + tt_int_op(0, OP_EQ, tor_version_parse("5.99.999", &ver1)); + tt_int_op(5, OP_EQ, ver1.major); + tt_int_op(99, OP_EQ, ver1.minor); + tt_int_op(999, OP_EQ, ver1.micro); + tt_int_op(0, OP_EQ, ver1.patchlevel); + tt_int_op(VER_RELEASE, OP_EQ, ver1.status); + tt_str_op("", OP_EQ, ver1.status_tag); + tt_int_op(0, OP_EQ, tor_version_parse("10.1-alpha", &ver1)); + tt_int_op(10, OP_EQ, ver1.major); + tt_int_op(1, OP_EQ, ver1.minor); + tt_int_op(0, OP_EQ, ver1.micro); + tt_int_op(0, OP_EQ, ver1.patchlevel); + tt_int_op(VER_RELEASE, OP_EQ, ver1.status); + tt_str_op("alpha", OP_EQ, ver1.status_tag); + tt_int_op(0, OP_EQ, tor_version_parse("2.1.700-alpha", &ver1)); + tt_int_op(2, OP_EQ, ver1.major); + tt_int_op(1, OP_EQ, ver1.minor); + tt_int_op(700, OP_EQ, ver1.micro); + tt_int_op(0, OP_EQ, ver1.patchlevel); + tt_int_op(VER_RELEASE, OP_EQ, ver1.status); + tt_str_op("alpha", OP_EQ, ver1.status_tag); + tt_int_op(0, OP_EQ, tor_version_parse("1.6.8-alpha-dev", &ver1)); + tt_int_op(1, OP_EQ, ver1.major); + tt_int_op(6, OP_EQ, ver1.minor); + tt_int_op(8, OP_EQ, ver1.micro); + tt_int_op(0, OP_EQ, ver1.patchlevel); + tt_int_op(VER_RELEASE, OP_EQ, ver1.status); + tt_str_op("alpha-dev", OP_EQ, ver1.status_tag); #define tt_versionstatus_op(vs1, op, vs2) \ tt_assert_test_type(vs1,vs2,#vs1" "#op" "#vs2,version_status_t, \ From 7c5a45575fd7881dbb0c16895608775b44c87f01 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 6 Jan 2015 17:10:27 -0500 Subject: [PATCH 112/120] Spelling -- readyness->readiness. --- src/or/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/main.c b/src/or/main.c index 44469ebe71..c925b7d593 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2081,7 +2081,7 @@ do_main_loop(void) #endif #ifdef HAVE_SYSTEMD - log_notice(LD_GENERAL, "Signaling readyness to systemd"); + log_notice(LD_GENERAL, "Signaling readiness to systemd"); sd_notify(0, "READY=1"); #endif From 2b9d48791d0b5245e3ccfd267150dfa34541c87c Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Wed, 7 Jan 2015 12:43:21 +0100 Subject: [PATCH 113/120] Enlarge the buffer for a line in a bw file --- changes/bug14125 | 5 +++++ src/or/dirserv.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changes/bug14125 diff --git a/changes/bug14125 b/changes/bug14125 new file mode 100644 index 0000000000..fe6821a332 --- /dev/null +++ b/changes/bug14125 @@ -0,0 +1,5 @@ + o Minor bugfixes (dirauth): + - Enlarge the buffer to read bw-auth generated files to avoid an + issue when parsing the file in dirserv_read_measured_bandwidths(). + Bugfix on 0.2.2.1-alpha, fixes #14125. + diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 49fafafab2..03b32cb2f3 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2487,7 +2487,7 @@ int dirserv_read_measured_bandwidths(const char *from_file, smartlist_t *routerstatuses) { - char line[256]; + char line[512]; FILE *fp = tor_fopen_cloexec(from_file, "r"); int applied_lines = 0; time_t file_time, now; From 7984fc153112baa5c370215f2205025a7648d7b4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 18 Jul 2013 23:45:40 -0400 Subject: [PATCH 114/120] Stop accepting milliseconds in various directory contexts Have clients and authorities both have new behavior, since the fix for bug 11243 has gone in. But make clients still accept accept old bogus HSDir descriptors, to avoid fingerprinting trickery. Fixes bug 9286. --- changes/bug9286 | 4 ++++ src/common/util.c | 23 ++++++++++++++++++----- src/common/util.h | 1 + src/or/rendcommon.c | 6 +++--- src/or/routerparse.c | 10 ++++++++-- src/or/routerparse.h | 3 ++- src/test/test.c | 12 ++++++------ src/test/test_util.c | 16 +++++++++------- 8 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 changes/bug9286 diff --git a/changes/bug9286 b/changes/bug9286 new file mode 100644 index 0000000000..062a7a03f3 --- /dev/null +++ b/changes/bug9286 @@ -0,0 +1,4 @@ + o Minor bugfixes (parsing): + - Stop accepting milliseconds (or other junk) at the end of + descriptor publication times. Fixes bug 9286; bugfix on + 0.0.2pre25. \ No newline at end of file diff --git a/src/common/util.c b/src/common/util.c index 50097dac93..481f96bb0f 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1656,15 +1656,18 @@ format_iso_time_nospace_usec(char *buf, const struct timeval *tv) /** Given an ISO-formatted UTC time value (after the epoch) in cp, * parse it and store its value in *t. Return 0 on success, -1 on - * failure. Ignore extraneous stuff in cp separated by whitespace from - * the end of the time string. */ + * failure. Ignore extraneous stuff in cp after the end of the time + * string, unless strict is set. */ int -parse_iso_time(const char *cp, time_t *t) +parse_iso_time_(const char *cp, time_t *t, int strict) { struct tm st_tm; unsigned int year=0, month=0, day=0, hour=0, minute=0, second=0; - if (tor_sscanf(cp, "%u-%2u-%2u %2u:%2u:%2u", &year, &month, - &day, &hour, &minute, &second) < 6) { + int n_fields; + char extra_char; + n_fields = tor_sscanf(cp, "%u-%2u-%2u %2u:%2u:%2u%c", &year, &month, + &day, &hour, &minute, &second, &extra_char); + if (strict ? (n_fields != 6) : (n_fields < 6)) { char *esc = esc_for_log(cp); log_warn(LD_GENERAL, "ISO time %s was unparseable", esc); tor_free(esc); @@ -1693,6 +1696,16 @@ parse_iso_time(const char *cp, time_t *t) return tor_timegm(&st_tm, t); } +/** Given an ISO-formatted UTC time value (after the epoch) in cp, + * parse it and store its value in *t. Return 0 on success, -1 on + * failure. Reject the string if any characters are present after the time. + */ +int +parse_iso_time(const char *cp, time_t *t) +{ + return parse_iso_time_(cp, t, 1); +} + /** Given a date in one of the three formats allowed by HTTP (ugh), * parse it into tm. Return 0 on success, negative on failure. */ int diff --git a/src/common/util.h b/src/common/util.h index 921dd79da0..a3a79a928d 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -270,6 +270,7 @@ void format_local_iso_time(char *buf, time_t t); void format_iso_time(char *buf, time_t t); void format_iso_time_nospace(char *buf, time_t t); void format_iso_time_nospace_usec(char *buf, const struct timeval *tv); +int parse_iso_time_(const char *cp, time_t *t, int strict); int parse_iso_time(const char *buf, time_t *t); int parse_http_time(const char *buf, struct tm *tm); int format_time_interval(char *out, size_t out_len, long interval); diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index df74b745a2..837bd2b5a1 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -411,7 +411,7 @@ rend_desc_v2_is_parsable(rend_encoded_v2_service_descriptor_t *desc) &test_intro_content, &test_intro_size, &test_encoded_size, - &test_next, desc->desc_str); + &test_next, desc->desc_str, 1); rend_service_descriptor_free(test_parsed); tor_free(test_intro_content); return (res >= 0); @@ -945,7 +945,7 @@ rend_cache_store_v2_desc_as_dir(const char *desc) } while (rend_parse_v2_service_descriptor(&parsed, desc_id, &intro_content, &intro_size, &encoded_size, - &next_desc, current_desc) >= 0) { + &next_desc, current_desc, 1) >= 0) { number_parsed++; /* We don't care about the introduction points. */ tor_free(intro_content); @@ -1084,7 +1084,7 @@ rend_cache_store_v2_desc_as_client(const char *desc, /* Parse the descriptor. */ if (rend_parse_v2_service_descriptor(&parsed, desc_id, &intro_content, &intro_size, &encoded_size, - &next_desc, desc) < 0) { + &next_desc, desc, 0) < 0) { log_warn(LD_REND, "Could not parse descriptor."); goto err; } diff --git a/src/or/routerparse.c b/src/or/routerparse.c index bc3b00226a..a944e35c22 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -4417,6 +4417,9 @@ sort_version_list(smartlist_t *versions, int remove_duplicates) * to *encoded_size_out, and a pointer to the possibly next * descriptor to *next_out; return 0 for success (including validation) * and -1 for failure. + * + * If as_hsdir is 1, we're parsing this as an HSDir, and we should + * be strict about time formats. */ int rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, @@ -4424,7 +4427,8 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, char **intro_points_encrypted_out, size_t *intro_points_encrypted_size_out, size_t *encoded_size_out, - const char **next_out, const char *desc) + const char **next_out, const char *desc, + int as_hsdir) { rend_service_descriptor_t *result = tor_malloc_zero(sizeof(rend_service_descriptor_t)); @@ -4438,6 +4442,8 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, char public_key_hash[DIGEST_LEN]; char test_desc_id[DIGEST_LEN]; memarea_t *area = NULL; + const int strict_time_fmt = as_hsdir; + tor_assert(desc); /* Check if desc starts correctly. */ if (strncmp(desc, "rendezvous-service-descriptor ", @@ -4532,7 +4538,7 @@ rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, * descriptor. */ tok = find_by_keyword(tokens, R_PUBLICATION_TIME); tor_assert(tok->n_args == 1); - if (parse_iso_time(tok->args[0], &result->timestamp) < 0) { + if (parse_iso_time_(tok->args[0], &result->timestamp, strict_time_fmt) < 0) { log_warn(LD_REND, "Invalid publication time: '%s'", tok->args[0]); goto err; } diff --git a/src/or/routerparse.h b/src/or/routerparse.h index e950548f8c..6629b6d4bc 100644 --- a/src/or/routerparse.h +++ b/src/or/routerparse.h @@ -73,7 +73,8 @@ int rend_parse_v2_service_descriptor(rend_service_descriptor_t **parsed_out, char **intro_points_encrypted_out, size_t *intro_points_encrypted_size_out, size_t *encoded_size_out, - const char **next_out, const char *desc); + const char **next_out, const char *desc, + int as_hsdir); int rend_decrypt_introduction_points(char **ipos_decrypted, size_t *ipos_decrypted_size, const char *descriptor_cookie, diff --git a/src/test/test.c b/src/test/test.c index 07901ab107..032a9d766e 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -696,12 +696,12 @@ test_rend_fns(void *arg) smartlist_get(descs, 0))->desc_id, OP_EQ, computed_desc_id, DIGEST_LEN); tt_assert(rend_parse_v2_service_descriptor(&parsed, parsed_desc_id, - &intro_points_encrypted, - &intro_points_size, - &encoded_size, - &next_desc, - ((rend_encoded_v2_service_descriptor_t *) - smartlist_get(descs, 0))->desc_str) == 0); + &intro_points_encrypted, + &intro_points_size, + &encoded_size, + &next_desc, + ((rend_encoded_v2_service_descriptor_t *) + smartlist_get(descs, 0))->desc_str, 1) == 0); tt_assert(parsed); tt_mem_op(((rend_encoded_v2_service_descriptor_t *) smartlist_get(descs, 0))->desc_id,OP_EQ, parsed_desc_id, DIGEST_LEN); diff --git a/src/test/test_util.c b/src/test/test_util.c index b952bb2596..94671f9430 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -589,15 +589,17 @@ test_util_time(void *arg) i = parse_iso_time("2004-8-4 0:48:22", &t_res); tt_int_op(0,OP_EQ, i); tt_int_op(t_res,OP_EQ, (time_t)1091580502UL); - tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-zz 99-99x99 GMT", &t_res)); - tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-32 00:00:00 GMT", &t_res)); - tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 24:00:00 GMT", &t_res)); - tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 23:60:00 GMT", &t_res)); - tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 23:59:62 GMT", &t_res)); - tt_int_op(-1,OP_EQ, parse_iso_time("1969-03-30 23:59:59 GMT", &t_res)); - tt_int_op(-1,OP_EQ, parse_iso_time("2011-00-30 23:59:59 GMT", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-zz 99-99x99", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-32 00:00:00", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 24:00:00", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 23:60:00", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 23:59:62", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("1969-03-30 23:59:59", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2011-00-30 23:59:59", &t_res)); tt_int_op(-1,OP_EQ, parse_iso_time("2147483647-08-29 14:00:00", &t_res)); tt_int_op(-1,OP_EQ, parse_iso_time("2011-03-30 23:59", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-04 00:48:22.100", &t_res)); + tt_int_op(-1,OP_EQ, parse_iso_time("2004-08-04 00:48:22XYZ", &t_res)); /* Test tor_gettimeofday */ From 79aaad952f4f43a7057c4162ae378d5bad28a77e Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 7 Jan 2015 10:09:09 -0500 Subject: [PATCH 115/120] appease "make check-spaces" --- src/or/circuitbuild.c | 2 +- src/test/test_config.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 0ad026b2d3..9620a23655 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2065,7 +2065,7 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state) /*XXXX025 use the using_as_guard flag to accomplish this.*/ if (options->UseEntryGuards && (!options->TestingTorNetwork || - smartlist_len(nodelist_get_list()) > smartlist_len(get_entry_guards()) + smartlist_len(nodelist_get_list()) > smartlist_len(get_entry_guards()) )) { SMARTLIST_FOREACH(get_entry_guards(), const entry_guard_t *, entry, { diff --git a/src/test/test_config.c b/src/test/test_config.c index 0b411e3354..fb8e4020dc 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1218,7 +1218,6 @@ test_config_resolve_my_address(void *arg) UNMOCK(tor_gethostname); tor_free(hostname_out); - /* * CASE 7: * We want resolve_my_address() to try and get network interface address via From e9463b04e7c396d4344dc658e0c9dae3bdfc15af Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 7 Jan 2015 11:52:24 -0500 Subject: [PATCH 116/120] Clarify why bug12985 is a thing --- changes/bug12985 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changes/bug12985 b/changes/bug12985 index dc14cdd375..636ae4d564 100644 --- a/changes/bug12985 +++ b/changes/bug12985 @@ -1,4 +1,5 @@ o Minor bugfixes (shutdown): - When shutting down, always call event_del() on lingering read or - write events before freeing them. Fixes bug 12985; bugfix on + write events before freeing them. Otherwise, we risk double-frees + or read-after-frees in event_base_free(). Fixes bug 12985; bugfix on 0.1.0.2-rc. From f8baa40c01917a6261dd6824097cee98e8ace514 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 7 Jan 2015 11:37:23 -0500 Subject: [PATCH 117/120] GETINFO bw-event-cache to get information on recent BW events Closes 14128; useful to regain functionality lost because of 13988. --- changes/ticket14128 | 5 +++++ src/or/control.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ src/or/control.h | 1 + 3 files changed, 56 insertions(+) create mode 100644 changes/ticket14128 diff --git a/changes/ticket14128 b/changes/ticket14128 new file mode 100644 index 0000000000..38b25fa7dc --- /dev/null +++ b/changes/ticket14128 @@ -0,0 +1,5 @@ + o Minor features (controller): + - New "GETINFO bw-event-cache" to get information about recent bandwidth + events. Closes ticket 14128. Useful for controllers to get recent + bandwidth history after the fix for 13988. + diff --git a/src/or/control.c b/src/or/control.c index 3dbaa1bdf2..9ff71c9541 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -1438,6 +1438,8 @@ getinfo_helper_misc(control_connection_t *conn, const char *question, (void) conn; if (!strcmp(question, "version")) { *answer = tor_strdup(get_version()); + } else if (!strcmp(question, "bw-event-cache")) { + *answer = get_bw_samples(); } else if (!strcmp(question, "config-file")) { *answer = tor_strdup(get_torrc_fname(0)); } else if (!strcmp(question, "config-defaults-file")) { @@ -2113,6 +2115,7 @@ typedef struct getinfo_item_t { * to answer them. */ static const getinfo_item_t getinfo_items[] = { ITEM("version", misc, "The current version of Tor."), + ITEM("bw-event-cache", misc, "Cached BW events for a short interval."), ITEM("config-file", misc, "Current location of the \"torrc\" file."), ITEM("config-defaults-file", misc, "Current location of the defaults file."), ITEM("config-text", misc, @@ -4155,11 +4158,29 @@ control_event_tb_empty(const char *bucket, uint32_t read_empty_time, return 0; } +/* about 5 minutes worth. */ +#define N_BW_EVENTS_TO_CACHE 300 +/* Index into cached_bw_events to next write. */ +static int next_measurement_idx = 0; +/* number of entries set in n_measurements */ +static int n_measurements = 0; +static struct cached_bw_event_s { + uint32_t n_read; + uint32_t n_written; +} cached_bw_events[N_BW_EVENTS_TO_CACHE]; + /** A second or more has elapsed: tell any interested control * connections how much bandwidth we used. */ int control_event_bandwidth_used(uint32_t n_read, uint32_t n_written) { + cached_bw_events[next_measurement_idx].n_read = n_read; + cached_bw_events[next_measurement_idx].n_written = n_written; + if (++next_measurement_idx == N_BW_EVENTS_TO_CACHE) + next_measurement_idx = 0; + if (n_measurements < N_BW_EVENTS_TO_CACHE) + ++n_measurements; + if (EVENT_IS_INTERESTING(EVENT_BANDWIDTH_USED)) { send_control_event(EVENT_BANDWIDTH_USED, ALL_FORMATS, "650 BW %lu %lu\r\n", @@ -4170,6 +4191,35 @@ control_event_bandwidth_used(uint32_t n_read, uint32_t n_written) return 0; } +STATIC char * +get_bw_samples(void) +{ + int i; + int idx = (next_measurement_idx + N_BW_EVENTS_TO_CACHE - n_measurements) + % N_BW_EVENTS_TO_CACHE; + tor_assert(0 <= idx && idx < N_BW_EVENTS_TO_CACHE); + + smartlist_t *elements = smartlist_new(); + + for (i = 0; i < n_measurements; ++i) { + tor_assert(0 <= idx && idx < N_BW_EVENTS_TO_CACHE); + const struct cached_bw_event_s *bwe = &cached_bw_events[idx]; + + smartlist_add_asprintf(elements, "%u,%u", + (unsigned)bwe->n_read, + (unsigned)bwe->n_written); + + idx = (idx + 1) % N_BW_EVENTS_TO_CACHE; + } + + char *result = smartlist_join_strings(elements, " ", 0, NULL); + + SMARTLIST_FOREACH(elements, char *, cp, tor_free(cp)); + smartlist_free(elements); + + return result; +} + /** Called when we are sending a log message to the controllers: suspend * sending further log messages to the controllers until we're done. Used by * CONN_LOG_PROTECT. */ diff --git a/src/or/control.h b/src/or/control.h index 0af09ae653..8c9f7bbdc9 100644 --- a/src/or/control.h +++ b/src/or/control.h @@ -203,6 +203,7 @@ void append_cell_stats_by_command(smartlist_t *event_parts, const uint64_t *number_to_include); void format_cell_stats(char **event_string, circuit_t *circ, cell_stats_t *cell_stats); +STATIC char *get_bw_samples(void); #endif #endif From 71f409606a686c3be2af22c1247e21b8781d98e6 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 7 Jan 2015 21:09:41 -0500 Subject: [PATCH 118/120] Unconfuse coverity when it sees the systemd headers --- src/or/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/or/main.c b/src/or/main.c index c925b7d593..9e5a916b16 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -76,6 +76,12 @@ #endif #ifdef HAVE_SYSTEMD +# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__) +/* Systemd's use of gcc's __INCLUDE_LEVEL__ extension macro appears to confuse + * Coverity. Here's a kludge to unconfuse it. + */ +# define __INCLUDE_LEVEL__ 2 +# endif #include #endif From 6f171003ce8e96e2138825d693e7293fd909956f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 8 Jan 2015 10:44:30 -0500 Subject: [PATCH 119/120] fix new mingw64 compilation warnings --- src/or/networkstatus.c | 3 ++- src/test/test_relaycell.c | 2 +- src/test/test_util.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index fdab03d05a..59ba1e6cb7 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -876,7 +876,8 @@ update_consensus_networkstatus_fetch_time_impl(time_t now, int flav) log_debug(LD_DIR, "fresh_until: %ld start: %ld " "dl_interval: %ld valid_until: %ld ", - c->fresh_until, start, dl_interval, c->valid_until); + (long)c->fresh_until, (long)start, dl_interval, + (long)c->valid_until); /* We must not try to replace c while it's still fresh: */ tor_assert(c->fresh_until < start); /* We must download the next one before c is invalid: */ diff --git a/src/test/test_relaycell.c b/src/test/test_relaycell.c index fafb5bbbea..28c8f4e8ef 100644 --- a/src/test/test_relaycell.c +++ b/src/test/test_relaycell.c @@ -104,7 +104,7 @@ test_relaycell_resolved(void *arg) tt_int_op(srm_answer_is_set, OP_EQ, 0); \ } \ tt_int_op(srm_ttl, OP_EQ, ttl); \ - tt_int_op(srm_expires, OP_EQ, expires); \ + tt_i64_op(srm_expires, OP_EQ, expires); \ } while (0) (void)arg; diff --git a/src/test/test_util.c b/src/test/test_util.c index 4891356820..15470e8efa 100644 --- a/src/test/test_util.c +++ b/src/test/test_util.c @@ -4851,7 +4851,7 @@ test_util_max_mem(void *arg) } else { /* You do not have a petabyte. */ #if SIZEOF_SIZE_T == SIZEOF_UINT64_T - tt_uint_op(memory1, OP_LT, (U64_LITERAL(1)<<50)); + tt_u64_op(memory1, OP_LT, (U64_LITERAL(1)<<50)); #endif } From 33df3e37ffecfed309a1a0f210a96620c0ebb837 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 9 Jan 2015 08:50:56 -0500 Subject: [PATCH 120/120] Allow two ISO times to appear in EntryGuardDownSince. When I made time parsing more strict, I broke the EntryGuardDownSince line, which relied on two concatenated ISO times being parsed as a single time. Fixes bug 14136. Bugfix on 7984fc153112baa5. Bug not in any released version of Tor. --- src/or/entrynodes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 9eb0efd670..968a993999 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -1319,7 +1319,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg) "EntryGuardDownSince/UnlistedSince without EntryGuard"); break; } - if (parse_iso_time(line->value, &when)<0) { + if (parse_iso_time_(line->value, &when, 0)<0) { *msg = tor_strdup("Unable to parse entry nodes: " "Bad time in EntryGuardDownSince/UnlistedSince"); break;