diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-04-08 13:55:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-04-08 13:55:02 -0400 |
commit | 245f273aaf6a6189a57d837d5fd76b76cc9b6f8e (patch) | |
tree | 2806ce750222a7e80e6151656360aeeb0a6d93eb /src/or/policies.c | |
parent | 3ac426afe8f169cb2c16de9d37b8630b7c3216f5 (diff) | |
parent | 51e13cd1ad5f7c130521e2a964ea462f35d1880e (diff) | |
download | tor-245f273aaf6a6189a57d837d5fd76b76cc9b6f8e.tar.gz tor-245f273aaf6a6189a57d837d5fd76b76cc9b6f8e.zip |
Merge branch 'bug7952_final'
Conflicts:
src/test/include.am
src/test/test.c
Diffstat (limited to 'src/or/policies.c')
-rw-r--r-- | src/or/policies.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/or/policies.c b/src/or/policies.c index 42dc46b7fd..8a91509a77 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -13,6 +13,7 @@ #include "dirserv.h" #include "nodelist.h" #include "policies.h" +#include "router.h" #include "routerparse.h" #include "geoip.h" #include "ht.h" @@ -1692,6 +1693,28 @@ getinfo_helper_policies(control_connection_t *conn, (void) errmsg; if (!strcmp(question, "exit-policy/default")) { *answer = tor_strdup(DEFAULT_EXIT_POLICY); + } else if (!strcmpstart(question, "exit-policy/")) { + const routerinfo_t *me = router_get_my_routerinfo(); + + int include_ipv4 = 0; + int include_ipv6 = 0; + + if (!strcmp(question, "exit-policy/ipv4")) { + include_ipv4 = 1; + } else if (!strcmp(question, "exit-policy/ipv6")) { + include_ipv6 = 1; + } else if (!strcmp(question, "exit-policy/full")) { + include_ipv4 = include_ipv6 = 1; + } else { + 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); } return 0; } |