Browse Source

Add __SocksPort etc variants for non-persistent use

Implements feature 20956.
Nick Mathewson 7 years ago
parent
commit
83307fc267
3 changed files with 30 additions and 2 deletions
  1. 6 0
      changes/feature20956
  2. 13 0
      doc/tor.1.txt
  3. 11 2
      src/or/config.c

+ 6 - 0
changes/feature20956

@@ -0,0 +1,6 @@
+  o Minor features (configuration, controller):
+    - Each of the *Port options, such as SocksPort, ORPort, ControlPort,
+      and so on, now comes with a __*Port variant that will not be
+      saved to the torrc file by the controller's SAVECONF command.
+      This change allows TorBrowser to set up a single-use domain socket
+      for each time it launches Tor. Closes ticket 20956.

+ 13 - 0
doc/tor.1.txt

@@ -2668,6 +2668,19 @@ The following options are used for running a testing Tor network.
     we replace it and issue a new key?
     (Default: 3 hours for link and auth; 1 day for signing.)
 
+NON-PERSISTENT OPTIONS
+----------------------
+
+These options are not saved to the torrc file by the "SAVECONF" controller
+command.  Other options of this type are documented in control-spec.txt,
+section 5.4. End-users should mostly ignore them.
+
+[[UnderscorePorts]] **\_\_ControlPort**, **\_\_DirPort**, **\_\_DNSPort**, **\_\_ExtORPort**, **\_\_NATDPort**, **\_\_ORPort**, **\_\_SocksPort**, **\_\_TransPort**::
+    These underscore-prefixed options are variants of the regular Port
+    options.  They behave the same, except they are not saved to the
+    torrc file by the controller's SAVECONF command.
+
+
 SIGNALS
 -------
 

+ 11 - 2
src/or/config.c

@@ -133,8 +133,17 @@ static config_abbrev_t option_abbrevs_[] = {
 /** An entry for config_vars: "The option <b>name</b> is obsolete." */
 #define OBSOLETE(name) { name, CONFIG_TYPE_OBSOLETE, 0, NULL }
 
-#define VPORT(member)                                   \
-  VAR(#member, LINELIST, member ## _lines, NULL)
+/**
+ * Macro to declare *Port options.  Each one comes in three entries.
+ * For example, most users should use "SocksPort" to configure the
+ * socks port, but TorBrowser wants to use __SocksPort so that it
+ * isn't stored by SAVECONF.  The SocksPortLines virtual option is
+ * used to query both options from the controller.
+ */
+#define VPORT(member)                                           \
+  VAR(#member "Lines", LINELIST_V, member ## _lines, NULL),     \
+  VAR(#member, LINELIST_S, member ## _lines, NULL),             \
+  VAR("__" #member, LINELIST_S, member ## _lines, NULL)
 
 /** Array of configuration options.  Until we disallow nonstandard
  * abbreviations, order is significant, since the first matching option will