[tor-commits] [tor/master] Add __SocksPort etc variants for non-persistent use

nickm at torproject.org nickm at torproject.org
Mon Jan 23 21:07:22 UTC 2017


commit 83307fc267e7de5fd3a9ccc0c51d6d377f454495
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jan 18 10:21:33 2017 -0500

    Add __SocksPort etc variants for non-persistent use
    
    Implements feature 20956.
---
 changes/feature20956 |  6 ++++++
 doc/tor.1.txt        | 13 +++++++++++++
 src/or/config.c      | 13 +++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/changes/feature20956 b/changes/feature20956
new file mode 100644
index 0000000..1ebddb1
--- /dev/null
+++ b/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.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index f1068ce..330cdd4 100644
--- a/doc/tor.1.txt
+++ b/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
 -------
 
diff --git a/src/or/config.c b/src/or/config.c
index 3b70b97..fe6aa78 100644
--- a/src/or/config.c
+++ b/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





More information about the tor-commits mailing list