mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
relay: Only authorities publish a DirPort
Relay will always publish 0 as DirPort value in their descriptor from now on except authorities. Related to #40282 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
38649b4f95
commit
9541ed63a1
@ -1357,8 +1357,8 @@ decide_to_advertise_dir_impl(const or_options_t *options,
|
||||
int
|
||||
router_should_advertise_dirport(const or_options_t *options, uint16_t dir_port)
|
||||
{
|
||||
/* supports_tunnelled_dir_requests is not relevant, pass 0 */
|
||||
return decide_to_advertise_dir_impl(options, dir_port, 0) ? dir_port : 0;
|
||||
/* Only authorities should advertise a DirPort now. */
|
||||
return authdir_mode(options) ? dir_port : 0;
|
||||
}
|
||||
|
||||
/** Front-end to decide_to_advertise_dir_impl(): return 0 if we don't want to
|
||||
|
@ -302,8 +302,6 @@ test_options_validate(void *arg)
|
||||
"ServerTransportOptions did not parse",
|
||||
LOG_WARN, "\"slingsnappy\" is not a k=v", PH_VALIDATE);
|
||||
|
||||
WANT_ERR("DirPort 8080\nDirCache 0",
|
||||
"DirPort configured but DirCache disabled.", PH_VALIDATE);
|
||||
WANT_ERR("BridgeRelay 1\nDirCache 0",
|
||||
"We're a bridge but DirCache is disabled.", PH_VALIDATE);
|
||||
|
||||
@ -1932,18 +1930,6 @@ test_options_validate__publish_server_descriptor(void *ignored)
|
||||
"PublishServerDescriptor line.");
|
||||
tor_free(msg);
|
||||
|
||||
free_options_test_data(tdata);
|
||||
tdata = get_options_test_data("BridgeRelay 1\n"
|
||||
"DirPort 999\n");
|
||||
|
||||
mock_clean_saved_logs();
|
||||
ret = options_validate(NULL, tdata->opt, &msg);
|
||||
tt_int_op(ret, OP_EQ, -1);
|
||||
expect_log_msg("Can't set a DirPort on a bridge "
|
||||
"relay; disabling DirPort\n");
|
||||
tt_assert(!tdata->opt->DirPort_lines);
|
||||
tt_assert(!tdata->opt->DirPort_set);
|
||||
|
||||
done:
|
||||
teardown_capture_of_logs();
|
||||
policies_free_all();
|
||||
@ -3456,35 +3442,6 @@ test_options_validate__constrained_sockets(void *ignored)
|
||||
"between 2048 and 262144 in 1024 byte increments.");
|
||||
tor_free(msg);
|
||||
|
||||
free_options_test_data(tdata);
|
||||
tdata = get_options_test_data("ConstrainedSockets 1\n"
|
||||
"ConstrainedSockSize 2048\n"
|
||||
"DirPort 999\n"
|
||||
"DirCache 1\n"
|
||||
);
|
||||
mock_clean_saved_logs();
|
||||
ret = options_validate(NULL, tdata->opt, &msg);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
expect_log_msg("You have requested constrained "
|
||||
"socket buffers while also serving directory entries via DirPort."
|
||||
" It is strongly suggested that you disable serving directory"
|
||||
" requests when system TCP buffer resources are scarce.\n");
|
||||
tor_free(msg);
|
||||
|
||||
free_options_test_data(tdata);
|
||||
tdata = get_options_test_data("ConstrainedSockets 1\n"
|
||||
"ConstrainedSockSize 2048\n"
|
||||
);
|
||||
mock_clean_saved_logs();
|
||||
ret = options_validate(NULL, tdata->opt, &msg);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
expect_no_log_msg(
|
||||
"You have requested constrained socket buffers while also serving"
|
||||
" directory entries via DirPort. It is strongly suggested that "
|
||||
"you disable serving directory requests when system TCP buffer "
|
||||
"resources are scarce.\n");
|
||||
tor_free(msg);
|
||||
|
||||
done:
|
||||
policies_free_all();
|
||||
teardown_capture_of_logs();
|
||||
|
Loading…
Reference in New Issue
Block a user