diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-04-24 08:49:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-04-24 08:49:20 -0400 |
commit | e8886340762cbe3be306268dfe0003214b09ac07 (patch) | |
tree | 3e6c4900586be15735900b49171bfc5111588b20 /src | |
parent | 5c3639923fb3d7a1bfc7b38248001e67333fa35e (diff) | |
parent | c3e40a83618c91fe7ef004577b0cb140ac83e3d9 (diff) | |
download | tor-e8886340762cbe3be306268dfe0003214b09ac07.tar.gz tor-e8886340762cbe3be306268dfe0003214b09ac07.zip |
Merge remote-tracking branch 'public/bug23693_031_redux' into maint-0.3.1
Diffstat (limited to 'src')
-rw-r--r-- | src/or/config.c | 10 | ||||
-rw-r--r-- | src/or/main.c | 2 | ||||
-rw-r--r-- | src/or/router.c | 21 |
3 files changed, 24 insertions, 9 deletions
diff --git a/src/or/config.c b/src/or/config.c index 156ffc9dfb..cac4ce8125 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1941,9 +1941,16 @@ options_act(const or_options_t *old_options) if (transition_affects_workers) { log_info(LD_GENERAL, "Worker-related options changed. Rotating workers."); + const int server_mode_turned_on = + server_mode(options) && !server_mode(old_options); + const int dir_server_mode_turned_on = + dir_server_mode(options) && !dir_server_mode(old_options); - if (server_mode(options) && !server_mode(old_options)) { + if (server_mode_turned_on || dir_server_mode_turned_on) { cpu_init(); + } + + if (server_mode_turned_on) { ip_address_changed(0); if (have_completed_a_circuit() || !any_predicted_circuits(time(NULL))) inform_testing_reachability(); @@ -4494,6 +4501,7 @@ options_transition_affects_workers(const or_options_t *old_options, old_options->SafeLogging_ != new_options->SafeLogging_ || old_options->ClientOnly != new_options->ClientOnly || server_mode(old_options) != server_mode(new_options) || + dir_server_mode(old_options) != dir_server_mode(new_options) || public_server_mode(old_options) != public_server_mode(new_options) || !config_lines_eq(old_options->Logs, new_options->Logs) || old_options->LogMessageDomains != new_options->LogMessageDomains) diff --git a/src/or/main.c b/src/or/main.c index 197dfd4308..e9723cb0b7 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2487,7 +2487,7 @@ do_main_loop(void) now = time(NULL); directory_info_has_arrived(now, 1, 0); - if (server_mode(get_options())) { + if (server_mode(get_options()) || dir_server_mode(get_options())) { /* launch cpuworkers. Need to do this *after* we've read the onion key. */ cpu_init(); } diff --git a/src/or/router.c b/src/or/router.c index 55b58e5d11..f29ebbdf88 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -131,7 +131,8 @@ get_onion_key(void) } /** Store a full copy of the current onion key into *<b>key</b>, and a full - * copy of the most recent onion key into *<b>last</b>. + * copy of the most recent onion key into *<b>last</b>. Store NULL into + * a pointer if the corresponding key does not exist. */ void dup_onion_keys(crypto_pk_t **key, crypto_pk_t **last) @@ -139,8 +140,10 @@ dup_onion_keys(crypto_pk_t **key, crypto_pk_t **last) tor_assert(key); tor_assert(last); tor_mutex_acquire(key_lock); - tor_assert(onionkey); - *key = crypto_pk_copy_full(onionkey); + if (onionkey) + *key = crypto_pk_copy_full(onionkey); + else + *last = NULL; if (lastonionkey) *last = crypto_pk_copy_full(lastonionkey); else @@ -207,10 +210,14 @@ construct_ntor_key_map(void) { di_digest256_map_t *m = NULL; - dimap_add_entry(&m, - curve25519_onion_key.pubkey.public_key, - tor_memdup(&curve25519_onion_key, - sizeof(curve25519_keypair_t))); + if (!tor_mem_is_zero((const char*) + curve25519_onion_key.pubkey.public_key, + CURVE25519_PUBKEY_LEN)) { + dimap_add_entry(&m, + curve25519_onion_key.pubkey.public_key, + tor_memdup(&curve25519_onion_key, + sizeof(curve25519_keypair_t))); + } if (!tor_mem_is_zero((const char*) last_curve25519_onion_key.pubkey.public_key, CURVE25519_PUBKEY_LEN)) { |