summaryrefslogtreecommitdiff
path: root/src/feature/dircache
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2020-01-29 07:31:19 -0500
committerteor <teor@torproject.org>2020-02-18 12:44:41 +1000
commitacb5b0d535dae67b6a85780b4ae54bcf415e79fc (patch)
tree052025c0802a26bc5d059d32accc29f86fa44d63 /src/feature/dircache
parentf231827946764c664fbfe7c8ddef2b88d7b6f105 (diff)
downloadtor-acb5b0d535dae67b6a85780b4ae54bcf415e79fc.tar.gz
tor-acb5b0d535dae67b6a85780b4ae54bcf415e79fc.zip
Don't accept posted votes after :52:30
If we receive via 'post' a vote from a dir auth after the fetch_missing_votes cutoff, that means we didn't get it by the time we begin the "fetching missing votes from everybody else" phase, which means it is very likely to cause a consensus split if we count it. Instead, we reject it. But we still allow votes that we fetch ourselves after that cutoff. This is a demo branch for making progress on #4631. I've been running it on moria1 and it catches and handles real buggy behavior from directory authorities, e.g. Jan 28 15:59:50.804 [warn] Rejecting vote from 199.58.81.140 received at 2020-01-28 20:59:50; our cutoff for received votes is 2020-01-28 20:52:30 Jan 28 15:59:50.805 [warn] Rejected vote from 199.58.81.140 ("Vote received too late, would be dangerous to count it"). Jan 29 01:52:52.667 [warn] Rejecting vote from 204.13.164.118 received at 2020-01-29 06:52:52; our cutoff for received votes is 2020-01-29 06:52:30 Jan 29 01:52:52.669 [warn] Rejected vote from 204.13.164.118 ("Vote received too late, would be dangerous to count it"). Jan 29 04:53:26.323 [warn] Rejecting vote from 204.13.164.118 received at 2020-01-29 09:53:26; our cutoff for received votes is 2020-01-29 09:52:30 Jan 29 04:53:26.326 [warn] Rejected vote from 204.13.164.118 ("Vote received too late, would be dangerous to count it").
Diffstat (limited to 'src/feature/dircache')
-rw-r--r--src/feature/dircache/dircache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c
index ef7054001e..9e1794272e 100644
--- a/src/feature/dircache/dircache.c
+++ b/src/feature/dircache/dircache.c
@@ -1696,7 +1696,7 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
!strcmp(url,"/tor/post/vote")) { /* v3 networkstatus vote */
const char *msg = "OK";
int status;
- if (dirvote_add_vote(body, &msg, &status)) {
+ if (dirvote_add_vote(body, approx_time(), &msg, &status)) {
write_short_http_response(conn, status, "Vote stored");
} else {
tor_assert(msg);