mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Merge remote-tracking branch 'origin/maint-0.2.2'
The conflicts were mainly caused by the routerinfo->node transition. Conflicts: src/or/circuitbuild.c src/or/command.c src/or/connection_edge.c src/or/directory.c src/or/dirserv.c src/or/relay.c src/or/rendservice.c src/or/routerlist.c
This commit is contained in:
commit
fa1d47293b
6
changes/bug3045
Normal file
6
changes/bug3045
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
o Minor features:
|
||||||
|
- Revise most log messages that refer to nodes by nickname to
|
||||||
|
instead use the "$key=nickname at address" format. This should be
|
||||||
|
more useful, especially since nicknames are less and less likely
|
||||||
|
to be unique. Fixes bug 3045.
|
||||||
|
|
@ -12,15 +12,12 @@ struct event_base;
|
|||||||
struct bufferevent;
|
struct bufferevent;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_EVENT2_EVENT_H
|
#ifdef HAVE_EVENT2_EVENT_H
|
||||||
#include <event2/util.h>
|
#include <event2/util.h>
|
||||||
#else
|
#elif !defined(EVUTIL_SOCKET_DEFINED)
|
||||||
#ifndef EVUTIL_SOCKET_DEFINED
|
|
||||||
#define EVUTIL_SOCKET_DEFINED
|
#define EVUTIL_SOCKET_DEFINED
|
||||||
#define evutil_socket_t int
|
#define evutil_socket_t int
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
void configure_libevent_logging(void);
|
void configure_libevent_logging(void);
|
||||||
void suppress_libevent_log_msg(const char *msg);
|
void suppress_libevent_log_msg(const char *msg);
|
||||||
|
@ -276,7 +276,7 @@ typedef struct ratelim_t {
|
|||||||
char *rate_limit_log(ratelim_t *lim, time_t now);
|
char *rate_limit_log(ratelim_t *lim, time_t now);
|
||||||
|
|
||||||
/* File helpers */
|
/* File helpers */
|
||||||
ssize_t write_all(tor_socket_t fd, const char *buf, size_t count, int isSocket);
|
ssize_t write_all(tor_socket_t fd, const char *buf, size_t count,int isSocket);
|
||||||
ssize_t read_all(tor_socket_t fd, char *buf, size_t count, int isSocket);
|
ssize_t read_all(tor_socket_t fd, char *buf, size_t count, int isSocket);
|
||||||
|
|
||||||
/** Return values from file_status(); see that function's documentation
|
/** Return values from file_status(); see that function's documentation
|
||||||
|
@ -1748,10 +1748,9 @@ circuit_handle_first_hop(origin_circuit_t *circ)
|
|||||||
|
|
||||||
if (!n_conn) {
|
if (!n_conn) {
|
||||||
/* not currently connected in a useful way. */
|
/* not currently connected in a useful way. */
|
||||||
const char *name = strlen(firsthop->extend_info->nickname) ?
|
|
||||||
firsthop->extend_info->nickname : fmt_addr(&firsthop->extend_info->addr);
|
|
||||||
log_info(LD_CIRC, "Next router is %s: %s",
|
log_info(LD_CIRC, "Next router is %s: %s",
|
||||||
safe_str_client(name), msg?msg:"???");
|
safe_str_client(extend_info_describe(firsthop->extend_info)),
|
||||||
|
msg?msg:"???");
|
||||||
circ->_base.n_hop = extend_info_dup(firsthop->extend_info);
|
circ->_base.n_hop = extend_info_dup(firsthop->extend_info);
|
||||||
|
|
||||||
if (should_launch) {
|
if (should_launch) {
|
||||||
@ -2034,7 +2033,7 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
|
|||||||
circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_BUILDING);
|
circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_BUILDING);
|
||||||
log_info(LD_CIRC,"First hop: finished sending %s cell to '%s'",
|
log_info(LD_CIRC,"First hop: finished sending %s cell to '%s'",
|
||||||
fast ? "CREATE_FAST" : "CREATE",
|
fast ? "CREATE_FAST" : "CREATE",
|
||||||
node ? node_get_nickname(node) : "<unnamed>");
|
node ? node_describe(node) : "<unnamed>");
|
||||||
} else {
|
} else {
|
||||||
tor_assert(circ->cpath->state == CPATH_STATE_OPEN);
|
tor_assert(circ->cpath->state == CPATH_STATE_OPEN);
|
||||||
tor_assert(circ->_base.state == CIRCUIT_STATE_BUILDING);
|
tor_assert(circ->_base.state == CIRCUIT_STATE_BUILDING);
|
||||||
@ -2818,7 +2817,7 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
|
|||||||
|
|
||||||
tor_free(n_supported);
|
tor_free(n_supported);
|
||||||
if (node) {
|
if (node) {
|
||||||
log_info(LD_CIRC, "Chose exit server '%s'", node_get_nickname(node));
|
log_info(LD_CIRC, "Chose exit server '%s'", node_describe(node));
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
if (options->ExitNodes) {
|
if (options->ExitNodes) {
|
||||||
@ -2925,7 +2924,7 @@ warn_if_last_router_excluded(origin_circuit_t *circ, const extend_info_t *exit)
|
|||||||
log_warn(LD_BUG, "Using %s '%s' which is listed in ExcludeNodes%s, "
|
log_warn(LD_BUG, "Using %s '%s' which is listed in ExcludeNodes%s, "
|
||||||
"even though StrictNodes is set. Please report. "
|
"even though StrictNodes is set. Please report. "
|
||||||
"(Circuit purpose: %s)",
|
"(Circuit purpose: %s)",
|
||||||
description, exit->nickname,
|
description, extend_info_describe(exit),
|
||||||
rs==options->ExcludeNodes?"":" or ExcludeExitNodes",
|
rs==options->ExcludeNodes?"":" or ExcludeExitNodes",
|
||||||
circuit_purpose_to_string(purpose));
|
circuit_purpose_to_string(purpose));
|
||||||
} else {
|
} else {
|
||||||
@ -2934,7 +2933,7 @@ warn_if_last_router_excluded(origin_circuit_t *circ, const extend_info_t *exit)
|
|||||||
"prevent this (and possibly break your Tor functionality), "
|
"prevent this (and possibly break your Tor functionality), "
|
||||||
"set the StrictNodes configuration option. "
|
"set the StrictNodes configuration option. "
|
||||||
"(Circuit purpose: %s)",
|
"(Circuit purpose: %s)",
|
||||||
description, exit->nickname,
|
description, extend_info_describe(exit),
|
||||||
rs==options->ExcludeNodes?"":" or ExcludeExitNodes",
|
rs==options->ExcludeNodes?"":" or ExcludeExitNodes",
|
||||||
circuit_purpose_to_string(purpose));
|
circuit_purpose_to_string(purpose));
|
||||||
}
|
}
|
||||||
@ -2964,7 +2963,8 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit)
|
|||||||
|
|
||||||
if (exit) { /* the circuit-builder pre-requested one */
|
if (exit) { /* the circuit-builder pre-requested one */
|
||||||
warn_if_last_router_excluded(circ, exit);
|
warn_if_last_router_excluded(circ, exit);
|
||||||
log_info(LD_CIRC,"Using requested exit node '%s'", exit->nickname);
|
log_info(LD_CIRC,"Using requested exit node '%s'",
|
||||||
|
extend_info_describe(exit));
|
||||||
exit = extend_info_dup(exit);
|
exit = extend_info_dup(exit);
|
||||||
} else { /* we have to decide one */
|
} else { /* we have to decide one */
|
||||||
const node_t *node =
|
const node_t *node =
|
||||||
@ -3014,8 +3014,8 @@ circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *exit)
|
|||||||
circuit_append_new_exit(circ, exit);
|
circuit_append_new_exit(circ, exit);
|
||||||
circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_BUILDING);
|
circuit_set_state(TO_CIRCUIT(circ), CIRCUIT_STATE_BUILDING);
|
||||||
if ((err_reason = circuit_send_next_onion_skin(circ))<0) {
|
if ((err_reason = circuit_send_next_onion_skin(circ))<0) {
|
||||||
log_warn(LD_CIRC, "Couldn't extend circuit to new point '%s'.",
|
log_warn(LD_CIRC, "Couldn't extend circuit to new point %s.",
|
||||||
exit->nickname);
|
extend_info_describe(exit));
|
||||||
circuit_mark_for_close(TO_CIRCUIT(circ), -err_reason);
|
circuit_mark_for_close(TO_CIRCUIT(circ), -err_reason);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3239,7 +3239,8 @@ onion_extend_cpath(origin_circuit_t *circ)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
|
log_debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
|
||||||
info->nickname, cur_len+1, build_state_get_exit_nickname(state));
|
extend_info_describe(info),
|
||||||
|
cur_len+1, build_state_get_exit_nickname(state));
|
||||||
|
|
||||||
onion_append_hop(&circ->cpath, info);
|
onion_append_hop(&circ->cpath, info);
|
||||||
extend_info_free(info);
|
extend_info_free(info);
|
||||||
@ -3541,20 +3542,24 @@ log_entry_guards(int severity)
|
|||||||
smartlist_t *elements = smartlist_create();
|
smartlist_t *elements = smartlist_create();
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e,
|
SMARTLIST_FOREACH_BEGIN(entry_guards, entry_guard_t *, e)
|
||||||
{
|
{
|
||||||
const char *msg = NULL;
|
const char *msg = NULL;
|
||||||
char *cp;
|
char *cp;
|
||||||
if (entry_is_live(e, 0, 1, 0, &msg))
|
if (entry_is_live(e, 0, 1, 0, &msg))
|
||||||
tor_asprintf(&cp, "%s (up %s)",
|
tor_asprintf(&cp, "%s [%s] (up %s)",
|
||||||
e->nickname,
|
e->nickname,
|
||||||
|
hex_str(e->identity, DIGEST_LEN),
|
||||||
e->made_contact ? "made-contact" : "never-contacted");
|
e->made_contact ? "made-contact" : "never-contacted");
|
||||||
else
|
else
|
||||||
tor_asprintf(&cp, "%s (%s, %s)",
|
tor_asprintf(&cp, "%s [%s] (%s, %s)",
|
||||||
e->nickname, msg,
|
e->nickname,
|
||||||
|
hex_str(e->identity, DIGEST_LEN),
|
||||||
|
msg,
|
||||||
e->made_contact ? "made-contact" : "never-contacted");
|
e->made_contact ? "made-contact" : "never-contacted");
|
||||||
smartlist_add(elements, cp);
|
smartlist_add(elements, cp);
|
||||||
});
|
}
|
||||||
|
SMARTLIST_FOREACH_END(e);
|
||||||
|
|
||||||
s = smartlist_join_strings(elements, ",", 0, NULL);
|
s = smartlist_join_strings(elements, ",", 0, NULL);
|
||||||
SMARTLIST_FOREACH(elements, char*, cp, tor_free(cp));
|
SMARTLIST_FOREACH(elements, char*, cp, tor_free(cp));
|
||||||
@ -3622,8 +3627,8 @@ add_an_entry_guard(const node_t *chosen, int reset_status)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
entry = tor_malloc_zero(sizeof(entry_guard_t));
|
entry = tor_malloc_zero(sizeof(entry_guard_t));
|
||||||
log_info(LD_CIRC, "Chose '%s' as new entry guard.",
|
log_info(LD_CIRC, "Chose %s as new entry guard.",
|
||||||
node_get_nickname(node));
|
node_describe(node));
|
||||||
strlcpy(entry->nickname, node_get_nickname(node), sizeof(entry->nickname));
|
strlcpy(entry->nickname, node_get_nickname(node), sizeof(entry->nickname));
|
||||||
memcpy(entry->identity, node->identity, DIGEST_LEN);
|
memcpy(entry->identity, node->identity, DIGEST_LEN);
|
||||||
/* Choose expiry time smudged over the past month. The goal here
|
/* Choose expiry time smudged over the past month. The goal here
|
||||||
@ -3813,8 +3818,9 @@ entry_guards_compute_status(or_options_t *options, time_t now)
|
|||||||
const char *reason = digestmap_get(reasons, entry->identity);
|
const char *reason = digestmap_get(reasons, entry->identity);
|
||||||
const char *live_msg = "";
|
const char *live_msg = "";
|
||||||
const node_t *r = entry_is_live(entry, 0, 1, 0, &live_msg);
|
const node_t *r = entry_is_live(entry, 0, 1, 0, &live_msg);
|
||||||
log_info(LD_CIRC, "Summary: Entry '%s' is %s, %s%s%s, and %s%s.",
|
log_info(LD_CIRC, "Summary: Entry %s [%s] is %s, %s%s%s, and %s%s.",
|
||||||
entry->nickname,
|
entry->nickname,
|
||||||
|
hex_str(entry->identity, DIGEST_LEN),
|
||||||
entry->unreachable_since ? "unreachable" : "reachable",
|
entry->unreachable_since ? "unreachable" : "reachable",
|
||||||
entry->bad_since ? "unusable" : "usable",
|
entry->bad_since ? "unusable" : "usable",
|
||||||
reason ? ", ": "",
|
reason ? ", ": "",
|
||||||
|
@ -272,8 +272,10 @@ circuit_count_pending_on_or_conn(or_connection_t *or_conn)
|
|||||||
circuit_get_all_pending_on_or_conn(sl, or_conn);
|
circuit_get_all_pending_on_or_conn(sl, or_conn);
|
||||||
cnt = smartlist_len(sl);
|
cnt = smartlist_len(sl);
|
||||||
smartlist_free(sl);
|
smartlist_free(sl);
|
||||||
log_debug(LD_CIRC,"or_conn to %s, %d pending circs",
|
log_debug(LD_CIRC,"or_conn to %s at %s, %d pending circs",
|
||||||
or_conn->nickname ? or_conn->nickname : "NULL", cnt);
|
or_conn->nickname ? or_conn->nickname : "NULL",
|
||||||
|
or_conn->_base.address,
|
||||||
|
cnt);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1317,8 +1317,8 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn,
|
|||||||
conn->_base.state = AP_CONN_STATE_RENDDESC_WAIT;
|
conn->_base.state = AP_CONN_STATE_RENDDESC_WAIT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
log_info(LD_REND,"Chose '%s' as intro point for '%s'.",
|
log_info(LD_REND,"Chose %s as intro point for '%s'.",
|
||||||
extend_info->nickname,
|
extend_info_describe(extend_info),
|
||||||
safe_str_client(conn->rend_data->onion_address));
|
safe_str_client(conn->rend_data->onion_address));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +276,8 @@ command_process_create_cell(cell_t *cell, or_connection_t *conn)
|
|||||||
if (node) {
|
if (node) {
|
||||||
char *p = esc_for_log(node_get_platform(node));
|
char *p = esc_for_log(node_get_platform(node));
|
||||||
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
|
||||||
"Details: nickname \"%s\", platform %s.",
|
"Details: router %s, platform %s.",
|
||||||
node_get_nickname(node), p);
|
node_describe(node), p);
|
||||||
tor_free(p);
|
tor_free(p);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -503,12 +503,12 @@ connection_ap_expire_beginning(void)
|
|||||||
}
|
}
|
||||||
tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_GENERAL);
|
tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_GENERAL);
|
||||||
log_fn(cutoff < 15 ? LOG_INFO : severity, LD_APP,
|
log_fn(cutoff < 15 ? LOG_INFO : severity, LD_APP,
|
||||||
"We tried for %d seconds to connect to '%s' using exit '%s'."
|
"We tried for %d seconds to connect to '%s' using exit %s."
|
||||||
" Retrying on a new circuit.",
|
" Retrying on a new circuit.",
|
||||||
seconds_idle,
|
seconds_idle,
|
||||||
safe_str_client(conn->socks_request->address),
|
safe_str_client(conn->socks_request->address),
|
||||||
conn->cpath_layer ?
|
conn->cpath_layer ?
|
||||||
conn->cpath_layer->extend_info->nickname : "*unnamed*");
|
extend_info_describe(conn->cpath_layer->extend_info): "*unnamed*");
|
||||||
/* send an end down the circuit */
|
/* send an end down the circuit */
|
||||||
connection_edge_end(conn, END_STREAM_REASON_TIMEOUT);
|
connection_edge_end(conn, END_STREAM_REASON_TIMEOUT);
|
||||||
/* un-mark it as ending, since we're going to reuse it */
|
/* un-mark it as ending, since we're going to reuse it */
|
||||||
@ -1830,7 +1830,7 @@ connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
|
|||||||
if (r) {
|
if (r) {
|
||||||
log_info(LD_APP,
|
log_info(LD_APP,
|
||||||
"Redirecting address %s to exit at enclave router %s",
|
"Redirecting address %s to exit at enclave router %s",
|
||||||
safe_str_client(socks->address), node_get_nickname(r));
|
safe_str_client(socks->address), node_describe(r));
|
||||||
/* use the hex digest, not nickname, in case there are two
|
/* use the hex digest, not nickname, in case there are two
|
||||||
routers with this nickname */
|
routers with this nickname */
|
||||||
conn->chosen_exit_name =
|
conn->chosen_exit_name =
|
||||||
|
@ -558,7 +558,8 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
|
|||||||
|
|
||||||
if (!node && anonymized_connection) {
|
if (!node && anonymized_connection) {
|
||||||
log_info(LD_DIR, "Not sending anonymized request to directory '%s'; we "
|
log_info(LD_DIR, "Not sending anonymized request to directory '%s'; we "
|
||||||
"don't have its router descriptor.", status->nickname);
|
"don't have its router descriptor.",
|
||||||
|
routerstatus_describe(status));
|
||||||
return;
|
return;
|
||||||
} else if (node) {
|
} else if (node) {
|
||||||
node_get_address_string(node, address_buf, sizeof(address_buf));
|
node_get_address_string(node, address_buf, sizeof(address_buf));
|
||||||
@ -572,10 +573,10 @@ directory_initiate_command_routerstatus_rend(const routerstatus_t *status,
|
|||||||
|
|
||||||
if (options->ExcludeNodes && options->StrictNodes &&
|
if (options->ExcludeNodes && options->StrictNodes &&
|
||||||
routerset_contains_routerstatus(options->ExcludeNodes, status, -1)) {
|
routerset_contains_routerstatus(options->ExcludeNodes, status, -1)) {
|
||||||
log_warn(LD_DIR, "Wanted to contact directory mirror '%s' for %s, but "
|
log_warn(LD_DIR, "Wanted to contact directory mirror %s for %s, but "
|
||||||
"it's in our ExcludedNodes list and StrictNodes is set. "
|
"it's in our ExcludedNodes list and StrictNodes is set. "
|
||||||
"Skipping. This choice might make your Tor not work.",
|
"Skipping. This choice might make your Tor not work.",
|
||||||
status->nickname,
|
routerstatus_describe(status),
|
||||||
dir_conn_purpose_to_string(dir_purpose));
|
dir_conn_purpose_to_string(dir_purpose));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -518,14 +518,15 @@ dirserv_router_has_valid_address(routerinfo_t *ri)
|
|||||||
if (get_options()->DirAllowPrivateAddresses)
|
if (get_options()->DirAllowPrivateAddresses)
|
||||||
return 0; /* whatever it is, we're fine with it */
|
return 0; /* whatever it is, we're fine with it */
|
||||||
if (!tor_inet_aton(ri->address, &iaddr)) {
|
if (!tor_inet_aton(ri->address, &iaddr)) {
|
||||||
log_info(LD_DIRSERV,"Router '%s' published non-IP address '%s'. Refusing.",
|
log_info(LD_DIRSERV,"Router %s published non-IP address '%s'. Refusing.",
|
||||||
ri->nickname, ri->address);
|
router_describe(ri),
|
||||||
|
ri->address);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (is_internal_IP(ntohl(iaddr.s_addr), 0)) {
|
if (is_internal_IP(ntohl(iaddr.s_addr), 0)) {
|
||||||
log_info(LD_DIRSERV,
|
log_info(LD_DIRSERV,
|
||||||
"Router '%s' published internal IP address '%s'. Refusing.",
|
"Router %s published internal IP address '%s'. Refusing.",
|
||||||
ri->nickname, ri->address);
|
router_describe(ri), ri->address);
|
||||||
return -1; /* it's a private IP, we should reject it */
|
return -1; /* it's a private IP, we should reject it */
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -554,10 +555,11 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
|
|||||||
/* Is there too much clock skew? */
|
/* Is there too much clock skew? */
|
||||||
now = time(NULL);
|
now = time(NULL);
|
||||||
if (ri->cache_info.published_on > now+ROUTER_ALLOW_SKEW) {
|
if (ri->cache_info.published_on > now+ROUTER_ALLOW_SKEW) {
|
||||||
log_fn(severity, LD_DIRSERV, "Publication time for nickname '%s' is too "
|
log_fn(severity, LD_DIRSERV, "Publication time for %s is too "
|
||||||
"far (%d minutes) in the future; possible clock skew. Not adding "
|
"far (%d minutes) in the future; possible clock skew. Not adding "
|
||||||
"(%s)",
|
"(%s)",
|
||||||
ri->nickname, (int)((ri->cache_info.published_on-now)/60),
|
router_describe(ri),
|
||||||
|
(int)((ri->cache_info.published_on-now)/60),
|
||||||
esc_router_info(ri));
|
esc_router_info(ri));
|
||||||
*msg = "Rejected: Your clock is set too far in the future, or your "
|
*msg = "Rejected: Your clock is set too far in the future, or your "
|
||||||
"timezone is not correct.";
|
"timezone is not correct.";
|
||||||
@ -565,9 +567,10 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
|
|||||||
}
|
}
|
||||||
if (ri->cache_info.published_on < now-ROUTER_MAX_AGE_TO_PUBLISH) {
|
if (ri->cache_info.published_on < now-ROUTER_MAX_AGE_TO_PUBLISH) {
|
||||||
log_fn(severity, LD_DIRSERV,
|
log_fn(severity, LD_DIRSERV,
|
||||||
"Publication time for router with nickname '%s' is too far "
|
"Publication time for %s is too far "
|
||||||
"(%d minutes) in the past. Not adding (%s)",
|
"(%d minutes) in the past. Not adding (%s)",
|
||||||
ri->nickname, (int)((now-ri->cache_info.published_on)/60),
|
router_describe(ri),
|
||||||
|
(int)((now-ri->cache_info.published_on)/60),
|
||||||
esc_router_info(ri));
|
esc_router_info(ri));
|
||||||
*msg = "Rejected: Server is expired, or your clock is too far in the past,"
|
*msg = "Rejected: Server is expired, or your clock is too far in the past,"
|
||||||
" or your timezone is not correct.";
|
" or your timezone is not correct.";
|
||||||
@ -575,9 +578,10 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
|
|||||||
}
|
}
|
||||||
if (dirserv_router_has_valid_address(ri) < 0) {
|
if (dirserv_router_has_valid_address(ri) < 0) {
|
||||||
log_fn(severity, LD_DIRSERV,
|
log_fn(severity, LD_DIRSERV,
|
||||||
"Router with nickname '%s' has invalid address '%s'. "
|
"Router %s has invalid address '%s'. "
|
||||||
"Not adding (%s).",
|
"Not adding (%s).",
|
||||||
ri->nickname, ri->address,
|
router_describe(ri),
|
||||||
|
ri->address,
|
||||||
esc_router_info(ri));
|
esc_router_info(ri));
|
||||||
*msg = "Rejected: Address is not an IP, or IP is a private address.";
|
*msg = "Rejected: Address is not an IP, or IP is a private address.";
|
||||||
return -1;
|
return -1;
|
||||||
@ -729,9 +733,9 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
|
|||||||
&& router_differences_are_cosmetic(ri_old, ri)
|
&& router_differences_are_cosmetic(ri_old, ri)
|
||||||
&& !router_is_me(ri)) {
|
&& !router_is_me(ri)) {
|
||||||
log_info(LD_DIRSERV,
|
log_info(LD_DIRSERV,
|
||||||
"Not replacing descriptor from '%s' (source: %s); "
|
"Not replacing descriptor from %s (source: %s); "
|
||||||
"differences are cosmetic.",
|
"differences are cosmetic.",
|
||||||
ri->nickname, source);
|
router_describe(ri), source);
|
||||||
*msg = "Not replacing router descriptor; no information has changed since "
|
*msg = "Not replacing router descriptor; no information has changed since "
|
||||||
"the last one with this identity.";
|
"the last one with this identity.";
|
||||||
control_event_or_authdir_new_descriptor("DROPPED",
|
control_event_or_authdir_new_descriptor("DROPPED",
|
||||||
@ -831,13 +835,15 @@ directory_remove_invalid(void)
|
|||||||
SMARTLIST_FOREACH_BEGIN(nodes, node_t *, node) {
|
SMARTLIST_FOREACH_BEGIN(nodes, node_t *, node) {
|
||||||
const char *msg;
|
const char *msg;
|
||||||
routerinfo_t *ent = node->ri;
|
routerinfo_t *ent = node->ri;
|
||||||
|
char description[NODE_DESC_BUF_LEN];
|
||||||
uint32_t r;
|
uint32_t r;
|
||||||
if (!ent)
|
if (!ent)
|
||||||
continue;
|
continue;
|
||||||
r = dirserv_router_get_status(ent, &msg);
|
r = dirserv_router_get_status(ent, &msg);
|
||||||
|
router_get_description(description, ent);
|
||||||
if (r & FP_REJECT) {
|
if (r & FP_REJECT) {
|
||||||
log_info(LD_DIRSERV, "Router '%s' is now rejected: %s",
|
log_info(LD_DIRSERV, "Router %s is now rejected: %s",
|
||||||
ent->nickname, msg?msg:"");
|
description, msg?msg:"");
|
||||||
routerlist_remove(rl, ent, 0, time(NULL));
|
routerlist_remove(rl, ent, 0, time(NULL));
|
||||||
changed = 1;
|
changed = 1;
|
||||||
continue;
|
continue;
|
||||||
@ -845,33 +851,33 @@ directory_remove_invalid(void)
|
|||||||
#if 0
|
#if 0
|
||||||
if (bool_neq((r & FP_NAMED), ent->auth_says_is_named)) {
|
if (bool_neq((r & FP_NAMED), ent->auth_says_is_named)) {
|
||||||
log_info(LD_DIRSERV,
|
log_info(LD_DIRSERV,
|
||||||
"Router '%s' is now %snamed.", ent->nickname,
|
"Router %s is now %snamed.", description,
|
||||||
(r&FP_NAMED)?"":"un");
|
(r&FP_NAMED)?"":"un");
|
||||||
ent->is_named = (r&FP_NAMED)?1:0;
|
ent->is_named = (r&FP_NAMED)?1:0;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
if (bool_neq((r & FP_UNNAMED), ent->auth_says_is_unnamed)) {
|
if (bool_neq((r & FP_UNNAMED), ent->auth_says_is_unnamed)) {
|
||||||
log_info(LD_DIRSERV,
|
log_info(LD_DIRSERV,
|
||||||
"Router '%s' is now %snamed. (FP_UNNAMED)", ent->nickname,
|
"Router '%s' is now %snamed. (FP_UNNAMED)", description,
|
||||||
(r&FP_NAMED)?"":"un");
|
(r&FP_NAMED)?"":"un");
|
||||||
ent->is_named = (r&FP_NUNAMED)?0:1;
|
ent->is_named = (r&FP_NUNAMED)?0:1;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (bool_neq((r & FP_INVALID), !node->is_valid)) {
|
if (bool_neq((r & FP_INVALID), !node->is_valid)) {
|
||||||
log_info(LD_DIRSERV, "Router '%s' is now %svalid.", ent->nickname,
|
log_info(LD_DIRSERV, "Router '%s' is now %svalid.", description,
|
||||||
(r&FP_INVALID) ? "in" : "");
|
(r&FP_INVALID) ? "in" : "");
|
||||||
node->is_valid = (r&FP_INVALID)?0:1;
|
node->is_valid = (r&FP_INVALID)?0:1;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
if (bool_neq((r & FP_BADDIR), node->is_bad_directory)) {
|
if (bool_neq((r & FP_BADDIR), node->is_bad_directory)) {
|
||||||
log_info(LD_DIRSERV, "Router '%s' is now a %s directory", ent->nickname,
|
log_info(LD_DIRSERV, "Router '%s' is now a %s directory", description,
|
||||||
(r & FP_BADDIR) ? "bad" : "good");
|
(r & FP_BADDIR) ? "bad" : "good");
|
||||||
node->is_bad_directory = (r&FP_BADDIR) ? 1: 0;
|
node->is_bad_directory = (r&FP_BADDIR) ? 1: 0;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
if (bool_neq((r & FP_BADEXIT), node->is_bad_exit)) {
|
if (bool_neq((r & FP_BADEXIT), node->is_bad_exit)) {
|
||||||
log_info(LD_DIRSERV, "Router '%s' is now a %s exit", ent->nickname,
|
log_info(LD_DIRSERV, "Router '%s' is now a %s exit", description,
|
||||||
(r & FP_BADEXIT) ? "bad" : "good");
|
(r & FP_BADEXIT) ? "bad" : "good");
|
||||||
node->is_bad_exit = (r&FP_BADEXIT) ? 1: 0;
|
node->is_bad_exit = (r&FP_BADEXIT) ? 1: 0;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
@ -3191,7 +3197,8 @@ dirserv_orconn_tls_done(const char *address,
|
|||||||
if (!bridge_auth || ri->purpose == ROUTER_PURPOSE_BRIDGE) {
|
if (!bridge_auth || ri->purpose == ROUTER_PURPOSE_BRIDGE) {
|
||||||
tor_addr_t addr, *addrp=NULL;
|
tor_addr_t addr, *addrp=NULL;
|
||||||
log_info(LD_DIRSERV, "Found router %s to be reachable at %s:%d. Yay.",
|
log_info(LD_DIRSERV, "Found router %s to be reachable at %s:%d. Yay.",
|
||||||
ri->nickname, address, ri->or_port );
|
router_describe(ri),
|
||||||
|
address, ri->or_port);
|
||||||
if (tor_addr_from_str(&addr, ri->address) != -1)
|
if (tor_addr_from_str(&addr, ri->address) != -1)
|
||||||
addrp = &addr;
|
addrp = &addr;
|
||||||
else
|
else
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "reasons.h"
|
#include "reasons.h"
|
||||||
#include "relay.h"
|
#include "relay.h"
|
||||||
#include "rendcommon.h"
|
#include "rendcommon.h"
|
||||||
|
#include "router.h"
|
||||||
#include "routerlist.h"
|
#include "routerlist.h"
|
||||||
#include "routerparse.h"
|
#include "routerparse.h"
|
||||||
|
|
||||||
@ -751,9 +752,9 @@ connection_ap_process_end_not_open(
|
|||||||
(tor_inet_aton(conn->socks_request->address, &in) &&
|
(tor_inet_aton(conn->socks_request->address, &in) &&
|
||||||
!conn->chosen_exit_name))) {
|
!conn->chosen_exit_name))) {
|
||||||
log_info(LD_APP,
|
log_info(LD_APP,
|
||||||
"Exitrouter '%s' seems to be more restrictive than its exit "
|
"Exitrouter %s seems to be more restrictive than its exit "
|
||||||
"policy. Not using this router as exit for now.",
|
"policy. Not using this router as exit for now.",
|
||||||
node_get_nickname(exitrouter));
|
node_describe(exitrouter));
|
||||||
policies_set_node_exitpolicy_to_reject_all(exitrouter);
|
policies_set_node_exitpolicy_to_reject_all(exitrouter);
|
||||||
}
|
}
|
||||||
/* rewrite it to an IP if we learned one. */
|
/* rewrite it to an IP if we learned one. */
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "rendclient.h"
|
#include "rendclient.h"
|
||||||
#include "rendcommon.h"
|
#include "rendcommon.h"
|
||||||
#include "rephist.h"
|
#include "rephist.h"
|
||||||
|
#include "router.h"
|
||||||
#include "routerlist.h"
|
#include "routerlist.h"
|
||||||
|
|
||||||
static extend_info_t *rend_client_get_random_intro_impl(
|
static extend_info_t *rend_client_get_random_intro_impl(
|
||||||
@ -91,12 +92,13 @@ rend_client_reextend_intro_circuit(origin_circuit_t *circ)
|
|||||||
if (circ->remaining_relay_early_cells) {
|
if (circ->remaining_relay_early_cells) {
|
||||||
log_info(LD_REND,
|
log_info(LD_REND,
|
||||||
"Re-extending circ %d, this time to %s.",
|
"Re-extending circ %d, this time to %s.",
|
||||||
circ->_base.n_circ_id, extend_info->nickname);
|
circ->_base.n_circ_id,
|
||||||
|
safe_str_client(extend_info_describe(extend_info)));
|
||||||
result = circuit_extend_to_new_exit(circ, extend_info);
|
result = circuit_extend_to_new_exit(circ, extend_info);
|
||||||
} else {
|
} else {
|
||||||
log_info(LD_REND,
|
log_info(LD_REND,
|
||||||
"Building a new introduction circuit, this time to %s.",
|
"Building a new introduction circuit, this time to %s.",
|
||||||
extend_info->nickname);
|
safe_str_client(extend_info_describe(extend_info)));
|
||||||
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_FINISHED);
|
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_FINISHED);
|
||||||
if (!circuit_launch_by_extend_info(CIRCUIT_PURPOSE_C_INTRODUCING,
|
if (!circuit_launch_by_extend_info(CIRCUIT_PURPOSE_C_INTRODUCING,
|
||||||
extend_info,
|
extend_info,
|
||||||
@ -169,7 +171,8 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
|
|||||||
"have a v2 rend desc with %d intro points. "
|
"have a v2 rend desc with %d intro points. "
|
||||||
"Trying a different intro point...",
|
"Trying a different intro point...",
|
||||||
safe_str_client(introcirc->rend_data->onion_address),
|
safe_str_client(introcirc->rend_data->onion_address),
|
||||||
introcirc->build_state->chosen_exit->nickname,
|
safe_str_client(extend_info_describe(
|
||||||
|
introcirc->build_state->chosen_exit)),
|
||||||
smartlist_len(entry->parsed->intro_nodes));
|
smartlist_len(entry->parsed->intro_nodes));
|
||||||
|
|
||||||
if (rend_client_reextend_intro_circuit(introcirc)) {
|
if (rend_client_reextend_intro_circuit(introcirc)) {
|
||||||
@ -352,8 +355,8 @@ rend_client_introduction_acked(origin_circuit_t *circ,
|
|||||||
* If none remain, refetch the service descriptor.
|
* If none remain, refetch the service descriptor.
|
||||||
*/
|
*/
|
||||||
log_info(LD_REND, "Got nack for %s from %s...",
|
log_info(LD_REND, "Got nack for %s from %s...",
|
||||||
safe_str_client(circ->rend_data->onion_address),
|
safe_str_client(circ->rend_data->onion_address),
|
||||||
circ->build_state->chosen_exit->nickname);
|
safe_str_client(extend_info_describe(circ->build_state->chosen_exit)));
|
||||||
if (rend_client_remove_intro_point(circ->build_state->chosen_exit,
|
if (rend_client_remove_intro_point(circ->build_state->chosen_exit,
|
||||||
circ->rend_data) > 0) {
|
circ->rend_data) > 0) {
|
||||||
/* There are introduction points left. Re-extend the circuit to
|
/* There are introduction points left. Re-extend the circuit to
|
||||||
@ -508,12 +511,12 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query)
|
|||||||
log_info(LD_REND, "Sending fetch request for v2 descriptor for "
|
log_info(LD_REND, "Sending fetch request for v2 descriptor for "
|
||||||
"service '%s' with descriptor ID '%s', auth type %d, "
|
"service '%s' with descriptor ID '%s', auth type %d, "
|
||||||
"and descriptor cookie '%s' to hidden service "
|
"and descriptor cookie '%s' to hidden service "
|
||||||
"directory '%s' on port %d.",
|
"directory %s",
|
||||||
rend_query->onion_address, desc_id_base32,
|
rend_query->onion_address, desc_id_base32,
|
||||||
rend_query->auth_type,
|
rend_query->auth_type,
|
||||||
(rend_query->auth_type == REND_NO_AUTH ? "[none]" :
|
(rend_query->auth_type == REND_NO_AUTH ? "[none]" :
|
||||||
escaped_safe_str_client(descriptor_cookie_base64)),
|
escaped_safe_str_client(descriptor_cookie_base64)),
|
||||||
hs_dir->nickname, hs_dir->dir_port);
|
routerstatus_describe(hs_dir));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,8 @@ rend_config_services(or_options_t *options, int validate_only)
|
|||||||
if (keep_it)
|
if (keep_it)
|
||||||
continue;
|
continue;
|
||||||
log_info(LD_REND, "Closing intro point %s for service %s.",
|
log_info(LD_REND, "Closing intro point %s for service %s.",
|
||||||
safe_str_client(oc->build_state->chosen_exit->nickname),
|
safe_str_client(extend_info_describe(
|
||||||
|
oc->build_state->chosen_exit)),
|
||||||
oc->rend_data->onion_address);
|
oc->rend_data->onion_address);
|
||||||
circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
|
circuit_mark_for_close(circ, END_CIRC_REASON_FINISHED);
|
||||||
/* XXXX Is there another reason we should use here? */
|
/* XXXX Is there another reason we should use here? */
|
||||||
@ -1147,7 +1148,7 @@ rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request,
|
|||||||
if (!launched) { /* give up */
|
if (!launched) { /* give up */
|
||||||
log_warn(LD_REND, "Giving up launching first hop of circuit to rendezvous "
|
log_warn(LD_REND, "Giving up launching first hop of circuit to rendezvous "
|
||||||
"point %s for service %s.",
|
"point %s for service %s.",
|
||||||
escaped_safe_str_client(extend_info->nickname),
|
safe_str_client(extend_info_describe(extend_info)),
|
||||||
serviceid);
|
serviceid);
|
||||||
reason = END_CIRC_REASON_CONNECTFAILED;
|
reason = END_CIRC_REASON_CONNECTFAILED;
|
||||||
goto err;
|
goto err;
|
||||||
@ -1155,7 +1156,7 @@ rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request,
|
|||||||
log_info(LD_REND,
|
log_info(LD_REND,
|
||||||
"Accepted intro; launching circuit to %s "
|
"Accepted intro; launching circuit to %s "
|
||||||
"(cookie %s) for service %s.",
|
"(cookie %s) for service %s.",
|
||||||
escaped_safe_str_client(extend_info->nickname),
|
safe_str_client(extend_info_describe(extend_info)),
|
||||||
hexcookie, serviceid);
|
hexcookie, serviceid);
|
||||||
tor_assert(launched->build_state);
|
tor_assert(launched->build_state);
|
||||||
/* Fill in the circuit's state. */
|
/* Fill in the circuit's state. */
|
||||||
@ -1207,7 +1208,8 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
|
|||||||
"Attempt to build circuit to %s for rendezvous has failed "
|
"Attempt to build circuit to %s for rendezvous has failed "
|
||||||
"too many times or expired; giving up.",
|
"too many times or expired; giving up.",
|
||||||
oldcirc->build_state ?
|
oldcirc->build_state ?
|
||||||
oldcirc->build_state->chosen_exit->nickname : "*unknown*");
|
safe_str(extend_info_describe(oldcirc->build_state->chosen_exit))
|
||||||
|
: "*unknown*");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1221,7 +1223,7 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_info(LD_REND,"Reattempting rendezvous circuit to '%s'",
|
log_info(LD_REND,"Reattempting rendezvous circuit to '%s'",
|
||||||
oldstate->chosen_exit->nickname);
|
safe_str(extend_info_describe(oldstate->chosen_exit)));
|
||||||
|
|
||||||
newcirc = circuit_launch_by_extend_info(CIRCUIT_PURPOSE_S_CONNECT_REND,
|
newcirc = circuit_launch_by_extend_info(CIRCUIT_PURPOSE_S_CONNECT_REND,
|
||||||
oldstate->chosen_exit,
|
oldstate->chosen_exit,
|
||||||
@ -1229,7 +1231,7 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
|
|||||||
|
|
||||||
if (!newcirc) {
|
if (!newcirc) {
|
||||||
log_warn(LD_REND,"Couldn't relaunch rendezvous circuit to '%s'.",
|
log_warn(LD_REND,"Couldn't relaunch rendezvous circuit to '%s'.",
|
||||||
oldstate->chosen_exit->nickname);
|
safe_str(extend_info_describe(oldstate->chosen_exit)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
newstate = newcirc->build_state;
|
newstate = newcirc->build_state;
|
||||||
@ -1253,7 +1255,7 @@ rend_service_launch_establish_intro(rend_service_t *service,
|
|||||||
|
|
||||||
log_info(LD_REND,
|
log_info(LD_REND,
|
||||||
"Launching circuit to introduction point %s for service %s",
|
"Launching circuit to introduction point %s for service %s",
|
||||||
escaped_safe_str_client(intro->extend_info->nickname),
|
safe_str_client(extend_info_describe(intro->extend_info)),
|
||||||
service->service_id);
|
service->service_id);
|
||||||
|
|
||||||
rep_hist_note_used_internal(time(NULL), 1, 0);
|
rep_hist_note_used_internal(time(NULL), 1, 0);
|
||||||
@ -1266,7 +1268,7 @@ rend_service_launch_establish_intro(rend_service_t *service,
|
|||||||
if (!launched) {
|
if (!launched) {
|
||||||
log_info(LD_REND,
|
log_info(LD_REND,
|
||||||
"Can't launch circuit to establish introduction at %s.",
|
"Can't launch circuit to establish introduction at %s.",
|
||||||
escaped_safe_str_client(intro->extend_info->nickname));
|
safe_str_client(extend_info_describe(intro->extend_info)));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1609,9 +1611,9 @@ directory_post_to_hs_dir(rend_service_descriptor_t *renddesc,
|
|||||||
continue;
|
continue;
|
||||||
if (!router_get_by_id_digest(hs_dir->identity_digest)) {
|
if (!router_get_by_id_digest(hs_dir->identity_digest)) {
|
||||||
log_info(LD_REND, "Not sending publish request for v2 descriptor to "
|
log_info(LD_REND, "Not sending publish request for v2 descriptor to "
|
||||||
"hidden service directory '%s'; we don't have its "
|
"hidden service directory %s; we don't have its "
|
||||||
"router descriptor. Queuing for later upload.",
|
"router descriptor. Queuing for later upload.",
|
||||||
hs_dir->nickname);
|
safe_str_client(routerstatus_describe(hs_dir)));
|
||||||
failed_upload = -1;
|
failed_upload = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1819,7 +1821,8 @@ rend_services_introduce(void)
|
|||||||
node = node_get_by_id(intro->extend_info->identity_digest);
|
node = node_get_by_id(intro->extend_info->identity_digest);
|
||||||
if (!node || !find_intro_circuit(intro, service->pk_digest)) {
|
if (!node || !find_intro_circuit(intro, service->pk_digest)) {
|
||||||
log_info(LD_REND,"Giving up on %s as intro point for %s.",
|
log_info(LD_REND,"Giving up on %s as intro point for %s.",
|
||||||
intro->extend_info->nickname, service->service_id);
|
safe_str_client(extend_info_describe(intro->extend_info)),
|
||||||
|
safe_str_client(service->service_id));
|
||||||
if (service->desc) {
|
if (service->desc) {
|
||||||
SMARTLIST_FOREACH(service->desc->intro_nodes, rend_intro_point_t *,
|
SMARTLIST_FOREACH(service->desc->intro_nodes, rend_intro_point_t *,
|
||||||
dintro, {
|
dintro, {
|
||||||
@ -1885,7 +1888,8 @@ rend_services_introduce(void)
|
|||||||
tor_assert(!crypto_pk_generate_key(intro->intro_key));
|
tor_assert(!crypto_pk_generate_key(intro->intro_key));
|
||||||
smartlist_add(service->intro_nodes, intro);
|
smartlist_add(service->intro_nodes, intro);
|
||||||
log_info(LD_REND, "Picked router %s as an intro point for %s.",
|
log_info(LD_REND, "Picked router %s as an intro point for %s.",
|
||||||
node_get_nickname(node), service->service_id);
|
safe_str_client(node_describe(node)),
|
||||||
|
safe_str_client(service->service_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there's no need to launch new circuits, stop here. */
|
/* If there's no need to launch new circuits, stop here. */
|
||||||
@ -1898,7 +1902,8 @@ rend_services_introduce(void)
|
|||||||
r = rend_service_launch_establish_intro(service, intro);
|
r = rend_service_launch_establish_intro(service, intro);
|
||||||
if (r<0) {
|
if (r<0) {
|
||||||
log_warn(LD_REND, "Error launching circuit to node %s for service %s.",
|
log_warn(LD_REND, "Error launching circuit to node %s for service %s.",
|
||||||
intro->extend_info->nickname, service->service_id);
|
safe_str_client(extend_info_describe(intro->extend_info)),
|
||||||
|
safe_str_client(service->service_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,6 +635,7 @@ rep_hist_dump_stats(time_t now, int severity)
|
|||||||
digestmap_iter_t *orhist_it;
|
digestmap_iter_t *orhist_it;
|
||||||
const char *name1, *name2, *digest1, *digest2;
|
const char *name1, *name2, *digest1, *digest2;
|
||||||
char hexdigest1[HEX_DIGEST_LEN+1];
|
char hexdigest1[HEX_DIGEST_LEN+1];
|
||||||
|
char hexdigest2[HEX_DIGEST_LEN+1];
|
||||||
or_history_t *or_history;
|
or_history_t *or_history;
|
||||||
link_history_t *link_history;
|
link_history_t *link_history;
|
||||||
void *or_history_p, *link_history_p;
|
void *or_history_p, *link_history_p;
|
||||||
@ -695,7 +696,10 @@ rep_hist_dump_stats(time_t now, int severity)
|
|||||||
|
|
||||||
link_history = (link_history_t*) link_history_p;
|
link_history = (link_history_t*) link_history_p;
|
||||||
|
|
||||||
ret = tor_snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
|
base16_encode(hexdigest2, sizeof(hexdigest2), digest2, DIGEST_LEN);
|
||||||
|
ret = tor_snprintf(buffer+len, 2048-len, "%s [%s](%ld/%ld); ",
|
||||||
|
name2,
|
||||||
|
hexdigest2,
|
||||||
link_history->n_extend_ok,
|
link_history->n_extend_ok,
|
||||||
link_history->n_extend_ok+link_history->n_extend_fail);
|
link_history->n_extend_ok+link_history->n_extend_fail);
|
||||||
if (ret<0)
|
if (ret<0)
|
||||||
|
180
src/or/router.c
180
src/or/router.c
@ -2235,6 +2235,186 @@ is_legal_hexdigest(const char *s)
|
|||||||
strspn(s,HEX_CHARACTERS)==HEX_DIGEST_LEN);
|
strspn(s,HEX_CHARACTERS)==HEX_DIGEST_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Use <b>buf</b> (which must be at least NODE_DESC_BUF_LEN bytes long) to
|
||||||
|
* hold a human-readable description of a node with identity digest
|
||||||
|
* <b>id_digest</b>, named-status <b>is_named</b>, nickname <b>nickname</b>,
|
||||||
|
* and address <b>addr</b> or <b>addr32h</b>.
|
||||||
|
*
|
||||||
|
* The <b>nickname</b> and <b>addr</b> fields are optional and may be set to
|
||||||
|
* NULL. The <b>addr32h</b> field is optional and may be set to 0.
|
||||||
|
*
|
||||||
|
* Return a pointer to the front of <b>buf</b>.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
format_node_description(char *buf,
|
||||||
|
const char *id_digest,
|
||||||
|
int is_named,
|
||||||
|
const char *nickname,
|
||||||
|
const tor_addr_t *addr,
|
||||||
|
uint32_t addr32h)
|
||||||
|
{
|
||||||
|
char *cp;
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
return "<NULL BUFFER>";
|
||||||
|
|
||||||
|
buf[0] = '$';
|
||||||
|
base16_encode(buf+1, HEX_DIGEST_LEN+1, id_digest, DIGEST_LEN);
|
||||||
|
cp = buf+1+HEX_DIGEST_LEN;
|
||||||
|
if (nickname) {
|
||||||
|
buf[1+HEX_DIGEST_LEN] = is_named ? '=' : '~';
|
||||||
|
strlcpy(buf+1+HEX_DIGEST_LEN+1, nickname, MAX_NICKNAME_LEN+1);
|
||||||
|
cp += strlen(cp);
|
||||||
|
}
|
||||||
|
if (addr32h || addr) {
|
||||||
|
memcpy(cp, " at ", 4);
|
||||||
|
cp += 4;
|
||||||
|
if (addr) {
|
||||||
|
tor_addr_to_str(cp, addr, TOR_ADDR_BUF_LEN, 0);
|
||||||
|
} else {
|
||||||
|
struct in_addr in;
|
||||||
|
in.s_addr = htonl(addr32h);
|
||||||
|
tor_inet_ntoa(&in, cp, INET_NTOA_BUF_LEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Use <b>buf</b> (which must be at least NODE_DESC_BUF_LEN bytes long) to
|
||||||
|
* hold a human-readable description of <b>ri</b>.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Return a pointer to the front of <b>buf</b>.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
router_get_description(char *buf, const routerinfo_t *ri)
|
||||||
|
{
|
||||||
|
if (!ri)
|
||||||
|
return "<null>";
|
||||||
|
return format_node_description(buf,
|
||||||
|
ri->cache_info.identity_digest,
|
||||||
|
router_is_named(ri),
|
||||||
|
ri->nickname,
|
||||||
|
NULL,
|
||||||
|
ri->addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Use <b>buf</b> (which must be at least NODE_DESC_BUF_LEN bytes long) to
|
||||||
|
* hold a human-readable description of <b>node</b>.
|
||||||
|
*
|
||||||
|
* Return a pointer to the front of <b>buf</b>.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
node_get_description(char *buf, const node_t *node)
|
||||||
|
{
|
||||||
|
const char *nickname = NULL;
|
||||||
|
uint32_t addr32h = 0;
|
||||||
|
int is_named = 0;
|
||||||
|
|
||||||
|
if (!node)
|
||||||
|
return "<null>";
|
||||||
|
|
||||||
|
if (node->rs) {
|
||||||
|
nickname = node->rs->nickname;
|
||||||
|
is_named = node->rs->is_named;
|
||||||
|
addr32h = node->rs->addr;
|
||||||
|
} else if (node->ri) {
|
||||||
|
nickname = node->ri->nickname;
|
||||||
|
addr32h = node->ri->addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return format_node_description(buf,
|
||||||
|
node->identity,
|
||||||
|
is_named,
|
||||||
|
nickname,
|
||||||
|
NULL,
|
||||||
|
addr32h);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Use <b>buf</b> (which must be at least NODE_DESC_BUF_LEN bytes long) to
|
||||||
|
* hold a human-readable description of <b>rs</b>.
|
||||||
|
*
|
||||||
|
* Return a pointer to the front of <b>buf</b>.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
routerstatus_get_description(char *buf, const routerstatus_t *rs)
|
||||||
|
{
|
||||||
|
if (!rs)
|
||||||
|
return "<null>";
|
||||||
|
return format_node_description(buf,
|
||||||
|
rs->identity_digest,
|
||||||
|
rs->is_named,
|
||||||
|
rs->nickname,
|
||||||
|
NULL,
|
||||||
|
rs->addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Use <b>buf</b> (which must be at least NODE_DESC_BUF_LEN bytes long) to
|
||||||
|
* hold a human-readable description of <b>ei</b>.
|
||||||
|
*
|
||||||
|
* Return a pointer to the front of <b>buf</b>.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
extend_info_get_description(char *buf, const extend_info_t *ei)
|
||||||
|
{
|
||||||
|
if (!ei)
|
||||||
|
return "<null>";
|
||||||
|
return format_node_description(buf,
|
||||||
|
ei->identity_digest,
|
||||||
|
0,
|
||||||
|
ei->nickname,
|
||||||
|
&ei->addr,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return a human-readable description of the routerinfo_t <b>ri</b>.
|
||||||
|
*
|
||||||
|
* This function is not thread-safe. Each call to this function invalidates
|
||||||
|
* previous values returned by this function.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
router_describe(const routerinfo_t *ri)
|
||||||
|
{
|
||||||
|
static char buf[NODE_DESC_BUF_LEN];
|
||||||
|
return router_get_description(buf, ri);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return a human-readable description of the node_t <b>node</b>.
|
||||||
|
*
|
||||||
|
* This function is not thread-safe. Each call to this function invalidates
|
||||||
|
* previous values returned by this function.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
node_describe(const node_t *node)
|
||||||
|
{
|
||||||
|
static char buf[NODE_DESC_BUF_LEN];
|
||||||
|
return node_get_description(buf, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return a human-readable description of the routerstatus_t <b>rs</b>.
|
||||||
|
*
|
||||||
|
* This function is not thread-safe. Each call to this function invalidates
|
||||||
|
* previous values returned by this function.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
routerstatus_describe(const routerstatus_t *rs)
|
||||||
|
{
|
||||||
|
static char buf[NODE_DESC_BUF_LEN];
|
||||||
|
return routerstatus_get_description(buf, rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Return a human-readable description of the extend_info_t <b>ri</b>.
|
||||||
|
*
|
||||||
|
* This function is not thread-safe. Each call to this function invalidates
|
||||||
|
* previous values returned by this function.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
extend_info_describe(const extend_info_t *ei)
|
||||||
|
{
|
||||||
|
static char buf[NODE_DESC_BUF_LEN];
|
||||||
|
return extend_info_get_description(buf, ei);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set <b>buf</b> (which must have MAX_VERBOSE_NICKNAME_LEN+1 bytes) to the
|
/** Set <b>buf</b> (which must have MAX_VERBOSE_NICKNAME_LEN+1 bytes) to the
|
||||||
* verbose representation of the identity of <b>router</b>. The format is:
|
* verbose representation of the identity of <b>router</b>. The format is:
|
||||||
* A dollar sign.
|
* A dollar sign.
|
||||||
|
@ -85,6 +85,30 @@ int extrainfo_dump_to_string(char **s, extrainfo_t *extrainfo,
|
|||||||
int is_legal_nickname(const char *s);
|
int is_legal_nickname(const char *s);
|
||||||
int is_legal_nickname_or_hexdigest(const char *s);
|
int is_legal_nickname_or_hexdigest(const char *s);
|
||||||
int is_legal_hexdigest(const char *s);
|
int is_legal_hexdigest(const char *s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Longest allowed output of format_node_description, plus 1 character for
|
||||||
|
* NUL. This allows space for:
|
||||||
|
* "$FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~xxxxxxxxxxxxxxxxxxx at"
|
||||||
|
* " [ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255]"
|
||||||
|
* plus a terminating NUL.
|
||||||
|
*/
|
||||||
|
#define NODE_DESC_BUF_LEN (MAX_VERBOSE_NICKNAME_LEN+4+TOR_ADDR_BUF_LEN)
|
||||||
|
const char *format_node_description(char *buf,
|
||||||
|
const char *id_digest,
|
||||||
|
int is_named,
|
||||||
|
const char *nickname,
|
||||||
|
const tor_addr_t *addr,
|
||||||
|
uint32_t addr32h);
|
||||||
|
const char *router_get_description(char *buf, const routerinfo_t *ri);
|
||||||
|
const char *node_get_description(char *buf, const node_t *node);
|
||||||
|
const char *routerstatus_get_description(char *buf, const routerstatus_t *rs);
|
||||||
|
const char *extend_info_get_description(char *buf, const extend_info_t *ei);
|
||||||
|
const char *router_describe(const routerinfo_t *ri);
|
||||||
|
const char *node_describe(const node_t *node);
|
||||||
|
const char *routerstatus_describe(const routerstatus_t *ri);
|
||||||
|
const char *extend_info_describe(const extend_info_t *ei);
|
||||||
|
|
||||||
void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
|
void router_get_verbose_nickname(char *buf, const routerinfo_t *router);
|
||||||
void routerstatus_get_verbose_nickname(char *buf,
|
void routerstatus_get_verbose_nickname(char *buf,
|
||||||
const routerstatus_t *router);
|
const routerstatus_t *router);
|
||||||
|
@ -2285,7 +2285,7 @@ hex_digest_nickname_matches(const char *hexdigest, const char *identity_digest,
|
|||||||
|
|
||||||
/* Return true iff <b>router</b> is listed as named in the current
|
/* Return true iff <b>router</b> is listed as named in the current
|
||||||
* consensus. */
|
* consensus. */
|
||||||
static int
|
int
|
||||||
router_is_named(const routerinfo_t *router)
|
router_is_named(const routerinfo_t *router)
|
||||||
{
|
{
|
||||||
const char *digest =
|
const char *digest =
|
||||||
@ -3230,10 +3230,8 @@ router_set_status(const char *digest, int up)
|
|||||||
node = node_get_mutable_by_id(digest);
|
node = node_get_mutable_by_id(digest);
|
||||||
if (node) {
|
if (node) {
|
||||||
#if 0
|
#if 0
|
||||||
char buf[MAX_VERBOSE_NICKNAME_LEN+1];
|
|
||||||
node_get_verbose_nickname(node,buf);
|
|
||||||
log_debug(LD_DIR,"Marking router %s as %s.",
|
log_debug(LD_DIR,"Marking router %s as %s.",
|
||||||
buf, up ? "up" : "down");
|
node_describe(node), up ? "up" : "down");
|
||||||
#endif
|
#endif
|
||||||
if (!up && node_is_me(node) && !we_are_hibernating())
|
if (!up && node_is_me(node) && !we_are_hibernating())
|
||||||
log_warn(LD_NET, "We just marked ourself as down. Are your external "
|
log_warn(LD_NET, "We just marked ourself as down. Are your external "
|
||||||
@ -3302,11 +3300,12 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
router->purpose == ROUTER_PURPOSE_BRIDGE &&
|
router->purpose == ROUTER_PURPOSE_BRIDGE &&
|
||||||
!was_bridge) {
|
!was_bridge) {
|
||||||
log_info(LD_DIR, "Replacing non-bridge descriptor with bridge "
|
log_info(LD_DIR, "Replacing non-bridge descriptor with bridge "
|
||||||
"descriptor for router '%s'", router->nickname);
|
"descriptor for router %s",
|
||||||
|
router_describe(router));
|
||||||
} else {
|
} else {
|
||||||
log_info(LD_DIR,
|
log_info(LD_DIR,
|
||||||
"Dropping descriptor that we already have for router '%s'",
|
"Dropping descriptor that we already have for router %s",
|
||||||
router->nickname);
|
router_describe(router));
|
||||||
*msg = "Router descriptor was not new.";
|
*msg = "Router descriptor was not new.";
|
||||||
routerinfo_free(router);
|
routerinfo_free(router);
|
||||||
return ROUTER_WAS_NOT_NEW;
|
return ROUTER_WAS_NOT_NEW;
|
||||||
@ -3330,8 +3329,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
/* We asked for it, so some networkstatus must have listed it when we
|
/* We asked for it, so some networkstatus must have listed it when we
|
||||||
* did. Save it if we're a cache in case somebody else asks for it. */
|
* did. Save it if we're a cache in case somebody else asks for it. */
|
||||||
log_info(LD_DIR,
|
log_info(LD_DIR,
|
||||||
"Received a no-longer-recognized descriptor for router '%s'",
|
"Received a no-longer-recognized descriptor for router %s",
|
||||||
router->nickname);
|
router_describe(router));
|
||||||
*msg = "Router descriptor is not referenced by any network-status.";
|
*msg = "Router descriptor is not referenced by any network-status.";
|
||||||
|
|
||||||
/* Only journal this desc if we'll be serving it. */
|
/* Only journal this desc if we'll be serving it. */
|
||||||
@ -3383,8 +3382,9 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
if (router->purpose == ROUTER_PURPOSE_BRIDGE && from_cache &&
|
if (router->purpose == ROUTER_PURPOSE_BRIDGE && from_cache &&
|
||||||
!authdir_mode_bridge(options) &&
|
!authdir_mode_bridge(options) &&
|
||||||
!routerinfo_is_a_configured_bridge(router)) {
|
!routerinfo_is_a_configured_bridge(router)) {
|
||||||
log_info(LD_DIR, "Dropping bridge descriptor for '%s' because we have "
|
log_info(LD_DIR, "Dropping bridge descriptor for %s because we have "
|
||||||
"no bridge configured at that address.", router->nickname);
|
"no bridge configured at that address.",
|
||||||
|
safe_str_client(router_describe(router)));
|
||||||
*msg = "Router descriptor was not a configured bridge.";
|
*msg = "Router descriptor was not a configured bridge.";
|
||||||
routerinfo_free(router);
|
routerinfo_free(router);
|
||||||
return ROUTER_WAS_NOT_WANTED;
|
return ROUTER_WAS_NOT_WANTED;
|
||||||
@ -3395,8 +3395,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
if (!in_consensus && (router->cache_info.published_on <=
|
if (!in_consensus && (router->cache_info.published_on <=
|
||||||
old_router->cache_info.published_on)) {
|
old_router->cache_info.published_on)) {
|
||||||
/* Same key, but old. This one is not listed in the consensus. */
|
/* Same key, but old. This one is not listed in the consensus. */
|
||||||
log_debug(LD_DIR, "Not-new descriptor for router '%s'",
|
log_debug(LD_DIR, "Not-new descriptor for router %s",
|
||||||
router->nickname);
|
router_describe(router));
|
||||||
/* Only journal this desc if we'll be serving it. */
|
/* Only journal this desc if we'll be serving it. */
|
||||||
if (!from_cache && should_cache_old_descriptors())
|
if (!from_cache && should_cache_old_descriptors())
|
||||||
signed_desc_append_to_journal(&router->cache_info,
|
signed_desc_append_to_journal(&router->cache_info,
|
||||||
@ -3406,9 +3406,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
return ROUTER_WAS_NOT_NEW;
|
return ROUTER_WAS_NOT_NEW;
|
||||||
} else {
|
} else {
|
||||||
/* Same key, and either new, or listed in the consensus. */
|
/* Same key, and either new, or listed in the consensus. */
|
||||||
log_debug(LD_DIR, "Replacing entry for router '%s/%s' [%s]",
|
log_debug(LD_DIR, "Replacing entry for router %s",
|
||||||
router->nickname, old_router->nickname,
|
router_describe(router));
|
||||||
hex_str(id_digest,DIGEST_LEN));
|
|
||||||
if (routers_have_same_or_addr(router, old_router)) {
|
if (routers_have_same_or_addr(router, old_router)) {
|
||||||
/* these carry over when the address and orport are unchanged. */
|
/* these carry over when the address and orport are unchanged. */
|
||||||
router->last_reachable = old_router->last_reachable;
|
router->last_reachable = old_router->last_reachable;
|
||||||
@ -3684,8 +3683,8 @@ routerlist_remove_old_routers(void)
|
|||||||
/* Too old: remove it. (If we're a cache, just move it into
|
/* Too old: remove it. (If we're a cache, just move it into
|
||||||
* old_routers.) */
|
* old_routers.) */
|
||||||
log_info(LD_DIR,
|
log_info(LD_DIR,
|
||||||
"Forgetting obsolete (too old) routerinfo for router '%s'",
|
"Forgetting obsolete (too old) routerinfo for router %s",
|
||||||
router->nickname);
|
router_describe(router));
|
||||||
routerlist_remove(routerlist, router, 1, now);
|
routerlist_remove(routerlist, router, 1, now);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
@ -4668,7 +4667,8 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote,
|
|||||||
if (oldrouter)
|
if (oldrouter)
|
||||||
format_iso_time(time_bufold, oldrouter->cache_info.published_on);
|
format_iso_time(time_bufold, oldrouter->cache_info.published_on);
|
||||||
log_info(LD_DIR, "Learned about %s (%s vs %s) from %s's vote (%s)",
|
log_info(LD_DIR, "Learned about %s (%s vs %s) from %s's vote (%s)",
|
||||||
rs->nickname, time_bufnew,
|
routerstatus_describe(rs),
|
||||||
|
time_bufnew,
|
||||||
oldrouter ? time_bufold : "none",
|
oldrouter ? time_bufold : "none",
|
||||||
source->nickname, oldrouter ? "known" : "unknown");
|
source->nickname, oldrouter ? "known" : "unknown");
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ const node_t *router_choose_random_node(smartlist_t *excludedsmartlist,
|
|||||||
|
|
||||||
const routerinfo_t *router_get_by_nickname(const char *nickname,
|
const routerinfo_t *router_get_by_nickname(const char *nickname,
|
||||||
int warn_if_unnamed);
|
int warn_if_unnamed);
|
||||||
|
int router_is_named(const routerinfo_t *router);
|
||||||
int router_digest_is_trusted_dir_type(const char *digest,
|
int router_digest_is_trusted_dir_type(const char *digest,
|
||||||
dirinfo_type_t type);
|
dirinfo_type_t type);
|
||||||
#define router_digest_is_trusted_dir(d) \
|
#define router_digest_is_trusted_dir(d) \
|
||||||
|
@ -1208,7 +1208,8 @@ router_parse_list_from_string(const char **s, const char *eos,
|
|||||||
prepend_annotations);
|
prepend_annotations);
|
||||||
if (router) {
|
if (router) {
|
||||||
log_debug(LD_DIR, "Read router '%s', purpose '%s'",
|
log_debug(LD_DIR, "Read router '%s', purpose '%s'",
|
||||||
router->nickname, router_purpose_to_string(router->purpose));
|
router_describe(router),
|
||||||
|
router_purpose_to_string(router->purpose));
|
||||||
signed_desc = &router->cache_info;
|
signed_desc = &router->cache_info;
|
||||||
elt = router;
|
elt = router;
|
||||||
}
|
}
|
||||||
@ -2502,7 +2503,7 @@ networkstatus_verify_bw_weights(networkstatus_t *ns)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log_warn(LD_BUG, "Missing consensus bandwidth for router %s",
|
log_warn(LD_BUG, "Missing consensus bandwidth for router %s",
|
||||||
rs->nickname);
|
routerstatus_describe(rs));
|
||||||
}
|
}
|
||||||
} SMARTLIST_FOREACH_END(rs);
|
} SMARTLIST_FOREACH_END(rs);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user