mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 13:13:44 +01:00
Use connection_describe() for log messages.
This commit is contained in:
parent
aa33b88778
commit
9d2867c396
@ -1736,8 +1736,8 @@ options_rollback_listener_transaction(listener_transaction_t *xn)
|
||||
|
||||
SMARTLIST_FOREACH(xn->new_listeners, connection_t *, conn,
|
||||
{
|
||||
log_notice(LD_NET, "Closing partially-constructed %s on %s:%d",
|
||||
conn_type_to_string(conn->type), conn->address, conn->port);
|
||||
log_notice(LD_NET, "Closing partially-constructed %s",
|
||||
connection_describe(conn));
|
||||
connection_close_immediate(conn);
|
||||
connection_mark_for_close(conn);
|
||||
});
|
||||
|
@ -338,15 +338,11 @@ dumpstats(int severity)
|
||||
SMARTLIST_FOREACH_BEGIN(get_connection_array(), connection_t *, conn) {
|
||||
int i = conn_sl_idx;
|
||||
tor_log(severity, LD_GENERAL,
|
||||
"Conn %d (socket %d) type %d (%s), state %d (%s), created %d secs ago",
|
||||
i, (int)conn->s, conn->type, conn_type_to_string(conn->type),
|
||||
conn->state, conn_state_to_string(conn->type, conn->state),
|
||||
"Conn %d (socket %d) is a %s, created %d secs ago",
|
||||
i, (int)conn->s,
|
||||
connection_describe(conn),
|
||||
(int)(now - conn->timestamp_created));
|
||||
if (!connection_is_listener(conn)) {
|
||||
tor_log(severity,LD_GENERAL,
|
||||
"Conn %d is to %s:%d.", i,
|
||||
safe_str_client(conn->address),
|
||||
conn->port);
|
||||
tor_log(severity,LD_GENERAL,
|
||||
"Conn %d: %d bytes waiting on inbuf (len %d, last read %d secs ago)",
|
||||
i,
|
||||
|
@ -1711,13 +1711,8 @@ connection_listener_new(const struct sockaddr *listensockaddr,
|
||||
*/
|
||||
connection_check_oos(get_n_open_sockets(), 0);
|
||||
|
||||
if (conn->socket_family == AF_UNIX) {
|
||||
log_notice(LD_NET, "Opened %s on %s",
|
||||
conn_type_to_string(type), conn->address);
|
||||
} else {
|
||||
log_notice(LD_NET, "Opened %s on %s",
|
||||
conn_type_to_string(type), fmt_addrport(&addr, gotPort));
|
||||
}
|
||||
log_notice(LD_NET, "Opened %s", connection_describe(conn));
|
||||
|
||||
return conn;
|
||||
|
||||
err:
|
||||
@ -2770,8 +2765,8 @@ connection_read_https_proxy_response(connection_t *conn)
|
||||
if (parse_http_response(headers, &status_code, &date_header,
|
||||
NULL, &reason) < 0) {
|
||||
log_warn(LD_NET,
|
||||
"Unparseable headers from proxy (connecting to '%s'). Closing.",
|
||||
conn->address);
|
||||
"Unparseable headers from proxy (%s). Closing.",
|
||||
connection_describe(conn));
|
||||
tor_free(headers);
|
||||
return -1;
|
||||
}
|
||||
@ -2780,8 +2775,8 @@ connection_read_https_proxy_response(connection_t *conn)
|
||||
|
||||
if (status_code == 200) {
|
||||
log_info(LD_NET,
|
||||
"HTTPS connect to '%s' successful! (200 %s) Starting TLS.",
|
||||
conn->address, escaped(reason));
|
||||
"HTTPS connect for %s successful! (200 %s) Starting TLS.",
|
||||
connection_describe(conn), escaped(reason));
|
||||
tor_free(reason);
|
||||
return 1;
|
||||
}
|
||||
@ -2997,16 +2992,16 @@ connection_read_proxy_handshake(connection_t *conn)
|
||||
|
||||
if (ret < 0) {
|
||||
if (reason) {
|
||||
log_warn(LD_NET, "Proxy Client: unable to connect to %s:%d (%s)",
|
||||
conn->address, conn->port, escaped(reason));
|
||||
log_warn(LD_NET, "Proxy Client: unable to connect %s (%s)",
|
||||
connection_describe(conn), escaped(reason));
|
||||
tor_free(reason);
|
||||
} else {
|
||||
log_warn(LD_NET, "Proxy Client: unable to connect to %s:%d",
|
||||
conn->address, conn->port);
|
||||
log_warn(LD_NET, "Proxy Client: unable to connect %s",
|
||||
connection_describe(conn));
|
||||
}
|
||||
} else if (ret == 1) {
|
||||
log_info(LD_NET, "Proxy Client: connection to %s:%d successful",
|
||||
conn->address, conn->port);
|
||||
log_info(LD_NET, "Proxy Client: %s successful",
|
||||
connection_describe(conn));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -3197,8 +3192,8 @@ retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol)
|
||||
connection_t *old_conn = r->old_conn;
|
||||
|
||||
if (skip) {
|
||||
log_debug(LD_NET, "Skipping creating new listener for %s:%d",
|
||||
old_conn->address, old_conn->port);
|
||||
log_debug(LD_NET, "Skipping creating new listener for %s",
|
||||
connection_describe(old_conn));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3214,10 +3209,11 @@ retry_all_listeners(smartlist_t *new_conns, int close_all_noncontrol)
|
||||
|
||||
smartlist_add(new_conns, new_conn);
|
||||
|
||||
log_notice(LD_NET, "Closed no-longer-configured %s on %s:%d "
|
||||
"(replaced by %s:%d)",
|
||||
conn_type_to_string(old_conn->type), old_conn->address,
|
||||
old_conn->port, new_conn->address, new_conn->port);
|
||||
char *old_desc = tor_strdup(connection_describe(old_conn));
|
||||
log_notice(LD_NET, "Closed no-longer-configured %s "
|
||||
"(replaced by %s)",
|
||||
old_desc, connection_describe(new_conn));
|
||||
tor_free(old_desc);
|
||||
} SMARTLIST_FOREACH_END(r);
|
||||
#endif /* defined(ENABLE_LISTENER_REBIND) */
|
||||
|
||||
@ -4025,17 +4021,14 @@ connection_buf_read_from_socket(connection_t *conn, ssize_t *max_to_read,
|
||||
switch (result) {
|
||||
case TOR_TLS_CLOSE:
|
||||
case TOR_TLS_ERROR_IO:
|
||||
log_debug(LD_NET,"TLS connection closed %son read. Closing. "
|
||||
"(Nickname %s, address %s)",
|
||||
result == TOR_TLS_CLOSE ? "cleanly " : "",
|
||||
or_conn->nickname ? or_conn->nickname : "not set",
|
||||
conn->address);
|
||||
log_debug(LD_NET,"TLS %s closed %son read. Closing.",
|
||||
connection_describe(conn),
|
||||
result == TOR_TLS_CLOSE ? "cleanly " : "");
|
||||
return result;
|
||||
CASE_TOR_TLS_ERROR_ANY_NONIO:
|
||||
log_debug(LD_NET,"tls error [%s]. breaking (nickname %s, address %s).",
|
||||
log_debug(LD_NET,"tls error [%s] from %s. Breaking.",
|
||||
tor_tls_err_to_string(result),
|
||||
or_conn->nickname ? or_conn->nickname : "not set",
|
||||
conn->address);
|
||||
connection_describe(conn));
|
||||
return result;
|
||||
case TOR_TLS_WANTWRITE:
|
||||
connection_start_writing(conn);
|
||||
@ -4888,7 +4881,7 @@ any_other_active_or_conns(const or_connection_t *this_conn)
|
||||
connection_t *conn = connection_get_another_active_or_conn(this_conn);
|
||||
if (conn != NULL) {
|
||||
log_debug(LD_DIR, "%s: Found an OR connection: %s",
|
||||
__func__, conn->address);
|
||||
__func__, connection_describe(conn));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1519,7 +1519,7 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
log_fn(LOG_WARN, LD_OR,
|
||||
"Negotiated link with non-2 protocol after doing a v2 TLS "
|
||||
"handshake with %s. Closing connection.",
|
||||
fmt_addr(&chan->conn->base_.addr));
|
||||
connection_describe_peer(TO_CONN(chan->conn)));
|
||||
connection_or_close_for_error(chan->conn, 0);
|
||||
return;
|
||||
}
|
||||
@ -1531,10 +1531,9 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
|
||||
if (chan->conn->link_proto == 2) {
|
||||
log_info(LD_OR,
|
||||
"Negotiated version %d with %s:%d; sending NETINFO.",
|
||||
"Negotiated version %d on %s; sending NETINFO.",
|
||||
highest_supported_version,
|
||||
safe_str_client(chan->conn->base_.address),
|
||||
chan->conn->base_.port);
|
||||
connection_describe(TO_CONN(chan->conn)));
|
||||
|
||||
if (connection_or_send_netinfo(chan->conn) < 0) {
|
||||
connection_or_close_for_error(chan->conn, 0);
|
||||
@ -1554,10 +1553,9 @@ channel_tls_process_versions_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
tor_assert(chan->conn->link_proto >= 3);
|
||||
|
||||
log_info(LD_OR,
|
||||
"Negotiated version %d with %s:%d; %s%s%s%s%s",
|
||||
"Negotiated version %d with on %s; %s%s%s%s%s",
|
||||
highest_supported_version,
|
||||
safe_str_client(chan->conn->base_.address),
|
||||
chan->conn->base_.port,
|
||||
connection_describe(TO_CONN(chan->conn)),
|
||||
send_any ? "Sending cells:" : "Waiting for CERTS cell",
|
||||
send_versions ? " VERSIONS" : "",
|
||||
send_certs ? " CERTS" : "",
|
||||
@ -1950,18 +1948,16 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
|
||||
|
||||
if (connection_or_set_state_open(chan->conn) < 0) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_OR,
|
||||
"Got good NETINFO cell from %s:%d; but "
|
||||
"Got good NETINFO cell on %s; but "
|
||||
"was unable to make the OR connection become open.",
|
||||
safe_str_client(chan->conn->base_.address),
|
||||
chan->conn->base_.port);
|
||||
connection_describe(TO_CONN(chan->conn)));
|
||||
connection_or_close_for_error(chan->conn, 0);
|
||||
} else {
|
||||
log_info(LD_OR,
|
||||
"Got good NETINFO cell from %s:%d; OR connection is now "
|
||||
"Got good NETINFO cell on %s; OR connection is now "
|
||||
"open, using protocol version %d. Its ID digest is %s. "
|
||||
"Our address is apparently %s.",
|
||||
safe_str_client(chan->conn->base_.address),
|
||||
chan->conn->base_.port,
|
||||
connection_describe(TO_CONN(chan->conn)),
|
||||
(int)(chan->conn->link_proto),
|
||||
hex_str(identity_digest, DIGEST_LEN),
|
||||
tor_addr_is_null(&my_apparent_addr) ?
|
||||
@ -2046,9 +2042,9 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
#define ERR(s) \
|
||||
do { \
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, \
|
||||
"Received a bad CERTS cell from %s:%d: %s", \
|
||||
safe_str(chan->conn->base_.address), \
|
||||
chan->conn->base_.port, (s)); \
|
||||
"Received a bad CERTS cell on %s: %s", \
|
||||
connection_describe(TO_CONN(chan->conn)), \
|
||||
(s)); \
|
||||
connection_or_close_for_error(chan->conn, 0); \
|
||||
goto err; \
|
||||
} while (0)
|
||||
@ -2096,9 +2092,8 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
tor_x509_cert_t *x509_cert = tor_x509_cert_decode(cert_body, cert_len);
|
||||
if (!x509_cert) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Received undecodable certificate in CERTS cell from %s:%d",
|
||||
safe_str(chan->conn->base_.address),
|
||||
chan->conn->base_.port);
|
||||
"Received undecodable certificate in CERTS cell on %s",
|
||||
connection_describe(TO_CONN(chan->conn)));
|
||||
} else {
|
||||
if (x509_certs[cert_type]) {
|
||||
tor_x509_cert_free(x509_cert);
|
||||
@ -2114,9 +2109,8 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
if (!ed_cert) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Received undecodable Ed certificate "
|
||||
"in CERTS cell from %s:%d",
|
||||
safe_str(chan->conn->base_.address),
|
||||
chan->conn->base_.port);
|
||||
"in CERTS cell on %s",
|
||||
connection_describe(TO_CONN(chan->conn)));
|
||||
} else {
|
||||
if (ed_certs[cert_type]) {
|
||||
tor_cert_free(ed_cert);
|
||||
@ -2226,9 +2220,9 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
ERR("Problem setting or checking peer id");
|
||||
|
||||
log_info(LD_HANDSHAKE,
|
||||
"Got some good certificates from %s:%d: Authenticated it with "
|
||||
"Got some good certificates on %s: Authenticated it with "
|
||||
"RSA%s",
|
||||
safe_str(chan->conn->base_.address), chan->conn->base_.port,
|
||||
connection_describe(TO_CONN(chan->conn)),
|
||||
checked_ed_id ? " and Ed25519" : "");
|
||||
|
||||
if (!public_server_mode(get_options())) {
|
||||
@ -2240,11 +2234,10 @@ channel_tls_process_certs_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
} else {
|
||||
/* We can't call it authenticated till we see an AUTHENTICATE cell. */
|
||||
log_info(LD_OR,
|
||||
"Got some good RSA%s certificates from %s:%d. "
|
||||
"Got some good RSA%s certificates on %s. "
|
||||
"Waiting for AUTHENTICATE.",
|
||||
checked_ed_id ? " and Ed25519" : "",
|
||||
safe_str(chan->conn->base_.address),
|
||||
chan->conn->base_.port);
|
||||
connection_describe(TO_CONN(chan->conn)));
|
||||
/* XXXX check more stuff? */
|
||||
}
|
||||
|
||||
@ -2293,9 +2286,9 @@ channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
#define ERR(s) \
|
||||
do { \
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, \
|
||||
"Received a bad AUTH_CHALLENGE cell from %s:%d: %s", \
|
||||
safe_str(chan->conn->base_.address), \
|
||||
chan->conn->base_.port, (s)); \
|
||||
"Received a bad AUTH_CHALLENGE cell on %s: %s", \
|
||||
connection_describe(TO_CONN(chan->conn)), \
|
||||
(s)); \
|
||||
connection_or_close_for_error(chan->conn, 0); \
|
||||
goto done; \
|
||||
} while (0)
|
||||
@ -2340,10 +2333,9 @@ channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
|
||||
if (use_type >= 0) {
|
||||
log_info(LD_OR,
|
||||
"Got an AUTH_CHALLENGE cell from %s:%d: Sending "
|
||||
"Got an AUTH_CHALLENGE cell on %s: Sending "
|
||||
"authentication type %d",
|
||||
safe_str(chan->conn->base_.address),
|
||||
chan->conn->base_.port,
|
||||
connection_describe(TO_CONN(chan->conn)),
|
||||
use_type);
|
||||
|
||||
if (connection_or_send_authenticate_cell(chan->conn, use_type) < 0) {
|
||||
@ -2354,10 +2346,9 @@ channel_tls_process_auth_challenge_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
}
|
||||
} else {
|
||||
log_info(LD_OR,
|
||||
"Got an AUTH_CHALLENGE cell from %s:%d, but we don't "
|
||||
"Got an AUTH_CHALLENGE cell on %s, but we don't "
|
||||
"know any of its authentication types. Not authenticating.",
|
||||
safe_str(chan->conn->base_.address),
|
||||
chan->conn->base_.port);
|
||||
connection_describe(TO_CONN(chan->conn)));
|
||||
}
|
||||
|
||||
if (connection_or_send_netinfo(chan->conn) < 0) {
|
||||
@ -2397,9 +2388,9 @@ channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
#define ERR(s) \
|
||||
do { \
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, \
|
||||
"Received a bad AUTHENTICATE cell from %s:%d: %s", \
|
||||
safe_str(chan->conn->base_.address), \
|
||||
chan->conn->base_.port, (s)); \
|
||||
"Received a bad AUTHENTICATE cell on %s: %s", \
|
||||
connection_describe(TO_CONN(chan->conn)), \
|
||||
(s)); \
|
||||
connection_or_close_for_error(chan->conn, 0); \
|
||||
var_cell_free(expected_cell); \
|
||||
return; \
|
||||
@ -2560,9 +2551,9 @@ channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
crypto_pk_free(identity_rcvd);
|
||||
|
||||
log_debug(LD_HANDSHAKE,
|
||||
"Calling connection_or_init_conn_from_address for %s "
|
||||
"Calling connection_or_init_conn_from_address on %s "
|
||||
" from %s, with%s ed25519 id.",
|
||||
safe_str(chan->conn->base_.address),
|
||||
connection_describe(TO_CONN(chan->conn)),
|
||||
__func__,
|
||||
ed_identity_received ? "" : "out");
|
||||
|
||||
@ -2575,10 +2566,9 @@ channel_tls_process_authenticate_cell(var_cell_t *cell, channel_tls_t *chan)
|
||||
0);
|
||||
|
||||
log_debug(LD_HANDSHAKE,
|
||||
"Got an AUTHENTICATE cell from %s:%d, type %d: Looks good.",
|
||||
safe_str(chan->conn->base_.address),
|
||||
chan->conn->base_.port,
|
||||
authtype);
|
||||
"Got an AUTHENTICATE cell on %s, type %d: Looks good.",
|
||||
connection_describe(TO_CONN(chan->conn)),
|
||||
authtype);
|
||||
}
|
||||
|
||||
var_cell_free(expected_cell);
|
||||
|
@ -424,9 +424,7 @@ warn_if_hs_unreachable(const edge_connection_t *conn, uint8_t reason)
|
||||
char *m;
|
||||
if ((m = rate_limit_log(&warn_limit, approx_time()))) {
|
||||
log_warn(LD_EDGE, "Onion service connection to %s failed (%s)",
|
||||
(conn->base_.socket_family == AF_UNIX) ?
|
||||
safe_str(conn->base_.address) :
|
||||
safe_str(fmt_addrport(&conn->base_.addr, conn->base_.port)),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
stream_end_reason_to_string(reason));
|
||||
tor_free(m);
|
||||
}
|
||||
@ -922,9 +920,8 @@ connection_edge_finished_connecting(edge_connection_t *edge_conn)
|
||||
conn = TO_CONN(edge_conn);
|
||||
tor_assert(conn->state == EXIT_CONN_STATE_CONNECTING);
|
||||
|
||||
log_info(LD_EXIT,"Exit connection to %s:%u (%s) established.",
|
||||
escaped_safe_str(conn->address), conn->port,
|
||||
safe_str(fmt_and_decorate_addr(&conn->addr)));
|
||||
log_info(LD_EXIT,"%s established.",
|
||||
connection_describe(conn));
|
||||
|
||||
rep_hist_note_exit_stream_opened(conn->port);
|
||||
|
||||
@ -3840,8 +3837,8 @@ handle_hs_exit_conn(circuit_t *circ, edge_connection_t *conn)
|
||||
return -1;
|
||||
}
|
||||
if (ret < 0) {
|
||||
log_info(LD_REND, "Didn't find rendezvous service (addr%s, port %d)",
|
||||
fmt_addr(&TO_CONN(conn)->addr), TO_CONN(conn)->port);
|
||||
log_info(LD_REND, "Didn't find rendezvous service at %s",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
/* Send back reason DONE because we want to make hidden service port
|
||||
* scanning harder thus instead of returning that the exit policy
|
||||
* didn't match, which makes it obvious that the port is closed,
|
||||
@ -4192,8 +4189,8 @@ connection_exit_connect(edge_connection_t *edge_conn)
|
||||
&why_failed_exit_policy)) {
|
||||
if (BUG(!why_failed_exit_policy))
|
||||
why_failed_exit_policy = "";
|
||||
log_info(LD_EXIT,"%s:%d failed exit policy%s. Closing.",
|
||||
escaped_safe_str_client(conn->address), conn->port,
|
||||
log_info(LD_EXIT,"%s failed exit policy%s. Closing.",
|
||||
connection_describe(conn),
|
||||
why_failed_exit_policy);
|
||||
connection_edge_end(edge_conn, END_STREAM_REASON_EXITPOLICY);
|
||||
circuit_detach_stream(circuit_get_by_edge_conn(edge_conn), edge_conn);
|
||||
|
@ -151,9 +151,9 @@ connection_or_set_identity_digest(or_connection_t *conn,
|
||||
if (conn->chan)
|
||||
chan = TLS_CHAN_TO_BASE(conn->chan);
|
||||
|
||||
log_info(LD_HANDSHAKE, "Set identity digest for %p (%s): %s %s.",
|
||||
log_info(LD_HANDSHAKE, "Set identity digest for %s at %p: %s %s.",
|
||||
connection_describe(TO_CONN(conn)),
|
||||
conn,
|
||||
escaped_safe_str(conn->base_.address),
|
||||
hex_str(rsa_digest, DIGEST_LEN),
|
||||
ed25519_fmt(ed_id));
|
||||
log_info(LD_HANDSHAKE, " (Previously: %s %s)",
|
||||
@ -575,11 +575,9 @@ connection_or_process_inbuf(or_connection_t *conn)
|
||||
* 100% true. */
|
||||
if (buf_datalen(conn->base_.inbuf) > MAX_OR_INBUF_WHEN_NONOPEN) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_NET, "Accumulated too much data (%d bytes) "
|
||||
"on nonopen OR connection %s %s:%u in state %s; closing.",
|
||||
"on non-open %s; closing.",
|
||||
(int)buf_datalen(conn->base_.inbuf),
|
||||
connection_or_nonopen_was_started_here(conn) ? "to" : "from",
|
||||
conn->base_.address, conn->base_.port,
|
||||
conn_state_to_string(conn->base_.type, conn->base_.state));
|
||||
connection_describe(TO_CONN(conn)));
|
||||
connection_or_close_for_error(conn, 0);
|
||||
ret = -1;
|
||||
}
|
||||
@ -691,8 +689,8 @@ connection_or_finished_connecting(or_connection_t *or_conn)
|
||||
conn = TO_CONN(or_conn);
|
||||
tor_assert(conn->state == OR_CONN_STATE_CONNECTING);
|
||||
|
||||
log_debug(LD_HANDSHAKE,"OR connect() to router at %s:%u finished.",
|
||||
conn->address,conn->port);
|
||||
log_debug(LD_HANDSHAKE,"connect finished for %s",
|
||||
connection_describe(conn));
|
||||
|
||||
if (proxy_type != PROXY_NONE) {
|
||||
/* start proxy handshake */
|
||||
@ -1010,9 +1008,10 @@ connection_or_single_set_badness_(time_t now,
|
||||
or_conn->base_.timestamp_created + TIME_BEFORE_OR_CONN_IS_TOO_OLD
|
||||
< now) {
|
||||
log_info(LD_OR,
|
||||
"Marking OR conn to %s:%d as too old for new circuits "
|
||||
"Marking %s as too old for new circuits "
|
||||
"(fd "TOR_SOCKET_T_FORMAT", %d secs old).",
|
||||
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
|
||||
connection_describe(TO_CONN(or_conn)),
|
||||
or_conn->base_.s,
|
||||
(int)(now - or_conn->base_.timestamp_created));
|
||||
connection_or_mark_bad_for_new_circs(or_conn);
|
||||
}
|
||||
@ -1077,10 +1076,11 @@ connection_or_group_set_badness_(smartlist_t *group, int force)
|
||||
/* We have at least one open canonical connection to this router,
|
||||
* and this one is open but not canonical. Mark it bad. */
|
||||
log_info(LD_OR,
|
||||
"Marking OR conn to %s:%d as unsuitable for new circuits: "
|
||||
"Marking %s unsuitable for new circuits: "
|
||||
"(fd "TOR_SOCKET_T_FORMAT", %d secs old). It is not "
|
||||
"canonical, and we have another connection to that OR that is.",
|
||||
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
|
||||
connection_describe(TO_CONN(or_conn)),
|
||||
or_conn->base_.s,
|
||||
(int)(now - or_conn->base_.timestamp_created));
|
||||
connection_or_mark_bad_for_new_circs(or_conn);
|
||||
continue;
|
||||
@ -1121,22 +1121,24 @@ connection_or_group_set_badness_(smartlist_t *group, int force)
|
||||
/* This isn't the best conn, _and_ the best conn is better than it */
|
||||
if (best->is_canonical) {
|
||||
log_info(LD_OR,
|
||||
"Marking OR conn to %s:%d as unsuitable for new circuits: "
|
||||
"Marking %s as unsuitable for new circuits: "
|
||||
"(fd "TOR_SOCKET_T_FORMAT", %d secs old). "
|
||||
"We have a better canonical one "
|
||||
"(fd "TOR_SOCKET_T_FORMAT"; %d secs old).",
|
||||
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
|
||||
connection_describe(TO_CONN(or_conn)),
|
||||
or_conn->base_.s,
|
||||
(int)(now - or_conn->base_.timestamp_created),
|
||||
best->base_.s, (int)(now - best->base_.timestamp_created));
|
||||
connection_or_mark_bad_for_new_circs(or_conn);
|
||||
} else if (!tor_addr_compare(&or_conn->real_addr,
|
||||
&best->real_addr, CMP_EXACT)) {
|
||||
log_info(LD_OR,
|
||||
"Marking OR conn to %s:%d as unsuitable for new circuits: "
|
||||
"Marking %s unsuitable for new circuits: "
|
||||
"(fd "TOR_SOCKET_T_FORMAT", %d secs old). We have a better "
|
||||
"one with the "
|
||||
"same address (fd "TOR_SOCKET_T_FORMAT"; %d secs old).",
|
||||
or_conn->base_.address, or_conn->base_.port, or_conn->base_.s,
|
||||
connection_describe(TO_CONN(or_conn)),
|
||||
or_conn->base_.s,
|
||||
(int)(now - or_conn->base_.timestamp_created),
|
||||
best->base_.s, (int)(now - best->base_.timestamp_created));
|
||||
connection_or_mark_bad_for_new_circs(or_conn);
|
||||
@ -1464,10 +1466,9 @@ connection_or_connect, (const tor_addr_t *_addr, uint16_t port,
|
||||
* that is we haven't had a failure earlier. This is to avoid to try to
|
||||
* constantly connect to relays that we think are not reachable. */
|
||||
if (!should_connect_to_relay(conn)) {
|
||||
log_info(LD_GENERAL, "Can't connect to identity %s at %s:%u because we "
|
||||
log_info(LD_GENERAL, "Can't connect to %s because we "
|
||||
"failed earlier. Refusing.",
|
||||
hex_str(id_digest, DIGEST_LEN), fmt_addr(&TO_CONN(conn)->addr),
|
||||
TO_CONN(conn)->port);
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
connection_free_(TO_CONN(conn));
|
||||
return NULL;
|
||||
}
|
||||
@ -1507,7 +1508,7 @@ connection_or_connect, (const tor_addr_t *_addr, uint16_t port,
|
||||
"transport proxy supporting '%s'. This can happen if you "
|
||||
"haven't provided a ClientTransportPlugin line, or if "
|
||||
"your pluggable transport proxy stopped running.",
|
||||
fmt_addrport(&TO_CONN(conn)->addr, TO_CONN(conn)->port),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
transport_name, transport_name);
|
||||
|
||||
control_event_bootstrap_prob_or(
|
||||
@ -1516,9 +1517,9 @@ connection_or_connect, (const tor_addr_t *_addr, uint16_t port,
|
||||
conn);
|
||||
|
||||
} else {
|
||||
log_warn(LD_GENERAL, "Tried to connect to '%s' through a proxy, but "
|
||||
log_warn(LD_GENERAL, "Tried to connect to %s through a proxy, but "
|
||||
"the proxy address could not be found.",
|
||||
fmt_addrport(&TO_CONN(conn)->addr, TO_CONN(conn)->port));
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
}
|
||||
|
||||
connection_free_(TO_CONN(conn));
|
||||
@ -1891,9 +1892,9 @@ connection_or_client_learned_peer_id(or_connection_t *conn,
|
||||
const int expected_ed_key =
|
||||
! ed25519_public_key_is_zero(&chan->ed25519_identity);
|
||||
|
||||
log_info(LD_HANDSHAKE, "learned peer id for %p (%s): %s, %s",
|
||||
log_info(LD_HANDSHAKE, "learned peer id for %s at %p: %s, %s",
|
||||
connection_describe(TO_CONN(conn)),
|
||||
conn,
|
||||
safe_str_client(conn->base_.address),
|
||||
hex_str((const char*)rsa_peer_id, DIGEST_LEN),
|
||||
ed25519_fmt(ed_peer_id));
|
||||
|
||||
@ -1907,9 +1908,9 @@ connection_or_client_learned_peer_id(or_connection_t *conn,
|
||||
conn->nickname[0] = '$';
|
||||
base16_encode(conn->nickname+1, HEX_DIGEST_LEN+1,
|
||||
conn->identity_digest, DIGEST_LEN);
|
||||
log_info(LD_HANDSHAKE, "Connected to router %s at %s:%d without knowing "
|
||||
"its key. Hoping for the best.",
|
||||
conn->nickname, conn->base_.address, conn->base_.port);
|
||||
log_info(LD_HANDSHAKE, "Connected to router at %s without knowing "
|
||||
"its key. Hoping for the best.",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
/* if it's a bridge and we didn't know its identity fingerprint, now
|
||||
* we do -- remember it for future attempts. */
|
||||
learned_router_identity(&conn->base_.addr, conn->base_.port,
|
||||
@ -1983,9 +1984,9 @@ connection_or_client_learned_peer_id(or_connection_t *conn,
|
||||
}
|
||||
|
||||
log_fn(severity, LD_HANDSHAKE,
|
||||
"Tried connecting to router at %s:%d, but RSA + ed25519 identity "
|
||||
"Tried connecting to router at %s, but RSA + ed25519 identity "
|
||||
"keys were not as expected: wanted %s + %s but got %s + %s.%s",
|
||||
conn->base_.address, conn->base_.port,
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
expected_rsa, expected_ed, seen_rsa, seen_ed, extra_log);
|
||||
|
||||
/* Tell the new guard API about the channel failure */
|
||||
@ -2057,11 +2058,10 @@ connection_tls_finish_handshake(or_connection_t *conn)
|
||||
|
||||
tor_assert(!started_here);
|
||||
|
||||
log_debug(LD_HANDSHAKE,"%s tls handshake on %p with %s done, using "
|
||||
log_debug(LD_HANDSHAKE,"%s tls handshake on %s done, using "
|
||||
"ciphersuite %s. verifying.",
|
||||
started_here?"outgoing":"incoming",
|
||||
conn,
|
||||
safe_str_client(conn->base_.address),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
tor_tls_get_ciphersuite_name(conn->tls));
|
||||
|
||||
if (connection_or_check_valid_tls_handshake(conn, started_here,
|
||||
|
@ -1614,7 +1614,8 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
|
||||
|
||||
if (!public_server_mode(options)) {
|
||||
log_info(LD_DIR, "Rejected dir post request from %s "
|
||||
"since we're not a public relay.", conn->base_.address);
|
||||
"since we're not a public relay.",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
write_short_http_response(conn, 503, "Not acting as a public relay");
|
||||
goto done;
|
||||
}
|
||||
@ -1630,7 +1631,8 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
|
||||
!strcmpstart(url,"/tor/rendezvous2/publish")) {
|
||||
if (rend_cache_store_v2_desc_as_dir(body) < 0) {
|
||||
log_warn(LD_REND, "Rejected v2 rend descriptor (body size %d) from %s.",
|
||||
(int)body_len, conn->base_.address);
|
||||
(int)body_len,
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
write_short_http_response(conn, 400,
|
||||
"Invalid v2 service descriptor rejected");
|
||||
} else {
|
||||
@ -1686,7 +1688,8 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
|
||||
log_info(LD_DIRSERV,
|
||||
"Rejected router descriptor or extra-info from %s "
|
||||
"(\"%s\").",
|
||||
conn->base_.address, msg);
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
msg);
|
||||
write_short_http_response(conn, 400, msg);
|
||||
}
|
||||
goto done;
|
||||
@ -1701,7 +1704,8 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
|
||||
} else {
|
||||
tor_assert(msg);
|
||||
log_warn(LD_DIRSERV, "Rejected vote from %s (\"%s\").",
|
||||
conn->base_.address, msg);
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
msg);
|
||||
write_short_http_response(conn, status, msg);
|
||||
}
|
||||
goto done;
|
||||
@ -1714,7 +1718,8 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers,
|
||||
write_short_http_response(conn, 200, msg?msg:"Signatures stored");
|
||||
} else {
|
||||
log_warn(LD_DIR, "Unable to store signatures posted by %s: %s",
|
||||
conn->base_.address, msg?msg:"???");
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
msg?msg:"???");
|
||||
write_short_http_response(conn, 400,
|
||||
msg?msg:"Unable to store signatures");
|
||||
}
|
||||
@ -1775,8 +1780,8 @@ directory_handle_command(dir_connection_t *conn)
|
||||
&body, &body_len, MAX_DIR_UL_SIZE, 0)) {
|
||||
case -1: /* overflow */
|
||||
log_warn(LD_DIRSERV,
|
||||
"Request too large from address '%s' to DirPort. Closing.",
|
||||
safe_str(conn->base_.address));
|
||||
"Request too large from %s to DirPort. Closing.",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
return -1;
|
||||
case 0:
|
||||
log_debug(LD_DIRSERV,"command not all here yet.");
|
||||
|
@ -740,8 +740,8 @@ connection_dir_client_request_failed(dir_connection_t *conn)
|
||||
if (conn->base_.purpose == DIR_PURPOSE_FETCH_SERVERDESC ||
|
||||
conn->base_.purpose == DIR_PURPOSE_FETCH_EXTRAINFO) {
|
||||
log_info(LD_DIR, "Giving up on serverdesc/extrainfo fetch from "
|
||||
"directory server at '%s'; retrying",
|
||||
conn->base_.address);
|
||||
"directory server at %s; retrying",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
if (conn->router_purpose == ROUTER_PURPOSE_BRIDGE)
|
||||
connection_dir_bridge_routerdesc_failed(conn);
|
||||
connection_dir_download_routerdesc_failed(conn);
|
||||
@ -750,18 +750,19 @@ connection_dir_client_request_failed(dir_connection_t *conn)
|
||||
networkstatus_consensus_download_failed(0, conn->requested_resource);
|
||||
} else if (conn->base_.purpose == DIR_PURPOSE_FETCH_CERTIFICATE) {
|
||||
log_info(LD_DIR, "Giving up on certificate fetch from directory server "
|
||||
"at '%s'; retrying",
|
||||
conn->base_.address);
|
||||
"at %s; retrying",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
connection_dir_download_cert_failed(conn, 0);
|
||||
} else if (conn->base_.purpose == DIR_PURPOSE_FETCH_DETACHED_SIGNATURES) {
|
||||
log_info(LD_DIR, "Giving up downloading detached signatures from '%s'",
|
||||
conn->base_.address);
|
||||
log_info(LD_DIR, "Giving up downloading detached signatures from %s",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
} else if (conn->base_.purpose == DIR_PURPOSE_FETCH_STATUS_VOTE) {
|
||||
log_info(LD_DIR, "Giving up downloading votes from '%s'",
|
||||
conn->base_.address);
|
||||
log_info(LD_DIR, "Giving up downloading votes from %s",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
} else if (conn->base_.purpose == DIR_PURPOSE_FETCH_MICRODESC) {
|
||||
log_info(LD_DIR, "Giving up on downloading microdescriptors from "
|
||||
"directory server at '%s'; will retry", conn->base_.address);
|
||||
"directory server at %s; will retry",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
connection_dir_download_routerdesc_failed(conn);
|
||||
}
|
||||
}
|
||||
@ -1754,10 +1755,10 @@ directory_send_command(dir_connection_t *conn,
|
||||
smartlist_free(headers);
|
||||
|
||||
log_debug(LD_DIR,
|
||||
"Sent request to directory server '%s:%d': "
|
||||
"Sent request to directory server %s "
|
||||
"(purpose: %d, request size: %"TOR_PRIuSZ", "
|
||||
"payload size: %"TOR_PRIuSZ")",
|
||||
conn->base_.address, conn->base_.port,
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
conn->base_.purpose,
|
||||
(total_request_len),
|
||||
(payload ? payload_len : 0));
|
||||
@ -1893,9 +1894,10 @@ dir_client_decompress_response_body(char **bodyp, size_t *bodylenp,
|
||||
}
|
||||
|
||||
tor_log(severity, LD_HTTP,
|
||||
"HTTP body from server '%s:%d' was labeled as %s, "
|
||||
"HTTP body from %s was labeled as %s, "
|
||||
"%s it seems to be %s.%s",
|
||||
conn->base_.address, conn->base_.port, description1,
|
||||
connection_describe(TO_CONN(conn)),
|
||||
description1,
|
||||
guessed != compression?"but":"and",
|
||||
description2,
|
||||
(compression>0 && guessed>0 && want_to_try_both)?
|
||||
@ -1941,11 +1943,11 @@ dir_client_decompress_response_body(char **bodyp, size_t *bodylenp,
|
||||
* we didn't manage to uncompress it, then warn and bail. */
|
||||
if (!plausible && !new_body) {
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_HTTP,
|
||||
"Unable to decompress HTTP body (tried %s%s%s, server '%s:%d').",
|
||||
"Unable to decompress HTTP body (tried %s%s%s, on %s).",
|
||||
description1,
|
||||
tried_both?" and ":"",
|
||||
tried_both?description2:"",
|
||||
conn->base_.address, conn->base_.port);
|
||||
connection_describe(TO_CONN(conn)));
|
||||
rv = -1;
|
||||
goto done;
|
||||
}
|
||||
@ -2052,8 +2054,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
||||
allow_partial)) {
|
||||
case -1: /* overflow */
|
||||
log_warn(LD_PROTOCOL,
|
||||
"'fetch' response too large (server '%s:%d'). Closing.",
|
||||
conn->base_.address, conn->base_.port);
|
||||
"'fetch' response too large (%s). Closing.",
|
||||
connection_describe(TO_CONN(conn)));
|
||||
return -1;
|
||||
case 0:
|
||||
log_info(LD_HTTP,
|
||||
@ -2064,22 +2066,22 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
||||
|
||||
if (parse_http_response(headers, &status_code, &date_header,
|
||||
&compression, &reason) < 0) {
|
||||
log_warn(LD_HTTP,"Unparseable headers (server '%s:%d'). Closing.",
|
||||
conn->base_.address, conn->base_.port);
|
||||
|
||||
log_warn(LD_HTTP,"Unparseable headers (%s). Closing.",
|
||||
connection_describe(TO_CONN(conn)));
|
||||
rv = -1;
|
||||
goto done;
|
||||
}
|
||||
if (!reason) reason = tor_strdup("[no reason given]");
|
||||
|
||||
tor_log(LOG_DEBUG, LD_DIR,
|
||||
"Received response from directory server '%s:%d': %d %s "
|
||||
"Received response on %s: %d %s "
|
||||
"(purpose: %d, response size: %"TOR_PRIuSZ
|
||||
#ifdef MEASUREMENTS_21206
|
||||
", data cells received: %d, data cells sent: %d"
|
||||
#endif
|
||||
", compression: %d)",
|
||||
conn->base_.address, conn->base_.port, status_code,
|
||||
connection_describe(TO_CONN(conn)),
|
||||
status_code,
|
||||
escaped(reason), conn->base_.purpose,
|
||||
(received_bytes),
|
||||
#ifdef MEASUREMENTS_21206
|
||||
@ -2133,9 +2135,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
||||
dir_server_t *ds;
|
||||
const char *id_digest = conn->identity_digest;
|
||||
log_info(LD_DIR,"Received http status code %d (%s) from server "
|
||||
"'%s:%d'. I'll try again soon.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
"%s. I'll try again soon.",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
time_t now = approx_time();
|
||||
if ((rs = router_get_mutable_consensus_status_by_id(id_digest)))
|
||||
rs->last_dir_503_at = now;
|
||||
@ -2240,9 +2242,9 @@ handle_response_fetch_consensus(dir_connection_t *conn,
|
||||
int severity = (status_code == 304) ? LOG_INFO : LOG_WARN;
|
||||
tor_log(severity, LD_DIR,
|
||||
"Received http status code %d (%s) from server "
|
||||
"'%s:%d' while fetching consensus directory.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
"%s while fetching consensus directory.",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
networkstatus_consensus_download_failed(status_code, flavname);
|
||||
return -1;
|
||||
}
|
||||
@ -2277,21 +2279,21 @@ handle_response_fetch_consensus(dir_connection_t *conn,
|
||||
tor_munmap_file(mapped_consensus);
|
||||
if (new_consensus == NULL) {
|
||||
log_warn(LD_DIR, "Could not apply consensus diff received from server "
|
||||
"'%s:%d'", conn->base_.address, conn->base_.port);
|
||||
"%s", connection_describe_peer(TO_CONN(conn)));
|
||||
// XXXX If this happens too many times, we should maybe not use
|
||||
// XXXX this directory for diffs any more?
|
||||
networkstatus_consensus_download_failed(0, flavname);
|
||||
return -1;
|
||||
}
|
||||
log_info(LD_DIR, "Applied consensus diff (size %d) from server "
|
||||
"'%s:%d', resulting in a new consensus document (size %d).",
|
||||
(int)body_len, conn->base_.address, conn->base_.port,
|
||||
"%s, resulting in a new consensus document (size %d).",
|
||||
(int)body_len, connection_describe_peer(TO_CONN(conn)),
|
||||
(int)strlen(new_consensus));
|
||||
consensus = new_consensus;
|
||||
sourcename = "generated based on a diff";
|
||||
} else {
|
||||
log_info(LD_DIR,"Received consensus directory (body size %d) from server "
|
||||
"'%s:%d'", (int)body_len, conn->base_.address, conn->base_.port);
|
||||
"%s", (int)body_len, connection_describe_peer(TO_CONN(conn)));
|
||||
consensus = body;
|
||||
sourcename = "downloaded";
|
||||
}
|
||||
@ -2302,8 +2304,9 @@ handle_response_fetch_consensus(dir_connection_t *conn,
|
||||
conn->identity_digest))<0) {
|
||||
log_fn(r<-1?LOG_WARN:LOG_INFO, LD_DIR,
|
||||
"Unable to load %s consensus directory %s from "
|
||||
"server '%s:%d'. I'll try again soon.",
|
||||
flavname, sourcename, conn->base_.address, conn->base_.port);
|
||||
"server %s. I'll try again soon.",
|
||||
flavname, sourcename,
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
networkstatus_consensus_download_failed(0, flavname);
|
||||
tor_free(new_consensus);
|
||||
return -1;
|
||||
@ -2344,15 +2347,16 @@ handle_response_fetch_certificate(dir_connection_t *conn,
|
||||
if (status_code != 200) {
|
||||
log_warn(LD_DIR,
|
||||
"Received http status code %d (%s) from server "
|
||||
"'%s:%d' while fetching \"/tor/keys/%s\".",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port, conn->requested_resource);
|
||||
"%s while fetching \"/tor/keys/%s\".",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
conn->requested_resource);
|
||||
connection_dir_download_cert_failed(conn, status_code);
|
||||
return -1;
|
||||
}
|
||||
log_info(LD_DIR,"Received authority certificates (body size %d) from "
|
||||
"server '%s:%d'",
|
||||
(int)body_len, conn->base_.address, conn->base_.port);
|
||||
"server %s",
|
||||
(int)body_len, connection_describe_peer(TO_CONN(conn)));
|
||||
|
||||
/*
|
||||
* Tell trusted_dirs_load_certs_from_string() whether it was by fp
|
||||
@ -2403,14 +2407,15 @@ handle_response_fetch_status_vote(dir_connection_t *conn,
|
||||
|
||||
const char *msg;
|
||||
int st;
|
||||
log_info(LD_DIR,"Got votes (body size %d) from server %s:%d",
|
||||
(int)body_len, conn->base_.address, conn->base_.port);
|
||||
log_info(LD_DIR,"Got votes (body size %d) from server %s",
|
||||
(int)body_len, connection_describe_peer(TO_CONN(conn)));
|
||||
if (status_code != 200) {
|
||||
log_warn(LD_DIR,
|
||||
"Received http status code %d (%s) from server "
|
||||
"'%s:%d' while fetching \"/tor/status-vote/next/%s.z\".",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port, conn->requested_resource);
|
||||
"%s while fetching \"/tor/status-vote/next/%s.z\".",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
conn->requested_resource);
|
||||
return -1;
|
||||
}
|
||||
dirvote_add_vote(body, 0, &msg, &st);
|
||||
@ -2438,19 +2443,21 @@ handle_response_fetch_detached_signatures(dir_connection_t *conn,
|
||||
const size_t body_len = args->body_len;
|
||||
|
||||
const char *msg = NULL;
|
||||
log_info(LD_DIR,"Got detached signatures (body size %d) from server %s:%d",
|
||||
(int)body_len, conn->base_.address, conn->base_.port);
|
||||
log_info(LD_DIR,"Got detached signatures (body size %d) from server %s",
|
||||
(int)body_len,
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
if (status_code != 200) {
|
||||
log_warn(LD_DIR,
|
||||
"Received http status code %d (%s) from server '%s:%d' while fetching "
|
||||
"Received http status code %d (%s) from server %s while fetching "
|
||||
"\"/tor/status-vote/next/consensus-signatures.z\".",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
return -1;
|
||||
}
|
||||
if (dirvote_add_signatures(body, conn->base_.address, &msg)<0) {
|
||||
log_warn(LD_DIR, "Problem adding detached signatures from %s:%d: %s",
|
||||
conn->base_.address, conn->base_.port, msg?msg:"???");
|
||||
log_warn(LD_DIR, "Problem adding detached signatures from %s: %s",
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
msg?msg:"???");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -2476,9 +2483,9 @@ handle_response_fetch_desc(dir_connection_t *conn,
|
||||
int n_asked_for = 0;
|
||||
int descriptor_digests = conn->requested_resource &&
|
||||
!strcmpstart(conn->requested_resource,"d/");
|
||||
log_info(LD_DIR,"Received %s (body size %d) from server '%s:%d'",
|
||||
log_info(LD_DIR,"Received %s (body size %d) from server %s",
|
||||
was_ei ? "extra server info" : "server info",
|
||||
(int)body_len, conn->base_.address, conn->base_.port);
|
||||
(int)body_len, connection_describe_peer(TO_CONN(conn)));
|
||||
if (conn->requested_resource &&
|
||||
(!strcmpstart(conn->requested_resource,"d/") ||
|
||||
!strcmpstart(conn->requested_resource,"fp/"))) {
|
||||
@ -2494,10 +2501,11 @@ handle_response_fetch_desc(dir_connection_t *conn,
|
||||
/* 404 means that it didn't have them; no big deal.
|
||||
* Older (pre-0.1.1.8) servers said 400 Servers unavailable instead. */
|
||||
log_fn(dir_okay ? LOG_INFO : LOG_WARN, LD_DIR,
|
||||
"Received http status code %d (%s) from server '%s:%d' "
|
||||
"Received http status code %d (%s) from server %s "
|
||||
"while fetching \"/tor/server/%s\". I'll try again soon.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port, conn->requested_resource);
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
conn->requested_resource);
|
||||
if (!which) {
|
||||
connection_dir_download_routerdesc_failed(conn);
|
||||
} else {
|
||||
@ -2537,10 +2545,10 @@ handle_response_fetch_desc(dir_connection_t *conn,
|
||||
}
|
||||
}
|
||||
if (which) { /* mark remaining ones as failed */
|
||||
log_info(LD_DIR, "Received %d/%d %s requested from %s:%d",
|
||||
log_info(LD_DIR, "Received %d/%d %s requested from %s",
|
||||
n_asked_for-smartlist_len(which), n_asked_for,
|
||||
was_ei ? "extra-info documents" : "router descriptors",
|
||||
conn->base_.address, (int)conn->base_.port);
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
if (smartlist_len(which)) {
|
||||
dir_routerdesc_download_failed(which, status_code,
|
||||
conn->router_purpose,
|
||||
@ -2571,9 +2579,9 @@ handle_response_fetch_microdesc(dir_connection_t *conn,
|
||||
|
||||
smartlist_t *which = NULL;
|
||||
log_info(LD_DIR,"Received answer to microdescriptor request (status %d, "
|
||||
"body size %d) from server '%s:%d'",
|
||||
status_code, (int)body_len, conn->base_.address,
|
||||
conn->base_.port);
|
||||
"body size %d) from server %s",
|
||||
status_code, (int)body_len,
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
tor_assert(conn->requested_resource &&
|
||||
!strcmpstart(conn->requested_resource, "d/"));
|
||||
tor_assert_nonfatal(!fast_mem_is_zero(conn->identity_digest, DIGEST_LEN));
|
||||
@ -2583,10 +2591,11 @@ handle_response_fetch_microdesc(dir_connection_t *conn,
|
||||
DSR_DIGEST256|DSR_BASE64);
|
||||
if (status_code != 200) {
|
||||
log_info(LD_DIR, "Received status code %d (%s) from server "
|
||||
"'%s:%d' while fetching \"/tor/micro/%s\". I'll try again "
|
||||
"%s while fetching \"/tor/micro/%s\". I'll try again "
|
||||
"soon.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
(int)conn->base_.port, conn->requested_resource);
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)),
|
||||
conn->requested_resource);
|
||||
dir_microdesc_download_failed(which, status_code, conn->identity_digest);
|
||||
SMARTLIST_FOREACH(which, char *, cp, tor_free(cp));
|
||||
smartlist_free(which);
|
||||
@ -2661,8 +2670,8 @@ handle_response_upload_dir(dir_connection_t *conn,
|
||||
break;
|
||||
case 400:
|
||||
log_warn(LD_GENERAL,"http status 400 (%s) response from "
|
||||
"dirserver '%s:%d'. Please correct.",
|
||||
escaped(reason), conn->base_.address, conn->base_.port);
|
||||
"dirserver %s. Please correct.",
|
||||
escaped(reason), connection_describe_peer(TO_CONN(conn)));
|
||||
control_event_server_status(LOG_WARN,
|
||||
"BAD_SERVER_DESCRIPTOR DIRAUTH=%s:%d REASON=\"%s\"",
|
||||
conn->base_.address, conn->base_.port, escaped(reason));
|
||||
@ -2670,10 +2679,10 @@ handle_response_upload_dir(dir_connection_t *conn,
|
||||
default:
|
||||
log_warn(LD_GENERAL,
|
||||
"HTTP status %d (%s) was unexpected while uploading "
|
||||
"descriptor to server '%s:%d'. Possibly the server is "
|
||||
"descriptor to server %s'. Possibly the server is "
|
||||
"misconfigured?",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
break;
|
||||
}
|
||||
/* return 0 in all cases, since we don't want to mark any
|
||||
@ -2696,21 +2705,21 @@ handle_response_upload_vote(dir_connection_t *conn,
|
||||
|
||||
switch (status_code) {
|
||||
case 200: {
|
||||
log_notice(LD_DIR,"Uploaded a vote to dirserver %s:%d",
|
||||
conn->base_.address, conn->base_.port);
|
||||
log_notice(LD_DIR,"Uploaded a vote to dirserver %s",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
}
|
||||
break;
|
||||
case 400:
|
||||
log_warn(LD_DIR,"http status 400 (%s) response after uploading "
|
||||
"vote to dirserver '%s:%d'. Please correct.",
|
||||
escaped(reason), conn->base_.address, conn->base_.port);
|
||||
"vote to dirserver %s. Please correct.",
|
||||
escaped(reason), connection_describe_peer(TO_CONN(conn)));
|
||||
break;
|
||||
default:
|
||||
log_warn(LD_GENERAL,
|
||||
"HTTP status %d (%s) was unexpected while uploading "
|
||||
"vote to server '%s:%d'.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
"vote to server %s.",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
break;
|
||||
}
|
||||
/* return 0 in all cases, since we don't want to mark any
|
||||
@ -2732,21 +2741,21 @@ handle_response_upload_signatures(dir_connection_t *conn,
|
||||
|
||||
switch (status_code) {
|
||||
case 200: {
|
||||
log_notice(LD_DIR,"Uploaded signature(s) to dirserver %s:%d",
|
||||
conn->base_.address, conn->base_.port);
|
||||
log_notice(LD_DIR,"Uploaded signature(s) to dirserver %s",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
}
|
||||
break;
|
||||
case 400:
|
||||
log_warn(LD_DIR,"http status 400 (%s) response after uploading "
|
||||
"signatures to dirserver '%s:%d'. Please correct.",
|
||||
escaped(reason), conn->base_.address, conn->base_.port);
|
||||
"signatures to dirserver %s. Please correct.",
|
||||
escaped(reason), connection_describe_peer(TO_CONN(conn)));
|
||||
break;
|
||||
default:
|
||||
log_warn(LD_GENERAL,
|
||||
"HTTP status %d (%s) was unexpected while uploading "
|
||||
"signatures to server '%s:%d'.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
"signatures to server %s.",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
break;
|
||||
}
|
||||
/* return 0 in all cases, since we don't want to mark any
|
||||
@ -2861,10 +2870,10 @@ handle_response_fetch_renddesc_v2(dir_connection_t *conn,
|
||||
default:
|
||||
log_warn(LD_REND, "Fetching v2 rendezvous descriptor failed: "
|
||||
"http status %d (%s) response unexpected while "
|
||||
"fetching v2 hidden service descriptor (server '%s:%d'). "
|
||||
"fetching v2 hidden service descriptor (server %s). "
|
||||
"Retrying at another directory.",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
SEND_HS_DESC_FAILED_EVENT("UNEXPECTED");
|
||||
SEND_HS_DESC_FAILED_CONTENT();
|
||||
break;
|
||||
@ -2908,15 +2917,15 @@ handle_response_upload_renddesc_v2(dir_connection_t *conn,
|
||||
break;
|
||||
case 400:
|
||||
log_warn(LD_REND,"http status 400 (%s) response from dirserver "
|
||||
"'%s:%d'. Malformed rendezvous descriptor?",
|
||||
escaped(reason), conn->base_.address, conn->base_.port);
|
||||
"%s. Malformed rendezvous descriptor?",
|
||||
escaped(reason), connection_describe_peer(TO_CONN(conn)));
|
||||
SEND_HS_DESC_UPLOAD_FAILED_EVENT("UPLOAD_REJECTED");
|
||||
break;
|
||||
default:
|
||||
log_warn(LD_REND,"http status %d (%s) response unexpected (server "
|
||||
"'%s:%d').",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
"%s).",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
SEND_HS_DESC_UPLOAD_FAILED_EVENT("UNEXPECTED");
|
||||
break;
|
||||
}
|
||||
@ -2954,17 +2963,17 @@ handle_response_upload_hsdesc(dir_connection_t *conn,
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_REND,
|
||||
"Uploading hidden service descriptor: http "
|
||||
"status 400 (%s) response from dirserver "
|
||||
"'%s:%d'. Malformed hidden service descriptor?",
|
||||
escaped(reason), conn->base_.address, conn->base_.port);
|
||||
"%s. Malformed hidden service descriptor?",
|
||||
escaped(reason), connection_describe_peer(TO_CONN(conn)));
|
||||
hs_control_desc_event_failed(conn->hs_ident, conn->identity_digest,
|
||||
"UPLOAD_REJECTED");
|
||||
break;
|
||||
default:
|
||||
log_warn(LD_REND, "Uploading hidden service descriptor: http "
|
||||
"status %d (%s) response unexpected (server "
|
||||
"'%s:%d').",
|
||||
status_code, escaped(reason), conn->base_.address,
|
||||
conn->base_.port);
|
||||
"%s').",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
hs_control_desc_event_failed(conn->hs_ident, conn->identity_digest,
|
||||
"UNEXPECTED");
|
||||
break;
|
||||
@ -3116,7 +3125,7 @@ connection_dir_close_consensus_fetches(dir_connection_t *except_this_one,
|
||||
if (d == except_this_one)
|
||||
continue;
|
||||
log_info(LD_DIR, "Closing consensus fetch (to %s) since one "
|
||||
"has just arrived.", TO_CONN(d)->address);
|
||||
"has just arrived.", connection_describe_peer(TO_CONN(d)));
|
||||
connection_mark_for_close(TO_CONN(d));
|
||||
} SMARTLIST_FOREACH_END(d);
|
||||
smartlist_free(conns_to_close);
|
||||
|
@ -455,9 +455,9 @@ connection_dir_process_inbuf(dir_connection_t *conn)
|
||||
|
||||
if (connection_get_inbuf_len(TO_CONN(conn)) > max_size) {
|
||||
log_warn(LD_HTTP,
|
||||
"Too much data received from directory connection (%s): "
|
||||
"Too much data received from %s: "
|
||||
"denial of service attempt, or you need to upgrade?",
|
||||
conn->base_.address);
|
||||
connection_describe(TO_CONN(conn)));
|
||||
connection_mark_for_close(TO_CONN(conn));
|
||||
return -1;
|
||||
}
|
||||
@ -540,8 +540,8 @@ connection_dir_finished_connecting(dir_connection_t *conn)
|
||||
tor_assert(conn->base_.type == CONN_TYPE_DIR);
|
||||
tor_assert(conn->base_.state == DIR_CONN_STATE_CONNECTING);
|
||||
|
||||
log_debug(LD_HTTP,"Dir connection to router %s:%u established.",
|
||||
conn->base_.address,conn->base_.port);
|
||||
log_debug(LD_HTTP,"Dir connection to %s established.",
|
||||
connection_describe_peer(TO_CONN(conn)));
|
||||
|
||||
/* start flushing conn */
|
||||
conn->base_.state = DIR_CONN_STATE_CLIENT_SENDING;
|
||||
|
@ -1554,9 +1554,9 @@ client_dir_fetch_unexpected(dir_connection_t *dir_conn, const char *reason,
|
||||
|
||||
log_warn(LD_REND, "Fetching v3 hidden service descriptor failed: "
|
||||
"http status %d (%s) response unexpected from HSDir "
|
||||
"server '%s:%d'. Retrying at another directory.",
|
||||
status_code, escaped(reason), TO_CONN(dir_conn)->address,
|
||||
TO_CONN(dir_conn)->port);
|
||||
"server %s'. Retrying at another directory.",
|
||||
status_code, escaped(reason),
|
||||
connection_describe_peer(TO_CONN(dir_conn)));
|
||||
/* Fire control port FAILED event. */
|
||||
hs_control_desc_event_failed(dir_conn->hs_ident, dir_conn->identity_digest,
|
||||
"UNEXPECTED");
|
||||
|
Loading…
Reference in New Issue
Block a user