diff options
author | Roger Dingledine <arma@torproject.org> | 2007-10-10 20:13:52 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-10-10 20:13:52 +0000 |
commit | d9a99b9ba6582d40a929838e5af771204b9c964b (patch) | |
tree | 3e8379963666f88d54ffe5ae833739e8c62644e4 /src/or | |
parent | 976c8f8a71b8dac7dc683e54cce02fcfe4146780 (diff) | |
download | tor-d9a99b9ba6582d40a929838e5af771204b9c964b.tar tor-d9a99b9ba6582d40a929838e5af771204b9c964b.tar.gz |
get r11842 closer to what i want
svn:r11851
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dirserv.c | 2 | ||||
-rw-r--r-- | src/or/or.h | 1 | ||||
-rw-r--r-- | src/or/routerlist.c | 14 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 7d69aa21a..b849fd90b 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1852,7 +1852,7 @@ get_possible_sybil_list(const smartlist_t *routers) last_addr = ri->addr; addr_count = 1; } else if (++addr_count > MAX_WITH_SAME_ADDR) { - if (!router_digest_is_trusted_dir(ri->cache_info.identity_digest) || + if (!router_addr_is_trusted_dir(ri->addr) || addr_count > MAX_WITH_SAME_ADDR_ON_AUTHORITY) digestmap_set(omit_as_sybil, ri->cache_info.identity_digest, ri); } diff --git a/src/or/or.h b/src/or/or.h index 85a686aa8..9b34ed899 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -3555,6 +3555,7 @@ int router_digest_is_trusted_dir_type(const char *digest, authority_type_t type); #define router_digest_is_trusted_dir(d) \ router_digest_is_trusted_dir_type((d), 0) +int router_addr_is_trusted_dir(uint32_t addr); routerlist_t *router_get_routerlist(void); void routerlist_reset_warnings(void); void routerlist_free(routerlist_t *routerlist); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 407295fe4..ee9ff7d8d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1783,6 +1783,20 @@ router_digest_is_trusted_dir_type(const char *digest, authority_type_t type) return 0; } +/** Return true iff <b>addr</b> is the address of one of our trusted + * directory authorities. */ +int +router_addr_is_trusted_dir(uint32_t addr) +{ + if (!trusted_dir_servers) + return 0; + SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, ent, + if (ent->addr == addr) + return 1; + ); + return 0; +} + /** If hexdigest is correctly formed, base16_decode it into * digest, which must have DIGEST_LEN space in it. * Return 0 on success, -1 on failure. |