Skip to content

Commit

Permalink
Merge remote-tracking branch 'tor-github/pr/268'
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Aug 11, 2018
2 parents b7ed611 + 5f2e002 commit 61d5bcc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
6 changes: 6 additions & 0 deletions changes/bug27034
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
o Minor bugfixes (controller):
- Consider all routerinfo errors other than "not a server"
to be transient for the purpose of "GETINFO exit-policy/*"
controller request. Print stacktrace in the unlikely case
of failing to recompute routerinfo digest. Fixes bug 27034;
bugfix on 0.3.4.1-alpha.
26 changes: 8 additions & 18 deletions src/feature/relay/router.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,12 @@ routerinfo_err_to_string(int err)
int
routerinfo_err_is_transient(int err)
{
switch (err) {
case TOR_ROUTERINFO_ERROR_NO_EXT_ADDR:
return 1;
case TOR_ROUTERINFO_ERROR_CANNOT_PARSE:
return 1;
case TOR_ROUTERINFO_ERROR_NOT_A_SERVER:
return 0;
case TOR_ROUTERINFO_ERROR_DIGEST_FAILED:
return 0; // XXX: bug?
case TOR_ROUTERINFO_ERROR_CANNOT_GENERATE:
return 1;
case TOR_ROUTERINFO_ERROR_DESC_REBUILDING:
return 1;
}

return 0;
/**
* For simplicity, we consider all errors other than
* "not a server" transient - see discussion on
* https://trac.torproject.org/projects/tor/ticket/27034
*/
return err != TOR_ROUTERINFO_ERROR_NOT_A_SERVER;
}

/** Replace the current onion key with <b>k</b>. Does not affect
Expand Down Expand Up @@ -2360,8 +2350,8 @@ router_build_fresh_descriptor(routerinfo_t **r, extrainfo_t **e)
}

ri->identity_pkey = crypto_pk_dup_key(get_server_identity_key());
if (crypto_pk_get_digest(ri->identity_pkey,
ri->cache_info.identity_digest)<0) {
if (BUG(crypto_pk_get_digest(ri->identity_pkey,
ri->cache_info.identity_digest) < 0)) {
routerinfo_free(ri);
return TOR_ROUTERINFO_ERROR_DIGEST_FAILED;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/test_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ test_policies_getinfo_helper_policies(void *arg)
rv = getinfo_helper_policies(NULL, "exit-policy/full", &answer,
&errmsg);

tt_int_op(rv, OP_EQ, 0);
tt_int_op(rv, OP_EQ, -1);
tt_ptr_op(answer, OP_EQ, NULL);
tt_ptr_op(errmsg, OP_NE, NULL);
tt_str_op(errmsg, OP_EQ, "Key digest failed");
Expand Down

0 comments on commit 61d5bcc

Please sign in to comment.