diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-09-17 18:05:48 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-09-20 11:00:27 -0400 |
commit | f8b44eedf725cadb15c3a0ad1bc5a0fa1dbbc21d (patch) | |
tree | c6f99d0d664da350fbb2c774f483887288f178ca /src/or/rendclient.c | |
parent | 1d0ba9a61f0bc30209a8eae48b863241044b6b23 (diff) | |
download | tor-f8b44eedf725cadb15c3a0ad1bc5a0fa1dbbc21d.tar.gz tor-f8b44eedf725cadb15c3a0ad1bc5a0fa1dbbc21d.zip |
Get ready to stop sending timestamps in INTRODUCE cells
For now, round down to the nearest 10 minutes. Later, eliminate entirely by
setting a consensus parameter.
(This rounding is safe because, in 0.2.2, where the timestamp mattered,
REND_REPLAY_TIME_INTERVAL was a nice generous 60 minutes.)
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r-- | src/or/rendclient.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 7115bf2080..9d48b9ce99 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -16,6 +16,7 @@ #include "connection_edge.h" #include "directory.h" #include "main.h" +#include "networkstatus.h" #include "nodelist.h" #include "relay.h" #include "rendclient.h" @@ -127,6 +128,16 @@ rend_client_reextend_intro_circuit(origin_circuit_t *circ) return result; } +/** Return true iff we should send timestamps in our INTRODUCE1 cells */ +static int +rend_client_should_send_timestamp(void) +{ + if (get_options()->Support022HiddenServices >= 0) + return get_options()->Support022HiddenServices; + + return networkstatus_get_param(NULL, "Support022HiddenServices", 1, 0, 1); +} + /** Called when we're trying to connect an ap conn; sends an INTRODUCE1 cell * down introcirc if possible. */ @@ -238,7 +249,14 @@ rend_client_send_introduction(origin_circuit_t *introcirc, REND_DESC_COOKIE_LEN); v3_shift += 2+REND_DESC_COOKIE_LEN; } - set_uint32(tmp+v3_shift+1, htonl((uint32_t)time(NULL))); + if (rend_client_should_send_timestamp()) { + time_t now = (uint32_t)time(NULL); + now += 300; + now -= now % 600; + set_uint32(tmp+v3_shift+1, htonl(now)); + } else { + set_uint32(tmp+v3_shift+1, 0); + } v3_shift += 4; } /* if version 2 only write version number */ else if (entry->parsed->protocols & (1<<2)) { |