diff options
author | Neel Chauhan <neel@neelc.org> | 2020-04-12 13:13:50 -0700 |
---|---|---|
committer | Neel Chauhan <neel@neelc.org> | 2020-04-12 13:13:50 -0700 |
commit | 8e59b8560a4ce372497ea7bf5bcddff0c5211ebc (patch) | |
tree | 1df6c00ea39e6c7c1ae3ce635860c0555cc73076 /src/feature/control | |
parent | 80031db32abebaf4d0a91c01db258fcdbd54a471 (diff) | |
download | tor-8e59b8560a4ce372497ea7bf5bcddff0c5211ebc.tar.gz tor-8e59b8560a4ce372497ea7bf5bcddff0c5211ebc.zip |
Return a descriptive error for 'GETINFO status/fresh-relay-descs'
Diffstat (limited to 'src/feature/control')
-rw-r--r-- | src/feature/control/control_getinfo.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/feature/control/control_getinfo.c b/src/feature/control/control_getinfo.c index 5dcc4b170d..aa951e74f1 100644 --- a/src/feature/control/control_getinfo.c +++ b/src/feature/control/control_getinfo.c @@ -1331,8 +1331,22 @@ getinfo_helper_events(control_connection_t *control_conn, } routerinfo_t *r; extrainfo_t *e; - if (router_build_fresh_descriptor(&r, &e) < 0) { - *errmsg = "Error generating descriptor"; + int result; + if ((result = router_build_fresh_descriptor(&r, &e)) < 0) { + switch (result) { + case TOR_ROUTERINFO_ERROR_NO_EXT_ADDR: + *errmsg = "Cannot get relay address while generating descriptor"; + break; + case TOR_ROUTERINFO_ERROR_DIGEST_FAILED: + *errmsg = "Key digest failed"; + break; + case TOR_ROUTERINFO_ERROR_CANNOT_GENERATE: + *errmsg = "Cannot generate router descriptor"; + break; + default: + *errmsg = "Error generating descriptor"; + break; + } return -1; } size_t size = r->cache_info.signed_descriptor_len + 1; |