Commit 7d366f61 authored by Nick Mathewson's avatar Nick Mathewson 🏃
Browse files

r9025@Kushana: nickm | 2006-09-29 18:33:13 -0400

 Differentiate more duplicated log entries


svn:r8542
parent 8308a379
......@@ -298,6 +298,8 @@ Deferred from 0.1.2.x:
- Implement
Minor items for 0.1.2.x as time permits:
- even if your torrc lists yourself in your myfamily line, don't list it in
the descriptor.
- Flesh out options_description array in src/or/config.c
- Don't let 'newnym' be triggered more often than every n seconds.
- change log_fn() to log() on notice/warn/err logs where we can.
......
......@@ -652,12 +652,13 @@ switch_id(char *user, char *group)
}
if (setgid(gr->gr_gid) != 0) {
log_warn(LD_GENERAL,"Error setting GID: %s", strerror(errno));
log_warn(LD_GENERAL,"Error setting to configured GID: %s",
strerror(errno));
return -1;
}
} else if (user) {
if (setgid(pw->pw_gid) != 0) {
log_warn(LD_GENERAL,"Error setting GID: %s", strerror(errno));
log_warn(LD_GENERAL,"Error setting to user GID: %s", strerror(errno));
return -1;
}
}
......
......@@ -734,7 +734,7 @@ crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const char *data,
tor_assert(sig);
if (crypto_digest(digest,data,datalen)<0) {
log_warn(LD_CRYPTO, "couldn't compute digest");
log_warn(LD_BUG, "couldn't compute digest");
return -1;
}
r = crypto_pk_public_checksig(env,buf,sig,siglen);
......
......@@ -907,7 +907,7 @@ parse_rfc1123_time(const char *buf, time_t *t)
}
if (m<0) {
char *esc = esc_for_log(buf);
log_warn(LD_GENERAL, "Got invalid RFC1123 time %s", esc);
log_warn(LD_GENERAL, "Got invalid RFC1123 time %s: No such month", esc);
tor_free(esc);
return -1;
}
......@@ -958,17 +958,17 @@ parse_iso_time(const char *cp, time_t *t)
struct tm st_tm;
#ifdef HAVE_STRPTIME
if (!strptime(cp, "%Y-%m-%d %H:%M:%S", &st_tm)) {
log_warn(LD_GENERAL, "Published time was unparseable"); return -1;
log_warn(LD_GENERAL, "ISO time was unparseable by strptime"); return -1;
}
#else
unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
if (sscanf(cp, "%u-%u-%u %u:%u:%u", &year, &month,
&day, &hour, &minute, &second) < 6) {
log_warn(LD_GENERAL, "Published time was unparseable"); return -1;
log_warn(LD_GENERAL, "ISO time time was unparseable"); return -1;
}
if (year < 1970 || month < 1 || month > 12 || day < 1 || day > 31 ||
hour > 23 || minute > 59 || second > 61) {
log_warn(LD_GENERAL, "Published time was nonsensical"); return -1;
log_warn(LD_GENERAL, "ISO time was nonsensical"); return -1;
}
st_tm.tm_year = year-1900;
st_tm.tm_mon = month-1;
......@@ -1876,7 +1876,7 @@ get_interface_address(int severity, uint32_t *addr)
/* XXXX Can this be right on IPv6 clients? */
if (getsockname(sock, (struct sockaddr*)&my_addr, &my_addr_len)) {
int e = tor_socket_errno(sock);
log_fn(severity, LD_NET, "getsockname() failed: %s",
log_fn(severity, LD_NET, "getsockname() to determine interface failed: %s",
tor_socket_strerror(e));
goto err;
}
......
......@@ -663,7 +663,7 @@ options_act_reversible(or_options_t *old_options, char **msg)
SMARTLIST_FOREACH(new_listeners, connection_t *, conn,
{
log_notice(LD_NET, "Closing %s on %s:%d",
log_notice(LD_NET, "Closing partially-constructed listener %s on %s:%d",
conn_type_to_string(conn->type), conn->address, conn->port);
connection_close_immediate(conn);
connection_mark_for_close(conn);
......@@ -800,7 +800,7 @@ options_act(or_options_t *old_options)
"Worker-related options changed. Rotating workers.");
if (server_mode(options) && !server_mode(old_options)) {
if (init_keys() < 0) {
log_err(LD_GENERAL,"Error initializing keys; exiting");
log_err(LD_BUG,"Error initializing keys; exiting");
return -1;
}
server_has_changed_ip();
......@@ -3473,7 +3473,7 @@ write_configuration_file(const char *fname, or_options_t *options)
}
log_notice(LD_CONFIG, "Renaming old configuration file to \"%s\"", fn_tmp);
if (rename(fname, fn_tmp) < 0) {
log_warn(LD_FS, "Couldn't rename \"%s\" to \"%s\": %s",
log_warn(LD_FS, "Couldn't rename configuration file \"%s\" to \"%s\": %s",
fname, fn_tmp, strerror(errno));
tor_free(fn_tmp);
goto err;
......
......@@ -743,7 +743,9 @@ connection_handle_listener_read(connection_t *conn, int new_type)
remotelen=256;
memset(addrbuf, 0, sizeof(addrbuf));
if (getsockname(news, (struct sockaddr*)addrbuf, &remotelen)<0) {
log_warn(LD_NET, "getsockname() failed.");
int e = tor_socket_errno(news);
log_warn(LD_NET, "getsockname() for new connection failed: %s",
tor_socket_strerror(tor_socket_strerror(e)));
} else {
if (check_sockaddr_in((struct sockaddr*)addrbuf, remotelen,
LOG_WARN) < 0) {
......@@ -963,7 +965,7 @@ retry_listeners(int type, config_line_t *cfg,
if (force) {
/* It's a listener, and we're relaunching all listeners of this
* type. Close this one. */
log_fn(LOG_NOTICE, LD_NET, "Closing %s on %s:%d",
log_notice(LD_NET, "Force-closing listener %s on %s:%d",
conn_type_to_string(type), conn->address, conn->port);
connection_close_immediate(conn);
connection_mark_for_close(conn);
......@@ -988,7 +990,7 @@ retry_listeners(int type, config_line_t *cfg,
});
if (! line) {
/* This one isn't configured. Close it. */
log_notice(LD_NET, "Closing %s on %s:%d",
log_notice(LD_NET, "Closing no-longer-configured %s on %s:%d",
conn_type_to_string(type), conn->address, conn->port);
if (replaced_conns) {
smartlist_add(replaced_conns, conn);
......@@ -2005,7 +2007,8 @@ client_check_address_changed(int sock)
if (getsockname(sock, (struct sockaddr*)&out_addr, &out_addr_len)<0) {
int e = tor_socket_errno(sock);
log_warn(LD_NET, "getsockname() failed: %s", tor_socket_strerror(e));
log_warn(LD_NET, "getsockname() to check for address change failed: %s",
tor_socket_strerror(e));
return;
}
......
......@@ -1310,7 +1310,8 @@ connection_ap_get_original_destination(edge_connection_t *conn,
if (getsockname(conn->_base.s, (struct sockaddr*)&proxy_addr,
&proxy_addr_len) < 0) {
int e = tor_socket_errno(conn->_base.s);
log_warn(LD_NET, "getsockname() failed: %s", tor_socket_strerror(e));
log_warn(LD_NET, "getsockname() to determine transocks destination "
"failed: %s", tor_socket_strerror(e));
return -1;
}
......
......@@ -726,7 +726,7 @@ control_setconf_helper(control_connection_t *conn, uint32_t len, char *body,
tor_free(config);
} else {
if (config_get_lines(body, &lines) < 0) {
log_warn(LD_CONTROL,"Controller gave us config lines we can't parse.");
log_warn(LD_CONTROL,"V0 controller gave us config lines we can't parse.");
send_control0_error(conn, ERR_SYNTAX, "Couldn't parse configuration");
return 0;
}
......@@ -2262,7 +2262,8 @@ handle_control_fragments(control_connection_t *conn, uint16_t command_type,
{
if (command_type == CONTROL0_CMD_FRAGMENTHEADER) {
if (conn->incoming_cmd) {
log_warn(LD_CONTROL, "Dropping incomplete fragmented command");
log_warn(LD_CONTROL, "Dropping incomplete fragmented command; new "
"fragmented command was begun.");
tor_free(conn->incoming_cmd);
}
if (body_len < 6) {
......
......@@ -110,7 +110,7 @@ cpuworkers_rotate(void)
int
connection_cpu_reached_eof(connection_t *conn)
{
log_warn(LD_GENERAL,"Read eof. Worker died unexpectedly.");
log_warn(LD_GENERAL,"Read eof. CPU worker died unexpectedly.");
if (conn->state != CPUWORKER_STATE_IDLE) {
/* the circ associated with this cpuworker will have to wait until
* it gets culled in run_connection_housekeeping(), since we have
......@@ -322,7 +322,7 @@ spawn_cpuworker(void)
fdarray = tor_malloc(sizeof(int)*2);
if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
log_warn(LD_NET, "Couldn't construct socketpair: %s",
log_warn(LD_NET, "Couldn't construct socketpair for cpuworker: %s",
tor_socket_strerror(-err));
tor_free(fdarray);
return -1;
......
......@@ -968,7 +968,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
(int)body_len, conn->_base.address, conn->_base.port);
if (status_code != 200) {
log_warn(LD_DIR,"Received http status code %d (%s) from server "
"'%s:%d'. I'll try again soon.",
"'%s:%d' while fetching directory. I'll try again soon.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
tor_free(body); tor_free(headers); tor_free(reason);
......@@ -986,7 +986,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
log_info(LD_DIR,"Received running-routers list (size %d)", (int)body_len);
if (status_code != 200) {
log_warn(LD_DIR,"Received http status code %d (%s) from server "
"'%s:%d'. I'll try again soon.",
"'%s:%d' while fetching running-routers. I'll try again soon.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
tor_free(body); tor_free(headers); tor_free(reason);
......@@ -1157,7 +1157,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
break;
default:
log_warn(LD_GENERAL,
"http status %d (%s) reason unexpected (server '%s:%d').",
"http status %d (%s) reason unexpected while uploding "
"descriptor to server '%s:%d').",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
break;
......@@ -1192,7 +1193,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
"rendezvous query?", escaped(reason));
break;
default:
log_warn(LD_REND,"http status %d (%s) response unexpected (server "
log_warn(LD_REND,"http status %d (%s) response unexpected while "
"fetching hidden service descriptor (server "
"'%s:%d').",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
......
......@@ -1069,7 +1069,7 @@ connection_dns_finished_flushing(connection_t *conn)
int
connection_dns_reached_eof(connection_t *conn)
{
log_warn(LD_EXIT,"Read eof. Worker died unexpectedly.");
log_warn(LD_EXIT,"Read eof. DNS worker died unexpectedly.");
if (conn->state == DNSWORKER_STATE_BUSY) {
/* don't cancel the resolve here -- it would be cancelled in
* connection_about_to_close_connection(), since conn is still
......@@ -1278,7 +1278,7 @@ spawn_dnsworker(void)
fdarray = tor_malloc(sizeof(int)*2);
if ((err = tor_socketpair(AF_UNIX, SOCK_STREAM, 0, fdarray)) < 0) {
log_warn(LD_NET, "Couldn't construct socketpair: %s",
log_warn(LD_NET, "Couldn't construct socketpair for dns worker: %s",
tor_socket_strerror(-err));
tor_free(fdarray);
return -1;
......
......@@ -622,7 +622,7 @@ read_bandwidth_usage(void)
n_written = tor_parse_uint64(smartlist_get(elts,4), 10, 0, UINT64_MAX,
&ok, NULL);
if (!ok) {
log_warn(LD_ACCT, "Error parsing number of bytes read");
log_warn(LD_ACCT, "Error parsing number of bytes written");
goto err;
}
n_seconds = (uint32_t)tor_parse_ulong(smartlist_get(elts,5), 10,0,ULONG_MAX,
......
......@@ -1139,7 +1139,7 @@ do_main_loop(void)
* TLS context. */
if (! identity_key_is_set()) {
if (init_keys() < 0) {
log_err(LD_GENERAL,"Error initializing keys; exiting");
log_err(LD_BUG,"Error initializing keys; exiting");
return -1;
}
}
......@@ -1520,7 +1520,7 @@ tor_init(int argc, char *argv[])
"Do not rely on it for strong anonymity.",VERSION);
if (network_init()<0) {
log_err(LD_NET,"Error initializing network; exiting.");
log_err(LD_BUG,"Error initializing network; exiting.");
return -1;
}
atexit(exit_function);
......@@ -1622,7 +1622,7 @@ do_list_fingerprint(void)
}
tor_assert(nickname);
if (init_keys() < 0) {
log_err(LD_BUG,"Error initializing keys; exiting");
log_err(LD_BUG,"Error initializing keys; can't display fingerprint");
return -1;
}
if (!(k = get_identity_key())) {
......
......@@ -139,7 +139,7 @@ rotate_onion_key(void)
goto error;
}
if (crypto_pk_write_private_key_to_filename(prkey, fname)) {
log_err(LD_FS,"Couldn't write generated key to \"%s\".", fname);
log_err(LD_FS,"Couldn't write generated onion key to \"%s\".", fname);
goto error;
}
log_info(LD_GENERAL, "Rotating onion key");
......@@ -169,7 +169,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_warn(LD_FS, "Couldn't rename \"%s\" to \"%s\": %s",
log_warn(LD_FS, "Couldn't rename key file \"%s\" to \"%s\": %s",
fname_old, fname_new, strerror(errno));
return NULL;
}
......
......@@ -462,12 +462,12 @@ router_parse_runningrouters(const char *str)
smartlist_t *tokens = NULL;
if (router_get_runningrouters_hash(str, digest)) {
log_warn(LD_DIR, "Unable to compute digest of directory");
log_warn(LD_DIR, "Unable to compute digest of running-routers");
goto err;
}
tokens = smartlist_create();
if (tokenize_string(str,str+strlen(str),tokens,DIR)) {
log_warn(LD_DIR, "Error tokenizing directory"); goto err;
log_warn(LD_DIR, "Error tokenizing running-routers"); goto err;
}
if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) {
log_warn(LD_DIR, "Unrecognized keyword %s; can't parse running-routers",
......@@ -859,7 +859,7 @@ router_parse_entry_from_string(const char *s, const char *end,
}
tor_strstrip(tok->args[0], " ");
if (base16_decode(d, DIGEST_LEN, tok->args[0], strlen(tok->args[0]))) {
log_warn(LD_DIR, "Couldn't decode fingerprint %s",
log_warn(LD_DIR, "Couldn't decode router fingerprint %s",
escaped(tok->args[0]));
goto err;
}
......@@ -1034,7 +1034,8 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
}
if (tor_inet_aton(tok->args[5], &in) == 0) {
log_warn(LD_DIR, "Error parsing address %s", escaped(tok->args[5]));
log_warn(LD_DIR, "Error parsing router address in network-status %s",
escaped(tok->args[5]));
goto err;
}
rs->addr = ntohl(in.s_addr);
......@@ -1147,7 +1148,8 @@ networkstatus_parse_from_string(const char *s)
}
ns->source_address = tok->args[0]; tok->args[0] = NULL;
if (tor_inet_aton(tok->args[1], &in) == 0) {
log_warn(LD_DIR, "Error parsing address %s", escaped(tok->args[1]));
log_warn(LD_DIR, "Error parsing network-status source address %s",
escaped(tok->args[1]));
goto err;
}
ns->source_addr = ntohl(in.s_addr);
......@@ -1168,7 +1170,8 @@ networkstatus_parse_from_string(const char *s)
}
if (base16_decode(ns->identity_digest, DIGEST_LEN, tok->args[0],
strlen(tok->args[0]))) {
log_warn(LD_DIR, "Couldn't decode fingerprint %s", escaped(tok->args[0]));
log_warn(LD_DIR, "Couldn't decode networkstatus fingerprint %s",
escaped(tok->args[0]));
goto err;
}
......@@ -1766,7 +1769,7 @@ router_get_hash_impl(const char *s, char *digest,
++end;
if (crypto_digest(digest, start, end-start)) {
log_warn(LD_DIR,"couldn't compute digest");
log_warn(LD_BUG,"couldn't compute digest");
return -1;
}
......
......@@ -238,7 +238,7 @@ main(int argc, char **argv)
}
if (network_init()<0) {
log_err(LD_NET,"Error initializing network; exiting.");
log_err(LD_BUG,"Error initializing network; exiting.");
return 1;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment