]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
export the default exit policy via the control port, so controllers
authorRoger Dingledine <arma@torproject.org>
Tue, 13 Jun 2006 09:16:09 +0000 (09:16 +0000)
committerRoger Dingledine <arma@torproject.org>
Tue, 13 Jun 2006 09:16:09 +0000 (09:16 +0000)
don't need to guess what it is / will be later.

svn:r6615

doc/control-spec.txt
src/or/control.c
src/or/or.h
src/or/policies.c

index 196cf7e7aa9d240b108f50dd19ecb94f2a8e2b73..b8566d6031ee230f22817357d203603f72d190fc 100644 (file)
@@ -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.
 
index abe1759ae4be16a4c64840c2fee7826b88334f27..7e06ec3ef9e9b32719cc67b061124673f91e5386 100644 (file)
@@ -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;
 }
index 92a7e5f2b098a13629befb595fb67c77711292ab..99acf2b41ff3a0245e97729d00a6c12a678ca516 100644 (file)
@@ -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);
index 7eff70fc9045fa55db09fc51f480315dea2100f0..31622a012081f5e16a76acf8ff71ffc5dd14d5a3 100644 (file)
@@ -627,6 +627,18 @@ exit_policy_is_general_exit(addr_policy_t *policy)
   return n_allowed >= 2;
 }
 
+int
+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> */
 void
 addr_policy_free(addr_policy_t *p)