clean up and downgrade some log messages

svn:r8727
This commit is contained in:
Roger Dingledine 2006-10-15 07:42:51 +00:00
parent 584d598e8a
commit 7d33c4b904
4 changed files with 42 additions and 27 deletions

View File

@ -1007,7 +1007,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req,
"Your application (using socks5 on port %d) is giving " "Your application (using socks5 on port %d) is giving "
"Tor only an IP address. Applications that do DNS resolves " "Tor only an IP address. Applications that do DNS resolves "
"themselves may leak information. Consider using Socks4A " "themselves may leak information. Consider using Socks4A "
"(e.g. via privoxy or socat) instead. For more information, " "(e.g. via privoxy or socat) instead. For more information, "
"please see http://wiki.noreply.org/noreply/TheOnionRouter/" "please see http://wiki.noreply.org/noreply/TheOnionRouter/"
"TorFAQ#SOCKSAndDNS.%s", req->port, "TorFAQ#SOCKSAndDNS.%s", req->port,
safe_socks ? " Rejecting." : ""); safe_socks ? " Rejecting." : "");

View File

@ -905,7 +905,8 @@ circuit_launch_by_nickname(uint8_t purpose, const char *exit_nickname,
if (exit_nickname) { if (exit_nickname) {
router = router_get_by_nickname(exit_nickname, 1); router = router_get_by_nickname(exit_nickname, 1);
if (!router) { if (!router) {
log_warn(LD_GENERAL, "No such OR as '%s'", exit_nickname); log_warn(LD_GENERAL, "Trying to launch circ by nickname, but "
"no such OR as '%s'", exit_nickname);
return NULL; return NULL;
} }
} }

View File

@ -202,7 +202,8 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource,
resource, NULL, 0); resource, NULL, 0);
else { else {
log_notice(LD_DIR, log_notice(LD_DIR,
"No running dirservers known. Will try again later. " "While fetching directory info, "
"no running dirservers known. Will try again later. "
"(purpose %d)", purpose); "(purpose %d)", purpose);
if (!purpose_is_private(purpose)) { if (!purpose_is_private(purpose)) {
/* remember we tried them all and failed. */ /* remember we tried them all and failed. */

View File

@ -286,7 +286,8 @@ relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
thishop = thishop->next; thishop = thishop->next;
} while (thishop != cpath && thishop->state == CPATH_STATE_OPEN); } while (thishop != cpath && thishop->state == CPATH_STATE_OPEN);
log_warn(LD_OR,"in-cell at client not recognized. Closing."); log_fn(LOG_PROTOCOL_WARN, LD_OR,
"Incoming cell at client not recognized. Closing.");
return -1; return -1;
} else { /* we're in the middle. Just one crypt. */ } else { /* we're in the middle. Just one crypt. */
if (relay_crypt_one_payload(TO_OR_CIRCUIT(circ)->p_crypto, if (relay_crypt_one_payload(TO_OR_CIRCUIT(circ)->p_crypto,
@ -529,7 +530,7 @@ connection_edge_end_reason_str(int reason)
{ {
switch (reason) { switch (reason) {
case -1: case -1:
log_warn(LD_PROTOCOL, log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"End cell arrived with length 0. Should be at least 1."); "End cell arrived with length 0. Should be at least 1.");
return "MALFORMED"; return "MALFORMED";
case END_STREAM_REASON_MISC: return "misc error"; case END_STREAM_REASON_MISC: return "misc error";
@ -545,7 +546,8 @@ connection_edge_end_reason_str(int reason)
case END_STREAM_REASON_CONNRESET: return "connection reset"; case END_STREAM_REASON_CONNRESET: return "connection reset";
case END_STREAM_REASON_TORPROTOCOL: return "Tor protocol error"; case END_STREAM_REASON_TORPROTOCOL: return "Tor protocol error";
default: default:
log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized.",reason); log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Reason for ending (%d) not recognized.",reason);
return "unknown"; return "unknown";
} }
} }
@ -589,8 +591,9 @@ connection_edge_end_reason_socks5_response(int reason)
case END_STREAM_REASON_NET_UNREACHABLE: case END_STREAM_REASON_NET_UNREACHABLE:
return SOCKS5_NET_UNREACHABLE; return SOCKS5_NET_UNREACHABLE;
default: default:
log_warn(LD_PROTOCOL,"Reason for ending (%d) not recognized; " log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"sending generic socks error.", reason); "Reason for ending (%d) not recognized; "
"sending generic socks error.", reason);
return SOCKS5_GENERAL_ERROR; return SOCKS5_GENERAL_ERROR;
} }
} }
@ -819,8 +822,8 @@ connection_edge_process_relay_cell_not_open(
rh->command == RELAY_COMMAND_CONNECTED) { rh->command == RELAY_COMMAND_CONNECTED) {
tor_assert(CIRCUIT_IS_ORIGIN(circ)); tor_assert(CIRCUIT_IS_ORIGIN(circ));
if (conn->_base.state != AP_CONN_STATE_CONNECT_WAIT) { if (conn->_base.state != AP_CONN_STATE_CONNECT_WAIT) {
log_warn(LD_APP,"Got 'connected' while not in state connect_wait. " log_fn(LOG_PROTOCOL_WARN, LD_APP,
"Dropping."); "Got 'connected' while not in state connect_wait. Dropping.");
return 0; return 0;
} }
// log_fn(LOG_INFO,"Connected! Notifying application."); // log_fn(LOG_INFO,"Connected! Notifying application.");
@ -862,15 +865,16 @@ connection_edge_process_relay_cell_not_open(
int ttl; int ttl;
int answer_len; int answer_len;
if (conn->_base.state != AP_CONN_STATE_RESOLVE_WAIT) { if (conn->_base.state != AP_CONN_STATE_RESOLVE_WAIT) {
log_warn(LD_APP,"Got a 'resolved' cell while not in state resolve_wait. " log_fn(LOG_PROTOCOL_WARN, LD_APP, "Got a 'resolved' cell while "
"Dropping."); "not in state resolve_wait. Dropping.");
return 0; return 0;
} }
tor_assert(conn->socks_request->command == SOCKS_COMMAND_RESOLVE || tor_assert(conn->socks_request->command == SOCKS_COMMAND_RESOLVE ||
conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR); conn->socks_request->command == SOCKS_COMMAND_RESOLVE_PTR);
answer_len = cell->payload[RELAY_HEADER_SIZE+1]; answer_len = cell->payload[RELAY_HEADER_SIZE+1];
if (rh->length < 2 || answer_len+2>rh->length) { if (rh->length < 2 || answer_len+2>rh->length) {
log_warn(LD_PROTOCOL, "Dropping malformed 'resolved' cell"); log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Dropping malformed 'resolved' cell");
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
return 0; return 0;
} }
@ -928,8 +932,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
log_debug(domain, "Now seen %d relay cells here.", num_seen); log_debug(domain, "Now seen %d relay cells here.", num_seen);
if (rh.length > RELAY_PAYLOAD_SIZE) { if (rh.length > RELAY_PAYLOAD_SIZE) {
log_warn(LD_PROTOCOL, log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Relay cell length field too long. Closing circuit."); "Relay cell length field too long. Closing circuit.");
return - END_CIRC_REASON_TORPROTOCOL; return - END_CIRC_REASON_TORPROTOCOL;
} }
@ -948,11 +952,13 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
case RELAY_COMMAND_BEGIN_DIR: case RELAY_COMMAND_BEGIN_DIR:
if (layer_hint && if (layer_hint &&
circ->purpose != CIRCUIT_PURPOSE_S_REND_JOINED) { circ->purpose != CIRCUIT_PURPOSE_S_REND_JOINED) {
log_warn(LD_APP,"relay begin request unsupported at AP. Dropping."); log_fn(LOG_PROTOCOL_WARN, LD_APP,
"Relay begin request unsupported at AP. Dropping.");
return 0; return 0;
} }
if (conn) { if (conn) {
log_warn(domain,"begin cell for known stream. Dropping."); log_fn(LOG_PROTOCOL_WARN, domain,
"Begin cell for known stream. Dropping.");
return 0; return 0;
} }
connection_exit_begin_conn(cell, circ); connection_exit_begin_conn(cell, circ);
@ -1016,14 +1022,15 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0; return 0;
case RELAY_COMMAND_EXTEND: case RELAY_COMMAND_EXTEND:
if (conn) { if (conn) {
log_warn(domain,"'extend' for non-zero stream. Dropping."); log_fn(LOG_PROTOCOL_WARN, domain,
"'extend' cell received for non-zero stream. Dropping.");
return 0; return 0;
} }
return circuit_extend(cell, circ); return circuit_extend(cell, circ);
case RELAY_COMMAND_EXTENDED: case RELAY_COMMAND_EXTENDED:
if (!layer_hint) { if (!layer_hint) {
log_warn(LD_PROTOCOL, log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"'extended' unsupported at non-origin. Dropping."); "'extended' unsupported at non-origin. Dropping.");
return 0; return 0;
} }
log_debug(domain,"Got an extended cell! Yay."); log_debug(domain,"Got an extended cell! Yay.");
@ -1040,7 +1047,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0; return 0;
case RELAY_COMMAND_TRUNCATE: case RELAY_COMMAND_TRUNCATE:
if (layer_hint) { if (layer_hint) {
log_warn(LD_APP,"'truncate' unsupported at origin. Dropping."); log_fn(LOG_PROTOCOL_WARN, LD_APP,
"'truncate' unsupported at origin. Dropping.");
return 0; return 0;
} }
if (circ->n_conn) { if (circ->n_conn) {
@ -1058,7 +1066,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0; return 0;
case RELAY_COMMAND_TRUNCATED: case RELAY_COMMAND_TRUNCATED:
if (!layer_hint) { if (!layer_hint) {
log_warn(LD_EXIT,"'truncated' unsupported at non-origin. Dropping."); log_fn(LOG_PROTOCOL_WARN, LD_EXIT,
"'truncated' unsupported at non-origin. Dropping.");
return 0; return 0;
} }
circuit_truncated(TO_ORIGIN_CIRCUIT(circ), layer_hint); circuit_truncated(TO_ORIGIN_CIRCUIT(circ), layer_hint);
@ -1101,21 +1110,25 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0; return 0;
case RELAY_COMMAND_RESOLVE: case RELAY_COMMAND_RESOLVE:
if (layer_hint) { if (layer_hint) {
log_warn(LD_APP,"resolve request unsupported at AP; dropping."); log_fn(LOG_PROTOCOL_WARN, LD_APP,
"resolve request unsupported at AP; dropping.");
return 0; return 0;
} else if (conn) { } else if (conn) {
log_warn(domain, "resolve request for known stream; dropping."); log_fn(LOG_PROTOCOL_WARN, domain,
"resolve request for known stream; dropping.");
return 0; return 0;
} else if (circ->purpose != CIRCUIT_PURPOSE_OR) { } else if (circ->purpose != CIRCUIT_PURPOSE_OR) {
log_warn(domain, "resolve request on circ with purpose %d; dropping", log_fn(LOG_PROTOCOL_WARN, domain,
circ->purpose); "resolve request on circ with purpose %d; dropping",
circ->purpose);
return 0; return 0;
} }
connection_exit_begin_resolve(cell, TO_OR_CIRCUIT(circ)); connection_exit_begin_resolve(cell, TO_OR_CIRCUIT(circ));
return 0; return 0;
case RELAY_COMMAND_RESOLVED: case RELAY_COMMAND_RESOLVED:
if (conn) { if (conn) {
log_warn(domain,"'resolved' unsupported while open. Closing circ."); log_fn(LOG_PROTOCOL_WARN, domain,
"'resolved' unsupported while open. Closing circ.");
return -END_CIRC_REASON_TORPROTOCOL; return -END_CIRC_REASON_TORPROTOCOL;
} }
log_info(domain, log_info(domain,