Merge branch 'tor-gitlab/mr/594'

This commit is contained in:
David Goulet 2022-11-01 09:11:29 -04:00
commit 15e5b203cd
10 changed files with 8 additions and 72 deletions

4
changes/bug40431 Normal file
View File

@ -0,0 +1,4 @@
o Removed features:
- Remove the RendPostPeriod option. This was primarily used in Version 2
Onion Services and after its deprecation isn't needed anymore. Closes
ticket 40431. Patch by Neel Chauhan.

View File

@ -3590,7 +3590,6 @@ The following options are used for running a testing Tor network.
TestingDirConnectionMaxStall 30 seconds TestingDirConnectionMaxStall 30 seconds
TestingEnableConnBwEvent 1 TestingEnableConnBwEvent 1
TestingEnableCellStatsEvent 1 TestingEnableCellStatsEvent 1
RendPostPeriod 2 minutes
[[TestingAuthDirTimeToLearnReachability]] **TestingAuthDirTimeToLearnReachability** __N__ **seconds**|**minutes**|**hours**:: [[TestingAuthDirTimeToLearnReachability]] **TestingAuthDirTimeToLearnReachability** __N__ **seconds**|**minutes**|**hours**::
After starting as an authority, do not make claims about whether routers After starting as an authority, do not make claims about whether routers

View File

@ -624,7 +624,6 @@ static const config_var_t option_vars_[] = {
V(RejectPlaintextPorts, CSV, ""), V(RejectPlaintextPorts, CSV, ""),
V(RelayBandwidthBurst, MEMUNIT, "0"), V(RelayBandwidthBurst, MEMUNIT, "0"),
V(RelayBandwidthRate, MEMUNIT, "0"), V(RelayBandwidthRate, MEMUNIT, "0"),
V(RendPostPeriod, INTERVAL, "1 hour"), /* Used internally. */
V(RephistTrackTime, INTERVAL, "24 hours"), V(RephistTrackTime, INTERVAL, "24 hours"),
V_IMMUTABLE(RunAsDaemon, BOOL, "0"), V_IMMUTABLE(RunAsDaemon, BOOL, "0"),
V(ReducedExitPolicy, BOOL, "0"), V(ReducedExitPolicy, BOOL, "0"),
@ -2974,19 +2973,11 @@ config_ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
return 0; 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. /** Highest allowable value for CircuitsAvailableTimeout.
* If this is too large, client connections will stay open for too long, * If this is too large, client connections will stay open for too long,
* incurring extra padding overhead. */ * incurring extra padding overhead. */
#define MAX_CIRCS_AVAILABLE_TIME (24*60*60) #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 /** Lowest allowable value for MaxCircuitDirtiness; if this is too low, Tor
* will generate too many circuits and potentially overload the network. */ * will generate too many circuits and potentially overload the network. */
#define MIN_MAX_CIRCUIT_DIRTINESS 10 #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) if (options_validate_relay_padding(old_options, options, msg) < 0)
return -1; 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 */ /* Check the Single Onion Service options */
if (options_validate_single_onion(options, msg) < 0) if (options_validate_single_onion(options, msg) < 0)
return -1; return -1;

View File

@ -396,8 +396,6 @@ struct or_options_t {
/** List of suffixes for <b>AutomapHostsOnResolve</b>. The special value /** List of suffixes for <b>AutomapHostsOnResolve</b>. The special value
* "." means "match everything." */ * "." means "match everything." */
struct smartlist_t *AutomapHostsSuffixes; 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 int KeepalivePeriod; /**< How often do we send padding cells to keep
* connections alive? */ * connections alive? */
int SocksTimeout; /**< How long do we let a socks connection wait int SocksTimeout; /**< How long do we let a socks connection wait

View File

@ -30,5 +30,4 @@
{ "TestingDirConnectionMaxStall", "30 seconds" }, { "TestingDirConnectionMaxStall", "30 seconds" },
{ "TestingEnableConnBwEvent", "1" }, { "TestingEnableConnBwEvent", "1" },
{ "TestingEnableCellStatsEvent", "1" }, { "TestingEnableCellStatsEvent", "1" },
{ "RendPostPeriod", "2 minutes" },
{ "___UsingTestNetworkDefaults", "1" }, { "___UsingTestNetworkDefaults", "1" },

View File

@ -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 * 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.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). * 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) { if (bytes_removed < min_remove_bytes) {
/* We haven't remove enough bytes so clean v3 cache. */ /* We haven't remove enough bytes so clean v3 cache. */
bytes_removed += cache_clean_v3_as_dir(now, cutoff); bytes_removed += cache_clean_v3_as_dir(now, cutoff);
/* Decrement K by a post period to shorten the cutoff. */ /* Decrement K by a post period to shorten the cutoff, Two minutes
k -= get_options()->RendPostPeriod; * if we are a testing network, or one hour otherwise. */
k -= get_options()->TestingTorNetwork ? 120 : 3600;
} }
} while (bytes_removed < min_remove_bytes); } while (bytes_removed < min_remove_bytes);

View File

@ -126,7 +126,6 @@ ReachableORAddresses 128.0.0.0/8
RejectPlaintextPorts 23 RejectPlaintextPorts 23
RelayBandwidthBurst 10000 RelayBandwidthBurst 10000
RelayBandwidthRate 1000 RelayBandwidthRate 1000
RendPostPeriod 600
RephistTrackTime 600 RephistTrackTime 600
SafeLogging 0 SafeLogging 0
Schedulers Vanilla,KISTLite,Kist Schedulers Vanilla,KISTLite,Kist

View File

@ -125,7 +125,6 @@ ReachableORAddresses 128.0.0.0/8
RejectPlaintextPorts 23 RejectPlaintextPorts 23
RelayBandwidthBurst 10000 RelayBandwidthBurst 10000
RelayBandwidthRate 1000 RelayBandwidthRate 1000
RendPostPeriod 600
RephistTrackTime 600 RephistTrackTime 600
SafeLogging 0 SafeLogging 0
Schedulers Vanilla,KISTLite,Kist Schedulers Vanilla,KISTLite,Kist

View File

@ -133,7 +133,6 @@ ReachableORAddresses 128.0.0.0/8
RejectPlaintextPorts 23 RejectPlaintextPorts 23
RelayBandwidthBurst 10000 RelayBandwidthBurst 10000
RelayBandwidthRate 1000 RelayBandwidthRate 1000
RendPostPeriod 10 minutes
RephistTrackTime 10 minutes RephistTrackTime 10 minutes
SafeLogging 0 SafeLogging 0
SafeSocks 0 SafeSocks 0

View File

@ -2005,43 +2005,6 @@ test_options_validate__testing(void *ignored)
tor_free(msg); 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 static void
test_options_validate__path_bias(void *ignored) test_options_validate__path_bias(void *ignored)
{ {
@ -4270,7 +4233,6 @@ struct testcase_t options_tests[] = {
LOCAL_VALIDATE_TEST(safe_logging), LOCAL_VALIDATE_TEST(safe_logging),
LOCAL_VALIDATE_TEST(publish_server_descriptor), LOCAL_VALIDATE_TEST(publish_server_descriptor),
LOCAL_VALIDATE_TEST(testing), LOCAL_VALIDATE_TEST(testing),
LOCAL_VALIDATE_TEST(hidserv),
LOCAL_VALIDATE_TEST(path_bias), LOCAL_VALIDATE_TEST(path_bias),
LOCAL_VALIDATE_TEST(bandwidth), LOCAL_VALIDATE_TEST(bandwidth),
LOCAL_VALIDATE_TEST(circuits), LOCAL_VALIDATE_TEST(circuits),