mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Stop setting bridges running in networkstatus_getinfo_by_purpose()
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
o Minor bugfixes (bridge authority):
|
||||
- We set bridges as running in a callback which runs every 5 minutes.
|
||||
Previously, we set bridges as running in a GETINFO controller as
|
||||
these shouldn't modify vital data structures. Fixes bug 24490;
|
||||
bugfix on 0.2.0.13-alpha. Patch by Neel Chauhan
|
||||
@@ -67,11 +67,11 @@ problem function-size /src/core/mainloop/connection.c:connection_handle_read_imp
|
||||
problem function-size /src/core/mainloop/connection.c:connection_buf_read_from_socket() 177
|
||||
problem function-size /src/core/mainloop/connection.c:connection_handle_write_impl() 241
|
||||
problem function-size /src/core/mainloop/connection.c:assert_connection_ok() 143
|
||||
problem file-size /src/core/mainloop/mainloop.c 3051
|
||||
problem include-count /src/core/mainloop/mainloop.c 66
|
||||
problem file-size /src/core/mainloop/mainloop.c 3076
|
||||
problem include-count /src/core/mainloop/mainloop.c 68
|
||||
problem function-size /src/core/mainloop/mainloop.c:conn_close_if_marked() 108
|
||||
problem function-size /src/core/mainloop/mainloop.c:run_connection_housekeeping() 123
|
||||
problem function-size /src/core/mainloop/mainloop.c:CALLBACK() 116
|
||||
problem function-size /src/core/mainloop/mainloop.c:CALLBACK() 118
|
||||
problem file-size /src/core/or/channel.c 3476
|
||||
problem function-size /src/core/or/channeltls.c:channel_tls_handle_var_cell() 160
|
||||
problem function-size /src/core/or/channeltls.c:channel_tls_process_versions_cell() 170
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "feature/control/control_events.h"
|
||||
#include "feature/dirauth/authmode.h"
|
||||
#include "feature/dirauth/reachability.h"
|
||||
#include "feature/dirauth/voteflags.h"
|
||||
#include "feature/dircache/consdiffmgr.h"
|
||||
#include "feature/dircache/dirserv.h"
|
||||
#include "feature/dircommon/directory.h"
|
||||
@@ -87,6 +88,7 @@
|
||||
#include "feature/nodelist/networkstatus.h"
|
||||
#include "feature/nodelist/nodelist.h"
|
||||
#include "feature/nodelist/routerlist.h"
|
||||
#include "feature/nodelist/routerlist_st.h"
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/routerkeys.h"
|
||||
#include "feature/relay/routermode.h"
|
||||
@@ -1375,6 +1377,7 @@ CALLBACK(rotate_onion_key);
|
||||
CALLBACK(rotate_x509_certificate);
|
||||
CALLBACK(save_stability);
|
||||
CALLBACK(save_state);
|
||||
CALLBACK(set_bridge_running);
|
||||
CALLBACK(write_bridge_ns);
|
||||
CALLBACK(write_stats_file);
|
||||
CALLBACK(control_per_second_events);
|
||||
@@ -1453,6 +1456,7 @@ STATIC periodic_event_item_t periodic_events[] = {
|
||||
|
||||
/* Bridge Authority only. */
|
||||
CALLBACK(write_bridge_ns, BRIDGEAUTH, 0),
|
||||
CALLBACK(set_bridge_running, BRIDGEAUTH, 0),
|
||||
|
||||
/* Directory server only. */
|
||||
CALLBACK(clean_consdiffmgr, DIRSERVER, 0),
|
||||
@@ -2583,6 +2587,27 @@ write_bridge_ns_callback(time_t now, const or_options_t *options)
|
||||
return PERIODIC_EVENT_NO_UPDATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Periodic callback: if we're the bridge authority, set the running flag on
|
||||
* bridges if they're reachable
|
||||
*/
|
||||
static int
|
||||
set_bridge_running_callback(time_t now, const or_options_t *options)
|
||||
{
|
||||
if (options->BridgeAuthoritativeDir) {
|
||||
routerlist_t *rl = router_get_routerlist();
|
||||
|
||||
SMARTLIST_FOREACH_BEGIN(rl->routers, routerinfo_t *, ri) {
|
||||
if (ri->purpose == ROUTER_PURPOSE_BRIDGE)
|
||||
dirserv_set_router_is_running(ri, now);
|
||||
} SMARTLIST_FOREACH_END(ri);
|
||||
|
||||
#define SET_BRIDGES_RUNNING_INTERVAL (3*60)
|
||||
return SET_BRIDGES_RUNNING_INTERVAL;
|
||||
}
|
||||
return PERIODIC_EVENT_NO_UPDATE;
|
||||
}
|
||||
|
||||
static int heartbeat_callback_first_time = 1;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2378,7 +2378,6 @@ networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
|
||||
smartlist_t *statuses;
|
||||
const uint8_t purpose = router_purpose_from_string(purpose_string);
|
||||
routerstatus_t rs;
|
||||
const int bridge_auth = authdir_mode_bridge(get_options());
|
||||
|
||||
if (purpose == ROUTER_PURPOSE_UNKNOWN) {
|
||||
log_info(LD_DIR, "Unrecognized purpose '%s' when listing router statuses.",
|
||||
@@ -2395,9 +2394,6 @@ networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
|
||||
continue;
|
||||
if (ri->purpose != purpose)
|
||||
continue;
|
||||
/* TODO: modifying the running flag in a getinfo is a bad idea */
|
||||
if (bridge_auth && ri->purpose == ROUTER_PURPOSE_BRIDGE)
|
||||
dirserv_set_router_is_running(ri, now);
|
||||
/* then generate and write out status lines for each of them */
|
||||
set_routerstatus_from_routerinfo(&rs, node, ri, now, 0);
|
||||
smartlist_add(statuses, networkstatus_getinfo_helper_single(&rs));
|
||||
|
||||
Reference in New Issue
Block a user