summaryrefslogtreecommitdiff
path: root/src/or/policies.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/policies.c')
-rw-r--r--src/or/policies.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/or/policies.c b/src/or/policies.c
index e0dbb021c6..1210ca687d 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -2999,11 +2999,12 @@ getinfo_helper_policies(control_connection_t *conn,
smartlist_free(private_policy_strings);
} else if (!strcmp(question, "exit-policy/reject-private/relay")) {
const or_options_t *options = get_options();
- const routerinfo_t *me = router_get_my_routerinfo();
+ int err = 0;
+ const routerinfo_t *me = router_get_my_routerinfo_with_err(&err);
if (!me) {
- *errmsg = "router_get_my_routerinfo returned NULL";
- return -1;
+ *errmsg = routerinfo_err_to_string(err);
+ return routerinfo_err_is_transient(err) ? -1 : 0;
}
if (!options->ExitPolicyRejectPrivate &&
@@ -3038,11 +3039,17 @@ getinfo_helper_policies(control_connection_t *conn,
SMARTLIST_FOREACH(configured_addresses, tor_addr_t *, a, tor_free(a));
smartlist_free(configured_addresses);
} else if (!strcmpstart(question, "exit-policy/")) {
- const routerinfo_t *me = router_get_my_routerinfo();
-
int include_ipv4 = 0;
int include_ipv6 = 0;
+ int err = 0;
+ const routerinfo_t *me = router_get_my_routerinfo_with_err(&err);
+
+ if (!me) {
+ *errmsg = routerinfo_err_to_string(err);
+ return routerinfo_err_is_transient(err) ? -1 : 0;
+ }
+
if (!strcmp(question, "exit-policy/ipv4")) {
include_ipv4 = 1;
} else if (!strcmp(question, "exit-policy/ipv6")) {
@@ -3053,13 +3060,10 @@ getinfo_helper_policies(control_connection_t *conn,
return 0; /* No such key. */
}
- if (!me) {
- *errmsg = "router_get_my_routerinfo returned NULL";
- return -1;
- }
-
- *answer = router_dump_exit_policy_to_string(me,include_ipv4,include_ipv6);
+ *answer = router_dump_exit_policy_to_string(me,include_ipv4,
+ include_ipv6);
}
+
return 0;
}