]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Clients no longer write "DirReqStatistics 0" in their saveconf output
authorRoger Dingledine <arma@torproject.org>
Thu, 11 Sep 2014 03:01:18 +0000 (23:01 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 18 Sep 2014 19:29:14 +0000 (15:29 -0400)
Stop modifying the value of our DirReqStatistics torrc option just
because we're not a bridge or relay. This bug was causing Tor
Browser users to write "DirReqStatistics 0" in their torrc files
as if they had chosen to change the config.

Fixes bug 4244; bugfix on 0.2.3.1-alpha.

changes/bug4244 [new file with mode: 0644]
src/or/config.c
src/or/or.h

diff --git a/changes/bug4244 b/changes/bug4244
new file mode 100644 (file)
index 0000000..2b228dd
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+    - Stop modifying the value of our DirReqStatistics torrc option just
+      because we're not a bridge or relay. This bug was causing Tor
+      Browser users to write "DirReqStatistics 0" in their torrc files
+      as if they had chosen to change the config. Fixes bug 4244; bugfix
+      on 0.2.3.1-alpha.
index 92bd495471afa1949b3a8f5c712a10c0c837a857..35317f1945e1c72b37089d30a755b9340aa24e5e 100644 (file)
@@ -208,7 +208,7 @@ static config_var_t option_vars_[] = {
   OBSOLETE("DirRecordUsageGranularity"),
   OBSOLETE("DirRecordUsageRetainIPs"),
   OBSOLETE("DirRecordUsageSaveInterval"),
-  V(DirReqStatistics,            BOOL,     "1"),
+  VAR("DirReqStatistics",        BOOL,     DirReqStatistics_option, "1"),
   VAR("DirAuthority",            LINELIST, DirAuthorities, NULL),
   V(DirAuthorityFallbackRate,    DOUBLE,   "1.0"),
   V(DisableAllSwap,              BOOL,     "0"),
@@ -1705,6 +1705,11 @@ options_act(const or_options_t *old_options)
       connection_or_update_token_buckets(get_connection_array(), options);
   }
 
+
+  /* Only collect directory-request statistics on relays and bridges. */
+  options->DirReqStatistics = options->DirReqStatistics_option &&
+    server_mode(options);
+
   if (options->CellStatistics || options->DirReqStatistics ||
       options->EntryStatistics || options->ExitPortStatistics ||
       options->ConnDirectionStatistics ||
@@ -1712,11 +1717,6 @@ options_act(const or_options_t *old_options)
     time_t now = time(NULL);
     int print_notice = 0;
 
-    /* Only collect directory-request statistics on relays and bridges. */
-    if (!server_mode(options)) {
-      options->DirReqStatistics = 0;
-    }
-
     /* Only collect other relay-only statistics on relays. */
     if (!public_server_mode(options)) {
       options->CellStatistics = 0;
@@ -1735,8 +1735,8 @@ options_act(const or_options_t *old_options)
         geoip_dirreq_stats_init(now);
         print_notice = 1;
       } else {
+        /* disable statistics collection since we have no geoip file */
         options->DirReqStatistics = 0;
-        /* Don't warn Tor clients, they don't use statistics */
         if (options->ORPort_set)
           log_notice(LD_CONFIG, "Configured to measure directory request "
                                 "statistics, but no GeoIP database found. "
index 06d4e3c9263ec92eec85aa30febda954295f2c7b..2258796aacd84dec858abef75eadca493bee3ecb 100644 (file)
@@ -3910,8 +3910,11 @@ typedef struct {
    * instead of a hostname. */
   int WarnUnsafeSocks;
 
-  /** If true, the user wants us to collect statistics on clients
+  /** If true, we're configured to collect statistics on clients
    * requesting network statuses from us as directory. */
+  int DirReqStatistics_option;
+  /** Internal variable to remember whether we're actually acting on
+   * DirReqStatistics_option -- yes if it's set and we're a server, else no. */
   int DirReqStatistics;
 
   /** If true, the user wants us to collect statistics on port usage. */