mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Merge remote-tracking branch 'tor-gitlab/mr/260' into maint-0.4.5
This commit is contained in:
commit
f79a31f6d5
4
changes/ticket40231
Normal file
4
changes/ticket40231
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor bugfixes (relay):
|
||||||
|
- If we were unable to build our descriptor, don't mark that we've
|
||||||
|
advertised our descriptor. Also remove an harmless BUG(). Fixes bug 40231;
|
||||||
|
bugfix on 0.4.5.1-alpha.
|
@ -198,9 +198,13 @@ relay_addr_learn_from_dirauth(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const node_t *node = node_get_by_id(rs->identity_digest);
|
const node_t *node = node_get_by_id(rs->identity_digest);
|
||||||
if (BUG(!node)) {
|
if (!node) {
|
||||||
/* If there is a routerstatus_t, there is a node_t thus this should
|
/* This can happen if we are still in the early starting stage where no
|
||||||
* never fail. */
|
* descriptors we actually fetched and thus we have the routerstatus_t
|
||||||
|
* for the authority but not its descriptor which is needed to build a
|
||||||
|
* circuit and thus learn our address. */
|
||||||
|
log_info(LD_GENERAL, "Can't build a circuit to an authority. Unable to "
|
||||||
|
"learn for now our address from them.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
extend_info_t *ei = extend_info_from_node(node, 1);
|
extend_info_t *ei = extend_info_from_node(node, 1);
|
||||||
|
@ -104,7 +104,7 @@ rotate_onion_key_callback(time_t now, const or_options_t *options)
|
|||||||
log_info(LD_GENERAL,"Rotating onion key.");
|
log_info(LD_GENERAL,"Rotating onion key.");
|
||||||
rotate_onion_key();
|
rotate_onion_key();
|
||||||
cpuworkers_rotate_keyinfo();
|
cpuworkers_rotate_keyinfo();
|
||||||
if (router_rebuild_descriptor(1)<0) {
|
if (!router_rebuild_descriptor(1)) {
|
||||||
log_info(LD_CONFIG, "Couldn't rebuild router descriptor");
|
log_info(LD_CONFIG, "Couldn't rebuild router descriptor");
|
||||||
}
|
}
|
||||||
if (advertised_server_mode() && !net_is_disabled())
|
if (advertised_server_mode() && !net_is_disabled())
|
||||||
|
@ -1427,10 +1427,9 @@ consider_publishable_server(int force)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
rebuilt = router_rebuild_descriptor(0);
|
rebuilt = router_rebuild_descriptor(0);
|
||||||
if (decide_if_publishable_server()) {
|
if (rebuilt && decide_if_publishable_server()) {
|
||||||
set_server_advertised(1);
|
set_server_advertised(1);
|
||||||
if (rebuilt == 0)
|
router_upload_dir_desc_to_dirservers(force);
|
||||||
router_upload_dir_desc_to_dirservers(force);
|
|
||||||
} else {
|
} else {
|
||||||
set_server_advertised(0);
|
set_server_advertised(0);
|
||||||
}
|
}
|
||||||
@ -1817,7 +1816,7 @@ router_get_my_extrainfo(void)
|
|||||||
{
|
{
|
||||||
if (!server_mode(get_options()))
|
if (!server_mode(get_options()))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (router_rebuild_descriptor(0))
|
if (!router_rebuild_descriptor(0))
|
||||||
return NULL;
|
return NULL;
|
||||||
return desc_extrainfo;
|
return desc_extrainfo;
|
||||||
}
|
}
|
||||||
@ -2414,9 +2413,10 @@ router_build_fresh_descriptor(routerinfo_t **r, extrainfo_t **e)
|
|||||||
|
|
||||||
/** If <b>force</b> is true, or our descriptor is out-of-date, rebuild a fresh
|
/** If <b>force</b> is true, or our descriptor is out-of-date, rebuild a fresh
|
||||||
* routerinfo, signed server descriptor, and extra-info document for this OR.
|
* routerinfo, signed server descriptor, and extra-info document for this OR.
|
||||||
* Return 0 on success, -1 on temporary error.
|
*
|
||||||
|
* Return true on success, else false on temporary error.
|
||||||
*/
|
*/
|
||||||
int
|
bool
|
||||||
router_rebuild_descriptor(int force)
|
router_rebuild_descriptor(int force)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@ -2424,13 +2424,13 @@ router_rebuild_descriptor(int force)
|
|||||||
extrainfo_t *ei;
|
extrainfo_t *ei;
|
||||||
|
|
||||||
if (desc_clean_since && !force)
|
if (desc_clean_since && !force)
|
||||||
return 0;
|
return true;
|
||||||
|
|
||||||
log_info(LD_OR, "Rebuilding relay descriptor%s", force ? " (forced)" : "");
|
log_info(LD_OR, "Rebuilding relay descriptor%s", force ? " (forced)" : "");
|
||||||
|
|
||||||
err = router_build_fresh_descriptor(&ri, &ei);
|
err = router_build_fresh_descriptor(&ri, &ei);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
return err;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
routerinfo_free(desc_routerinfo);
|
routerinfo_free(desc_routerinfo);
|
||||||
@ -2446,7 +2446,7 @@ router_rebuild_descriptor(int force)
|
|||||||
}
|
}
|
||||||
desc_dirty_reason = NULL;
|
desc_dirty_reason = NULL;
|
||||||
control_event_my_descriptor_changed();
|
control_event_my_descriptor_changed();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when we have a new set of consensus parameters. */
|
/** Called when we have a new set of consensus parameters. */
|
||||||
|
@ -102,7 +102,7 @@ int router_extrainfo_digest_is_me(const char *digest);
|
|||||||
int router_is_me(const routerinfo_t *router);
|
int router_is_me(const routerinfo_t *router);
|
||||||
bool router_addr_is_my_published_addr(const tor_addr_t *addr);
|
bool router_addr_is_my_published_addr(const tor_addr_t *addr);
|
||||||
int router_build_fresh_descriptor(routerinfo_t **r, extrainfo_t **e);
|
int router_build_fresh_descriptor(routerinfo_t **r, extrainfo_t **e);
|
||||||
int router_rebuild_descriptor(int force);
|
bool router_rebuild_descriptor(int force);
|
||||||
char *router_dump_router_to_string(routerinfo_t *router,
|
char *router_dump_router_to_string(routerinfo_t *router,
|
||||||
const crypto_pk_t *ident_key,
|
const crypto_pk_t *ident_key,
|
||||||
const crypto_pk_t *tap_key,
|
const crypto_pk_t *tap_key,
|
||||||
|
Loading…
Reference in New Issue
Block a user