]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Stop failing on startup when the relay module is disabled
authorteor <teor@torproject.org>
Thu, 7 Nov 2019 00:44:10 +0000 (10:44 +1000)
committerteor <teor@torproject.org>
Thu, 7 Nov 2019 01:43:41 +0000 (11:43 +1000)
When the relay module is disabled, make "ClientOnly 1" and
"DirCache 0" by default. (But keep "ClientOnly 0" and
"DirCache 1" as the defaults for the unit tests.)

And run "make autostyle".

Part of ticket 32410.

changes/ticket32410 [new file with mode: 0644]
src/app/config/config.c
src/app/config/or_options_st.h
src/feature/relay/relay_config.h

diff --git a/changes/ticket32410 b/changes/ticket32410
new file mode 100644 (file)
index 0000000..56368fe
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor features (relay):
+    - When the relay module is disabled, make "DirCache 0" the default.
+      Closes ticket 32410.
index e223011fcf68243dea8b7ef073d97f1495212c36..5f9a55ed172836ad91e9d6699f8745cffede469c 100644 (file)
@@ -363,7 +363,13 @@ static const config_var_t option_vars_[] = {
   V(CircuitStreamTimeout,        INTERVAL, "0"),
   V(CircuitPriorityHalflife,     DOUBLE,  "-1.0"), /*negative:'Use default'*/
   V(ClientDNSRejectInternalAddresses, BOOL,"1"),
+#if defined(HAVE_MODULE_RELAY) || defined(TOR_UNIT_TESTS)
+  /* The unit tests expect the ClientOnly default to be 0. */
   V(ClientOnly,                  BOOL,     "0"),
+#else
+  /* We must be a Client if the relay module is disabled. */
+  V(ClientOnly,                  BOOL,     "1"),
+#endif /* defined(HAVE_MODULE_RELAY) || defined(TOR_UNIT_TESTS) */
   V(ClientPreferIPv6ORPort,      AUTOBOOL, "auto"),
   V(ClientPreferIPv6DirPort,     AUTOBOOL, "auto"),
   V(ClientAutoIPv6ORPort,        BOOL,     "0"),
@@ -400,7 +406,13 @@ static const config_var_t option_vars_[] = {
   V(DirPortFrontPage,            FILENAME, NULL),
   VAR("DirReqStatistics",        BOOL,     DirReqStatistics_option, "1"),
   VAR("DirAuthority",            LINELIST, DirAuthorities, NULL),
+#if defined(HAVE_MODULE_RELAY) || defined(TOR_UNIT_TESTS)
+  /* The unit tests expect the DirCache default to be 1. */
   V(DirCache,                    BOOL,     "1"),
+#else
+  /* We can't be a DirCache if the relay module is disabled. */
+  V(DirCache,                    BOOL,     "0"),
+#endif /* defined(HAVE_MODULE_RELAY) || defined(TOR_UNIT_TESTS) */
   /* A DirAuthorityFallbackRate of 0.1 means that 0.5% of clients try an
    * authority when all fallbacks are up, and 2% try an authority when 25% of
    * fallbacks are down. (We rebuild the list when 25% of fallbacks are down).
index 1bbb2b97ec67792f60295619e696ff71587e8d1f..5511763daa97d6627fd6c735b10e7c914a7f4daa 100644 (file)
@@ -573,7 +573,9 @@ struct or_options_t {
 
   int DirCache; /**< Cache all directory documents and accept requests via
                  * tunnelled dir conns from clients. If 1, enabled (default);
-                 * If 0, disabled. */
+                 * If 0, disabled. Use dir_server_mode() rather than
+                 * referencing this option directly. (Except for routermode
+                 * and relay_config, which do direct checks.) */
 
   char *VirtualAddrNetworkIPv4; /**< Address and mask to hand out for virtual
                                  * MAPADDRESS requests for IPv4 addresses */
index 214f07efc246a5a60995c92392d14ac0be23abc2..5c36b43bd2307f489c299fd34e1736c81ff87593 100644 (file)
@@ -122,9 +122,6 @@ options_validate_relay_mode(const or_options_t *old_options,
     return -1;
   }
 
-  /* 31851 / 29211: Set this option the correct way */
-  options->ClientOnly = 1;
-
   return 0;
 }