Commit 31b51849 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

export the default exit policy via the control port, so controllers

don't need to guess what it is / will be later.

parent 279e86f3
......@@ -316,6 +316,13 @@ $Id$
"config-file" -- The location of Tor's configuration file ("torrc").
["exit-policy/prepend" -- The default exit policy lines that Tor will
*prepend* to the ExitPolicy config option.
-- Never implemented. Useful?]
"exit-policy/default" -- The default exit policy lines that Tor will
*append* to the ExitPolicy config option.
"desc/id/<OR identity>" or "desc/name/<OR nickname>" -- the latest
server descriptor for a given OR, NUL-terminated.
......@@ -1289,12 +1289,14 @@ list_getinfo_options(void)
"addr-mappings/configl Addresses remapped from configuration options.\n"
"addr-mappings/control Addresses remapped by a controller.\n"
"circuit-status Status of each current circuit.\n"
"config-file Current location of the \"torrc\" file.\n"
"config/names List of configuration options, types, and documentation.\n"
"desc/id/* Server descriptor by hex ID\n"
"desc/name/* Server descriptor by nickname.\n"
"desc/all-recent Latest server descriptor for every router\n"
"dir/server/* Fetch server descriptors -- see dir-spec.txt\n"
"entry-guards Which nodes will we use as entry guards?\n"
"exit-policy/default Default lines appended to config->ExitPolicy\n"
"info/names List of GETINFO options, types, and documentation.\n"
"network-status List of hex IDs, nicknames, server statuses.\n"
"orconn-status Status of each current OR connection.\n"
......@@ -1532,6 +1534,8 @@ handle_getinfo_helper(const char *question, char **answer)
cp += d->dir_len;
*cp = '\0';
} else if (!strcmpstart(question, "exit-policy/")) {
return policies_getinfo_helper(question, answer);
return 0;
......@@ -2051,6 +2051,7 @@ int policies_parse_exit_policy(config_line_t *cfg,
addr_policy_t **dest,
int rejectprivate);
int exit_policy_is_general_exit(addr_policy_t *policy);
int policies_getinfo_helper(const char *question, char **answer);
void addr_policy_free(addr_policy_t *p);
void policies_free_all(void);
......@@ -627,6 +627,18 @@ exit_policy_is_general_exit(addr_policy_t *policy)
return n_allowed >= 2;
policies_getinfo_helper(const char *question, char **answer)
if (!strcmp(question, "exit-policy/default")) {
*answer = tor_strdup(DEFAULT_EXIT_POLICY);
// } else if (!strcmp(question, "exit-policy/prepend")) {
} else {
*answer = NULL;
return 0;
/** Release all storage held by <b>p</b> */
addr_policy_free(addr_policy_t *p)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment