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
@ -285,7 +285,7 @@ buf_shrink(buf_t *buf)
|
||||
return;
|
||||
|
||||
debug(LD_MM,"Shrinking buffer from %d to %d bytes.",
|
||||
(int)buf->len, (int)new_len);
|
||||
(int)buf->len, (int)new_len);
|
||||
buf_resize(buf, new_len);
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ read_to_buf_impl(int s, size_t at_most, buf_t *buf,
|
||||
if (buf->datalen > buf->highwater)
|
||||
buf->highwater = buf->datalen;
|
||||
debug(LD_NET,"Read %d bytes. %d on inbuf.",read_result,
|
||||
(int)buf->datalen);
|
||||
(int)buf->datalen);
|
||||
return read_result;
|
||||
}
|
||||
}
|
||||
@ -479,8 +479,8 @@ read_to_buf_tls_impl(tor_tls_t *tls, size_t at_most, buf_t *buf, char *next)
|
||||
int r;
|
||||
|
||||
debug(LD_NET,"before: %d on buf, %d pending, at_most %d.",
|
||||
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
|
||||
(int)at_most);
|
||||
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
|
||||
(int)at_most);
|
||||
r = tor_tls_read(tls, next, at_most);
|
||||
if (r<0)
|
||||
return r;
|
||||
@ -489,7 +489,7 @@ read_to_buf_tls_impl(tor_tls_t *tls, size_t at_most, buf_t *buf, char *next)
|
||||
if (buf->datalen > buf->highwater)
|
||||
buf->highwater = buf->datalen;
|
||||
debug(LD_NET,"Read %d bytes. %d on inbuf; %d pending",r,
|
||||
(int)buf->datalen,(int)tor_tls_get_pending_bytes(tls));
|
||||
(int)buf->datalen,(int)tor_tls_get_pending_bytes(tls));
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -523,8 +523,8 @@ read_to_buf_tls(tor_tls_t *tls, size_t at_most, buf_t *buf)
|
||||
assert_buf_ok(buf);
|
||||
|
||||
debug(LD_NET,"start: %d on buf, %d pending, at_most %d.",
|
||||
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
|
||||
(int)at_most);
|
||||
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
|
||||
(int)at_most);
|
||||
|
||||
if (buf_ensure_capacity(buf, at_most+buf->datalen))
|
||||
return TOR_TLS_ERROR;
|
||||
@ -610,7 +610,7 @@ flush_buf(int s, buf_t *buf, size_t sz, size_t *buf_flushlen)
|
||||
check();
|
||||
|
||||
debug(LD_NET,"%d: flushed %d bytes, %d ready to flush, %d remain.",
|
||||
s,r,(int)*buf_flushlen,(int)buf->datalen);
|
||||
s,r,(int)*buf_flushlen,(int)buf->datalen);
|
||||
if (r < 0 || (size_t)r < flushlen0)
|
||||
return r; /* Error, or can't flush any more now. */
|
||||
flushed = r;
|
||||
@ -620,7 +620,7 @@ flush_buf(int s, buf_t *buf, size_t sz, size_t *buf_flushlen)
|
||||
r = flush_buf_impl(s, buf, flushlen1, buf_flushlen);
|
||||
check();
|
||||
debug(LD_NET,"%d: flushed %d bytes, %d ready to flush, %d remain.",
|
||||
s,r,(int)*buf_flushlen,(int)buf->datalen);
|
||||
s,r,(int)*buf_flushlen,(int)buf->datalen);
|
||||
if (r<0)
|
||||
return r;
|
||||
flushed += r;
|
||||
@ -645,7 +645,7 @@ flush_buf_tls_impl(tor_tls_t *tls, buf_t *buf, size_t sz, size_t *buf_flushlen)
|
||||
*buf_flushlen -= r;
|
||||
buf_remove_from_front(buf, r);
|
||||
debug(LD_NET,"flushed %d bytes, %d ready to flush, %d remain.",
|
||||
r,(int)*buf_flushlen,(int)buf->datalen);
|
||||
r,(int)*buf_flushlen,(int)buf->datalen);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -726,7 +727,7 @@ write_to_buf(const char *string, size_t string_len, buf_t *buf)
|
||||
if (buf->datalen > buf->highwater)
|
||||
buf->highwater = buf->datalen;
|
||||
debug(LD_NET,"added %d bytes to buf (now %d total).",
|
||||
(int)string_len, (int)buf->datalen);
|
||||
(int)string_len, (int)buf->datalen);
|
||||
check();
|
||||
return buf->datalen;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -945,7 +947,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
|
||||
req->command != SOCKS_COMMAND_RESOLVE) {
|
||||
/* not a connect or resolve? we don't support it. */
|
||||
warn(LD_APP,"socks5: command %d not recognized. Rejecting.",
|
||||
req->command);
|
||||
req->command);
|
||||
return -1;
|
||||
}
|
||||
switch (*(buf->cur+3)) { /* address type */
|
||||
@ -959,7 +961,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
|
||||
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
|
||||
if (strlen(tmpbuf)+1 > MAX_SOCKS_ADDR_LEN) {
|
||||
warn(LD_APP,"socks5 IP takes %d bytes, which doesn't fit in %d. Rejecting.",
|
||||
(int)strlen(tmpbuf)+1,(int)MAX_SOCKS_ADDR_LEN);
|
||||
(int)strlen(tmpbuf)+1,(int)MAX_SOCKS_ADDR_LEN);
|
||||
return -1;
|
||||
}
|
||||
strlcpy(req->address,tmpbuf,sizeof(req->address));
|
||||
@ -983,7 +985,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
|
||||
return 0; /* not yet */
|
||||
if (len+1 > MAX_SOCKS_ADDR_LEN) {
|
||||
warn(LD_APP,"socks5 hostname is %d bytes, which doesn't fit in %d. Rejecting.",
|
||||
len+1,MAX_SOCKS_ADDR_LEN);
|
||||
len+1,MAX_SOCKS_ADDR_LEN);
|
||||
return -1;
|
||||
}
|
||||
memcpy(req->address,buf->cur+5,len);
|
||||
@ -1013,7 +1015,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
|
||||
req->command != SOCKS_COMMAND_RESOLVE) {
|
||||
/* not a connect or resolve? we don't support it. */
|
||||
warn(LD_APP,"socks4: command %d not recognized. Rejecting.",
|
||||
req->command);
|
||||
req->command);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1029,7 +1031,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
|
||||
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
|
||||
if (strlen(tmpbuf)+1 > MAX_SOCKS_ADDR_LEN) {
|
||||
debug(LD_APP,"socks4 addr (%d bytes) too long. Rejecting.",
|
||||
(int)strlen(tmpbuf));
|
||||
(int)strlen(tmpbuf));
|
||||
return -1;
|
||||
}
|
||||
debug(LD_APP,"socks4: successfully read destip (%s)", safe_str(tmpbuf));
|
||||
@ -1112,7 +1114,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
|
||||
/* fall through */
|
||||
default: /* version is not socks4 or socks5 */
|
||||
warn(LD_APP,"Socks version %d not recognized. (Tor is not an http proxy.)",
|
||||
*(buf->cur));
|
||||
*(buf->cur));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ circuit_handle_first_hop(circuit_t *circ)
|
||||
in.s_addr = htonl(firsthop->extend_info->addr);
|
||||
tor_inet_ntoa(&in, tmpbuf, sizeof(tmpbuf));
|
||||
debug(LD_CIRC,"Looking for firsthop '%s:%u'",tmpbuf,
|
||||
firsthop->extend_info->port);
|
||||
firsthop->extend_info->port);
|
||||
/* imprint the circuit with its future n_conn->id */
|
||||
memcpy(circ->n_conn_id_digest, firsthop->extend_info->identity_digest,
|
||||
DIGEST_LEN);
|
||||
@ -391,7 +391,7 @@ circuit_n_conn_done(connection_t *or_conn, int status)
|
||||
extern smartlist_t *circuits_pending_or_conns;
|
||||
|
||||
debug(LD_CIRC,"or_conn to %s, status=%d",
|
||||
or_conn->nickname ? or_conn->nickname : "NULL", status);
|
||||
or_conn->nickname ? or_conn->nickname : "NULL", status);
|
||||
|
||||
if (!circuits_pending_or_conns)
|
||||
return;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -678,7 +680,7 @@ circuit_extend(cell_t *cell, circuit_t *circ)
|
||||
in.s_addr = htonl(circ->n_addr);
|
||||
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
|
||||
info(LD_CIRC|LD_OR,"Next router (%s:%d) not connected. Connecting.",
|
||||
tmpbuf, circ->n_port);
|
||||
tmpbuf, circ->n_port);
|
||||
|
||||
circ->onionskin = tor_malloc(ONIONSKIN_CHALLENGE_LEN);
|
||||
memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
|
||||
@ -910,7 +912,7 @@ onionskin_answer(circuit_t *circ, uint8_t cell_type, char *payload, char *keys)
|
||||
cell_type == CELL_CREATED ? ONIONSKIN_REPLY_LEN : DIGEST_LEN*2);
|
||||
|
||||
debug(LD_CIRC,"init digest forward 0x%.8x, backward 0x%.8x.",
|
||||
(unsigned int)*(uint32_t*)(keys), (unsigned int)*(uint32_t*)(keys+20));
|
||||
(unsigned int)*(uint32_t*)(keys), (unsigned int)*(uint32_t*)(keys+20));
|
||||
if (circuit_init_cpath_crypto(tmp_cpath, keys, 0)<0) {
|
||||
warn(LD_BUG,"Circuit initialization failed");
|
||||
tor_free(tmp_cpath);
|
||||
@ -969,19 +971,19 @@ new_route_len(double cw, uint8_t purpose, extend_info_t *exit,
|
||||
routelen++;
|
||||
#endif
|
||||
debug(LD_CIRC,"Chosen route length %d (%d routers available).",routelen,
|
||||
smartlist_len(routers));
|
||||
smartlist_len(routers));
|
||||
|
||||
num_acceptable_routers = count_acceptable_routers(routers);
|
||||
|
||||
if (num_acceptable_routers < 2) {
|
||||
info(LD_CIRC,"Not enough acceptable routers (%d). Discarding this circuit.",
|
||||
num_acceptable_routers);
|
||||
num_acceptable_routers);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (num_acceptable_routers < routelen) {
|
||||
info(LD_CIRC,"Not enough routers: cutting routelen from %d to %d.",
|
||||
routelen, num_acceptable_routers);
|
||||
routelen, num_acceptable_routers);
|
||||
routelen = num_acceptable_routers;
|
||||
}
|
||||
|
||||
@ -1184,7 +1186,7 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
|
||||
}
|
||||
}
|
||||
info(LD_CIRC, "Found %d servers that might support %d/%d pending connections.",
|
||||
n_best_support, best_support, n_pending_connections);
|
||||
n_best_support, best_support, n_pending_connections);
|
||||
|
||||
preferredexits = smartlist_create();
|
||||
add_nickname_list_to_smartlist(preferredexits,options->ExitNodes,1,1);
|
||||
@ -1216,8 +1218,8 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
|
||||
if (best_support == -1) {
|
||||
if (need_uptime || need_capacity) {
|
||||
info(LD_CIRC, "We couldn't find any live%s%s routers; falling back to list of all routers.",
|
||||
need_capacity?", fast":"",
|
||||
need_uptime?", stable":"");
|
||||
need_capacity?", fast":"",
|
||||
need_uptime?", stable":"");
|
||||
return choose_good_exit_server_general(dir, 0, 0);
|
||||
}
|
||||
notice(LD_CIRC, "All routers are down or middleman -- choosing a doomed exit at random.");
|
||||
@ -1358,7 +1360,7 @@ circuit_extend_to_new_exit(circuit_t *circ, extend_info_t *info)
|
||||
circuit_set_state(circ, CIRCUIT_STATE_BUILDING);
|
||||
if (circuit_send_next_onion_skin(circ)<0) {
|
||||
warn(LD_CIRC, "Couldn't extend circuit to new point '%s'.",
|
||||
info->nickname);
|
||||
info->nickname);
|
||||
circuit_mark_for_close(circ);
|
||||
return -1;
|
||||
}
|
||||
@ -1540,12 +1542,12 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
|
||||
|
||||
if (cur_len >= state->desired_path_len) {
|
||||
debug(LD_CIRC, "Path is complete: %d steps long",
|
||||
state->desired_path_len);
|
||||
state->desired_path_len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
debug(LD_CIRC, "Path is %d long; we want %d", cur_len,
|
||||
state->desired_path_len);
|
||||
state->desired_path_len);
|
||||
|
||||
if (cur_len == state->desired_path_len - 1) { /* Picking last node */
|
||||
info = extend_info_dup(state->chosen_exit);
|
||||
@ -1566,7 +1568,7 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
|
||||
}
|
||||
|
||||
debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
|
||||
info->nickname, cur_len+1, build_state_get_exit_nickname(state));
|
||||
info->nickname, cur_len+1, build_state_get_exit_nickname(state));
|
||||
|
||||
onion_append_hop(head_ptr, info);
|
||||
extend_info_free(info);
|
||||
@ -1754,7 +1756,7 @@ remove_dead_helpers(void)
|
||||
base16_encode(dbuf, sizeof(dbuf), helper->identity, DIGEST_LEN);
|
||||
format_local_iso_time(tbuf, since);
|
||||
warn(LD_CIRC, "Helper node '%s' (%s) has been %s since %s; removing.",
|
||||
helper->nickname, dbuf, why, tbuf);
|
||||
helper->nickname, dbuf, why, tbuf);
|
||||
tor_free(helper);
|
||||
smartlist_del(helper_nodes, i);
|
||||
helper_nodes_changed();
|
||||
@ -1796,13 +1798,13 @@ helper_nodes_set_status_from_directory(void)
|
||||
helper->unlisted_since = time(NULL);
|
||||
++changed;
|
||||
warn(LD_CIRC,"Helper node '%s' is not listed by directories",
|
||||
helper->nickname);
|
||||
helper->nickname);
|
||||
severity = LOG_WARN;
|
||||
}
|
||||
} else {
|
||||
if (helper->unlisted_since) {
|
||||
warn(LD_CIRC,"Helper node '%s' is listed again by directories",
|
||||
helper->nickname);
|
||||
helper->nickname);
|
||||
++changed;
|
||||
severity = LOG_WARN;
|
||||
}
|
||||
@ -1852,17 +1854,17 @@ helper_node_set_status(const char *digest, int succeeded)
|
||||
if (helper->down_since) {
|
||||
/*XXXX shouldn't warn. NM */
|
||||
warn(LD_CIRC,
|
||||
"Connection to formerly down helper node '%s' succeeded. "
|
||||
"%d/%d helpers usable.", helper->nickname,
|
||||
num_live_helpers(), smartlist_len(helper_nodes));
|
||||
"Connection to formerly down helper node '%s' succeeded. "
|
||||
"%d/%d helpers usable.", helper->nickname,
|
||||
num_live_helpers(), smartlist_len(helper_nodes));
|
||||
helper_nodes_changed();
|
||||
}
|
||||
helper->down_since = 0;
|
||||
} else if (!helper->down_since) {
|
||||
helper->down_since = time(NULL);
|
||||
warn(LD_CIRC,
|
||||
"Connection to helper node '%s' failed. %d/%d helpers usable.",
|
||||
helper->nickname, num_live_helpers(), smartlist_len(helper_nodes));
|
||||
"Connection to helper node '%s' failed. %d/%d helpers usable.",
|
||||
helper->nickname, num_live_helpers(), smartlist_len(helper_nodes));
|
||||
helper_nodes_changed();
|
||||
}
|
||||
}
|
||||
|
@ -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) &&
|
||||
@ -682,8 +683,8 @@ _circuit_mark_for_close(circuit_t *circ, int line, const char *file)
|
||||
tor_assert(circ->build_state->chosen_exit);
|
||||
/* treat this like getting a nack from it */
|
||||
info(LD_REND,"Failed intro circ %s to %s (awaiting ack). Removing from descriptor.",
|
||||
safe_str(circ->rend_query),
|
||||
safe_str(build_state_get_exit_nickname(circ->build_state)));
|
||||
safe_str(circ->rend_query),
|
||||
safe_str(build_state_get_exit_nickname(circ->build_state)));
|
||||
rend_client_remove_intro_point(circ->build_state->chosen_exit,
|
||||
circ->rend_query);
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ circuit_predict_and_launch_new(void)
|
||||
if (!circuit_all_predicted_ports_handled(now, &port_needs_uptime,
|
||||
&port_needs_capacity)) {
|
||||
info(LD_CIRC,"Have %d clean circs (%d internal), need another exit circ.",
|
||||
num, num_internal);
|
||||
num, num_internal);
|
||||
circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL,
|
||||
port_needs_uptime, port_needs_capacity, 0);
|
||||
return;
|
||||
@ -381,7 +381,7 @@ circuit_predict_and_launch_new(void)
|
||||
/* Third, see if we need any more hidden service (server) circuits. */
|
||||
if (num_rend_services() && num_uptime_internal < 3) {
|
||||
info(LD_CIRC,"Have %d clean circs (%d internal), need another internal circ for my hidden service.",
|
||||
num, num_internal);
|
||||
num, num_internal);
|
||||
circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL,
|
||||
1, 1, 1);
|
||||
return;
|
||||
@ -393,7 +393,7 @@ circuit_predict_and_launch_new(void)
|
||||
((num_uptime_internal<2 && hidserv_needs_uptime) ||
|
||||
num_internal<2)) {
|
||||
info(LD_CIRC,"Have %d clean circs (%d uptime-internal, %d internal),"
|
||||
" need another hidserv circ.", num, num_uptime_internal, num_internal);
|
||||
" need another hidserv circ.", num, num_uptime_internal, num_internal);
|
||||
circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL,
|
||||
hidserv_needs_uptime, hidserv_needs_capacity, 1);
|
||||
return;
|
||||
@ -569,7 +569,7 @@ circuit_expire_old_circuits(void)
|
||||
#define CIRCUIT_UNUSED_CIRC_TIMEOUT 3600 /* an hour */
|
||||
if (circ->timestamp_created + CIRCUIT_UNUSED_CIRC_TIMEOUT < now) {
|
||||
debug(LD_CIRC,"Closing circuit that has been unused for %d seconds.",
|
||||
(int)(now - circ->timestamp_created));
|
||||
(int)(now - circ->timestamp_created));
|
||||
circuit_mark_for_close(circ);
|
||||
}
|
||||
}
|
||||
@ -771,7 +771,7 @@ circuit_launch_by_extend_info(uint8_t purpose, extend_info_t *extend_info,
|
||||
need_uptime, need_capacity, internal);
|
||||
if (circ) {
|
||||
info(LD_CIRC,"Cannibalizing circ '%s' for purpose %d",
|
||||
build_state_get_exit_nickname(circ->build_state), purpose);
|
||||
build_state_get_exit_nickname(circ->build_state), purpose);
|
||||
circ->purpose = purpose;
|
||||
/* reset the birth date of this circ, else expire_building
|
||||
* will see it and think it's been trying to build since it
|
||||
@ -1129,12 +1129,12 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
|
||||
routerinfo_t *router = router_get_by_nickname(conn->chosen_exit_name, 1);
|
||||
if (!router) {
|
||||
warn(LD_APP,"Requested exit point '%s' is not known. Closing.",
|
||||
conn->chosen_exit_name);
|
||||
conn->chosen_exit_name);
|
||||
return -1;
|
||||
}
|
||||
if (!connection_ap_can_use_exit(conn, router)) {
|
||||
warn(LD_APP, "Requested exit point '%s' would refuse request. Closing.",
|
||||
conn->chosen_exit_name);
|
||||
conn->chosen_exit_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1145,7 +1145,7 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
|
||||
return retval;
|
||||
|
||||
debug(LD_APP|LD_CIRC,"Attaching apconn to circ %d (stream %d sec old).",
|
||||
circ->n_circ_id, conn_age);
|
||||
circ->n_circ_id, conn_age);
|
||||
/* here, print the circ's path. so people can figure out which circs are sucking. */
|
||||
circuit_log_path(LOG_INFO,LD_APP|LD_CIRC,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;
|
||||
}
|
||||
|
||||
@ -1202,12 +1205,12 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
|
||||
|
||||
if (rendcirc && introcirc && rendcirc->purpose == CIRCUIT_PURPOSE_C_REND_READY) {
|
||||
info(LD_REND,"ready rend circ %d already here (no intro-ack yet on intro %d). (stream %d sec old)",
|
||||
rendcirc->n_circ_id, introcirc->n_circ_id, conn_age);
|
||||
rendcirc->n_circ_id, introcirc->n_circ_id, conn_age);
|
||||
|
||||
tor_assert(introcirc->purpose == CIRCUIT_PURPOSE_C_INTRODUCING);
|
||||
if (introcirc->state == CIRCUIT_STATE_OPEN) {
|
||||
info(LD_REND,"found open intro circ %d (rend %d); sending introduction. (stream %d sec old)",
|
||||
introcirc->n_circ_id, rendcirc->n_circ_id, conn_age);
|
||||
introcirc->n_circ_id, rendcirc->n_circ_id, conn_age);
|
||||
if (rend_client_send_introduction(introcirc, rendcirc) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -82,10 +82,10 @@ command_process_cell(cell_t *cell, connection_t *conn)
|
||||
if (now > current_second) { /* the second has rolled over */
|
||||
/* print stats */
|
||||
info(LD_OR,"At end of second: %d creates (%d ms), %d createds (%d ms), %d relays (%d ms), %d destroys (%d ms)",
|
||||
num_create, create_time/1000,
|
||||
num_created, created_time/1000,
|
||||
num_relay, relay_time/1000,
|
||||
num_destroy, destroy_time/1000);
|
||||
num_create, create_time/1000,
|
||||
num_created, created_time/1000,
|
||||
num_relay, relay_time/1000,
|
||||
num_destroy, destroy_time/1000);
|
||||
|
||||
/* zero out stats */
|
||||
num_create = num_created = num_relay = num_destroy = 0;
|
||||
@ -174,11 +174,11 @@ command_process_create_cell(cell_t *cell, connection_t *conn)
|
||||
*/
|
||||
if ((cell->circ_id & (1<<15)) && conn->circ_id_type == CIRC_ID_TYPE_HIGHER) {
|
||||
info(LD_OR, "Got a high circuit ID from %s (%d); switching to low circuit IDs.",
|
||||
conn->nickname ? conn->nickname : "client", conn->s);
|
||||
conn->nickname ? conn->nickname : "client", conn->s);
|
||||
conn->circ_id_type = CIRC_ID_TYPE_LOWER;
|
||||
} else if (!(cell->circ_id & (1<<15)) && conn->circ_id_type == CIRC_ID_TYPE_LOWER) {
|
||||
info(LD_OR, "Got a low circuit ID from %s (%d); switching to high circuit IDs.",
|
||||
conn->nickname ? conn->nickname : "client", conn->s);
|
||||
conn->nickname ? conn->nickname : "client", conn->s);
|
||||
conn->circ_id_type = CIRC_ID_TYPE_HIGHER;
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ command_process_destroy_cell(cell_t *cell, connection_t *conn)
|
||||
|
||||
if (!circ) {
|
||||
info(LD_OR,"unknown circuit %d on connection from %s:%d. Dropping.",
|
||||
cell->circ_id, conn->address, conn->port);
|
||||
cell->circ_id, conn->address, conn->port);
|
||||
return;
|
||||
}
|
||||
debug(LD_OR,"Received for circID %d.",cell->circ_id);
|
||||
|
@ -486,7 +486,7 @@ options_act_reversible(or_options_t *old_options)
|
||||
/* Ensure data directory is private; create if possible. */
|
||||
if (check_private_dir(options->DataDirectory, CPD_CREATE)<0) {
|
||||
err(LD_FS, "Couldn't access/create private data directory \"%s\"",
|
||||
options->DataDirectory);
|
||||
options->DataDirectory);
|
||||
/* No need to roll back, since you can't change the value. */
|
||||
goto done;
|
||||
}
|
||||
@ -705,9 +705,9 @@ expand_abbrev(config_format_t *fmt, const char *option, int command_line,
|
||||
(command_line || !fmt->abbrevs[i].commandline_only)) {
|
||||
if (warn_obsolete && fmt->abbrevs[i].warn) {
|
||||
warn(LD_CONFIG,
|
||||
"The configuration option '%s' is deprecated; use '%s' instead.",
|
||||
fmt->abbrevs[i].abbreviated,
|
||||
fmt->abbrevs[i].full);
|
||||
"The configuration option '%s' is deprecated; use '%s' instead.",
|
||||
fmt->abbrevs[i].abbreviated,
|
||||
fmt->abbrevs[i].full);
|
||||
}
|
||||
return fmt->abbrevs[i].full;
|
||||
}
|
||||
@ -740,7 +740,7 @@ config_get_commandlines(int argc, char **argv, config_line_t **result)
|
||||
}
|
||||
if (i == argc-1) {
|
||||
warn(LD_CONFIG,"Command-line option '%s' with no value. Failing.",
|
||||
argv[i]);
|
||||
argv[i]);
|
||||
config_free_lines(front);
|
||||
return -1;
|
||||
}
|
||||
@ -867,8 +867,8 @@ config_find_option(config_format_t *fmt, const char *key)
|
||||
for (i=0; fmt->vars[i].name; ++i) {
|
||||
if (!strncasecmp(key, fmt->vars[i].name, keylen)) {
|
||||
warn(LD_CONFIG, "The abbreviation '%s' is deprecated. "
|
||||
"Please use '%s' instead",
|
||||
key, fmt->vars[i].name);
|
||||
"Please use '%s' instead",
|
||||
key, fmt->vars[i].name);
|
||||
return &fmt->vars[i];
|
||||
}
|
||||
}
|
||||
@ -1099,7 +1099,7 @@ get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key
|
||||
return NULL;
|
||||
} else if (var->type == CONFIG_TYPE_LINELIST_S) {
|
||||
warn(LD_CONFIG,
|
||||
"Can't return context-sensitive '%s' on its own", key);
|
||||
"Can't return context-sensitive '%s' on its own", key);
|
||||
return NULL;
|
||||
}
|
||||
value = ((char*)options) + var->var_offset;
|
||||
@ -2524,7 +2524,7 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
|
||||
levelMin = parse_log_level(tmp_sev);
|
||||
if (levelMin < 0) {
|
||||
warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
|
||||
"err|warn|notice|info|debug", tmp_sev);
|
||||
"err|warn|notice|info|debug", tmp_sev);
|
||||
tor_free(tmp_sev);
|
||||
return -1;
|
||||
}
|
||||
@ -2536,7 +2536,7 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
|
||||
levelMax = parse_log_level(cp+1);
|
||||
if (levelMax < 0) {
|
||||
warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
|
||||
"err|warn|notice|info|debug", cp+1);
|
||||
"err|warn|notice|info|debug", cp+1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -2544,7 +2544,7 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
|
||||
levelMin = parse_log_level(range);
|
||||
if (levelMin < 0) {
|
||||
warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
|
||||
"err|warn|notice|info|debug", range);
|
||||
"err|warn|notice|info|debug", range);
|
||||
return -1;
|
||||
}
|
||||
levelMax = LOG_ERR;
|
||||
@ -2581,7 +2581,7 @@ convert_log_option(or_options_t *options, config_line_t *level_opt,
|
||||
if (file_opt && !strcasecmp(file_opt->key, "LogFile")) {
|
||||
if (add_single_log_option(options, levelMin, levelMax, "file", file_opt->value) < 0) {
|
||||
warn(LD_FS, "Cannot write to LogFile \"%s\": %s.", file_opt->value,
|
||||
strerror(errno));
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
} else if (file_opt && !strcasecmp(file_opt->key, "SysLog")) {
|
||||
@ -2653,11 +2653,11 @@ options_init_logs(or_options_t *options, int validate_only)
|
||||
#endif
|
||||
} else {
|
||||
warn(LD_CONFIG, "Unrecognized log type %s",
|
||||
(const char*)smartlist_get(elts,1));
|
||||
(const char*)smartlist_get(elts,1));
|
||||
if (strchr(smartlist_get(elts,1), '/') ||
|
||||
strchr(smartlist_get(elts,1), '\\')) {
|
||||
warn(LD_CONFIG, "Did you mean to say 'Log file %s' ?",
|
||||
(const char *)smartlist_get(elts,1));
|
||||
(const char *)smartlist_get(elts,1));
|
||||
}
|
||||
ok = 0; goto cleanup;
|
||||
}
|
||||
@ -3397,7 +3397,7 @@ check_libevent_version(const char *m, const char *v, int server)
|
||||
} else if (slow && server) {
|
||||
log(LOG_WARN, LD_GENERAL,
|
||||
"libevent %s can be very slow with %s. "
|
||||
"When running a server, please use the latest version of libevent.",v,m);
|
||||
"When running a server, please use the latest version of libevent.",v,m);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
@ -367,7 +369,7 @@ connection_about_to_close_connection(connection_t *conn)
|
||||
/* since conn gets removed right after this function finishes,
|
||||
* there's no point trying to send back a reply at this point. */
|
||||
warn(LD_BUG,"Bug: Closing stream (marked at %s:%d) without sending back a socks reply.",
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
} else {
|
||||
control_event_stream_status(conn, STREAM_EVENT_CLOSED);
|
||||
}
|
||||
@ -403,9 +405,9 @@ connection_close_immediate(connection_t *conn)
|
||||
}
|
||||
if (conn->outbuf_flushlen) {
|
||||
info(LD_NET,"fd %d, type %s, state %s, %d bytes on outbuf.",
|
||||
conn->s, conn_type_to_string(conn->type),
|
||||
conn_state_to_string(conn->type, conn->state),
|
||||
(int)conn->outbuf_flushlen);
|
||||
conn->s, conn_type_to_string(conn->type),
|
||||
conn_state_to_string(conn->type, conn->state),
|
||||
(int)conn->outbuf_flushlen);
|
||||
}
|
||||
|
||||
connection_unregister(conn);
|
||||
@ -540,13 +542,13 @@ connection_create_listener(const char *listenaddress, uint16_t listenport,
|
||||
|
||||
if (bind(s,(struct sockaddr *)&listenaddr,sizeof(listenaddr)) < 0) {
|
||||
warn(LD_NET, "Could not bind to %s:%u: %s", address, usePort,
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (listen(s,SOMAXCONN) < 0) {
|
||||
warn(LD_NET, "Could not listen on %s:%u: %s", address, usePort,
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -638,7 +640,7 @@ connection_handle_listener_read(connection_t *conn, int new_type)
|
||||
}
|
||||
/* else there was a real error. */
|
||||
warn(LD_NET,"accept() failed: %s. Closing listener.",
|
||||
tor_socket_strerror(e));
|
||||
tor_socket_strerror(e));
|
||||
connection_mark_for_close(conn);
|
||||
return -1;
|
||||
}
|
||||
@ -748,12 +750,12 @@ connection_connect(connection_t *conn, char *address,
|
||||
s = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
|
||||
if (s < 0) {
|
||||
warn(LD_NET,"Error creating network socket: %s",
|
||||
tor_socket_strerror(tor_socket_errno(-1)));
|
||||
tor_socket_strerror(tor_socket_errno(-1)));
|
||||
return -1;
|
||||
} else if (!SOCKET_IS_POLLABLE(s)) {
|
||||
warn(LD_NET,
|
||||
"Too many connections; can't create pollable connection to %s",
|
||||
safe_str(address));
|
||||
"Too many connections; can't create pollable connection to %s",
|
||||
safe_str(address));
|
||||
tor_close_socket(s);
|
||||
return -1;
|
||||
}
|
||||
@ -766,11 +768,11 @@ connection_connect(connection_t *conn, char *address,
|
||||
ext_addr.sin_port = 0;
|
||||
if (!tor_inet_aton(options->OutboundBindAddress, &ext_addr.sin_addr)) {
|
||||
warn(LD_CONFIG,"Outbound bind address '%s' didn't parse. Ignoring.",
|
||||
options->OutboundBindAddress);
|
||||
options->OutboundBindAddress);
|
||||
} else {
|
||||
if (bind(s, (struct sockaddr*)&ext_addr, sizeof(ext_addr)) < 0) {
|
||||
warn(LD_NET,"Error binding network socket: %s",
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
tor_socket_strerror(tor_socket_errno(s)));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -790,7 +792,7 @@ connection_connect(connection_t *conn, char *address,
|
||||
if (!ERRNO_IS_CONN_EINPROGRESS(e)) {
|
||||
/* yuck. kill it. */
|
||||
info(LD_NET,"connect() to %s:%u failed: %s",safe_str(address),port,
|
||||
tor_socket_strerror(e));
|
||||
tor_socket_strerror(e));
|
||||
tor_close_socket(s);
|
||||
return -1;
|
||||
} else {
|
||||
@ -1232,7 +1234,7 @@ connection_read_to_buf(connection_t *conn, int *max_to_read)
|
||||
}
|
||||
|
||||
debug(LD_NET,"%d: starting, inbuf_datalen %d (%d pending in tls object). at_most %d.",
|
||||
conn->s,(int)buf_datalen(conn->inbuf),tor_tls_get_pending_bytes(conn->tls), at_most);
|
||||
conn->s,(int)buf_datalen(conn->inbuf),tor_tls_get_pending_bytes(conn->tls), at_most);
|
||||
|
||||
/* else open, or closing */
|
||||
result = read_to_buf_tls(conn->tls, at_most, conn->inbuf);
|
||||
@ -1240,11 +1242,11 @@ connection_read_to_buf(connection_t *conn, int *max_to_read)
|
||||
switch (result) {
|
||||
case TOR_TLS_CLOSE:
|
||||
info(LD_NET,"TLS connection closed on read. Closing. (Nickname %s, address %s",
|
||||
conn->nickname ? conn->nickname : "not set", conn->address);
|
||||
conn->nickname ? conn->nickname : "not set", conn->address);
|
||||
return -1;
|
||||
case TOR_TLS_ERROR:
|
||||
info(LD_NET,"tls error. breaking (nickname %s, address %s).",
|
||||
conn->nickname ? conn->nickname : "not set", conn->address);
|
||||
conn->nickname ? conn->nickname : "not set", conn->address);
|
||||
return -1;
|
||||
case TOR_TLS_WANTWRITE:
|
||||
connection_start_writing(conn);
|
||||
@ -1413,7 +1415,7 @@ connection_handle_write(connection_t *conn)
|
||||
case TOR_TLS_ERROR:
|
||||
case TOR_TLS_CLOSE:
|
||||
info(LD_NET,result==TOR_TLS_ERROR?
|
||||
"tls error. breaking.":"TLS connection closed on flush");
|
||||
"tls error. breaking.":"TLS connection closed on flush");
|
||||
connection_close_immediate(conn); /* Don't flush; connection is dead. */
|
||||
connection_mark_for_close(conn);
|
||||
return -1;
|
||||
|
@ -126,7 +126,7 @@ connection_edge_process_inbuf(connection_t *conn, int package_partial)
|
||||
case AP_CONN_STATE_RESOLVE_WAIT:
|
||||
case AP_CONN_STATE_CONTROLLER_WAIT:
|
||||
info(LD_EDGE,"data from edge while in '%s' state. Leaving it on buffer.",
|
||||
conn_state_to_string(conn->type, conn->state));
|
||||
conn_state_to_string(conn->type, conn->state));
|
||||
return 0;
|
||||
}
|
||||
warn(LD_BUG,"Bug: Got unexpected state %d. Closing.",conn->state);
|
||||
@ -183,7 +183,7 @@ connection_edge_end(connection_t *conn, char reason, crypt_path_t *cpath_layer)
|
||||
|
||||
if (conn->marked_for_close) {
|
||||
warn(LD_BUG,"Bug: called on conn that's already marked for close at %s:%d.",
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ connection_edge_finished_connecting(connection_t *conn)
|
||||
in.s_addr = htonl(conn->addr);
|
||||
tor_inet_ntoa(&in,valbuf,sizeof(valbuf));
|
||||
info(LD_EXIT,"Exit connection to %s:%u (%s) established.",
|
||||
safe_str(conn->address),conn->port,safe_str(valbuf));
|
||||
safe_str(conn->address),conn->port,safe_str(valbuf));
|
||||
|
||||
conn->state = EXIT_CONN_STATE_OPEN;
|
||||
connection_watch_events(conn, EV_READ); /* stop writing, continue reading */
|
||||
@ -341,7 +341,7 @@ connection_ap_expire_beginning(void)
|
||||
circ = circuit_get_by_edge_conn(conn);
|
||||
if (!circ) { /* it's vanished? */
|
||||
info(LD_APP,"Conn is waiting (address %s), but lost its circ.",
|
||||
safe_str(conn->socks_request->address));
|
||||
safe_str(conn->socks_request->address));
|
||||
connection_mark_unattached_ap(conn, END_STREAM_REASON_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
@ -588,7 +588,7 @@ addressmap_rewrite(char *address, size_t maxlen)
|
||||
strlcpy(address, ent->new_address, maxlen);
|
||||
}
|
||||
warn(LD_CONFIG,"Loop detected: we've rewritten '%s' 16 times! Using it as-is.",
|
||||
safe_str(address));
|
||||
safe_str(address));
|
||||
/* it's fine to rewrite a rewrite, but don't loop forever */
|
||||
}
|
||||
|
||||
@ -668,7 +668,7 @@ client_dns_incr_failures(const char *address)
|
||||
}
|
||||
++ent->num_resolve_failures;
|
||||
info(LD_APP, "Address %s now has %d resolve failures.",
|
||||
safe_str(address), ent->num_resolve_failures);
|
||||
safe_str(address), ent->num_resolve_failures);
|
||||
return ent->num_resolve_failures;
|
||||
}
|
||||
|
||||
@ -960,7 +960,7 @@ connection_ap_handshake_process_socks(connection_t *conn)
|
||||
|
||||
tor_strlower(socks->address); /* normalize it */
|
||||
debug(LD_APP,"Client asked for %s:%d", safe_str(socks->address),
|
||||
socks->port);
|
||||
socks->port);
|
||||
|
||||
/* For address map controls, remap the address */
|
||||
addressmap_rewrite(socks->address, sizeof(socks->address));
|
||||
@ -973,7 +973,7 @@ connection_ap_handshake_process_socks(connection_t *conn)
|
||||
* information.
|
||||
*/
|
||||
warn(LD_APP,"Missing mapping for virtual address '%s'. Refusing.",
|
||||
socks->address); /* don't safe_str() this yet. */
|
||||
socks->address); /* don't safe_str() this yet. */
|
||||
connection_mark_unattached_ap(conn, END_STREAM_REASON_INTERNAL);
|
||||
return -1;
|
||||
}
|
||||
@ -1029,7 +1029,7 @@ connection_ap_handshake_process_socks(connection_t *conn)
|
||||
if (tor_should_handle_stream &&
|
||||
address_is_invalid_destination(socks->address)) {
|
||||
warn(LD_APP,"Destination '%s' seems to be an invalid hostname. Failing.",
|
||||
safe_str(socks->address));
|
||||
safe_str(socks->address));
|
||||
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
|
||||
return -1;
|
||||
}
|
||||
@ -1066,7 +1066,7 @@ connection_ap_handshake_process_socks(connection_t *conn)
|
||||
router_find_exact_exit_enclave(socks->address, socks->port);
|
||||
if (r) {
|
||||
info(LD_APP,"Redirecting address %s to exit at enclave router %s",
|
||||
safe_str(socks->address), r->nickname);
|
||||
safe_str(socks->address), r->nickname);
|
||||
/* use the hex digest, not nickname, in case there are two
|
||||
routers with this nickname */
|
||||
conn->chosen_exit_name =
|
||||
@ -1103,19 +1103,19 @@ connection_ap_handshake_process_socks(connection_t *conn)
|
||||
|
||||
strlcpy(conn->rend_query, socks->address, sizeof(conn->rend_query));
|
||||
info(LD_REND,"Got a hidden service request for ID '%s'",
|
||||
safe_str(conn->rend_query));
|
||||
safe_str(conn->rend_query));
|
||||
/* see if we already have it cached */
|
||||
r = rend_cache_lookup_entry(conn->rend_query, -1, &entry);
|
||||
if (r<0) {
|
||||
warn(LD_REND,"Invalid service descriptor %s",
|
||||
safe_str(conn->rend_query));
|
||||
safe_str(conn->rend_query));
|
||||
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
|
||||
return -1;
|
||||
}
|
||||
if (r==0) {
|
||||
conn->state = AP_CONN_STATE_RENDDESC_WAIT;
|
||||
info(LD_REND, "Unknown descriptor %s. Fetching.",
|
||||
safe_str(conn->rend_query));
|
||||
safe_str(conn->rend_query));
|
||||
rend_client_refetch_renddesc(conn->rend_query);
|
||||
} else { /* r > 0 */
|
||||
#define NUM_SECONDS_BEFORE_REFETCH (60*15)
|
||||
@ -1243,7 +1243,7 @@ connection_ap_handshake_send_resolve(connection_t *ap_conn, circuit_t *circ)
|
||||
|
||||
ap_conn->state = AP_CONN_STATE_RESOLVE_WAIT;
|
||||
info(LD_APP,"Address sent for resolve, ap socket %d, n_circ_id %d",
|
||||
ap_conn->s, circ->n_circ_id);
|
||||
ap_conn->s, circ->n_circ_id);
|
||||
control_event_stream_status(ap_conn, STREAM_EVENT_SENT_RESOLVE);
|
||||
return 0;
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ connection_ap_make_bridge(char *address, uint16_t port)
|
||||
|
||||
if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fd)) < 0) {
|
||||
warn(LD_NET,"Couldn't construct socketpair (%s). Network down? Delaying.",
|
||||
tor_socket_strerror(-err));
|
||||
tor_socket_strerror(-err));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1607,7 +1607,7 @@ connection_exit_connect(connection_t *conn)
|
||||
if (!connection_edge_is_rendezvous_stream(conn) &&
|
||||
router_compare_to_my_exit_policy(conn)) {
|
||||
info(LD_EXIT,"%s:%d failed exit policy. Closing.",
|
||||
safe_str(conn->address), conn->port);
|
||||
safe_str(conn->address), conn->port);
|
||||
connection_edge_end(conn, END_STREAM_REASON_EXITPOLICY, conn->cpath_layer);
|
||||
circuit_detach_stream(circuit_get_by_edge_conn(conn), conn);
|
||||
connection_free(conn);
|
||||
@ -1629,7 +1629,7 @@ connection_exit_connect(connection_t *conn)
|
||||
in.s_addr = htonl(addr);
|
||||
tor_inet_ntoa(&in, tmpbuf, sizeof(tmpbuf));
|
||||
debug(LD_EXIT, "Redirecting connection from %s:%d to %s:%d",
|
||||
safe_str(conn->address), conn->port, safe_str(tmpbuf), port);
|
||||
safe_str(conn->address), conn->port, safe_str(tmpbuf), port);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1716,7 +1716,7 @@ connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit)
|
||||
if (router_get_by_nickname(conn->chosen_exit_name, 1) != exit) {
|
||||
/* doesn't match */
|
||||
debug(LD_APP,"Requested node '%s', considering node '%s'. No.",
|
||||
conn->chosen_exit_name, exit->nickname);
|
||||
conn->chosen_exit_name, exit->nickname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ connection_or_read_proxy_response(connection_t *conn)
|
||||
}
|
||||
/* else, bad news on the status code */
|
||||
warn(LD_OR,
|
||||
"The https proxy sent back an unexpected status code %d (\"%s\"). Closing.",
|
||||
status_code, reason);
|
||||
"The https proxy sent back an unexpected status code %d (\"%s\"). Closing.",
|
||||
status_code, reason);
|
||||
tor_free(reason);
|
||||
connection_mark_for_close(conn);
|
||||
return -1;
|
||||
@ -260,7 +260,7 @@ connection_or_finished_connecting(connection_t *conn)
|
||||
tor_assert(conn->state == OR_CONN_STATE_CONNECTING);
|
||||
|
||||
debug(LD_OR,"OR connect() to router at %s:%u finished.",
|
||||
conn->address,conn->port);
|
||||
conn->address,conn->port);
|
||||
|
||||
if (get_options()->HttpsProxy) {
|
||||
char buf[1024];
|
||||
@ -572,7 +572,7 @@ connection_or_check_valid_handshake(connection_t *conn, char *digest_rcvd)
|
||||
}
|
||||
check_no_tls_errors();
|
||||
debug(LD_OR, "Other side (%s:%d) claims to be router '%s'",
|
||||
conn->address, conn->port, nickname);
|
||||
conn->address, conn->port, nickname);
|
||||
|
||||
if (tor_tls_verify(severity, conn->tls, &identity_rcvd) < 0) {
|
||||
log_fn(severity,LD_OR,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.",
|
||||
@ -655,7 +655,7 @@ connection_tls_finish_handshake(connection_t *conn)
|
||||
connection_t *c;
|
||||
if ((c=connection_or_get_by_identity_digest(digest_rcvd))) {
|
||||
debug(LD_OR,"Router '%s' is already connected on fd %d. Dropping fd %d.",
|
||||
c->nickname, c->s, conn->s);
|
||||
c->nickname, c->s, conn->s);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
@ -710,7 +710,7 @@ connection_or_write_cell_to_buf(const cell_t *cell, connection_t *conn)
|
||||
if (!conn->marked_for_close) {
|
||||
/* this connection is broken. remove it. */
|
||||
warn(LD_BUG,"Bug: unhandled error on write for OR conn (fd %d); removing",
|
||||
conn->s);
|
||||
conn->s);
|
||||
tor_fragile_assert();
|
||||
conn->has_sent_end = 1; /* otherwise we cry wolf about duplicate close */
|
||||
/* XXX do we need a close-immediate here, so we don't try to flush? */
|
||||
@ -740,7 +740,7 @@ connection_or_process_cells_from_inbuf(connection_t *conn)
|
||||
|
||||
loop:
|
||||
debug(LD_OR,"%d: starting, inbuf_datalen %d (%d pending in tls object).",
|
||||
conn->s,(int)buf_datalen(conn->inbuf),tor_tls_get_pending_bytes(conn->tls));
|
||||
conn->s,(int)buf_datalen(conn->inbuf),tor_tls_get_pending_bytes(conn->tls));
|
||||
if (buf_datalen(conn->inbuf) < CELL_NETWORK_SIZE) /* entire response available? */
|
||||
return 0; /* not yet */
|
||||
|
||||
|
@ -1339,7 +1339,7 @@ handle_getinfo_helper(const char *question, char **answer)
|
||||
state = "SUCCEEDED"; break;
|
||||
default:
|
||||
warn(LD_BUG, "Asked for stream in unknown state %d",
|
||||
conns[i]->state);
|
||||
conns[i]->state);
|
||||
continue;
|
||||
}
|
||||
circ = circuit_get_by_edge_conn(conns[i]);
|
||||
@ -2281,7 +2281,7 @@ connection_control_process_inbuf_v0(connection_t *conn)
|
||||
case CONTROL0_CMD_EVENT:
|
||||
case CONTROL0_CMD_INFOVALUE:
|
||||
warn(LD_CONTROL, "Received client-only '%s' command; ignoring.",
|
||||
control_cmd_to_string(command_type));
|
||||
control_cmd_to_string(command_type));
|
||||
send_control0_error(conn, ERR_UNRECOGNIZED_TYPE,
|
||||
"Command type only valid from server to tor client");
|
||||
break;
|
||||
@ -2291,7 +2291,7 @@ connection_control_process_inbuf_v0(connection_t *conn)
|
||||
send_control0_error(conn, ERR_SYNTAX, "Bad fragmentation on command.");
|
||||
default:
|
||||
warn(LD_CONTROL, "Received unrecognized command type %d; ignoring.",
|
||||
(int)command_type);
|
||||
(int)command_type);
|
||||
send_control0_error(conn, ERR_UNRECOGNIZED_TYPE,
|
||||
"Unrecognized command type");
|
||||
break;
|
||||
|
@ -282,16 +282,16 @@ connection_dir_request_failed(connection_t *conn)
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_DIR ||
|
||||
conn->purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
|
||||
info(LD_DIR, "Giving up on directory server at '%s:%d'; retrying",
|
||||
conn->address, conn->port);
|
||||
conn->address, conn->port);
|
||||
directory_get_from_dirserver(conn->purpose, NULL,
|
||||
0 /* don't retry_if_no_servers */);
|
||||
} else if (conn->purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
|
||||
info(LD_DIR, "Giving up on directory server at '%s'; retrying",
|
||||
conn->address);
|
||||
conn->address);
|
||||
connection_dir_download_networkstatus_failed(conn);
|
||||
} else if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC) {
|
||||
info(LD_DIR, "Giving up on directory server at '%s'; retrying",
|
||||
conn->address);
|
||||
conn->address);
|
||||
connection_dir_download_routerdesc_failed(conn);
|
||||
}
|
||||
}
|
||||
@ -501,7 +501,7 @@ directory_send_command(connection_t *conn, const char *platform,
|
||||
tor_assert(!resource);
|
||||
tor_assert(!payload);
|
||||
debug(LD_DIR, "Asking for compressed directory from server running %s",
|
||||
platform?platform:"<unknown version>");
|
||||
platform?platform:"<unknown version>");
|
||||
httpcommand = "GET";
|
||||
url = tor_strdup("/tor/dir.z");
|
||||
break;
|
||||
@ -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;
|
||||
}
|
||||
@ -877,9 +879,9 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
description2 = "uncompressed";
|
||||
|
||||
info(LD_HTTP, "HTTP body from server '%s:%d' was labeled %s, "
|
||||
"but it seems to be %s.%s",
|
||||
conn->address, conn->port, description1, description2,
|
||||
(compression>0 && guessed>0)?" Trying both.":"");
|
||||
"but it seems to be %s.%s",
|
||||
conn->address, conn->port, description1, description2,
|
||||
(compression>0 && guessed>0)?" Trying both.":"");
|
||||
}
|
||||
/* Try declared compression first if we can. */
|
||||
if (compression > 0)
|
||||
@ -908,16 +910,16 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_DIR) {
|
||||
/* fetch/process the directory to learn about new routers. */
|
||||
info(LD_DIR,"Received directory (size %d) from server '%s:%d'",
|
||||
(int)body_len, conn->address, conn->port);
|
||||
(int)body_len, conn->address, conn->port);
|
||||
if (status_code == 503 || body_len == 0) {
|
||||
info(LD_DIR,"Empty directory; status %d (\"%s\") Ignoring.",
|
||||
status_code, reason);
|
||||
status_code, reason);
|
||||
tor_free(body); tor_free(headers); tor_free(reason);
|
||||
return -1;
|
||||
}
|
||||
if (status_code != 200) {
|
||||
warn(LD_DIR,"Received http status code %d (\"%s\") from server '%s:%d'. I'll try again soon.",
|
||||
status_code, reason, conn->address, conn->port);
|
||||
status_code, reason, conn->address, conn->port);
|
||||
tor_free(body); tor_free(headers); tor_free(reason);
|
||||
return -1;
|
||||
}
|
||||
@ -931,13 +933,13 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
info(LD_DIR,"Received running-routers list (size %d)", (int)body_len);
|
||||
if (status_code != 200) {
|
||||
warn(LD_DIR,"Received http status code %d (\"%s\") from server '%s:%d'. I'll try again soon.",
|
||||
status_code, reason, conn->address, conn->port);
|
||||
status_code, reason, conn->address, conn->port);
|
||||
tor_free(body); tor_free(headers); tor_free(reason);
|
||||
return -1;
|
||||
}
|
||||
if (router_parse_runningrouters(body)<0) {
|
||||
warn(LD_DIR,"Bad running-routers from server '%s:%d'. I'll try again soon.",
|
||||
conn->address, conn->port);
|
||||
conn->address, conn->port);
|
||||
tor_free(body); tor_free(headers); tor_free(reason);
|
||||
return -1;
|
||||
}
|
||||
@ -949,8 +951,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
info(LD_DIR,"Received networkstatus objects (size %d) from server '%s:%d'",(int) body_len, conn->address, conn->port);
|
||||
if (status_code != 200) {
|
||||
warn(LD_DIR,"Received http status code %d (\"%s\") from server '%s:%d' while fetching \"/tor/status/%s\". I'll try again soon.",
|
||||
status_code, reason, conn->address, conn->port,
|
||||
conn->requested_resource);
|
||||
status_code, reason, conn->address, conn->port,
|
||||
conn->requested_resource);
|
||||
tor_free(body); tor_free(headers); tor_free(reason);
|
||||
connection_dir_download_networkstatus_failed(conn);
|
||||
return -1;
|
||||
@ -991,7 +993,7 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
smartlist_t *which = NULL;
|
||||
int n_asked_for = 0;
|
||||
info(LD_DIR,"Received server info (size %d) from server '%s:%d'",
|
||||
(int)body_len, conn->address, conn->port);
|
||||
(int)body_len, conn->address, conn->port);
|
||||
if (conn->requested_resource &&
|
||||
!strcmpstart(conn->requested_resource,"fp/")) {
|
||||
which = smartlist_create();
|
||||
@ -1031,8 +1033,8 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
}
|
||||
if (which) { /* mark remaining ones as failed */
|
||||
info(LD_DIR, "Received %d/%d routers requested from %s:%d",
|
||||
n_asked_for-smartlist_len(which), n_asked_for,
|
||||
conn->address, (int)conn->port);
|
||||
n_asked_for-smartlist_len(which), n_asked_for,
|
||||
conn->address, (int)conn->port);
|
||||
if (smartlist_len(which)) {
|
||||
dir_routerdesc_download_failed(which);
|
||||
}
|
||||
@ -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
|
||||
@ -1076,7 +1079,7 @@ connection_dir_client_reached_eof(connection_t *conn)
|
||||
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_RENDDESC) {
|
||||
info(LD_REND,"Received rendezvous descriptor (size %d, status %d (\"%s\"))",
|
||||
(int)body_len, status_code, reason);
|
||||
(int)body_len, status_code, reason);
|
||||
switch (status_code) {
|
||||
case 200:
|
||||
if (rend_cache_store(body, body_len) < 0) {
|
||||
@ -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,11 +1265,13 @@ 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",
|
||||
date,
|
||||
(int)dlen,
|
||||
deflated?"application/octet-stream":"text/plain",
|
||||
deflated?"deflate":"identity");
|
||||
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",
|
||||
deflated?"deflate":"identity");
|
||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||
connection_write_to_buf(cp, dlen, conn);
|
||||
return 0;
|
||||
@ -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",
|
||||
@ -1374,9 +1384,9 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
}
|
||||
tor_free(inp);
|
||||
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"
|
||||
"Content-Encoding: deflate\r\n\r\n",
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: application/octet-stream\r\n"
|
||||
"Content-Encoding: deflate\r\n\r\n",
|
||||
date,
|
||||
(int)compressed_len);
|
||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||
@ -1384,8 +1394,8 @@ directory_handle_command_get(connection_t *conn, char *headers,
|
||||
tor_free(compressed);
|
||||
} else {
|
||||
tor_snprintf(tmp, sizeof(tmp),
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: text/plain\r\n\r\n",
|
||||
"HTTP/1.0 200 OK\r\nDate: %s\r\nContent-Length: %d\r\n"
|
||||
"Content-Type: text/plain\r\n\r\n",
|
||||
date,
|
||||
(int)len);
|
||||
connection_write_to_buf(tmp, strlen(tmp), conn);
|
||||
@ -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",
|
||||
date,
|
||||
(int)desc_len); /* can't include descp here, because it's got nuls */
|
||||
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);
|
||||
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 */
|
||||
@ -1658,13 +1671,13 @@ dir_routerdesc_download_failed(smartlist_t *failed)
|
||||
}
|
||||
if (rs->next_attempt_at == 0)
|
||||
debug(LD_DIR, "%s failed %d time(s); I'll try again immediately.",
|
||||
cp, (int)rs->n_download_failures);
|
||||
cp, (int)rs->n_download_failures);
|
||||
else if (rs->next_attempt_at < TIME_MAX)
|
||||
debug(LD_DIR, "%s failed %d time(s); I'll try again in %d seconds.",
|
||||
cp, (int)rs->n_download_failures, (int)(rs->next_attempt_at-now));
|
||||
cp, (int)rs->n_download_failures, (int)(rs->next_attempt_at-now));
|
||||
else
|
||||
debug(LD_DIR, "%s failed %d time(s); Giving up for a while.",
|
||||
cp, (int)rs->n_download_failures);
|
||||
cp, (int)rs->n_download_failures);
|
||||
});
|
||||
|
||||
/* update_router_descriptor_downloads(time(NULL)); */
|
||||
|
@ -204,8 +204,8 @@ dirserv_parse_fingerprint_file(const char *fname)
|
||||
/* If you approved an OR called "client", then clients who use
|
||||
* the default nickname could all be rejected. That's no good. */
|
||||
notice(LD_CONFIG,
|
||||
"Authorizing a nickname '%s' would break many clients; skipping.",
|
||||
DEFAULT_CLIENT_NICKNAME);
|
||||
"Authorizing a nickname '%s' would break many clients; skipping.",
|
||||
DEFAULT_CLIENT_NICKNAME);
|
||||
continue;
|
||||
}
|
||||
if (add_fingerprint_to_dir(nickname, fingerprint, fingerprint_list_new) != 0)
|
||||
@ -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 : "");
|
||||
@ -551,7 +553,7 @@ directory_remove_invalid(void)
|
||||
switch (r) {
|
||||
case FP_REJECT:
|
||||
info(LD_DIRSERV, "Router '%s' is now rejected: %s",
|
||||
ent->nickname, msg?msg:"");
|
||||
ent->nickname, msg?msg:"");
|
||||
routerlist_remove(rl, ent, i--, 0);
|
||||
changed = 1;
|
||||
break;
|
||||
@ -829,13 +831,13 @@ dirserv_dump_directory_to_string(char **dir_out,
|
||||
overruns.*/
|
||||
|
||||
tor_snprintf(buf, buf_len,
|
||||
"signed-directory\n"
|
||||
"published %s\n"
|
||||
"recommended-software %s\n"
|
||||
"router-status %s\n"
|
||||
"dir-signing-key\n%s\n",
|
||||
published, recommended_versions, router_status,
|
||||
identity_pkey);
|
||||
"signed-directory\n"
|
||||
"published %s\n"
|
||||
"recommended-software %s\n"
|
||||
"router-status %s\n"
|
||||
"dir-signing-key\n%s\n",
|
||||
published, recommended_versions, router_status,
|
||||
identity_pkey);
|
||||
|
||||
tor_free(recommended_versions);
|
||||
tor_free(router_status);
|
||||
|
21
src/or/dns.c
21
src/or/dns.c
@ -158,7 +158,7 @@ purge_expired_resolves(uint32_t now)
|
||||
while (oldest_cached_resolve && (oldest_cached_resolve->expire < now)) {
|
||||
resolve = oldest_cached_resolve;
|
||||
debug(LD_EXIT,"Forgetting old cached resolve (address %s, expires %lu)",
|
||||
safe_str(resolve->address), (unsigned long)resolve->expire);
|
||||
safe_str(resolve->address), (unsigned long)resolve->expire);
|
||||
if (resolve->state == CACHE_STATE_PENDING) {
|
||||
debug(LD_EXIT,"Bug: Expiring a dns resolve ('%s') that's still pending. Forgot to cull it?", safe_str(resolve->address));
|
||||
tor_fragile_assert();
|
||||
@ -292,19 +292,19 @@ dns_resolve(connection_t *exitconn)
|
||||
pending_connection->next = resolve->pending_connections;
|
||||
resolve->pending_connections = pending_connection;
|
||||
debug(LD_EXIT,"Connection (fd %d) waiting for pending DNS resolve of '%s'",
|
||||
exitconn->s, safe_str(exitconn->address));
|
||||
exitconn->s, safe_str(exitconn->address));
|
||||
exitconn->state = EXIT_CONN_STATE_RESOLVING;
|
||||
return 0;
|
||||
case CACHE_STATE_VALID:
|
||||
exitconn->addr = resolve->addr;
|
||||
debug(LD_EXIT,"Connection (fd %d) found cached answer for '%s'",
|
||||
exitconn->s, safe_str(exitconn->address));
|
||||
exitconn->s, safe_str(exitconn->address));
|
||||
if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
|
||||
send_resolved_cell(exitconn, RESOLVED_TYPE_IPV4);
|
||||
return 1;
|
||||
case CACHE_STATE_FAILED:
|
||||
debug(LD_EXIT,"Connection (fd %d) found cached error for '%s'",
|
||||
exitconn->s, safe_str(exitconn->address));
|
||||
exitconn->s, safe_str(exitconn->address));
|
||||
if (exitconn->purpose == EXIT_PURPOSE_RESOLVE)
|
||||
send_resolved_cell(exitconn, RESOLVED_TYPE_ERROR);
|
||||
circ = circuit_get_by_edge_conn(exitconn);
|
||||
@ -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);
|
||||
@ -407,7 +408,7 @@ connection_dns_remove(connection_t *conn)
|
||||
resolve->pending_connections = pend->next;
|
||||
tor_free(pend);
|
||||
debug(LD_EXIT, "First connection (fd %d) no longer waiting for resolve of '%s'",
|
||||
conn->s, safe_str(conn->address));
|
||||
conn->s, safe_str(conn->address));
|
||||
return;
|
||||
} else {
|
||||
for ( ; pend->next; pend = pend->next) {
|
||||
@ -416,7 +417,7 @@ connection_dns_remove(connection_t *conn)
|
||||
pend->next = victim->next;
|
||||
tor_free(victim);
|
||||
debug(LD_EXIT, "Connection (fd %d) no longer waiting for resolve of '%s'",
|
||||
conn->s, safe_str(conn->address));
|
||||
conn->s, safe_str(conn->address));
|
||||
return; /* more are pending */
|
||||
}
|
||||
}
|
||||
@ -485,7 +486,7 @@ dns_cancel_pending_resolve(char *address)
|
||||
if (!resolve->pending_connections) {
|
||||
/* XXX this should never trigger, but sometimes it does */
|
||||
warn(LD_BUG,"Bug: Address '%s' is pending but has no pending connections!",
|
||||
safe_str(address));
|
||||
safe_str(address));
|
||||
tor_fragile_assert();
|
||||
return;
|
||||
}
|
||||
@ -704,7 +705,7 @@ connection_dns_process_inbuf(connection_t *conn)
|
||||
connection_fetch_from_buf(&success,1,conn);
|
||||
connection_fetch_from_buf((char *)&addr,sizeof(uint32_t),conn);
|
||||
warn(LD_EXIT,"Discarding idle dns answer (success %d, addr %d.)",
|
||||
success, addr); // XXX safe_str
|
||||
success, addr); // XXX safe_str
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -942,7 +943,7 @@ spawn_enough_dnsworkers(void)
|
||||
/* too many idle? */
|
||||
/* cull excess workers */
|
||||
info(LD_EXIT,"%d of %d dnsworkers are idle. Killing one.",
|
||||
num_dnsworkers-num_dnsworkers_busy, num_dnsworkers);
|
||||
num_dnsworkers-num_dnsworkers_busy, num_dnsworkers);
|
||||
dnsconn = connection_get_by_type_state(CONN_TYPE_DNSWORKER, DNSWORKER_STATE_IDLE);
|
||||
tor_assert(dnsconn);
|
||||
connection_mark_for_close(dnsconn);
|
||||
|
@ -459,9 +459,9 @@ accounting_set_wakeup_time(void)
|
||||
interval_wakeup_time = interval_start_time;
|
||||
|
||||
notice(LD_ACCT, "Configured hibernation. This interval begins at %s "
|
||||
"and ends at %s. We have no prior estimate for bandwidth, so "
|
||||
"we will start out awake and hibernate when we exhaust our quota.",
|
||||
buf1, buf2);
|
||||
"and ends at %s. We have no prior estimate for bandwidth, so "
|
||||
"we will start out awake and hibernate when we exhaust our quota.",
|
||||
buf1, buf2);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -567,12 +567,12 @@ read_bandwidth_usage(void)
|
||||
if (smartlist_len(elts)<1 ||
|
||||
atoi(smartlist_get(elts,0)) != BW_ACCOUNTING_VERSION) {
|
||||
warn(LD_ACCT, "Unrecognized bw_accounting file version: %s",
|
||||
(const char*)smartlist_get(elts,0));
|
||||
(const char*)smartlist_get(elts,0));
|
||||
goto err;
|
||||
}
|
||||
if (smartlist_len(elts) < 7) {
|
||||
warn(LD_ACCT, "Corrupted bw_accounting file: %d lines",
|
||||
smartlist_len(elts));
|
||||
smartlist_len(elts));
|
||||
goto err;
|
||||
}
|
||||
if (parse_iso_time(smartlist_get(elts,1), &t1)) {
|
||||
@ -619,12 +619,12 @@ read_bandwidth_usage(void)
|
||||
"this interval. At the start of the interval, we expected to use "
|
||||
"about %lu KB per second. ("U64_FORMAT" bytes read so far, "
|
||||
U64_FORMAT" bytes written so far)",
|
||||
(char*)smartlist_get(elts,2),
|
||||
(char*)smartlist_get(elts,1),
|
||||
(unsigned long)n_seconds_active_in_interval,
|
||||
(unsigned long)((uint64_t)expected_bandwidth_usage*1024/60),
|
||||
U64_PRINTF_ARG(n_bytes_read_in_interval),
|
||||
U64_PRINTF_ARG(n_bytes_written_in_interval));
|
||||
(char*)smartlist_get(elts,2),
|
||||
(char*)smartlist_get(elts,1),
|
||||
(unsigned long)n_seconds_active_in_interval,
|
||||
(unsigned long)((uint64_t)expected_bandwidth_usage*1024/60),
|
||||
U64_PRINTF_ARG(n_bytes_read_in_interval),
|
||||
U64_PRINTF_ARG(n_bytes_written_in_interval));
|
||||
SMARTLIST_FOREACH(elts, char *, cp, tor_free(cp));
|
||||
smartlist_free(elts);
|
||||
|
||||
@ -671,8 +671,8 @@ hibernate_begin(int new_state, time_t now)
|
||||
if (new_state == HIBERNATE_STATE_EXITING &&
|
||||
hibernate_state != HIBERNATE_STATE_LIVE) {
|
||||
notice(LD_GENERAL,"Sigint received %s; exiting now.",
|
||||
hibernate_state == HIBERNATE_STATE_EXITING ?
|
||||
"a second time" : "while hibernating");
|
||||
hibernate_state == HIBERNATE_STATE_EXITING ?
|
||||
"a second time" : "while hibernating");
|
||||
tor_cleanup();
|
||||
exit(0);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ connection_add(connection_t *conn)
|
||||
nfds++;
|
||||
|
||||
debug(LD_NET,"new conn type %s, socket %d, nfds %d.",
|
||||
conn_type_to_string(conn->type), conn->s, nfds);
|
||||
conn_type_to_string(conn->type), conn->s, nfds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -332,7 +332,7 @@ connection_stop_writing(connection_t *conn)
|
||||
|
||||
if (event_del(conn->write_event))
|
||||
warn(LD_NET, "Error from libevent setting write event state for %d to unwatched.",
|
||||
conn->s);
|
||||
conn->s);
|
||||
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ connection_start_writing(connection_t *conn)
|
||||
|
||||
if (event_add(conn->write_event, NULL))
|
||||
warn(LD_NET, "Error from libevent setting write event state for %d to watched.",
|
||||
conn->s);
|
||||
conn->s);
|
||||
}
|
||||
|
||||
/** Close all connections that have been scheduled to get closed */
|
||||
@ -379,7 +379,7 @@ conn_read_callback(int fd, short event, void *_conn)
|
||||
if (!conn->marked_for_close) {
|
||||
#ifndef MS_WINDOWS
|
||||
warn(LD_BUG,"Bug: unhandled error on read for %s connection (fd %d); removing",
|
||||
conn_type_to_string(conn->type), conn->s);
|
||||
conn_type_to_string(conn->type), conn->s);
|
||||
tor_fragile_assert();
|
||||
#endif
|
||||
if (CONN_IS_EDGE(conn))
|
||||
@ -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->address, conn->s, conn_type_to_string(conn->type), conn->state,
|
||||
(int)conn->outbuf_flushlen, conn->marked_for_close_file, conn->marked_for_close);
|
||||
"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);
|
||||
if (connection_speaks_cells(conn)) {
|
||||
if (conn->state == OR_CONN_STATE_OPEN) {
|
||||
retval = flush_buf_tls(conn->tls, conn->outbuf, sz, &conn->outbuf_flushlen);
|
||||
@ -590,7 +591,7 @@ run_connection_housekeeping(int i, time_t now)
|
||||
!conn->marked_for_close &&
|
||||
conn->timestamp_lastwritten + 5*60 < now) {
|
||||
info(LD_DIR,"Expiring wedged directory conn (fd %d, purpose %d)",
|
||||
conn->s, conn->purpose);
|
||||
conn->s, conn->purpose);
|
||||
/* This check is temporary; it's to let us know whether we should consider
|
||||
* parsing partial serverdesc responses. */
|
||||
if (conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC &&
|
||||
@ -643,7 +644,7 @@ run_connection_housekeeping(int i, time_t now)
|
||||
(!router || !server_mode(options) ||
|
||||
!router_is_clique_mode(router))) {
|
||||
info(LD_OR,"Expiring non-used OR connection to fd %d (%s:%d) [Not in clique mode].",
|
||||
conn->s,conn->address, conn->port);
|
||||
conn->s,conn->address, conn->port);
|
||||
connection_mark_for_close(conn);
|
||||
conn->hold_open_until_flushed = 1;
|
||||
} else if (
|
||||
@ -926,12 +927,12 @@ second_elapsed_callback(int fd, short event, void *args)
|
||||
warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that "
|
||||
"its ORPort is reachable. Please check your firewalls, ports, "
|
||||
"address, /etc/hosts file, etc.",
|
||||
me->address, me->or_port);
|
||||
me->address, me->or_port);
|
||||
if (me && !check_whether_dirport_reachable())
|
||||
warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that its "
|
||||
"DirPort is reachable. Please check your firewalls, ports, "
|
||||
"address, /etc/hosts file, etc.",
|
||||
me->address, me->dir_port);
|
||||
me->address, me->dir_port);
|
||||
}
|
||||
|
||||
/* if more than 100s have elapsed, probably the clock jumped: doesn't count. */
|
||||
@ -1102,10 +1103,10 @@ do_main_loop(void)
|
||||
if (e != EINTR && !ERRNO_IS_EINPROGRESS(e)) {
|
||||
#ifdef HAVE_EVENT_GET_METHOD
|
||||
err(LD_NET,"libevent poll with %s failed: %s [%d]",
|
||||
event_get_method(), tor_socket_strerror(e), e);
|
||||
event_get_method(), tor_socket_strerror(e), e);
|
||||
#else
|
||||
err(LD_NET,"libevent poll failed: %s [%d]",
|
||||
tor_socket_strerror(e), e);
|
||||
tor_socket_strerror(e), e);
|
||||
#endif
|
||||
return -1;
|
||||
#ifndef MS_WINDOWS
|
||||
@ -1249,44 +1250,44 @@ dumpstats(int severity)
|
||||
for (i=0;i<nfds;i++) {
|
||||
conn = connection_array[i];
|
||||
log(severity, LD_GENERAL, "Conn %d (socket %d) type %d (%s), state %d (%s), created %d secs ago",
|
||||
i, conn->s, conn->type, conn_type_to_string(conn->type),
|
||||
i, conn->s, conn->type, conn_type_to_string(conn->type),
|
||||
conn->state, conn_state_to_string(conn->type, conn->state), (int)(now - conn->timestamp_created));
|
||||
if (!connection_is_listener(conn)) {
|
||||
log(severity,LD_GENERAL,"Conn %d is to '%s:%d'.",i,safe_str(conn->address), conn->port);
|
||||
log(severity,LD_GENERAL, "Conn %d: %d bytes waiting on inbuf (len %d, last read %d secs ago)",i,
|
||||
(int)buf_datalen(conn->inbuf),
|
||||
(int)buf_capacity(conn->inbuf),
|
||||
(int)(now - conn->timestamp_lastread));
|
||||
(int)buf_datalen(conn->inbuf),
|
||||
(int)buf_capacity(conn->inbuf),
|
||||
(int)(now - conn->timestamp_lastread));
|
||||
log(severity,LD_GENERAL, "Conn %d: %d bytes waiting on outbuf (len %d, last written %d secs ago)",i,
|
||||
(int)buf_datalen(conn->outbuf),
|
||||
(int)buf_capacity(conn->outbuf),
|
||||
(int)(now - conn->timestamp_lastwritten));
|
||||
(int)buf_datalen(conn->outbuf),
|
||||
(int)buf_capacity(conn->outbuf),
|
||||
(int)(now - conn->timestamp_lastwritten));
|
||||
}
|
||||
circuit_dump_by_conn(conn, severity); /* dump info about all the circuits using this conn */
|
||||
}
|
||||
log(severity, LD_NET,
|
||||
"Cells processed: %10lu padding\n"
|
||||
" %10lu create\n"
|
||||
" %10lu created\n"
|
||||
" %10lu relay\n"
|
||||
" (%10lu relayed)\n"
|
||||
" (%10lu delivered)\n"
|
||||
" %10lu destroy",
|
||||
stats_n_padding_cells_processed,
|
||||
stats_n_create_cells_processed,
|
||||
stats_n_created_cells_processed,
|
||||
stats_n_relay_cells_processed,
|
||||
stats_n_relay_cells_relayed,
|
||||
stats_n_relay_cells_delivered,
|
||||
stats_n_destroy_cells_processed);
|
||||
"Cells processed: %10lu padding\n"
|
||||
" %10lu create\n"
|
||||
" %10lu created\n"
|
||||
" %10lu relay\n"
|
||||
" (%10lu relayed)\n"
|
||||
" (%10lu delivered)\n"
|
||||
" %10lu destroy",
|
||||
stats_n_padding_cells_processed,
|
||||
stats_n_create_cells_processed,
|
||||
stats_n_created_cells_processed,
|
||||
stats_n_relay_cells_processed,
|
||||
stats_n_relay_cells_relayed,
|
||||
stats_n_relay_cells_delivered,
|
||||
stats_n_destroy_cells_processed);
|
||||
if (stats_n_data_cells_packaged)
|
||||
log(severity,LD_NET,"Average packaged cell fullness: %2.3f%%",
|
||||
100*(((double)stats_n_data_bytes_packaged) /
|
||||
(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
|
||||
100*(((double)stats_n_data_bytes_packaged) /
|
||||
(stats_n_data_cells_packaged*RELAY_PAYLOAD_SIZE)) );
|
||||
if (stats_n_data_cells_received)
|
||||
log(severity,LD_NET,"Average delivered cell fullness: %2.3f%%",
|
||||
100*(((double)stats_n_data_bytes_received) /
|
||||
(stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
|
||||
100*(((double)stats_n_data_bytes_received) /
|
||||
(stats_n_data_cells_received*RELAY_PAYLOAD_SIZE)) );
|
||||
|
||||
if (now - time_of_process_start >= 0)
|
||||
elapsed = now - time_of_process_start;
|
||||
@ -1350,7 +1351,7 @@ handle_signals(int is_parent)
|
||||
(void*)(uintptr_t)signals[i]);
|
||||
if (signal_add(&signal_events[i], NULL))
|
||||
warn(LD_BUG, "Error from libevent when adding event for signal %d",
|
||||
signals[i]);
|
||||
signals[i]);
|
||||
}
|
||||
} else {
|
||||
struct sigaction action;
|
||||
|
@ -240,7 +240,7 @@ onion_skin_server_handshake(const char *onion_skin, /* ONIONSKIN_CHALLENGE_LEN b
|
||||
goto err;
|
||||
} else if (len != DH_KEY_LEN) {
|
||||
warn(LD_PROTOCOL, "Unexpected onionskin length after decryption: %d",
|
||||
len);
|
||||
len);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -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. */
|
||||
@ -427,7 +429,7 @@ connection_edge_send_command(connection_t *fromconn, circuit_t *circ,
|
||||
|
||||
if (fromconn && fromconn->marked_for_close) {
|
||||
warn(LD_BUG,"Bug: called on conn that's already marked for close at %s:%d.",
|
||||
fromconn->marked_for_close_file, fromconn->marked_for_close);
|
||||
fromconn->marked_for_close_file, fromconn->marked_for_close);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -466,7 +468,7 @@ connection_edge_send_command(connection_t *fromconn, circuit_t *circ,
|
||||
}
|
||||
|
||||
debug(LD_OR,"delivering %d cell %s.", relay_command,
|
||||
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
|
||||
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
|
||||
|
||||
if (circuit_package_relay_cell(&cell, circ, cell_direction, cpath_layer) < 0) {
|
||||
warn(LD_BUG,"circuit_package_relay_cell failed. Closing.");
|
||||
@ -632,7 +634,7 @@ connection_edge_process_end_not_open(
|
||||
if (rh->length > 0 && edge_reason_is_retriable(reason)) {
|
||||
if (conn->type != CONN_TYPE_AP) {
|
||||
warn(LD_PROTOCOL,"Got an end because of %s, but we're not an AP. Closing.",
|
||||
connection_edge_end_reason_str(reason));
|
||||
connection_edge_end_reason_str(reason));
|
||||
return -1;
|
||||
}
|
||||
info(LD_APP,"Address '%s' refused due to '%s'. Considering retrying.",
|
||||
@ -647,7 +649,7 @@ connection_edge_process_end_not_open(
|
||||
int ttl;
|
||||
if (!addr) {
|
||||
info(LD_APP,"Address '%s' resolved to 0.0.0.0. Closing,",
|
||||
safe_str(conn->socks_request->address));
|
||||
safe_str(conn->socks_request->address));
|
||||
connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL);
|
||||
return 0;
|
||||
}
|
||||
@ -713,7 +715,7 @@ connection_edge_process_end_not_open(
|
||||
}
|
||||
|
||||
info(LD_APP,"Edge got end (%s) before we're connected. Marking for close.",
|
||||
connection_edge_end_reason_str(rh->length > 0 ? reason : -1));
|
||||
connection_edge_end_reason_str(rh->length > 0 ? reason : -1));
|
||||
if (conn->type == CONN_TYPE_AP) {
|
||||
circuit_log_path(LOG_INFO,LD_APP,circ);
|
||||
connection_mark_unattached_ap(conn, reason);
|
||||
@ -747,7 +749,7 @@ connection_edge_process_relay_cell_not_open(
|
||||
// log_fn(LOG_INFO,"Connected! Notifying application.");
|
||||
conn->state = AP_CONN_STATE_OPEN;
|
||||
info(LD_APP,"'connected' received after %d seconds.",
|
||||
(int)(time(NULL) - conn->timestamp_lastread));
|
||||
(int)(time(NULL) - conn->timestamp_lastread));
|
||||
if (rh->length >= 4) {
|
||||
uint32_t addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE));
|
||||
int ttl;
|
||||
@ -802,8 +804,8 @@ connection_edge_process_relay_cell_not_open(
|
||||
}
|
||||
|
||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||
"Got an unexpected relay command %d, in state %d (%s). Dropping.",
|
||||
rh->command, conn->state, conn_state_to_string(conn->type, conn->state));
|
||||
"Got an unexpected relay command %d, in state %d (%s). Dropping.",
|
||||
rh->command, conn->state, conn_state_to_string(conn->type, conn->state));
|
||||
return 0; /* for forward compatibility, don't kill the circuit */
|
||||
// connection_edge_end(conn, END_STREAM_REASON_TORPROTOCOL, conn->cpath_layer);
|
||||
// connection_mark_for_close(conn);
|
||||
@ -876,7 +878,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
|
||||
return -1;
|
||||
}
|
||||
debug(domain,"circ deliver_window now %d.", layer_hint ?
|
||||
layer_hint->deliver_window : circ->deliver_window);
|
||||
layer_hint->deliver_window : circ->deliver_window);
|
||||
|
||||
circuit_consider_sending_sendme(circ, layer_hint);
|
||||
|
||||
@ -899,15 +901,15 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
|
||||
case RELAY_COMMAND_END:
|
||||
if (!conn) {
|
||||
info(domain,"end cell (%s) dropped, unknown stream.",
|
||||
connection_edge_end_reason_str(rh.length > 0 ?
|
||||
*(char *)(cell->payload+RELAY_HEADER_SIZE) : -1));
|
||||
connection_edge_end_reason_str(rh.length > 0 ?
|
||||
*(char *)(cell->payload+RELAY_HEADER_SIZE) : -1));
|
||||
return 0;
|
||||
}
|
||||
/* XXX add to this log_fn the exit node's nickname? */
|
||||
info(domain,"%d: end cell (%s) for stream %d. Removing stream.",
|
||||
conn->s,
|
||||
connection_edge_end_reason_str(rh.length > 0 ?
|
||||
*(char *)(cell->payload+RELAY_HEADER_SIZE) : -1),
|
||||
*(char *)(cell->payload+RELAY_HEADER_SIZE) : -1),
|
||||
conn->stream_id);
|
||||
if (conn->socks_request && !conn->socks_request->has_finished)
|
||||
warn(LD_BUG,"Bug: open stream hasn't sent socks answer yet? Closing.");
|
||||
@ -986,12 +988,12 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
|
||||
if (layer_hint) {
|
||||
layer_hint->package_window += CIRCWINDOW_INCREMENT;
|
||||
debug(LD_APP,"circ-level sendme at origin, packagewindow %d.",
|
||||
layer_hint->package_window);
|
||||
layer_hint->package_window);
|
||||
circuit_resume_edge_reading(circ, layer_hint);
|
||||
} else {
|
||||
circ->package_window += CIRCWINDOW_INCREMENT;
|
||||
debug(LD_APP,"circ-level sendme at non-origin, packagewindow %d.",
|
||||
circ->package_window);
|
||||
circ->package_window);
|
||||
circuit_resume_edge_reading(circ, layer_hint);
|
||||
}
|
||||
return 0;
|
||||
@ -1015,7 +1017,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
|
||||
return 0;
|
||||
} else if (circ->purpose != CIRCUIT_PURPOSE_OR) {
|
||||
warn(domain, "resolve request on circ with purpose %d; dropping",
|
||||
circ->purpose);
|
||||
circ->purpose);
|
||||
return 0;
|
||||
}
|
||||
connection_exit_begin_resolve(cell, circ);
|
||||
@ -1070,7 +1072,7 @@ connection_edge_package_raw_inbuf(connection_t *conn, int package_partial)
|
||||
tor_assert(!connection_speaks_cells(conn));
|
||||
if (conn->marked_for_close) {
|
||||
warn(LD_BUG,"Bug: called on conn that's already marked for close at %s:%d.",
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
conn->marked_for_close_file, conn->marked_for_close);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1110,7 +1112,7 @@ repeat_connection_edge_package_raw_inbuf:
|
||||
connection_fetch_from_buf(payload, length, conn);
|
||||
|
||||
debug(domain,"(%d) Packaging %d bytes (%d waiting).", conn->s,
|
||||
(int)length, (int)buf_datalen(conn->inbuf));
|
||||
(int)length, (int)buf_datalen(conn->inbuf));
|
||||
|
||||
if (connection_edge_send_command(conn, circ, RELAY_COMMAND_DATA,
|
||||
payload, length, conn->cpath_layer) < 0)
|
||||
@ -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)
|
||||
|
@ -69,7 +69,7 @@ rend_client_send_introduction(circuit_t *introcirc, circuit_t *rendcirc)
|
||||
|
||||
if (rend_cache_lookup_entry(introcirc->rend_query, -1, &entry) < 1) {
|
||||
warn(LD_REND,"query '%s' didn't have valid rend desc in cache. Failing.",
|
||||
safe_str(introcirc->rend_query));
|
||||
safe_str(introcirc->rend_query));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ rend_client_introduction_acked(circuit_t *circ,
|
||||
|
||||
if (circ->purpose != CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) {
|
||||
warn(LD_PROTOCOL, "Received REND_INTRODUCE_ACK on unexpected circuit %d.",
|
||||
circ->n_circ_id);
|
||||
circ->n_circ_id);
|
||||
circuit_mark_for_close(circ);
|
||||
return -1;
|
||||
}
|
||||
@ -221,7 +221,7 @@ rend_client_introduction_acked(circuit_t *circ,
|
||||
extend_info = rend_client_get_random_intro(circ->rend_query);
|
||||
if (!extend_info) {
|
||||
warn(LD_REND, "No introduction points left for %s. Closing.",
|
||||
safe_str(circ->rend_query));
|
||||
safe_str(circ->rend_query));
|
||||
circuit_mark_for_close(circ);
|
||||
return -1;
|
||||
}
|
||||
@ -273,7 +273,7 @@ rend_client_remove_intro_point(extend_info_t *failed_intro, const char *query)
|
||||
}
|
||||
if (r==0) {
|
||||
info(LD_REND, "Unknown service %s. Re-fetching descriptor.",
|
||||
safe_str(query));
|
||||
safe_str(query));
|
||||
rend_client_refetch_renddesc(query);
|
||||
return 0;
|
||||
}
|
||||
@ -308,7 +308,7 @@ rend_client_remove_intro_point(extend_info_t *failed_intro, const char *query)
|
||||
|
||||
if (!ent->parsed->n_intro_points) {
|
||||
info(LD_REND,"No more intro points remain for %s. Re-fetching descriptor.",
|
||||
safe_str(query));
|
||||
safe_str(query));
|
||||
rend_client_refetch_renddesc(query);
|
||||
|
||||
/* move all pending streams back to renddesc_wait */
|
||||
@ -453,7 +453,7 @@ rend_client_get_random_intro(const char *query)
|
||||
|
||||
if (rend_cache_lookup_entry(query, -1, &entry) < 1) {
|
||||
warn(LD_REND,"Query '%s' didn't have valid rend desc in cache. Failing.",
|
||||
safe_str(query));
|
||||
safe_str(query));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ rend_parse_service_descriptor(const char *str, size_t len)
|
||||
if ((size_t)(end-cp) < keylen) goto truncated;
|
||||
if ((size_t)(end-cp) > keylen) {
|
||||
warn(LD_PROTOCOL, "Signature is %d bytes too long on service descriptor.",
|
||||
(int)((size_t)(end-cp) - keylen));
|
||||
(int)((size_t)(end-cp) - keylen));
|
||||
goto error;
|
||||
}
|
||||
if (crypto_pk_public_checksig_digest(result->pk,
|
||||
@ -378,7 +378,7 @@ rend_cache_store(const char *desc, size_t desc_len)
|
||||
}
|
||||
if (parsed->timestamp > now+REND_CACHE_MAX_SKEW) {
|
||||
warn(LD_REND,"Service descriptor %s is too far in the future.",
|
||||
safe_str(query));
|
||||
safe_str(query));
|
||||
rend_service_descriptor_free(parsed);
|
||||
return -1;
|
||||
}
|
||||
@ -408,7 +408,7 @@ rend_cache_store(const char *desc, size_t desc_len)
|
||||
memcpy(e->desc, desc, desc_len);
|
||||
|
||||
debug(LD_REND,"Successfully stored rend desc '%s', len %d.",
|
||||
safe_str(query), (int)desc_len);
|
||||
safe_str(query), (int)desc_len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ rend_mid_establish_intro(circuit_t *circ, const char *request, size_t request_le
|
||||
while ((c = circuit_get_next_by_pk_and_purpose(
|
||||
c,pk_digest,CIRCUIT_PURPOSE_INTRO_POINT))) {
|
||||
info(LD_REND, "Replacing old circuit %d for service %s",
|
||||
c->p_circ_id, safe_str(serviceid));
|
||||
c->p_circ_id, safe_str(serviceid));
|
||||
circuit_mark_for_close(c);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ rend_mid_introduce(circuit_t *circ, const char *request, size_t request_len)
|
||||
|
||||
if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
|
||||
warn(LD_PROTOCOL, "Rejecting INTRODUCE1 on non-OR or non-edge circuit %d.",
|
||||
circ->p_circ_id);
|
||||
circ->p_circ_id);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ rend_mid_establish_rendezvous(circuit_t *circ, const char *request, size_t reque
|
||||
base16_encode(hexid,9,request,4);
|
||||
|
||||
info(LD_REND, "Established rendezvous point on circuit %d for cookie %s",
|
||||
circ->p_circ_id, hexid);
|
||||
circ->p_circ_id, hexid);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
@ -238,7 +238,7 @@ rend_mid_rendezvous(circuit_t *circ, const char *request, size_t request_len)
|
||||
|
||||
if (request_len>=4) {
|
||||
info(LD_REND, "Got request for rendezvous from circuit %d to cookie %s.",
|
||||
circ->p_circ_id, hexid);
|
||||
circ->p_circ_id, hexid);
|
||||
}
|
||||
|
||||
if (circ->purpose != CIRCUIT_PURPOSE_OR || circ->n_conn) {
|
||||
|
@ -131,7 +131,7 @@ add_service(rend_service_t *service)
|
||||
addr.s_addr = htonl(p->real_addr);
|
||||
tor_inet_ntoa(&addr, addrbuf, sizeof(addrbuf));
|
||||
debug(LD_REND,"Service maps port %d to %s:%d",
|
||||
p->virtual_port, addrbuf, p->real_port);
|
||||
p->virtual_port, addrbuf, p->real_port);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,7 +295,7 @@ rend_service_update_descriptor(rend_service_t *service)
|
||||
router = router_get_by_nickname(smartlist_get(service->intro_nodes, i),1);
|
||||
if (!router) {
|
||||
info(LD_REND,"Router '%s' not found. Skipping.",
|
||||
(char*)smartlist_get(service->intro_nodes, i));
|
||||
(char*)smartlist_get(service->intro_nodes, i));
|
||||
continue;
|
||||
}
|
||||
circ = find_intro_circuit(router, service->pk_digest);
|
||||
@ -416,11 +416,11 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
||||
base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
|
||||
circuit->rend_pk_digest,10);
|
||||
info(LD_REND, "Received INTRODUCE2 cell for service %s on circ %d.",
|
||||
serviceid, circuit->n_circ_id);
|
||||
serviceid, circuit->n_circ_id);
|
||||
|
||||
if (circuit->purpose != CIRCUIT_PURPOSE_S_INTRO) {
|
||||
warn(LD_PROTOCOL, "Got an INTRODUCE2 over a non-introduction circuit %d.",
|
||||
circuit->n_circ_id);
|
||||
circuit->n_circ_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -428,7 +428,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
||||
if (request_len < DIGEST_LEN+REND_COOKIE_LEN+(MAX_NICKNAME_LEN+1)+
|
||||
DH_KEY_LEN+42) {
|
||||
warn(LD_PROTOCOL, "Got a truncated INTRODUCE2 cell on circ %d.",
|
||||
circuit->n_circ_id);
|
||||
circuit->n_circ_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -436,13 +436,13 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
||||
service = rend_service_get_by_pk_digest(request);
|
||||
if (!service) {
|
||||
warn(LD_REND, "Got an INTRODUCE2 cell for an unrecognized service %s.",
|
||||
serviceid);
|
||||
serviceid);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp(circuit->rend_pk_digest, request, DIGEST_LEN)) {
|
||||
base32_encode(serviceid, REND_SERVICE_ID_LEN+1, request, 10);
|
||||
warn(LD_REND, "Got an INTRODUCE2 cell for the wrong service (%s).",
|
||||
serviceid);
|
||||
serviceid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
||||
router = router_get_by_nickname(rp_nickname, 0);
|
||||
if (!router) {
|
||||
info(LD_REND, "Couldn't find router '%s' named in rendezvous cell.",
|
||||
rp_nickname);
|
||||
rp_nickname);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
|
||||
}
|
||||
if (!launched) { /* give up */
|
||||
warn(LD_REND,"Giving up launching first hop of circuit to rendezvous point '%s' for service %s.",
|
||||
extend_info->nickname, serviceid);
|
||||
extend_info->nickname, serviceid);
|
||||
goto err;
|
||||
}
|
||||
info(LD_REND,
|
||||
@ -606,8 +606,8 @@ rend_service_relaunch_rendezvous(circuit_t *oldcirc)
|
||||
oldcirc->build_state->failure_count > MAX_REND_FAILURES ||
|
||||
oldcirc->build_state->expiry_time < time(NULL)) {
|
||||
info(LD_REND,"Attempt to build circuit to %s for rendezvous has failed too many times or expired; giving up.",
|
||||
oldcirc->build_state ? oldcirc->build_state->chosen_exit->nickname :
|
||||
"*unknown*");
|
||||
oldcirc->build_state ? oldcirc->build_state->chosen_exit->nickname :
|
||||
"*unknown*");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -620,13 +620,13 @@ rend_service_relaunch_rendezvous(circuit_t *oldcirc)
|
||||
}
|
||||
|
||||
info(LD_REND,"Reattempting rendezvous circuit to %s",
|
||||
oldstate->chosen_exit->nickname);
|
||||
oldstate->chosen_exit->nickname);
|
||||
|
||||
newcirc = circuit_launch_by_extend_info(CIRCUIT_PURPOSE_S_CONNECT_REND,
|
||||
oldstate->chosen_exit, 0, 1, 1);
|
||||
if (!newcirc) {
|
||||
warn(LD_REND,"Couldn't relaunch rendezvous circuit to %s.",
|
||||
oldstate->chosen_exit->nickname);
|
||||
oldstate->chosen_exit->nickname);
|
||||
return;
|
||||
}
|
||||
newstate = newcirc->build_state;
|
||||
@ -650,7 +650,7 @@ rend_service_launch_establish_intro(rend_service_t *service, const char *nicknam
|
||||
circuit_t *launched;
|
||||
|
||||
info(LD_REND, "Launching circuit to introduction point %s for service %s",
|
||||
nickname, service->service_id);
|
||||
nickname, service->service_id);
|
||||
|
||||
rep_hist_note_used_internal(time(NULL), 1, 0);
|
||||
|
||||
@ -658,7 +658,7 @@ rend_service_launch_establish_intro(rend_service_t *service, const char *nicknam
|
||||
launched = circuit_launch_by_nickname(CIRCUIT_PURPOSE_S_ESTABLISH_INTRO, nickname, 1, 0, 1);
|
||||
if (!launched) {
|
||||
info(LD_REND, "Can't launch circuit to establish introduction at '%s'.",
|
||||
nickname);
|
||||
nickname);
|
||||
return -1;
|
||||
}
|
||||
strlcpy(launched->rend_query, service->service_id,
|
||||
@ -693,7 +693,7 @@ rend_service_intro_has_opened(circuit_t *circuit)
|
||||
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
||||
if (!service) {
|
||||
warn(LD_REND, "Unrecognized service ID %s on introduction circuit %d.",
|
||||
serviceid, circuit->n_circ_id);
|
||||
serviceid, circuit->n_circ_id);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -746,7 +746,7 @@ rend_service_intro_established(circuit_t *circuit, const char *request, size_t r
|
||||
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
||||
if (!service) {
|
||||
warn(LD_REND, "Unknown service on introduction circuit %d.",
|
||||
circuit->n_circ_id);
|
||||
circuit->n_circ_id);
|
||||
goto err;
|
||||
}
|
||||
service->desc_is_dirty = time(NULL);
|
||||
@ -782,7 +782,7 @@ rend_service_rendezvous_has_opened(circuit_t *circuit)
|
||||
|
||||
info(LD_REND,
|
||||
"Done building circuit %d to rendezvous with cookie %s for service %s",
|
||||
circuit->n_circ_id, hexcookie, serviceid);
|
||||
circuit->n_circ_id, hexcookie, serviceid);
|
||||
|
||||
service = rend_service_get_by_pk_digest(circuit->rend_pk_digest);
|
||||
if (!service) {
|
||||
@ -937,7 +937,7 @@ rend_services_introduce(void)
|
||||
router = router_get_by_nickname(intro, 0);
|
||||
if (!router || !find_intro_circuit(router,service->pk_digest)) {
|
||||
info(LD_REND,"Giving up on %s as intro point for %s.",
|
||||
intro, service->service_id);
|
||||
intro, service->service_id);
|
||||
tor_free(intro);
|
||||
smartlist_del(service->intro_nodes,j--);
|
||||
changed = 1;
|
||||
@ -969,7 +969,7 @@ rend_services_introduce(void)
|
||||
get_options()->_AllowUnverified & ALLOW_UNVERIFIED_INTRODUCTION, 0);
|
||||
if (!router) {
|
||||
warn(LD_REND, "Could only establish %d introduction points for %s.",
|
||||
smartlist_len(service->intro_nodes), service->service_id);
|
||||
smartlist_len(service->intro_nodes), service->service_id);
|
||||
break;
|
||||
}
|
||||
changed = 1;
|
||||
@ -998,7 +998,7 @@ rend_services_introduce(void)
|
||||
r = rend_service_launch_establish_intro(service, intro);
|
||||
if (r<0) {
|
||||
warn(LD_REND, "Error launching circuit to node %s for service %s.",
|
||||
intro, service->service_id);
|
||||
intro, service->service_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1093,7 +1093,7 @@ rend_service_set_connection_addr_port(connection_t *conn, circuit_t *circ)
|
||||
service = rend_service_get_by_pk_digest(circ->rend_pk_digest);
|
||||
if (!service) {
|
||||
warn(LD_REND, "Couldn't find any service associated with pk %s on rendezvous circuit %d; closing.",
|
||||
serviceid, circ->n_circ_id);
|
||||
serviceid, circ->n_circ_id);
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < smartlist_len(service->ports); ++i) {
|
||||
@ -1105,7 +1105,7 @@ rend_service_set_connection_addr_port(connection_t *conn, circuit_t *circ)
|
||||
}
|
||||
}
|
||||
info(LD_REND, "No virtual port mapping exists for port %d on service %s",
|
||||
conn->port,serviceid);
|
||||
conn->port,serviceid);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ init_key_from_file_name_changed(const char *fname_old,
|
||||
/* The old filename exists, and the new one doesn't. Rename and load. */
|
||||
if (rename(fname_old, fname_new) < 0) {
|
||||
log_fn(LOG_ERR, LD_FS, "Couldn't rename \"%s\" to \"%s\": %s",
|
||||
fname_old, fname_new, strerror(errno));
|
||||
fname_old, fname_new, strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
return init_key_from_file(fname_new);
|
||||
@ -466,7 +466,7 @@ router_orport_found_reachable(void)
|
||||
if (!can_reach_or_port) {
|
||||
if (!clique_mode(get_options()))
|
||||
notice(LD_OR,"Self-testing indicates your ORPort is reachable from the outside. Excellent.%s",
|
||||
get_options()->NoPublish ? "" : " Publishing server descriptor.");
|
||||
get_options()->NoPublish ? "" : " Publishing server descriptor.");
|
||||
can_reach_or_port = 1;
|
||||
mark_my_descriptor_dirty();
|
||||
consider_publishable_server(time(NULL), 1);
|
||||
@ -615,8 +615,8 @@ router_retry_connections(int force)
|
||||
if (force ||
|
||||
!connection_or_get_by_identity_digest(router->cache_info.identity_digest)) {
|
||||
debug(LD_OR,"%sconnecting to %s at %s:%u.",
|
||||
clique_mode(options) ? "(forced) " : "",
|
||||
router->nickname, router->address, router->or_port);
|
||||
clique_mode(options) ? "(forced) " : "",
|
||||
router->nickname, router->address, router->or_port);
|
||||
/* Remember when we started trying to determine reachability */
|
||||
if (!router->testing_since)
|
||||
router->testing_since = now;
|
||||
@ -820,8 +820,8 @@ router_rebuild_descriptor(int force)
|
||||
if (!member) {
|
||||
if (!smartlist_string_isin(warned_nonexistent_family, name)) {
|
||||
warn(LD_CONFIG, "I have no descriptor for the router named \"%s\" "
|
||||
"in my declared family; I'll use the nickname as is, but "
|
||||
"this may confuse clients.", name);
|
||||
"in my declared family; I'll use the nickname as is, but "
|
||||
"this may confuse clients.", name);
|
||||
smartlist_add(warned_nonexistent_family, tor_strdup(name));
|
||||
}
|
||||
smartlist_add(ri->declared_family, name);
|
||||
|
@ -106,7 +106,7 @@ router_reload_networkstatus(void)
|
||||
if (strlen(fn) != HEX_DIGEST_LEN ||
|
||||
base16_decode(buf, sizeof(buf), fn, strlen(fn))) {
|
||||
info(LD_DIR,
|
||||
"Skipping cached-status file with unexpected name \"%s\"",fn);
|
||||
"Skipping cached-status file with unexpected name \"%s\"",fn);
|
||||
continue;
|
||||
}
|
||||
tor_snprintf(filename,sizeof(filename),"%s/cached-status/%s",
|
||||
@ -345,7 +345,7 @@ router_pick_directory_server(int requireother,
|
||||
return choice;
|
||||
|
||||
info(LD_DIR,"Still no %s router entries. Reloading and trying again.",
|
||||
fascistfirewall ? "reachable" : "known");
|
||||
fascistfirewall ? "reachable" : "known");
|
||||
if (router_reload_router_list()) {
|
||||
return NULL;
|
||||
}
|
||||
@ -934,9 +934,9 @@ router_get_by_nickname(const char *nickname, int warn_if_unnamed)
|
||||
if (any_unwarned) {
|
||||
char *alternatives = smartlist_join_strings(fps, "; ",0,NULL);
|
||||
warn(LD_CONFIG, "There are multiple matches for the nickname \"%s\","
|
||||
" but none is listed as named by the directory authories. "
|
||||
"Choosing one arbitrarily. If you meant one in particular, "
|
||||
"you should say %s.", nickname, alternatives);
|
||||
" but none is listed as named by the directory authories. "
|
||||
"Choosing one arbitrarily. If you meant one in particular, "
|
||||
"you should say %s.", nickname, alternatives);
|
||||
tor_free(alternatives);
|
||||
}
|
||||
SMARTLIST_FOREACH(fps, char *, cp, tor_free(cp));
|
||||
@ -948,9 +948,9 @@ router_get_by_nickname(const char *nickname, int warn_if_unnamed)
|
||||
char fp[HEX_DIGEST_LEN+1];
|
||||
base16_encode(fp, sizeof(fp), best_match->cache_info.identity_digest, DIGEST_LEN);
|
||||
warn(LD_CONFIG, "You specified a server \"%s\" by name, but the "
|
||||
"directory authorities do not have a listing for this name. "
|
||||
"To make sure you get the same server in the future, refer to "
|
||||
"it by key, as \"$%s\".", nickname, fp);
|
||||
"directory authorities do not have a listing for this name. "
|
||||
"To make sure you get the same server in the future, refer to "
|
||||
"it by key, as \"$%s\".", nickname, fp);
|
||||
rs->name_lookup_warned = 1;
|
||||
}
|
||||
}
|
||||
@ -1493,7 +1493,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
old_router->cache_info.published_on) {
|
||||
/* Same key, but old */
|
||||
debug(LD_DIR, "Skipping not-new descriptor for router '%s'",
|
||||
router->nickname);
|
||||
router->nickname);
|
||||
routerlist_insert_old(routerlist, router);
|
||||
*msg = "Router descriptor was not new.";
|
||||
return -1;
|
||||
@ -1501,8 +1501,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
/* Same key, new. */
|
||||
int unreachable = 0;
|
||||
debug(LD_DIR, "Replacing entry for router '%s/%s' [%s]",
|
||||
router->nickname, old_router->nickname,
|
||||
hex_str(id_digest,DIGEST_LEN));
|
||||
router->nickname, old_router->nickname,
|
||||
hex_str(id_digest,DIGEST_LEN));
|
||||
if (router->addr == old_router->addr &&
|
||||
router->or_port == old_router->or_port) {
|
||||
/* these carry over when the address and orport are unchanged.*/
|
||||
@ -1516,8 +1516,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
if (router->num_unreachable_notifications >= 3) {
|
||||
unreachable = 1;
|
||||
notice(LD_DIR, "Notifying server '%s' that it's unreachable. (ContactInfo '%s', platform '%s').",
|
||||
router->nickname, router->contact_info ? router->contact_info : "",
|
||||
router->platform ? router->platform : "");
|
||||
router->nickname, router->contact_info ? router->contact_info : "",
|
||||
router->platform ? router->platform : "");
|
||||
} else {
|
||||
info(LD_DIR,"'%s' may be unreachable -- the %d previous "
|
||||
"descriptors were thought to be unreachable.",
|
||||
@ -1550,14 +1550,14 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
old_router->cache_info.identity_digest))) {
|
||||
// And LD_OR? XXXXNM
|
||||
info(LD_DIR,"Closing conn to router '%s'; there is now a named router with that name.",
|
||||
old_router->nickname);
|
||||
old_router->nickname);
|
||||
connection_mark_for_close(conn);
|
||||
}
|
||||
routerlist_remove(routerlist, old_router, i--, 0);
|
||||
} else if (old_router->is_named) {
|
||||
/* Can't replace a verified router with an unverified one. */
|
||||
debug(LD_DIR, "Skipping unverified entry for verified router '%s'",
|
||||
router->nickname);
|
||||
router->nickname);
|
||||
routerinfo_free(router);
|
||||
*msg = "Already have named router with same nickname and different key.";
|
||||
return -2;
|
||||
@ -1770,7 +1770,7 @@ router_load_single_router(const char *s, const char **msg)
|
||||
|
||||
if (router_add_to_routerlist(ri, msg, 0)<0) {
|
||||
warn(LD_DIR, "Couldn't add router to list: %s Dropping.",
|
||||
*msg?*msg:"(No message).");
|
||||
*msg?*msg:"(No message).");
|
||||
/* we've already assigned to *msg now, and ri is already freed */
|
||||
smartlist_free(lst);
|
||||
return 0;
|
||||
@ -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;
|
||||
}
|
||||
@ -1959,9 +1961,9 @@ router_set_networkstatus(const char *s, time_t arrived_at,
|
||||
/* Same one we had before. */
|
||||
networkstatus_free(ns);
|
||||
info(LD_DIR,
|
||||
"Not replacing network-status from %s (published %s); "
|
||||
"we already have it.",
|
||||
trusted_dir->description, published);
|
||||
"Not replacing network-status from %s (published %s); "
|
||||
"we already have it.",
|
||||
trusted_dir->description, published);
|
||||
if (old_ns->received_on < arrived_at) {
|
||||
if (source != NS_FROM_CACHE) {
|
||||
char *fn = networkstatus_get_cache_filename(old_ns);
|
||||
@ -1976,10 +1978,10 @@ router_set_networkstatus(const char *s, time_t arrived_at,
|
||||
char old_published[ISO_TIME_LEN+1];
|
||||
format_iso_time(old_published, old_ns->published_on);
|
||||
info(LD_DIR,
|
||||
"Not replacing network-status from %s (published %s);"
|
||||
" we have a newer one (published %s) for this authority.",
|
||||
trusted_dir->description, published,
|
||||
old_published);
|
||||
"Not replacing network-status from %s (published %s);"
|
||||
" we have a newer one (published %s) for this authority.",
|
||||
trusted_dir->description, published,
|
||||
old_published);
|
||||
networkstatus_free(ns);
|
||||
return 0;
|
||||
} else {
|
||||
@ -1995,9 +1997,9 @@ router_set_networkstatus(const char *s, time_t arrived_at,
|
||||
smartlist_add(networkstatus_list, ns);
|
||||
|
||||
info(LD_DIR, "Setting networkstatus %s %s (published %s)",
|
||||
source == NS_FROM_CACHE?"cached from":
|
||||
(source==NS_FROM_DIR?"downloaded from":"generated for"),
|
||||
trusted_dir->description, published);
|
||||
source == NS_FROM_CACHE?"cached from":
|
||||
(source==NS_FROM_DIR?"downloaded from":"generated for"),
|
||||
trusted_dir->description, published);
|
||||
networkstatus_list_has_changed = 1;
|
||||
|
||||
smartlist_sort(networkstatus_list, _compare_networkstatus_published_on);
|
||||
@ -2212,16 +2214,16 @@ update_networkstatus_client_downloads(time_t now)
|
||||
|
||||
if (needed)
|
||||
info(LD_DIR, "For %d/%d running directory servers, we have %d live"
|
||||
" network-status documents. Downloading %d.",
|
||||
n_running_dirservers, n_dirservers, n_live, needed);
|
||||
" network-status documents. Downloading %d.",
|
||||
n_running_dirservers, n_dirservers, n_live, needed);
|
||||
|
||||
/* Also, download at least 1 every NETWORKSTATUS_CLIENT_DL_INTERVAL. */
|
||||
if (n_running_dirservers &&
|
||||
most_recent_received < now-NETWORKSTATUS_CLIENT_DL_INTERVAL && needed < 1) {
|
||||
info(LD_DIR, "Our most recent network-status document (from %s) "
|
||||
"is %d seconds old; downloading another.",
|
||||
most_recent?most_recent->description:"nobody",
|
||||
(int)(now-most_recent_received));
|
||||
"is %d seconds old; downloading another.",
|
||||
most_recent?most_recent->description:"nobody",
|
||||
(int)(now-most_recent_received));
|
||||
needed = 1;
|
||||
}
|
||||
|
||||
@ -2439,8 +2441,8 @@ exit_policy_implicitly_allows_local_networks(addr_policy_t *policy,
|
||||
policy, private_networks[i].addr, private_networks[i].mask, &p)) {
|
||||
if (should_warn)
|
||||
warn(LD_CONFIG, "Exit policy %s implicitly accepts %s",
|
||||
p?p->string:"(default)",
|
||||
private_networks[i].network);
|
||||
p?p->string:"(default)",
|
||||
private_networks[i].network);
|
||||
r = 1;
|
||||
}
|
||||
}
|
||||
@ -2586,11 +2588,11 @@ routers_update_all_from_networkstatus(void)
|
||||
* have tried all of them? -RD */
|
||||
if (n_valid <= n_recent/2) {
|
||||
warn(LD_GENERAL, "%d/%d recent directory servers list us as invalid. Please consider sending your identity fingerprint to the tor-ops.",
|
||||
n_recent-n_valid, n_recent);
|
||||
n_recent-n_valid, n_recent);
|
||||
have_warned_about_unverified_status = 1;
|
||||
} else if (!n_named) { // (n_named <= n_recent/2) {
|
||||
warn(LD_GENERAL, "0/%d recent directory servers recognize this server. Please consider sending your identity fingerprint to the tor-ops.",
|
||||
n_recent);
|
||||
n_recent);
|
||||
have_warned_about_unverified_status = 1;
|
||||
}
|
||||
}
|
||||
@ -2635,7 +2637,7 @@ routers_update_all_from_networkstatus(void)
|
||||
}
|
||||
} else {
|
||||
info(LD_GENERAL, "%d/%d recent directories think my version is ok.",
|
||||
n_recommended, n_recent);
|
||||
n_recommended, n_recent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2676,8 +2678,8 @@ networkstatus_list_update_recent(time_t now)
|
||||
if (!ns->is_recent) {
|
||||
format_iso_time(published, ns->published_on);
|
||||
info(LD_DIR,
|
||||
"Networkstatus from %s (published %s) is now \"recent\"",
|
||||
src, published);
|
||||
"Networkstatus from %s (published %s) is now \"recent\"",
|
||||
src, published);
|
||||
changed = 1;
|
||||
}
|
||||
ns->is_recent = 1;
|
||||
@ -2686,8 +2688,8 @@ networkstatus_list_update_recent(time_t now)
|
||||
if (ns->is_recent) {
|
||||
format_iso_time(published, ns->published_on);
|
||||
info(LD_DIR,
|
||||
"Networkstatus from %s (published %s) is no longer \"recent\"",
|
||||
src, published);
|
||||
"Networkstatus from %s (published %s) is no longer \"recent\"",
|
||||
src, published);
|
||||
changed = 1;
|
||||
ns->is_recent = 0;
|
||||
}
|
||||
@ -2848,7 +2850,7 @@ routerstatus_list_update_from_networkstatus(time_t now)
|
||||
base16_encode(hd, HEX_DIGEST_LEN+1, rs->identity_digest, DIGEST_LEN);
|
||||
if (! smartlist_string_isin(warned_conflicts, hd)) {
|
||||
warn(LD_DIR, "Naming authorities disagree about nicknames for $%s (\"%s\" vs \"%s\")",
|
||||
hd, the_name, rs->nickname);
|
||||
hd, the_name, rs->nickname);
|
||||
smartlist_add(warned_conflicts, tor_strdup(hd));
|
||||
}
|
||||
the_name = "**mismatch**";
|
||||
@ -2868,11 +2870,11 @@ routerstatus_list_update_from_networkstatus(time_t now)
|
||||
}
|
||||
smartlist_add(result, rs_out);
|
||||
debug(LD_DIR, "Router '%s' is listed by %d/%d directories, "
|
||||
"named by %d/%d, validated by %d/%d, and %d/%d recent directories "
|
||||
"think it's running.",
|
||||
rs_out->status.nickname,
|
||||
n_listing, n_statuses, n_named, n_naming, n_valid, n_statuses,
|
||||
n_running, n_recent);
|
||||
"named by %d/%d, validated by %d/%d, and %d/%d recent directories "
|
||||
"think it's running.",
|
||||
rs_out->status.nickname,
|
||||
n_listing, n_statuses, n_named, n_naming, n_valid, n_statuses,
|
||||
n_running, n_recent);
|
||||
rs_out->status.is_named = 0;
|
||||
if (the_name && strcmp(the_name, "**mismatch**") && n_named > 0) {
|
||||
const char *d = strmap_get_lc(name_map, the_name);
|
||||
@ -3090,17 +3092,17 @@ router_list_downloadable(void)
|
||||
|
||||
#if 0
|
||||
info(LD_DIR, "%d router descriptors are downloadable; "
|
||||
"%d are up to date; %d are in progress; "
|
||||
"%d are not ready to retry; "
|
||||
"%d are not published recently enough to be worthwhile; "
|
||||
"%d are running pre-0.1.1.6 Tors and aren't stale enough to replace. "
|
||||
"%d have unrecognized descriptor hashes; %d are newer than the dirs "
|
||||
"have told us about; %d are both unrecognized and newer than any "
|
||||
"publication date in the networkstatus; %d are both "
|
||||
"unrecognized and running a pre-0.1.1.6 version.",
|
||||
n_downloadable, n_uptodate, n_in_progress, n_not_ready,
|
||||
n_obsolete, n_skip_old, xx_n_unrecognized, xx_n_extra_new, xx_n_both,
|
||||
xx_n_unrec_old);
|
||||
"%d are up to date; %d are in progress; "
|
||||
"%d are not ready to retry; "
|
||||
"%d are not published recently enough to be worthwhile; "
|
||||
"%d are running pre-0.1.1.6 Tors and aren't stale enough to replace. "
|
||||
"%d have unrecognized descriptor hashes; %d are newer than the dirs "
|
||||
"have told us about; %d are both unrecognized and newer than any "
|
||||
"publication date in the networkstatus; %d are both "
|
||||
"unrecognized and running a pre-0.1.1.6 version.",
|
||||
n_downloadable, n_uptodate, n_in_progress, n_not_ready,
|
||||
n_obsolete, n_skip_old, xx_n_unrecognized, xx_n_extra_new, xx_n_both,
|
||||
xx_n_unrec_old);
|
||||
#endif
|
||||
|
||||
if (!n_downloadable)
|
||||
@ -3153,7 +3155,7 @@ update_router_descriptor_downloads(time_t now)
|
||||
n_downloadable = smartlist_len(downloadable);
|
||||
if (n_downloadable >= MAX_DL_TO_DELAY) {
|
||||
debug(LD_DIR,
|
||||
"There are enough downloadable routerdescs to launch requests.");
|
||||
"There are enough downloadable routerdescs to launch requests.");
|
||||
should_delay = 0;
|
||||
} else if (n_downloadable == 0) {
|
||||
// debug(LD_DIR, "No routerdescs need to be downloaded.");
|
||||
@ -3170,7 +3172,7 @@ update_router_descriptor_downloads(time_t now)
|
||||
// debug(LD_DIR, "There are not many downloadable routerdescs; waiting till we have some more.");
|
||||
} else
|
||||
info(LD_DIR, "There are not many downloadable routerdescs, but we've been waiting long enough (%d seconds). Downloading.",
|
||||
(int)(now-last_routerdesc_download_attempted));
|
||||
(int)(now-last_routerdesc_download_attempted));
|
||||
}
|
||||
|
||||
if (! should_delay) {
|
||||
@ -3186,9 +3188,9 @@ update_router_descriptor_downloads(time_t now)
|
||||
n_per_request = MIN_DL_PER_REQUEST;
|
||||
}
|
||||
info(LD_DIR, "Launching %d request%s for %d router%s, %d at a time",
|
||||
(n_downloadable+n_per_request-1)/n_per_request,
|
||||
n_downloadable>n_per_request?"s":"",
|
||||
n_downloadable, n_downloadable>1?"s":"", n_per_request);
|
||||
(n_downloadable+n_per_request-1)/n_per_request,
|
||||
n_downloadable>n_per_request?"s":"",
|
||||
n_downloadable, n_downloadable>1?"s":"", n_per_request);
|
||||
for (i=0; i < n_downloadable; i += n_per_request) {
|
||||
char *cp = resource;
|
||||
memcpy(resource, "fp/", 3);
|
||||
|
@ -271,7 +271,7 @@ tor_version_is_obsolete(const char *myversion, const char *versionlist)
|
||||
vl = versionlist;
|
||||
|
||||
debug(LD_CONFIG,"Checking whether version '%s' is in '%s'",
|
||||
myversion, versionlist);
|
||||
myversion, versionlist);
|
||||
|
||||
if (tor_version_parse(myversion, &mine)) {
|
||||
err(LD_BUG,"I couldn't parse my own version (%s)", myversion);
|
||||
@ -467,7 +467,7 @@ router_parse_runningrouters(const char *str)
|
||||
}
|
||||
if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) {
|
||||
warn(LD_DIR, "Unrecognized keyword '%s'; can't parse running-routers",
|
||||
tok->args[0]);
|
||||
tok->args[0]);
|
||||
goto err;
|
||||
}
|
||||
tok = smartlist_get(tokens,0);
|
||||
@ -731,8 +731,10 @@ 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.)",
|
||||
tok->args[0]);
|
||||
warn(LD_DIR,
|
||||
"Unrecognized critical keyword '%s'; skipping descriptor. "
|
||||
"(It may be from another version of Tor.)",
|
||||
tok->args[0]);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -830,7 +832,7 @@ router_parse_entry_from_string(const char *s, const char *end)
|
||||
}
|
||||
if (crypto_pk_keysize(tok->key) != PK_BYTES) {
|
||||
warn(LD_DIR, "Wrong size on onion key: %d bits!",
|
||||
(int)crypto_pk_keysize(tok->key)*8);
|
||||
(int)crypto_pk_keysize(tok->key)*8);
|
||||
goto err;
|
||||
}
|
||||
router->onion_pkey = tok->key;
|
||||
@ -994,7 +996,7 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
|
||||
}
|
||||
if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) {
|
||||
warn(LD_DIR, "Unrecognized keyword \"%s\" in router status; skipping.",
|
||||
tok->args[0]);
|
||||
tok->args[0]);
|
||||
goto err;
|
||||
}
|
||||
if (!(tok = find_first_by_keyword(tokens, K_R))) {
|
||||
@ -1003,13 +1005,13 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
|
||||
}
|
||||
if (tok->n_args < 8) {
|
||||
warn(LD_DIR,
|
||||
"Too few arguments to 'r' keywork in router status; skipping.");
|
||||
"Too few arguments to 'r' keywork in router status; skipping.");
|
||||
}
|
||||
rs = tor_malloc_zero(sizeof(routerstatus_t));
|
||||
|
||||
if (!is_legal_nickname(tok->args[0])) {
|
||||
warn(LD_DIR,
|
||||
"Invalid nickname '%s' in router status; skipping.", tok->args[0]);
|
||||
"Invalid nickname '%s' in router status; skipping.", tok->args[0]);
|
||||
goto err;
|
||||
}
|
||||
strlcpy(rs->nickname, tok->args[0], sizeof(rs->nickname));
|
||||
@ -1108,7 +1110,7 @@ networkstatus_parse_from_string(const char *s)
|
||||
}
|
||||
if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) {
|
||||
warn(LD_DIR, "Unrecognized keyword '%s'; can't parse network-status",
|
||||
tok->args[0]);
|
||||
tok->args[0]);
|
||||
goto err;
|
||||
}
|
||||
ns = tor_malloc_zero(sizeof(networkstatus_t));
|
||||
@ -1686,7 +1688,7 @@ router_get_hash_impl(const char *s, char *digest,
|
||||
}
|
||||
if (start != s && *(start-1) != '\n') {
|
||||
warn(LD_DIR, "first occurrence of \"%s\" is not at the start of a line",
|
||||
start_str);
|
||||
start_str);
|
||||
return -1;
|
||||
}
|
||||
end = strstr(start+strlen(start_str), end_str);
|
||||
|
Loading…
Reference in New Issue
Block a user