diff --git a/src/or/command.c b/src/or/command.c index 3a5c6c01a2..60c9184b57 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -622,7 +622,7 @@ command_process_netinfo_cell(cell_t *cell, or_connection_t *conn) /** Warn when we get a netinfo skew with at least this value. */ #define NETINFO_NOTICE_SKEW 3600 if (labs(apparent_skew) > NETINFO_NOTICE_SKEW && - router_get_by_digest(conn->identity_digest)) { + router_get_by_id_digest(conn->identity_digest)) { char dbuf[64]; int severity; /*XXXX be smarter about when everybody says we are skewed. */ diff --git a/src/or/connection_or.c b/src/or/connection_or.c index ec76b88ee0..9f979f086e 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -360,7 +360,7 @@ connection_or_digest_is_known_relay(const char *id_digest) { if (router_get_consensus_status_by_id(id_digest)) return 1; /* It's in the consensus: "yes" */ - if (router_get_by_digest(id_digest)) + if (router_get_by_id_digest(id_digest)) return 1; /* Not in the consensus, but we have a descriptor for * it. Probably it was in a recent consensus. "Yes". */ return 0; @@ -1342,7 +1342,7 @@ connection_or_set_state_open(or_connection_t *conn) router_set_status(conn->identity_digest, 1); } else { /* only report it to the geoip module if it's not a known router */ - if (!router_get_by_digest(conn->identity_digest)) { + if (!router_get_by_id_digest(conn->identity_digest)) { if (tor_addr_family(&TO_CONN(conn)->addr) == AF_INET) { /*XXXX IP6 support ipv6 geoip.*/ uint32_t a = tor_addr_to_ipv4h(&TO_CONN(conn)->addr); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 4c0e049840..8ce23f7274 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -780,7 +780,7 @@ dirserv_add_extrainfo(extrainfo_t *ei, const char **msg) tor_assert(msg); *msg = NULL; - ri = router_get_by_digest(ei->cache_info.identity_digest); + ri = router_get_by_id_digest(ei->cache_info.identity_digest); if (!ri) { *msg = "No corresponding router descriptor for extra-info descriptor"; extrainfo_free(ei); @@ -2057,7 +2057,7 @@ routerstatus_format_entry(char *buf, size_t buf_len, } if (format != NS_V2) { - const routerinfo_t* desc = router_get_by_digest(rs->identity_digest); + const routerinfo_t* desc = router_get_by_id_digest(rs->identity_digest); uint32_t bw; if (format != NS_CONTROL_PORT) { @@ -3099,7 +3099,7 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, if (ri) smartlist_add(descs_out, (void*) &(ri->cache_info)); } else { - const routerinfo_t *ri = router_get_by_digest(d); + const routerinfo_t *ri = router_get_by_id_digest(d); /* Don't actually serve a descriptor that everyone will think is * expired. This is an (ugly) workaround to keep buggy 0.1.1.10 * Tors from downloading descriptors that they will throw away. @@ -3299,7 +3299,7 @@ get_signed_descriptor_by_fp(const char *fp, int extrainfo, else return &(router_get_my_routerinfo()->cache_info); } else { - const routerinfo_t *ri = router_get_by_digest(fp); + const routerinfo_t *ri = router_get_by_id_digest(fp); if (ri && ri->cache_info.published_on > publish_cutoff) { if (extrainfo) diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 5c5e1bfa4e..848b02d3a0 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -415,7 +415,7 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query) SMARTLIST_FOREACH(responsible_dirs, routerstatus_t *, dir, { if (lookup_last_hid_serv_request(dir, desc_id_base32, 0, 0) + REND_HID_SERV_DIR_REQUERY_PERIOD >= now || - !router_get_by_digest(dir->identity_digest)) + !router_get_by_id_digest(dir->identity_digest)) SMARTLIST_DEL_CURRENT(responsible_dirs, dir); }); diff --git a/src/or/rendservice.c b/src/or/rendservice.c index f67e9ab659..0f63776ef2 100644 --- a/src/or/rendservice.c +++ b/src/or/rendservice.c @@ -1578,7 +1578,7 @@ directory_post_to_hs_dir(rend_service_descriptor_t *renddesc, hs_dir->identity_digest)) /* Don't upload descriptor if we succeeded in doing so last time. */ continue; - if (!router_get_by_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 " "hidden service directory '%s'; we don't have its " "router descriptor. Queuing for later upload.", diff --git a/src/or/rephist.c b/src/or/rephist.c index 1b978d963d..6ce4322bbf 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -757,7 +757,7 @@ rep_hist_record_mtbf_data(time_t now, int missing_means_down) base16_encode(dbuf, sizeof(dbuf), digest, DIGEST_LEN); if (missing_means_down && hist->start_of_run && - !router_get_by_digest(digest)) { + !router_get_by_id_digest(digest)) { /* We think this relay is running, but it's not listed in our * routerlist. Somehow it fell out without telling us it went * down. Complain and also correct it. */ diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 449d558af5..816cfadf33 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -2462,7 +2462,7 @@ router_get_by_nickname(const char *nickname, int warn_if_unnamed) int router_digest_version_as_new_as(const char *digest, const char *cutoff) { - const routerinfo_t *router = router_get_by_digest(digest); + const routerinfo_t *router = router_get_by_id_digest(digest); if (!router) return 1; return tor_version_as_new_as(router->platform, cutoff); @@ -2526,7 +2526,7 @@ router_get_by_hexdigest(const char *hexdigest) return router_get_by_nickname(hexdigest, 1); } -/** As router_get_by_digest,but return a pointer that you're allowed to +/** As router_get_by_id_digest,but return a pointer that you're allowed to * modify */ routerinfo_t * router_get_mutable_by_digest(const char *digest) @@ -2543,7 +2543,7 @@ router_get_mutable_by_digest(const char *digest) /** Return the router in our routerlist whose 20-byte key digest * is digest. Return NULL if no such router is known. */ const routerinfo_t * -router_get_by_digest(const char *digest) +router_get_by_id_digest(const char *digest) { return router_get_mutable_by_digest(digest); } @@ -4610,7 +4610,7 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote, if ((sd = router_get_by_descriptor_digest(rs->descriptor_digest))) { const routerinfo_t *ri; ++n_have; - if (!(ri = router_get_by_digest(rs->identity_digest)) || + if (!(ri = router_get_by_id_digest(rs->identity_digest)) || memcmp(ri->cache_info.signed_descriptor_digest, sd->signed_descriptor_digest, DIGEST_LEN)) { /* We have a descriptor with this digest, but either there is no @@ -4644,7 +4644,7 @@ update_consensus_router_descriptor_downloads(time_t now, int is_vote, char time_bufnew[ISO_TIME_LEN+1]; char time_bufold[ISO_TIME_LEN+1]; const routerinfo_t *oldrouter; - oldrouter = router_get_by_digest(rs->identity_digest); + oldrouter = router_get_by_id_digest(rs->identity_digest); format_iso_time(time_bufnew, rs->published_on); if (oldrouter) format_iso_time(time_bufold, oldrouter->cache_info.published_on); @@ -4765,7 +4765,7 @@ update_extrainfo_downloads(time_t now) sd = &((routerinfo_t*)smartlist_get(lst, i))->cache_info; if (sd->is_extrainfo) continue; /* This should never happen. */ - if (old_routers && !router_get_by_digest(sd->identity_digest)) + if (old_routers && !router_get_by_id_digest(sd->identity_digest)) continue; /* Couldn't check the signature if we got it. */ if (sd->extrainfo_is_bogus) continue; diff --git a/src/or/routerlist.h b/src/or/routerlist.h index cda2d2ef5f..b69ef70f6e 100644 --- a/src/or/routerlist.h +++ b/src/or/routerlist.h @@ -65,7 +65,7 @@ int router_digest_is_trusted_dir_type(const char *digest, int router_addr_is_trusted_dir(uint32_t addr); int hexdigest_to_digest(const char *hexdigest, char *digest); const routerinfo_t *router_get_by_hexdigest(const char *hexdigest); -const routerinfo_t *router_get_by_digest(const char *digest); +const routerinfo_t *router_get_by_id_digest(const char *digest); routerinfo_t *router_get_mutable_by_digest(const char *digest); signed_descriptor_t *router_get_by_descriptor_digest(const char *digest); signed_descriptor_t *router_get_by_extrainfo_digest(const char *digest);