mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Fix crash when starting with LearnCircuitBuildTimeout 0.
Before we've set our options, we can neither call get_options() nor
networkstatus_get_latest_consensus().
Fixes bug 22252; bugfix on 4d9d2553ba
in 0.2.9.3-alpha.
This commit is contained in:
parent
a7bcab2639
commit
2ba58f275c
3
changes/bug22252
Normal file
3
changes/bug22252
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor bugfixes (configuration):
|
||||||
|
- Do not crash when starting with LearnCircuitBuildTimeout 0.
|
||||||
|
Fixes bug 22252; bugfix on 0.2.9.3-alpha.
|
@ -106,12 +106,20 @@ get_circuit_build_timeout_ms(void)
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
circuit_build_times_disabled(void)
|
circuit_build_times_disabled(void)
|
||||||
|
{
|
||||||
|
return circuit_build_times_disabled_(get_options());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** As circuit_build_times_disabled, but take options as an argument. */
|
||||||
|
int
|
||||||
|
circuit_build_times_disabled_(const or_options_t *options,
|
||||||
|
int ignore_consensus)
|
||||||
{
|
{
|
||||||
if (unit_tests) {
|
if (unit_tests) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
const or_options_t *options = get_options();
|
int consensus_disabled =
|
||||||
int consensus_disabled = networkstatus_get_param(NULL, "cbtdisabled",
|
ignore_consensus ? 0 : networkstatus_get_param(NULL, "cbtdisabled",
|
||||||
0, 0, 1);
|
0, 0, 1);
|
||||||
int config_disabled = !options->LearnCircuitBuildTimeout;
|
int config_disabled = !options->LearnCircuitBuildTimeout;
|
||||||
int dirauth_disabled = options->AuthoritativeDir;
|
int dirauth_disabled = options->AuthoritativeDir;
|
||||||
|
@ -18,6 +18,9 @@ double get_circuit_build_close_time_ms(void);
|
|||||||
double get_circuit_build_timeout_ms(void);
|
double get_circuit_build_timeout_ms(void);
|
||||||
|
|
||||||
int circuit_build_times_disabled(void);
|
int circuit_build_times_disabled(void);
|
||||||
|
int circuit_build_times_disabled_(const or_options_t *options,
|
||||||
|
int ignore_consensus);
|
||||||
|
|
||||||
int circuit_build_times_enough_to_compute(const circuit_build_times_t *cbt);
|
int circuit_build_times_enough_to_compute(const circuit_build_times_t *cbt);
|
||||||
void circuit_build_times_update_state(const circuit_build_times_t *cbt,
|
void circuit_build_times_update_state(const circuit_build_times_t *cbt,
|
||||||
or_state_t *state);
|
or_state_t *state);
|
||||||
|
@ -3450,7 +3450,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|||||||
int severity = LOG_NOTICE;
|
int severity = LOG_NOTICE;
|
||||||
/* Be a little quieter if we've deliberately disabled
|
/* Be a little quieter if we've deliberately disabled
|
||||||
* LearnCircuitBuildTimeout. */
|
* LearnCircuitBuildTimeout. */
|
||||||
if (circuit_build_times_disabled()) {
|
if (circuit_build_times_disabled_(options, 1)) {
|
||||||
severity = LOG_INFO;
|
severity = LOG_INFO;
|
||||||
}
|
}
|
||||||
log_fn(severity, LD_CONFIG, "You disabled LearnCircuitBuildTimeout, but "
|
log_fn(severity, LD_CONFIG, "You disabled LearnCircuitBuildTimeout, but "
|
||||||
|
Loading…
Reference in New Issue
Block a user