mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
when we changed from log_fn to debug/info/notice/warn/err,
we screwed up the formatting in wild and unpredictable ways. fix it before it becomes convention to format logs in wild and unpredictable ways. still need to do src/common/ someday. svn:r5551
This commit is contained in:
parent
9b0a40ec78
commit
58366ffd24
@ -706,7 +706,8 @@ write_to_buf(const char *string, size_t string_len, buf_t *buf)
|
||||
/* assert_buf_ok(buf); */
|
||||
|
||||
if (buf_ensure_capacity(buf, buf->datalen+string_len)) {
|
||||
warn(LD_MM, "buflen too small, can't hold %d bytes.", (int)(buf->datalen+string_len));
|
||||
warn(LD_MM, "buflen too small, can't hold %d bytes.",
|
||||
(int)(buf->datalen+string_len));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -822,12 +823,13 @@ fetch_from_buf_http(buf_t *buf,
|
||||
debug(LD_HTTP,"headerlen %d, bodylen %d.", (int)headerlen, (int)bodylen);
|
||||
|
||||
if (max_headerlen <= headerlen) {
|
||||
warn(LD_HTTP,"headerlen %d larger than %d. Failing.", (int)headerlen,
|
||||
(int)max_headerlen-1);
|
||||
warn(LD_HTTP,"headerlen %d larger than %d. Failing.",
|
||||
(int)headerlen, (int)max_headerlen-1);
|
||||
return -1;
|
||||
}
|
||||
if (max_bodylen <= bodylen) {
|
||||
warn(LD_HTTP,"bodylen %d larger than %d. Failing.", (int)bodylen, (int)max_bodylen-1);
|
||||
warn(LD_HTTP,"bodylen %d larger than %d. Failing.",
|
||||
(int)bodylen, (int)max_bodylen-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -656,7 +656,9 @@ circuit_extend(cell_t *cell, circuit_t *circ)
|
||||
relay_header_unpack(&rh, cell->payload);
|
||||
|
||||
if (rh.length < 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,"Wrong length %d on extend cell. Closing circuit.", rh.length);
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Wrong length %d on extend cell. Closing circuit.",
|
||||
rh.length);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,8 @@ circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info,
|
||||
circuit_t *circ;
|
||||
circuit_t *best=NULL;
|
||||
|
||||
debug(LD_CIRC,"Hunting for a circ to cannibalize: purpose %d, uptime %d, capacity %d, internal %d", purpose, need_uptime, need_capacity, internal);
|
||||
debug(LD_CIRC,"Hunting for a circ to cannibalize: purpose %d, uptime %d, capacity %d, internal %d",
|
||||
purpose, need_uptime, need_capacity, internal);
|
||||
|
||||
for (circ=global_circuitlist; circ; circ = circ->next) {
|
||||
if (CIRCUIT_IS_ORIGIN(circ) &&
|
||||
|
@ -1181,7 +1181,10 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
|
||||
}
|
||||
|
||||
if (rendcirc && rendcirc->purpose == CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) {
|
||||
info(LD_REND,"pending-join circ %d already here, with intro ack. Stalling. (stream %d sec old)", rendcirc->n_circ_id, conn_age);
|
||||
info(LD_REND,
|
||||
"pending-join circ %d already here, with intro ack. "
|
||||
"Stalling. (stream %d sec old)",
|
||||
rendcirc->n_circ_id, conn_age);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,9 @@ connection_about_to_close_connection(connection_t *conn)
|
||||
|
||||
if (CONN_IS_EDGE(conn)) {
|
||||
if (!conn->has_sent_end) {
|
||||
warn(LD_BUG,"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?", conn->marked_for_close_file, conn->marked_for_close);
|
||||
warn(LD_BUG,
|
||||
"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?",
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
tor_fragile_assert();
|
||||
}
|
||||
}
|
||||
|
@ -815,7 +815,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
&body, &body_len, MAX_DIR_SIZE,
|
||||
allow_partial)) {
|
||||
case -1: /* overflow */
|
||||
warn(LD_PROTOCOL,"'fetch' response too large (server '%s:%d'). Closing.", conn->address, conn->port);
|
||||
warn(LD_PROTOCOL,"'fetch' response too large (server '%s:%d'). Closing.",
|
||||
conn->address, conn->port);
|
||||
return -1;
|
||||
case 0:
|
||||
info(LD_HTTP,"'fetch' response not all here, but we're at eof. Closing.");
|
||||
@ -825,7 +826,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
|
||||
if (parse_http_response(headers, &status_code, &date_header,
|
||||
&compression, &reason) < 0) {
|
||||
warn(LD_HTTP,"Unparseable headers (server '%s:%d'). Closing.", conn->address, conn->port);
|
||||
warn(LD_HTTP,"Unparseable headers (server '%s:%d'). Closing.",
|
||||
conn->address, conn->port);
|
||||
tor_free(body); tor_free(headers);
|
||||
return -1;
|
||||
}
|
||||
@ -1067,7 +1069,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
"tor-doc-server.html", reason, conn->address, conn->port);
|
||||
break;
|
||||
default:
|
||||
warn(LD_GENERAL,"http status %d (\"%s\") reason unexpected (server '%s:%d').", status_code, reason, conn->address, conn->port);
|
||||
warn(LD_GENERAL,"http status %d (\"%s\") reason unexpected (server '%s:%d').",
|
||||
status_code, reason, conn->address, conn->port);
|
||||
break;
|
||||
}
|
||||
/* return 0 in all cases, since we don't want to mark any
|
||||
@ -1097,7 +1100,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
warn(LD_REND,"http status 400 (\"%s\"). Dirserver didn't like our rendezvous query?", reason);
|
||||
break;
|
||||
default:
|
||||
warn(LD_REND,"http status %d (\"%s\") response unexpected (server '%s:%d').", status_code, reason, conn->address, conn->port);
|
||||
warn(LD_REND,"http status %d (\"%s\") response unexpected (server '%s:%d').",
|
||||
status_code, reason, conn->address, conn->port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1261,7 +1265,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
debug(LD_DIRSERV,"Dumping %sdirectory to client.",
|
||||
deflated?"deflated ":"");
|
||||
format_rfc1123_time(date, time(NULL));
|
||||
tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: %s\r\nContent-Encoding: %s\r\n\r\n",
|
||||
tor_snprintf(tmp, sizeof(tmp),
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: %s\r\nContent-Encoding: %s\r\n\r\n",
|
||||
date,
|
||||
(int)dlen,
|
||||
deflated?"application/octet-stream":"text/plain",
|
||||
@ -1285,7 +1291,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
}
|
||||
|
||||
format_rfc1123_time(date, time(NULL));
|
||||
tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: %s\r\nContent-Encoding: %s\r\n\r\n",
|
||||
tor_snprintf(tmp, sizeof(tmp),
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: %s\r\nContent-Encoding: %s\r\n\r\n",
|
||||
date,
|
||||
(int)dlen,
|
||||
deflated?"application/octet-stream":"text/plain",
|
||||
@ -1317,7 +1325,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
SMARTLIST_FOREACH(dir_objs, cached_dir_t *, d,
|
||||
dlen += deflated?d->dir_z_len:d->dir_len);
|
||||
format_rfc1123_time(date, time(NULL));
|
||||
tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: %s\r\nContent-Encoding: %s\r\n\r\n",
|
||||
tor_snprintf(tmp, sizeof(tmp),
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: %s\r\nContent-Encoding: %s\r\n\r\n",
|
||||
date,
|
||||
(int)dlen,
|
||||
deflated?"application/octet-stream":"text/plain",
|
||||
@ -1420,10 +1430,13 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
switch (rend_cache_lookup_desc(query, versioned?-1:0, &descp, &desc_len)) {
|
||||
case 1: /* valid */
|
||||
format_rfc1123_time(date, time(NULL));
|
||||
tor_snprintf(tmp, sizeof(tmp), "HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\nContent-Type: application/octet-stream\r\n\r\n",
|
||||
tor_snprintf(tmp, sizeof(tmp),
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: application/octet-stream\r\n\r\n",
|
||||
date,
|
||||
(int)desc_len); /* can't include descp here, because it's got nuls */
|
||||
(int)desc_len);
|
||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||
/* need to send descp separately, because it may include nuls */
|
||||
connection_write_to_buf(descp, desc_len, conn);
|
||||
break;
|
||||
case 0: /* well-formed but not present */
|
||||
|
@ -335,7 +335,9 @@ dirserv_get_status_impl(const char *fp, const char *nickname,
|
||||
return FP_NAMED; /* Right fingerprint. */
|
||||
} else {
|
||||
if (should_log)
|
||||
warn(LD_DIRSERV,"Mismatched fingerprint for '%s': expected '%s' got '%s'. ContactInfo '%s', platform '%s'.)",
|
||||
warn(LD_DIRSERV,
|
||||
"Mismatched fingerprint for '%s': expected '%s' got '%s'. "
|
||||
"ContactInfo '%s', platform '%s'.)",
|
||||
nickname, nn_ent->fingerprint, fp,
|
||||
contact ? contact : "",
|
||||
platform ? platform : "");
|
||||
|
@ -359,7 +359,8 @@ assign_to_dnsworker(connection_t *exitconn)
|
||||
}
|
||||
|
||||
debug(LD_EXIT,
|
||||
"Connection (fd %d) needs to resolve '%s'; assigning to DNSWorker (fd %d)",
|
||||
"Connection (fd %d) needs to resolve '%s'; assigning "
|
||||
"to DNSWorker (fd %d)",
|
||||
exitconn->s, safe_str(exitconn->address), dnsconn->s);
|
||||
|
||||
tor_free(dnsconn->address);
|
||||
|
@ -448,10 +448,11 @@ conn_close_if_marked(int i)
|
||||
int sz = connection_bucket_write_limit(conn);
|
||||
if (!conn->hold_open_until_flushed)
|
||||
info(LD_NET,
|
||||
"Conn (addr %s, fd %d, type %s, state %d) marked, but wants to flush %d bytes. "
|
||||
"(Marked at %s:%d)",
|
||||
"Conn (addr %s, fd %d, type %s, state %d) marked, but wants "
|
||||
"to flush %d bytes. (Marked at %s:%d)",
|
||||
conn->address, conn->s, conn_type_to_string(conn->type), conn->state,
|
||||
(int)conn->outbuf_flushlen, conn->marked_for_close_file, conn->marked_for_close);
|
||||
(int)conn->outbuf_flushlen,
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
if (connection_speaks_cells(conn)) {
|
||||
if (conn->state == OR_CONN_STATE_OPEN) {
|
||||
retval = flush_buf_tls(conn->tls, conn->outbuf, sz, &conn->outbuf_flushlen);
|
||||
|
@ -194,7 +194,8 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, int cell_direction)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"Didn't recognize cell, but circ stops here! Closing circ.");
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Didn't recognize cell, but circ stops here! Closing circ.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -241,7 +242,8 @@ relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
|
||||
tor_assert(circ->cpath);
|
||||
thishop = circ->cpath;
|
||||
if (thishop->state != CPATH_STATE_OPEN) {
|
||||
log_fn(LOG_PROTOCOL_WARN,LD_PROTOCOL,"Relay cell before first created cell? Closing.");
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Relay cell before first created cell? Closing.");
|
||||
return -1;
|
||||
}
|
||||
do { /* Remember: cpath is in forward order, that is, first hop first. */
|
||||
@ -1241,7 +1243,8 @@ circuit_consider_stop_edge_reading(circuit_t *circ, crypt_path_t *layer_hint)
|
||||
return 0;
|
||||
}
|
||||
/* else, layer hint is defined, use it */
|
||||
debug(domain,"considering layer_hint->package_window %d", layer_hint->package_window);
|
||||
debug(domain,"considering layer_hint->package_window %d",
|
||||
layer_hint->package_window);
|
||||
if (layer_hint->package_window <= 0) {
|
||||
debug(domain,"yes, at-origin. stopped.");
|
||||
for (conn = circ->n_streams; conn; conn=conn->next_stream)
|
||||
|
@ -1940,7 +1940,9 @@ router_set_networkstatus(const char *s, time_t arrived_at,
|
||||
smartlist_string_remove(requested_fingerprints, fp);
|
||||
} else {
|
||||
char *requested = smartlist_join_strings(requested_fingerprints," ",0,NULL);
|
||||
warn(LD_DIR, "We received a network status with a fingerprint (%s) that we never requested. (We asked for: %s.) Dropping.", fp, requested);
|
||||
warn(LD_DIR,
|
||||
"We received a network status with a fingerprint (%s) that we "
|
||||
"never requested. (We asked for: %s.) Dropping.", fp, requested);
|
||||
tor_free(requested);
|
||||
return 0;
|
||||
}
|
||||
|
@ -731,7 +731,9 @@ router_parse_entry_from_string(const char *s, const char *end)
|
||||
goto err;
|
||||
}
|
||||
if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) {
|
||||
warn(LD_DIR, "Unrecognized critical keyword '%s'; skipping descriptor. (It may be from another version of Tor.)",
|
||||
warn(LD_DIR,
|
||||
"Unrecognized critical keyword '%s'; skipping descriptor. "
|
||||
"(It may be from another version of Tor.)",
|
||||
tok->args[0]);
|
||||
goto err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user