diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-13 09:57:10 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-13 09:57:10 -0400 |
commit | 1c80eb92fa6c5240b1029c5ee1febe2d20b7d882 (patch) | |
tree | 308dd10ec350e5a35b6b2c36b075979c1d6f119e | |
parent | bbbb5f39bed9412b7b27b903fc1939b7774fb1b0 (diff) | |
parent | ff70cc84f8b00e710171bc988ababc9fe1be88e9 (diff) | |
download | tor-1c80eb92fa6c5240b1029c5ee1febe2d20b7d882.tar.gz tor-1c80eb92fa6c5240b1029c5ee1febe2d20b7d882.zip |
Merge branch 'maint-0.3.2' into maint-0.3.3
-rw-r--r-- | changes/bug25686_diagnostic | 4 | ||||
-rw-r--r-- | src/or/directory.c | 5 | ||||
-rw-r--r-- | src/or/router.c | 8 |
3 files changed, 14 insertions, 3 deletions
diff --git a/changes/bug25686_diagnostic b/changes/bug25686_diagnostic new file mode 100644 index 0000000000..96323145d8 --- /dev/null +++ b/changes/bug25686_diagnostic @@ -0,0 +1,4 @@ + o Minor features (relay, diagnostic): + - Add several checks to detect whether Tor relays are uploading their + descriptors without specifying why they regenerated. Diagnostic for + ticket 25686. diff --git a/src/or/directory.c b/src/or/directory.c index 29d091af38..0004878cdb 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1811,9 +1811,10 @@ directory_send_command(dir_connection_t *conn, tor_assert(payload); httpcommand = "POST"; url = tor_strdup("/tor/"); - if (why) { - smartlist_add_asprintf(headers, "X-Desc-Gen-Reason: %s\r\n", why); + if (!why) { + why = "for no reason at all"; } + smartlist_add_asprintf(headers, "X-Desc-Gen-Reason: %s\r\n", why); break; } case DIR_PURPOSE_UPLOAD_VOTE: diff --git a/src/or/router.c b/src/or/router.c index 39b07c52ef..92c0ec6711 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1853,7 +1853,7 @@ static routerinfo_t *desc_routerinfo = NULL; static extrainfo_t *desc_extrainfo = NULL; /** Why did we most recently decide to regenerate our descriptor? Used to * tell the authorities why we're sending it to them. */ -static const char *desc_gen_reason = NULL; +static const char *desc_gen_reason = "uninitialized reason"; /** Since when has our descriptor been "clean"? 0 if we need to regenerate it * now. */ static time_t desc_clean_since = 0; @@ -2441,6 +2441,9 @@ router_rebuild_descriptor(int force) desc_clean_since = time(NULL); desc_needs_upload = 1; desc_gen_reason = desc_dirty_reason; + if (BUG(desc_gen_reason == NULL)) { + desc_gen_reason = "descriptor was marked dirty earlier, for no reason."; + } desc_dirty_reason = NULL; control_event_my_descriptor_changed(); return 0; @@ -2497,6 +2500,9 @@ void mark_my_descriptor_dirty(const char *reason) { const or_options_t *options = get_options(); + if (BUG(reason == NULL)) { + reason = "marked descriptor dirty for unspecified reason"; + } if (server_mode(options) && options->PublishServerDescriptor_) log_info(LD_OR, "Decided to publish new relay descriptor: %s", reason); desc_clean_since = 0; |