mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
Allow using regular relays as bridges
This commit is contained in:
parent
7409929917
commit
9ca311f622
5
changes/relays_as_bridges
Normal file
5
changes/relays_as_bridges
Normal file
@ -0,0 +1,5 @@
|
||||
o Minor bugfixes:
|
||||
- Allow the use of regular relays as bridges. To achieve this, replace
|
||||
routers with a purpose other than bridge with bridge descriptors when
|
||||
fetching them. Bugfix on 0.1.1.9-alpha; fixes bug 1776.
|
||||
|
@ -3151,9 +3151,16 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
|
||||
id_digest = router->cache_info.identity_digest;
|
||||
|
||||
old_router = router_get_by_digest(id_digest);
|
||||
|
||||
/* Make sure that we haven't already got this exact descriptor. */
|
||||
if (sdmap_get(routerlist->desc_digest_map,
|
||||
router->cache_info.signed_descriptor_digest)) {
|
||||
/* If we have this descriptor already and the new descriptor is a bridge
|
||||
* descriptor, replace it. If we had a bridge descriptor before and the
|
||||
* new one is not a bridge descriptor, don't replace it. */
|
||||
if (old_router && (!routerinfo_is_a_configured_bridge(router) ||
|
||||
routerinfo_is_a_configured_bridge(old_router))) {
|
||||
log_info(LD_DIR,
|
||||
"Dropping descriptor that we already have for router '%s'",
|
||||
router->nickname);
|
||||
@ -3161,6 +3168,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
routerinfo_free(router);
|
||||
return ROUTER_WAS_NOT_NEW;
|
||||
}
|
||||
}
|
||||
|
||||
if (authdir) {
|
||||
if (authdir_wants_to_reject_router(router, msg,
|
||||
@ -3196,15 +3204,14 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
SMARTLIST_FOREACH(networkstatus_v2_list, networkstatus_v2_t *, ns,
|
||||
{
|
||||
routerstatus_t *rs =
|
||||
networkstatus_v2_find_entry(ns, router->cache_info.identity_digest);
|
||||
networkstatus_v2_find_entry(ns, id_digest);
|
||||
if (rs && !memcmp(rs->descriptor_digest,
|
||||
router->cache_info.signed_descriptor_digest,
|
||||
DIGEST_LEN))
|
||||
rs->need_to_mirror = 0;
|
||||
});
|
||||
if (consensus) {
|
||||
routerstatus_t *rs = networkstatus_vote_find_entry(consensus,
|
||||
router->cache_info.identity_digest);
|
||||
routerstatus_t *rs = networkstatus_vote_find_entry(consensus, id_digest);
|
||||
if (rs && !memcmp(rs->descriptor_digest,
|
||||
router->cache_info.signed_descriptor_digest,
|
||||
DIGEST_LEN)) {
|
||||
@ -3226,8 +3233,6 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
||||
}
|
||||
|
||||
/* If we have a router with the same identity key, choose the newer one. */
|
||||
old_router = rimap_get(routerlist->identity_map,
|
||||
router->cache_info.identity_digest);
|
||||
if (old_router) {
|
||||
if (!in_consensus && (router->cache_info.published_on <=
|
||||
old_router->cache_info.published_on)) {
|
||||
|
Loading…
Reference in New Issue
Block a user