[or-cvs] more log uncluttering
arma at seul.org
arma at seul.org
Mon Oct 17 01:29:31 UTC 2005
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
circuitbuild.c connection.c connection_or.c main.c relay.c
Log Message:
more log uncluttering
Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- circuitbuild.c 12 Oct 2005 19:08:48 -0000 1.149
+++ circuitbuild.c 17 Oct 2005 01:29:27 -0000 1.150
@@ -599,8 +599,9 @@
}
/** 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.
+ * sure we're connected to the next hop, and pass it the onion skin using
+ * a create cell. Return -1 if we want to warn and tear down the circuit,
+ * else return 0.
*/
int
circuit_extend(cell_t *cell, circuit_t *circ)
@@ -611,14 +612,14 @@
char *id_digest=NULL;
if (circ->n_conn) {
- log_fn(LOG_WARN,"n_conn already set. Bug/attack. Closing.");
+ log_fn(LOG_PROTOCOL_WARN,"n_conn already set. Bug/attack. Closing.");
return -1;
}
relay_header_unpack(&rh, cell->payload);
if (rh.length < 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) {
- log_fn(LOG_WARN, "Wrong length %d on extend cell. Closing circuit.", rh.length);
+ log_fn(LOG_PROTOCOL_WARN, "Wrong length %d on extend cell. Closing circuit.", rh.length);
return -1;
}
@@ -654,7 +655,8 @@
n_conn = connection_or_connect(circ->n_addr, circ->n_port, id_digest);
if (!n_conn) {
log_fn(LOG_INFO,"Launching n_conn failed. Closing.");
- return -1;
+ circuit_mark_for_close(circ);
+ return 0;
}
log_fn(LOG_DEBUG,"connecting in progress (or finished). Good.");
}
Index: connection.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.408
retrieving revision 1.409
diff -u -d -r1.408 -r1.409
--- connection.c 7 Oct 2005 19:49:48 -0000 1.408
+++ connection.c 17 Oct 2005 01:29:27 -0000 1.409
@@ -458,7 +458,13 @@
if (conn->hold_open_until_flushed) {
tor_assert(conn->marked_for_close);
if (now - conn->timestamp_lastwritten >= 15) {
- log_fn(LOG_NOTICE,"Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %s).",
+ int severity;
+ if (conn->type == CONN_TYPE_EXIT ||
+ (conn->type == CONN_TYPE_DIR && conn->purpose == DIR_PURPOSE_SERVER))
+ severity = LOG_INFO;
+ else
+ severity = LOG_NOTICE;
+ log_fn(severity, "Giving up on marked_for_close conn that's been flushing for 15s (fd %d, type %s, state %s).",
conn->s, conn_type_to_string(conn->type),
conn_state_to_string(conn->type, conn->state));
conn->hold_open_until_flushed = 0;
Index: connection_or.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_or.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- connection_or.c 17 Oct 2005 00:35:53 -0000 1.191
+++ connection_or.c 17 Oct 2005 01:29:28 -0000 1.192
@@ -463,8 +463,7 @@
crypto_pk_env_t *identity_rcvd=NULL;
char nickname[MAX_NICKNAME_LEN+1];
or_options_t *options = get_options();
- int severity = (authdir_mode(options) || !server_mode(options))
- ? LOG_WARN : LOG_INFO;
+ int severity = server_mode(options) ? LOG_PROTOCOL_WARN : LOG_WARN;
check_no_tls_errors();
if (! tor_tls_peer_has_cert(conn->tls)) {
@@ -473,7 +472,7 @@
}
check_no_tls_errors();
if (tor_tls_get_peer_cert_nickname(conn->tls, nickname, sizeof(nickname))) {
- log_fn(LOG_WARN,"Other side (%s:%d) has a cert without a valid nickname. Closing.",
+ log_fn(severity,"Other side (%s:%d) has a cert without a valid nickname. Closing.",
conn->address, conn->port);
return -1;
}
@@ -482,7 +481,7 @@
conn->address, conn->port, nickname);
if (tor_tls_verify(severity, conn->tls, &identity_rcvd) < 0) {
- log_fn(LOG_WARN,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.",
+ log_fn(severity,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.",
nickname, conn->address, conn->port);
return -1;
}
Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.579
retrieving revision 1.580
diff -u -d -r1.579 -r1.580
--- main.c 17 Oct 2005 00:35:53 -0000 1.579
+++ main.c 17 Oct 2005 01:29:28 -0000 1.580
@@ -619,7 +619,7 @@
} else if (
now >= conn->timestamp_lastempty + options->KeepalivePeriod*10 &&
now >= conn->timestamp_lastwritten + options->KeepalivePeriod*10) {
- log_fn(LOG_NOTICE,"Expiring stuck OR connection to fd %d (%s:%d). (%d bytes to flush; %d seconds since last write)",
+ log_fn(LOG_PROTOCOL_WARN,"Expiring stuck OR connection to fd %d (%s:%d). (%d bytes to flush; %d seconds since last write)",
conn->s, conn->address, conn->port,
(int)buf_datalen(conn->outbuf),
(int)(now-conn->timestamp_lastwritten));
Index: relay.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/relay.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- relay.c 17 Oct 2005 00:35:53 -0000 1.82
+++ relay.c 17 Oct 2005 01:29:28 -0000 1.83
@@ -157,7 +157,7 @@
++stats_n_relay_cells_delivered;
log_fn(LOG_DEBUG,"Sending away from origin.");
if (connection_edge_process_relay_cell(cell, circ, conn, NULL) < 0) {
- log_fn(LOG_WARN,"connection_edge_process_relay_cell (away from origin) failed.");
+ log_fn(LOG_PROTOCOL_WARN,"connection_edge_process_relay_cell (away from origin) failed.");
return -1;
}
}
@@ -808,7 +808,7 @@
* If <b>layer_hint</b> is defined, then we're the origin of the
* circuit, and it specifies the hop that packaged <b>cell</b>.
*
- * Return -1 if you want to tear down the circuit, else 0.
+ * Return -1 if you want to warn and tear down the circuit, else 0.
*/
static int
connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
@@ -858,8 +858,10 @@
++stats_n_data_cells_received;
if (( layer_hint && --layer_hint->deliver_window < 0) ||
(!layer_hint && --circ->deliver_window < 0)) {
- log_fn(LOG_WARN,"(relay data) circ deliver_window below 0. Killing.");
- connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL, conn->cpath_layer);
+ log_fn(LOG_PROTOCOL_WARN,
+ "(relay data) circ deliver_window below 0. Killing.");
+ connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL,
+ conn->cpath_layer);
connection_mark_for_close(conn);
return -1;
}
@@ -874,7 +876,8 @@
}
if (--conn->deliver_window < 0) { /* is it below 0 after decrement? */
- log_fn(LOG_WARN,"(relay data) conn deliver_window below 0. Killing.");
+ log_fn(LOG_PROTOCOL_WARN,
+ "(relay data) conn deliver_window below 0. Killing.");
return -1; /* somebody's breaking protocol. kill the whole circuit. */
}
@@ -962,7 +965,8 @@
return 0;
case RELAY_COMMAND_CONNECTED:
if (conn) {
- log_fn(LOG_WARN,"'connected' unsupported while open. Closing circ.");
+ log_fn(LOG_PROTOCOL_WARN,
+ "'connected' unsupported while open. Closing circ.");
return -1;
}
log_fn(LOG_INFO,"'connected' received, no conn attached anymore. Ignoring.");
More information about the tor-commits
mailing list