[tor-commits] [tor] 01/05: Remove unused RendPostPeriod option

gitolite role git at cupani.torproject.org
Tue Nov 1 13:16:05 UTC 2022


This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit 419aa78b3acbc5c407b02509e82e473d8bda5d35
Author: Neel Chauhan <neel at neelc.org>
AuthorDate: Wed Aug 18 18:38:20 2021 -0700

    Remove unused RendPostPeriod option
---
 doc/man/tor.1.txt                                  |  1 -
 src/app/config/config.c                            | 24 --------------
 src/app/config/or_options_st.h                     |  2 --
 src/app/config/testnet.inc                         |  1 -
 src/feature/hs/hs_cache.c                          |  7 ++--
 src/test/conf_examples/large_1/expected            |  1 -
 src/test/conf_examples/large_1/expected_no_dirauth |  1 -
 src/test/conf_examples/large_1/torrc               |  1 -
 src/test/test_options.c                            | 38 ----------------------
 9 files changed, 4 insertions(+), 72 deletions(-)

diff --git a/doc/man/tor.1.txt b/doc/man/tor.1.txt
index 6a4afc0bbd..5f6a946b20 100644
--- a/doc/man/tor.1.txt
+++ b/doc/man/tor.1.txt
@@ -3562,7 +3562,6 @@ The following options are used for running a testing Tor network.
        TestingDirConnectionMaxStall 30 seconds
        TestingEnableConnBwEvent 1
        TestingEnableCellStatsEvent 1
-       RendPostPeriod 2 minutes
 
 [[TestingAuthDirTimeToLearnReachability]] **TestingAuthDirTimeToLearnReachability** __N__ **seconds**|**minutes**|**hours**::
     After starting as an authority, do not make claims about whether routers
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 15addd5be4..a3382c761b 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -624,7 +624,6 @@ static const config_var_t option_vars_[] = {
   V(RejectPlaintextPorts,        CSV,      ""),
   V(RelayBandwidthBurst,         MEMUNIT,  "0"),
   V(RelayBandwidthRate,          MEMUNIT,  "0"),
-  V(RendPostPeriod,              INTERVAL, "1 hour"), /* Used internally. */
   V(RephistTrackTime,            INTERVAL, "24 hours"),
   V_IMMUTABLE(RunAsDaemon,       BOOL,     "0"),
   V(ReducedExitPolicy,           BOOL,     "0"),
@@ -2974,19 +2973,11 @@ config_ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
   return 0;
 }
 
-/** Lowest allowable value for RendPostPeriod; if this is too low, hidden
- * services can overload the directory system. */
-#define MIN_REND_POST_PERIOD (10*60)
-#define MIN_REND_POST_PERIOD_TESTING (5)
-
 /** Highest allowable value for CircuitsAvailableTimeout.
  * If this is too large, client connections will stay open for too long,
  * incurring extra padding overhead. */
 #define MAX_CIRCS_AVAILABLE_TIME (24*60*60)
 
-/** Highest allowable value for RendPostPeriod. */
-#define MAX_DIR_PERIOD ((7*24*60*60)/2)
-
 /** Lowest allowable value for MaxCircuitDirtiness; if this is too low, Tor
  * will generate too many circuits and potentially overload the network. */
 #define MIN_MAX_CIRCUIT_DIRTINESS 10
@@ -3546,21 +3537,6 @@ options_validate_cb(const void *old_options_, void *options_, char **msg)
   if (options_validate_relay_padding(old_options, options, msg) < 0)
     return -1;
 
-  const int min_rendpostperiod =
-    options->TestingTorNetwork ?
-    MIN_REND_POST_PERIOD_TESTING : MIN_REND_POST_PERIOD;
-  if (options->RendPostPeriod < min_rendpostperiod) {
-    log_warn(LD_CONFIG, "RendPostPeriod option is too short; "
-             "raising to %d seconds.", min_rendpostperiod);
-    options->RendPostPeriod = min_rendpostperiod;
-  }
-
-  if (options->RendPostPeriod > MAX_DIR_PERIOD) {
-    log_warn(LD_CONFIG, "RendPostPeriod is too large; clipping to %ds.",
-             MAX_DIR_PERIOD);
-    options->RendPostPeriod = MAX_DIR_PERIOD;
-  }
-
   /* Check the Single Onion Service options */
   if (options_validate_single_onion(options, msg) < 0)
     return -1;
diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h
index 290a2bb9b4..0811af1388 100644
--- a/src/app/config/or_options_st.h
+++ b/src/app/config/or_options_st.h
@@ -396,8 +396,6 @@ struct or_options_t {
   /** List of suffixes for <b>AutomapHostsOnResolve</b>.  The special value
    * "." means "match everything." */
   struct smartlist_t *AutomapHostsSuffixes;
-  int RendPostPeriod; /**< How often do we post each rendezvous service
-                       * descriptor? Remember to publish them independently. */
   int KeepalivePeriod; /**< How often do we send padding cells to keep
                         * connections alive? */
   int SocksTimeout; /**< How long do we let a socks connection wait
diff --git a/src/app/config/testnet.inc b/src/app/config/testnet.inc
index 039454a0d0..2774a4c8ea 100644
--- a/src/app/config/testnet.inc
+++ b/src/app/config/testnet.inc
@@ -30,5 +30,4 @@
 { "TestingDirConnectionMaxStall", "30 seconds" },
 { "TestingEnableConnBwEvent", "1" },
 { "TestingEnableCellStatsEvent", "1" },
-{ "RendPostPeriod", "2 minutes" },
 { "___UsingTestNetworkDefaults", "1" },
diff --git a/src/feature/hs/hs_cache.c b/src/feature/hs/hs_cache.c
index cf8e377313..dcca1d7086 100644
--- a/src/feature/hs/hs_cache.c
+++ b/src/feature/hs/hs_cache.c
@@ -1081,7 +1081,7 @@ hs_cache_handle_oom(time_t now, size_t min_remove_bytes)
    *
    *   1) Deallocate all entries from v3 cache that are older than K hours
    *      2.1) If the amount of remove bytes has been reached, stop.
-   *   2) Set K = K - RendPostPeriod and repeat process until K is < 0.
+   *   2) Set K = K - 1 hour and repeat process until K is < 0.
    *
    * This ends up being O(Kn).
    */
@@ -1104,8 +1104,9 @@ hs_cache_handle_oom(time_t now, size_t min_remove_bytes)
     if (bytes_removed < min_remove_bytes) {
       /* We haven't remove enough bytes so clean v3 cache. */
       bytes_removed += cache_clean_v3_as_dir(now, cutoff);
-      /* Decrement K by a post period to shorten the cutoff. */
-      k -= get_options()->RendPostPeriod;
+      /* Decrement K by a post period to shorten the cutoff, Two minutes
+       * if we are a testing network, or one hour otherwise. */
+      k -= get_options()->TestingTorNetwork ? 120 : 3600;
     }
   } while (bytes_removed < min_remove_bytes);
 
diff --git a/src/test/conf_examples/large_1/expected b/src/test/conf_examples/large_1/expected
index fcd19db3df..73e48cf0d3 100644
--- a/src/test/conf_examples/large_1/expected
+++ b/src/test/conf_examples/large_1/expected
@@ -126,7 +126,6 @@ ReachableORAddresses 128.0.0.0/8
 RejectPlaintextPorts 23
 RelayBandwidthBurst 10000
 RelayBandwidthRate 1000
-RendPostPeriod 600
 RephistTrackTime 600
 SafeLogging 0
 Schedulers Vanilla,KISTLite,Kist
diff --git a/src/test/conf_examples/large_1/expected_no_dirauth b/src/test/conf_examples/large_1/expected_no_dirauth
index 4a19bc546c..21f08d0a33 100644
--- a/src/test/conf_examples/large_1/expected_no_dirauth
+++ b/src/test/conf_examples/large_1/expected_no_dirauth
@@ -125,7 +125,6 @@ ReachableORAddresses 128.0.0.0/8
 RejectPlaintextPorts 23
 RelayBandwidthBurst 10000
 RelayBandwidthRate 1000
-RendPostPeriod 600
 RephistTrackTime 600
 SafeLogging 0
 Schedulers Vanilla,KISTLite,Kist
diff --git a/src/test/conf_examples/large_1/torrc b/src/test/conf_examples/large_1/torrc
index 3f5b1e179f..ebf4a3fb96 100644
--- a/src/test/conf_examples/large_1/torrc
+++ b/src/test/conf_examples/large_1/torrc
@@ -133,7 +133,6 @@ ReachableORAddresses 128.0.0.0/8
 RejectPlaintextPorts 23
 RelayBandwidthBurst 10000
 RelayBandwidthRate 1000
-RendPostPeriod 10 minutes
 RephistTrackTime 10 minutes
 SafeLogging 0
 SafeSocks 0
diff --git a/src/test/test_options.c b/src/test/test_options.c
index 182e6dd572..6610e317a7 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -2005,43 +2005,6 @@ test_options_validate__testing(void *ignored)
   tor_free(msg);
 }
 
-static void
-test_options_validate__hidserv(void *ignored)
-{
-  (void)ignored;
-  int ret;
-  char *msg;
-  setup_capture_of_logs(LOG_WARN);
-
-  options_test_data_t *tdata = NULL;
-
-  free_options_test_data(tdata);
-  tdata = get_options_test_data("RendPostPeriod 1\n" );
-  mock_clean_saved_logs();
-  ret = options_validate(NULL, tdata->opt, &msg);
-  tt_int_op(ret, OP_EQ, 0);
-  expect_log_msg("RendPostPeriod option is too short;"
-            " raising to 600 seconds.\n");
-  tt_int_op(tdata->opt->RendPostPeriod, OP_EQ, 600);
-  tor_free(msg);
-
-  free_options_test_data(tdata);
-  tdata = get_options_test_data("RendPostPeriod 302401\n" );
-  mock_clean_saved_logs();
-  ret = options_validate(NULL, tdata->opt, &msg);
-  tt_int_op(ret, OP_EQ, 0);
-  expect_log_msg("RendPostPeriod is too large; "
-            "clipping to 302400s.\n");
-  tt_int_op(tdata->opt->RendPostPeriod, OP_EQ, 302400);
-  tor_free(msg);
-
- done:
-  teardown_capture_of_logs();
-  policies_free_all();
-  free_options_test_data(tdata);
-  tor_free(msg);
-}
-
 static void
 test_options_validate__path_bias(void *ignored)
 {
@@ -4270,7 +4233,6 @@ struct testcase_t options_tests[] = {
   LOCAL_VALIDATE_TEST(safe_logging),
   LOCAL_VALIDATE_TEST(publish_server_descriptor),
   LOCAL_VALIDATE_TEST(testing),
-  LOCAL_VALIDATE_TEST(hidserv),
   LOCAL_VALIDATE_TEST(path_bias),
   LOCAL_VALIDATE_TEST(bandwidth),
   LOCAL_VALIDATE_TEST(circuits),

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list