mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
if our clock jumps forward by 100 seconds or more, assume something
has gone wrong with our network and abandon all not-yet-used circs. svn:r3792
This commit is contained in:
parent
856ab90ca8
commit
4a497e5030
@ -469,6 +469,12 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void circuit_note_clock_jumped(int seconds_elapsed) {
|
||||
log_fn(LOG_NOTICE,"Your clock just jumped %d seconds forward; assuming established circuits no longer work.", seconds_elapsed);
|
||||
has_completed_circuit=0; /* so it'll log when it works again */
|
||||
circuit_mark_all_unused_circs();
|
||||
}
|
||||
|
||||
/** Take the 'extend' cell, pull out addr/port plus the onion skin. Make
|
||||
* sure we're connected to the next hop, and pass it the onion skin in
|
||||
* a create cell.
|
||||
|
@ -359,6 +359,19 @@ circuit_get_clean_open(uint8_t purpose, int need_uptime,
|
||||
return best;
|
||||
}
|
||||
|
||||
/** Go through the circuitlist; mark-for-close each circuit that starts
|
||||
* at us but has not yet been used. */
|
||||
void circuit_mark_all_unused_circs(void) {
|
||||
circuit_t *circ;
|
||||
|
||||
for (circ=global_circuitlist; circ; circ = circ->next) {
|
||||
if (CIRCUIT_IS_ORIGIN(circ) &&
|
||||
!circ->marked_for_close &&
|
||||
!circ->timestamp_dirty)
|
||||
circuit_mark_for_close(circ);
|
||||
}
|
||||
}
|
||||
|
||||
/** Mark <b>circ</b> to be closed next time we call
|
||||
* circuit_close_all_marked(). Do any cleanup needed:
|
||||
* - If state is onionskin_pending, remove circ from the onion_pending
|
||||
|
@ -892,8 +892,10 @@ static void second_elapsed_callback(int fd, short event, void *args)
|
||||
stats_prev_global_write_bucket = global_write_bucket;
|
||||
|
||||
/* if more than 10s have elapsed, probably the clock jumped: doesn't count. */
|
||||
if (seconds_elapsed < 10)
|
||||
if (seconds_elapsed < 100)
|
||||
stats_n_seconds_working += seconds_elapsed;
|
||||
else
|
||||
circuit_note_clock_jumped(seconds_elapsed);
|
||||
|
||||
assert_all_pending_dns_resolves_ok();
|
||||
run_scheduled_events(now.tv_sec);
|
||||
|
@ -1124,6 +1124,7 @@ circuit_t *circuit_establish_circuit(uint8_t purpose, const char *exit_digest,
|
||||
int need_uptime, int need_capacity, int internal);
|
||||
void circuit_n_conn_done(connection_t *or_conn, int status);
|
||||
int circuit_send_next_onion_skin(circuit_t *circ);
|
||||
void circuit_note_clock_jumped(int seconds_elapsed);
|
||||
int circuit_extend(cell_t *cell, circuit_t *circ);
|
||||
int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse);
|
||||
int circuit_finish_handshake(circuit_t *circ, char *reply);
|
||||
@ -1149,6 +1150,7 @@ circuit_t *circuit_get_next_by_pk_and_purpose(circuit_t *start,
|
||||
circuit_t *circuit_get_rendezvous(const char *cookie);
|
||||
circuit_t *circuit_get_clean_open(uint8_t purpose, int need_uptime,
|
||||
int need_capacity, int internal);
|
||||
void circuit_mark_all_unused_circs(void);
|
||||
int _circuit_mark_for_close(circuit_t *circ);
|
||||
|
||||
#define circuit_mark_for_close(c) \
|
||||
|
Loading…
Reference in New Issue
Block a user