From f91152ce6a6308edd699429bc004b0fcfbb62df3 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 25 Nov 2004 04:20:10 +0000 Subject: Clarify a bunch of log messages svn:r2983 --- src/or/connection_or.c | 14 +++++++------- src/or/directory.c | 2 +- src/or/dirserv.c | 30 +++++++++++++++--------------- src/or/main.c | 2 +- src/or/router.c | 2 +- src/or/routerlist.c | 15 ++++++++------- src/or/routerparse.c | 12 ++++++------ 7 files changed, 39 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/or/connection_or.c b/src/or/connection_or.c index c9d3bc8b4..45070f87f 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -92,7 +92,7 @@ int connection_or_finished_connecting(connection_t *conn) tor_assert(conn->type == CONN_TYPE_OR); tor_assert(conn->state == OR_CONN_STATE_CONNECTING); - log_fn(LOG_INFO,"OR connect() to router %s:%u finished.", + log_fn(LOG_INFO,"OR connect() to router at %s:%u finished.", conn->address,conn->port); if(connection_tls_start_handshake(conn, 0) < 0) { @@ -219,7 +219,7 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port, conn = connection_get_by_identity_digest(id_digest, CONN_TYPE_OR); if(conn) { tor_assert(conn->nickname); - log_fn(LOG_WARN,"Asked me to connect to %s, but there's already a connection.", conn->nickname); + log_fn(LOG_WARN,"Asked me to connect to router '%s', but there's already a connection.", conn->nickname); return conn; } @@ -358,11 +358,11 @@ connection_tls_finish_handshake(connection_t *conn) { conn->address, conn->port); return -1; } - log_fn(LOG_DEBUG, "Other side (%s:%d) claims to be '%s'", conn->address, - conn->port, nickname); + log_fn(LOG_DEBUG, "Other side (%s:%d) claims to be router '%s'", + conn->address, conn->port, nickname); if(tor_tls_verify(conn->tls, &identity_rcvd) < 0) { - log_fn(LOG_WARN,"Other side '%s' (%s:%d) has a cert but it's invalid. Closing.", + log_fn(LOG_WARN,"Other side, which claims to be router '%s' (%s:%d), has a cert but it's invalid. Closing.", nickname, conn->address, conn->port); return -1; } @@ -387,7 +387,7 @@ connection_tls_finish_handshake(connection_t *conn) { if(router && /* we know this nickname */ router->is_verified && /* make sure it's the right guy */ memcmp(digest_rcvd, router->identity_digest, DIGEST_LEN) != 0) { - log_fn(LOG_WARN, "Identity key not as expected for %s", nickname); + log_fn(LOG_WARN, "Identity key not as expected for router claiming to be '%s' (%s:%d) ", nickname, conn->address, conn->port); return -1; } if (router_get_by_digest(digest_rcvd)) { @@ -410,7 +410,7 @@ connection_tls_finish_handshake(connection_t *conn) { } } else { if((c=connection_get_by_identity_digest(digest_rcvd, CONN_TYPE_OR))) { - log_fn(LOG_INFO,"Router %s is already connected on fd %d. Dropping fd %d.", nickname, c->s, conn->s); + log_fn(LOG_INFO,"Router '%s' is already connected on fd %d. Dropping fd %d.", nickname, c->s, conn->s); return -1; } connection_or_init_conn_from_address(conn,conn->addr,conn->port,digest_rcvd); diff --git a/src/or/directory.c b/src/or/directory.c index 68600b59c..175db8242 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -285,7 +285,7 @@ directory_initiate_command(const char *address, uint32_t addr, router_mark_as_down(conn->identity_digest); /* don't try him again */ if(purpose == DIR_PURPOSE_FETCH_DIR && !all_trusted_directory_servers_down()) { - log_fn(LOG_INFO,"Giving up on dirserver %s; trying another.", conn->address); + log_fn(LOG_INFO,"Giving up on dirserver '%s'; trying another.", conn->address); directory_get_from_dirserver(purpose, NULL); } connection_free(conn); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 5af1e928c..d7ba37515 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -110,12 +110,12 @@ dirserv_parse_fingerprint_file(const char *fname) for(list=front; list; list=list->next) { nickname = list->key; fingerprint = list->value; if (strlen(nickname) > MAX_NICKNAME_LEN) { - log(LOG_WARN, "Nickname %s too long in fingerprint file. Skipping.", nickname); + log(LOG_WARN, "Nickname '%s' too long in fingerprint file. Skipping.", nickname); continue; } if(strlen(fingerprint) != FINGERPRINT_LEN || !crypto_pk_check_fingerprint_syntax(fingerprint)) { - log_fn(LOG_WARN, "Invalid fingerprint (nickname %s, fingerprint %s). Skipping.", + log_fn(LOG_WARN, "Invalid fingerprint (nickname '%s', fingerprint %s). Skipping.", nickname, fingerprint); continue; } @@ -130,7 +130,7 @@ dirserv_parse_fingerprint_file(const char *fname) for (i = 0; i < smartlist_len(fingerprint_list_new); ++i) { ent = smartlist_get(fingerprint_list_new, i); if (0==strcasecmp(ent->nickname, nickname)) { - log(LOG_WARN, "Duplicate nickname %s. Skipping.",nickname); + log(LOG_WARN, "Duplicate nickname '%s'. Skipping.",nickname); break; /* out of the for. the 'if' below means skip to the next line. */ } } @@ -176,7 +176,7 @@ dirserv_router_fingerprint_is_known(const routerinfo_t *router) } if (!found) { /* No such server known */ - log_fn(LOG_INFO,"no fingerprint found for %s",router->nickname); + log_fn(LOG_INFO,"no fingerprint found for '%s'",router->nickname); return 0; } if (crypto_pk_get_fingerprint(router->identity_pkey, fp, 0)) { @@ -184,10 +184,10 @@ dirserv_router_fingerprint_is_known(const routerinfo_t *router) return -1; } if (0==strcasecmp(ent->fingerprint, fp)) { - log_fn(LOG_DEBUG,"good fingerprint for %s",router->nickname); + log_fn(LOG_DEBUG,"good fingerprint for '%s'",router->nickname); return 1; /* Right fingerprint. */ } else { - log_fn(LOG_WARN,"mismatched fingerprint for %s",router->nickname); + log_fn(LOG_WARN,"mismatched fingerprint for '%s'",router->nickname); return -1; /* Wrong fingerprint. */ } } @@ -332,17 +332,17 @@ dirserv_add_descriptor(const char **desc) /* Okay. Now check whether the fingerprint is recognized. */ r = dirserv_router_fingerprint_is_known(ri); if(r==-1) { - log_fn(LOG_WARN, "Known nickname %s, wrong fingerprint. Not adding.", ri->nickname); + log_fn(LOG_WARN, "Known nickname '%s', wrong fingerprint. Not adding.", ri->nickname); routerinfo_free(ri); *desc = end; return 0; } if(r==0) { char fp[FINGERPRINT_LEN+1]; - log_fn(LOG_INFO, "Unknown nickname %s (%s:%d). Adding.", + log_fn(LOG_INFO, "Unknown nickname '%s' (%s:%d). Adding.", ri->nickname, ri->address, ri->or_port); if (crypto_pk_get_fingerprint(ri->identity_pkey, fp, 1) < 0) { - log_fn(LOG_WARN, "Error computing fingerprint for %s", ri->nickname); + log_fn(LOG_WARN, "Error computing fingerprint for '%s'", ri->nickname); } else { log_fn(LOG_INFO, "Fingerprint line: %s %s", ri->nickname, fp); } @@ -351,13 +351,13 @@ dirserv_add_descriptor(const char **desc) /* Is there too much clock skew? */ now = time(NULL); if (ri->published_on > now+ROUTER_ALLOW_SKEW) { - log_fn(LOG_WARN, "Publication time for nickname %s is too far in the future; possible clock skew. Not adding.", ri->nickname); + log_fn(LOG_WARN, "Publication time for nickname '%s' is too far in the future; possible clock skew. Not adding.", ri->nickname); routerinfo_free(ri); *desc = end; return 0; } if (ri->published_on < now-ROUTER_MAX_AGE) { - log_fn(LOG_WARN, "Publication time for router with nickname %s is too far in the past. Not adding.", ri->nickname); + log_fn(LOG_WARN, "Publication time for router with nickname '%s' is too far in the past. Not adding.", ri->nickname); routerinfo_free(ri); *desc = end; return 0; @@ -375,19 +375,19 @@ dirserv_add_descriptor(const char **desc) /* if so, decide whether to update it. */ if (ent->published >= ri->published_on) { /* We already have a newer or equal-time descriptor */ - log_fn(LOG_INFO,"We already have a new enough desc for nickname %s. Not adding.",ri->nickname); + log_fn(LOG_INFO,"We already have a new enough desc for nickname '%s'. Not adding.",ri->nickname); /* This isn't really an error; return success. */ routerinfo_free(ri); *desc = end; return 1; } /* We don't have a newer one; we'll update this one. */ - log_fn(LOG_INFO,"Dirserv updating desc for nickname %s",ri->nickname); + log_fn(LOG_INFO,"Dirserv updating desc for nickname '%s'",ri->nickname); free_descriptor_entry(ent); smartlist_del_keeporder(descriptor_list, found); } else { /* Add at the end. */ - log_fn(LOG_INFO,"Dirserv adding desc for nickname %s",ri->nickname); + log_fn(LOG_INFO,"Dirserv adding desc for nickname '%s'",ri->nickname); } ent = tor_malloc(sizeof(descriptor_entry_t)); @@ -420,7 +420,7 @@ directory_remove_unrecognized(void) for (i = 0; i < smartlist_len(descriptor_list); ++i) { ent = smartlist_get(descriptor_list, i); if (dirserv_router_fingerprint_is_known(ent->router)<=0) { - log(LOG_INFO, "Router %s is no longer recognized", + log(LOG_INFO, "Router '%s' is no longer recognized", ent->nickname); free_descriptor_entry(ent); smartlist_del(descriptor_list, i--); diff --git a/src/or/main.c b/src/or/main.c index d02e04dce..7a355475d 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -772,7 +772,7 @@ static int do_hup(void) { /* Rebuild fresh descriptor. */ router_rebuild_descriptor(1); tor_snprintf(keydir,sizeof(keydir),"%s/router.desc", options->DataDirectory); - log_fn(LOG_INFO,"Dumping descriptor to %s...",keydir); + log_fn(LOG_INFO,"Saving descriptor to %s...",keydir); if (write_str_to_file(keydir, router_get_my_descriptor(), 0)) { return -1; } diff --git a/src/or/router.c b/src/or/router.c index c9b7467d2..30d245c72 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -404,7 +404,7 @@ void router_retry_connections(void) { if(!connection_get_by_identity_digest(router->identity_digest, CONN_TYPE_OR)) { /* not in the list */ - log_fn(LOG_DEBUG,"connecting to OR %s:%u.",router->address,router->or_port); + log_fn(LOG_DEBUG,"connecting to OR at %s:%u.",router->address,router->or_port); connection_or_connect(router->addr, router->or_port, router->identity_digest); } } diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 10df528f4..3609b038e 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -59,7 +59,7 @@ int router_reload_router_list(void) log_fn(LOG_INFO, "Loading cached directory from %s", filename); is_recent = st.st_mtime > time(NULL) - 60*15; if (router_load_routerlist_from_directory(s, NULL, is_recent) < 0) { - log_fn(LOG_WARN, "Cached directory '%s' was unparseable; ignoring.", filename); + log_fn(LOG_WARN, "Cached directory at '%s' was unparseable; ignoring.", filename); } if(routerlist && ((routerlist->published_on > time(NULL) - OLD_MIN_ONION_KEY_LIFETIME/2) @@ -406,7 +406,7 @@ routerlist_sl_remove_unreliable_routers(smartlist_t *sl) for (i = 0; i < smartlist_len(sl); ++i) { router = smartlist_get(sl, i); if(router_is_unreliable_router(router, 1, 0)) { - log(LOG_DEBUG, "Router %s has insufficient uptime; deleting.", + log(LOG_DEBUG, "Router '%s' has insufficient uptime; deleting.", router->nickname); smartlist_del(sl, i--); } @@ -719,7 +719,7 @@ void router_mark_as_down(const char *digest) { router = router_get_by_digest(digest); if(!router) /* we don't seem to know about him in the first place */ return; - log_fn(LOG_DEBUG,"Marking %s as down.",router->nickname); + log_fn(LOG_DEBUG,"Marking router '%s' as down.",router->nickname); if (router_is_me(router)) log_fn(LOG_WARN, "We just marked ourself as down. Are your external addresses reachable?"); router->is_running = 0; @@ -819,7 +819,7 @@ routerlist_remove_old_routers(int age) router = smartlist_get(routerlist->routers, i); if (router->published_on <= cutoff) { /* Too old. Remove it. */ - log_fn(LOG_INFO,"Forgetting obsolete routerinfo for node %s.", router->nickname); + log_fn(LOG_INFO,"Forgetting obsolete routerinfo for router '%s'", router->nickname); routerinfo_free(router); smartlist_del(routerlist->routers, i--); } @@ -872,8 +872,8 @@ router_resolve(routerinfo_t *router) { if (tor_lookup_hostname(router->address, &router->addr) != 0 || !router->addr) { - log_fn(LOG_WARN,"Could not get address for router %s (%s).", - router->address, router->nickname); + log_fn(LOG_WARN,"Could not resolve address for router '%s' at %s", + router->nickname, router->address); return -1; } router->addr = ntohl(router->addr); /* get it back into host order */ @@ -906,7 +906,8 @@ router_resolve_routerlist(routerlist_t *rl) } else if (r->addr) { /* already resolved. */ } else if (router_resolve(r)) { - log_fn(LOG_WARN, "Couldn't resolve router %s; not using", r->address); + log_fn(LOG_WARN, "Couldn't resolve router '%s' at '%s'; not using", + r->nickname, r->address); remove = 1; } if (remove) { diff --git a/src/or/routerparse.c b/src/or/routerparse.c index f568d550f..0df516239 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -212,7 +212,7 @@ get_recommended_software_from_directory(const char *str) vl = versionlist; - log_fn(LOG_DEBUG,"checking '%s' in '%s'.", myversion, versionlist); + log_fn(LOG_DEBUG,"Checking whether version '%s' is in '%s'", myversion, versionlist); if (tor_version_parse(myversion, &mine)) { log_fn(LOG_ERR, "I couldn't parse my own version (%s)", myversion); @@ -437,7 +437,7 @@ router_parse_routerlist_from_directory(const char *str, good_nickname_list, tok->tp==K_RUNNING_ROUTERS)==1 && me->is_verified == 0 && !have_warned_about_unverified_status) { - log_fn(LOG_WARN,"Dirserver %s lists your server as unverified. Please consider sending your identity fingerprint to the tor-ops.", dirnickname); + log_fn(LOG_WARN,"Dirserver '%s' lists your server as unverified. Please consider sending your identity fingerprint to the tor-ops.", dirnickname); have_warned_about_unverified_status = 1; } } @@ -495,7 +495,7 @@ router_parse_runningrouters(const char *str) log_fn(LOG_WARN, "Error tokenizing directory"); goto err; } if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) { - log_fn(LOG_WARN, "Unrecognized keyword \"%s\"; can't parse running-routers", + log_fn(LOG_WARN, "Unrecognized keyword '%s'; can't parse running-routers", tok->args[0]); goto err; } @@ -774,7 +774,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s, goto err; } if ((tok = find_first_by_keyword(tokens, _UNRECOGNIZED))) { - log_fn(LOG_WARN, "Unrecognized keyword \"%s\"; skipping descriptor.", + log_fn(LOG_WARN, "Unrecognized keyword '%s'; skipping descriptor.", tok->args[0]); goto err; } @@ -841,7 +841,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s, } else if (tok) { if (tok->n_args < 3) { /* XXXX Once 0.0.7 is *really* dead, restore this warning to its old form*/ - log_fn(LOG_WARN,"Not enough arguments to \"bandwidth\": must be an obsolete server. Rejecting (nickname %s).", router->nickname); + log_fn(LOG_WARN,"Not enough arguments to \"bandwidth\": must be an obsolete server. Rejecting one server (nickname '%s').", router->nickname); goto err; } router->bandwidthrate = tor_parse_long(tok->args[0],10,0,INT_MAX,NULL,NULL); @@ -905,7 +905,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s, router->declared_family = smartlist_create(); for (i=0;in_args;++i) { if (!is_legal_nickname_or_hexdigest(tok->args[i])) { - log_fn(LOG_WARN, "Illegal nickname %s in family line", tok->args[i]); + log_fn(LOG_WARN, "Illegal nickname '%s' in family line", tok->args[i]); goto err; } smartlist_add(router->declared_family, tor_strdup(tok->args[i])); -- cgit v1.2.3