[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] if our clock jumps forward by 100 seconds or more, assume s...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] if our clock jumps forward by 100 seconds or more, assume s...
- From: arma@xxxxxxxx (Roger Dingledine)
- Date: Sat, 19 Mar 2005 18:58:45 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Sat, 19 Mar 2005 18:59:06 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or
Modified Files:
circuitbuild.c circuitlist.c main.c or.h
Log Message:
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.
Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- circuitbuild.c 19 Mar 2005 23:04:15 -0000 1.88
+++ circuitbuild.c 19 Mar 2005 23:58:42 -0000 1.89
@@ -469,6 +469,12 @@
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.
Index: circuitlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitlist.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- circuitlist.c 17 Mar 2005 12:38:35 -0000 1.29
+++ circuitlist.c 19 Mar 2005 23:58:42 -0000 1.30
@@ -359,6 +359,19 @@
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
Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.462
retrieving revision 1.463
diff -u -d -r1.462 -r1.463
--- main.c 19 Mar 2005 23:04:15 -0000 1.462
+++ main.c 19 Mar 2005 23:58:42 -0000 1.463
@@ -892,8 +892,10 @@
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);
Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.561
retrieving revision 1.562
diff -u -d -r1.561 -r1.562
--- or.h 19 Mar 2005 06:57:15 -0000 1.561
+++ or.h 19 Mar 2005 23:58:42 -0000 1.562
@@ -1124,6 +1124,7 @@
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_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) \