mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 18:22:09 +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;
|
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. */
|
/* Make sure that we haven't already got this exact descriptor. */
|
||||||
if (sdmap_get(routerlist->desc_digest_map,
|
if (sdmap_get(routerlist->desc_digest_map,
|
||||||
router->cache_info.signed_descriptor_digest)) {
|
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,
|
log_info(LD_DIR,
|
||||||
"Dropping descriptor that we already have for router '%s'",
|
"Dropping descriptor that we already have for router '%s'",
|
||||||
router->nickname);
|
router->nickname);
|
||||||
@ -3161,6 +3168,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|||||||
routerinfo_free(router);
|
routerinfo_free(router);
|
||||||
return ROUTER_WAS_NOT_NEW;
|
return ROUTER_WAS_NOT_NEW;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (authdir) {
|
if (authdir) {
|
||||||
if (authdir_wants_to_reject_router(router, msg,
|
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,
|
SMARTLIST_FOREACH(networkstatus_v2_list, networkstatus_v2_t *, ns,
|
||||||
{
|
{
|
||||||
routerstatus_t *rs =
|
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,
|
if (rs && !memcmp(rs->descriptor_digest,
|
||||||
router->cache_info.signed_descriptor_digest,
|
router->cache_info.signed_descriptor_digest,
|
||||||
DIGEST_LEN))
|
DIGEST_LEN))
|
||||||
rs->need_to_mirror = 0;
|
rs->need_to_mirror = 0;
|
||||||
});
|
});
|
||||||
if (consensus) {
|
if (consensus) {
|
||||||
routerstatus_t *rs = networkstatus_vote_find_entry(consensus,
|
routerstatus_t *rs = networkstatus_vote_find_entry(consensus, id_digest);
|
||||||
router->cache_info.identity_digest);
|
|
||||||
if (rs && !memcmp(rs->descriptor_digest,
|
if (rs && !memcmp(rs->descriptor_digest,
|
||||||
router->cache_info.signed_descriptor_digest,
|
router->cache_info.signed_descriptor_digest,
|
||||||
DIGEST_LEN)) {
|
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. */
|
/* 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 (old_router) {
|
||||||
if (!in_consensus && (router->cache_info.published_on <=
|
if (!in_consensus && (router->cache_info.published_on <=
|
||||||
old_router->cache_info.published_on)) {
|
old_router->cache_info.published_on)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user