Commit dbd7b97e authored by Roger Dingledine's avatar Roger Dingledine
Browse files

helper nodes are dead. long live entry nodes.

(config options EntryNodes and StrictEntryNodes still not
implemented.)


svn:r5673
parent 5d9256a3
This diff is collapsed.
......@@ -680,7 +680,7 @@ circuit_build_failed(circuit_t *circ)
"(%s:%d). I'm going to try to rotate to a better connection.",
n_conn->address, n_conn->port);
n_conn->is_obsolete = 1;
helper_node_set_status(n_conn->identity_digest, 0);
entry_node_set_status(n_conn->identity_digest, 0);
}
}
......
......@@ -71,6 +71,15 @@ static config_abbrev_t _option_abbrevs[] = {
{ "ORBindAddress", "ORListenAddress", 0, 0},
{ "DirBindAddress", "DirListenAddress", 0, 0},
{ "SocksBindAddress", "SocksListenAddress", 0, 0},
{ "UseHelperNodes", "UseEntryNodes", 0, 0},
{ "NumHelperNodes", "NumEntryNodes", 0, 0},
{ NULL, NULL, 0, 0},
};
/* A list of state-file abbreviations, for compatibility. */
static config_abbrev_t _state_abbrevs[] = {
{ "HelperNode", "EntryNode", 0, 0},
{ "HelperNodeDownSince", "EntryNodeDownSince", 0, 0},
{ "HelperNodeUnlistedSince", "EntryNodeUnlistedSince", 0, 0},
{ NULL, NULL, 0, 0},
};
#undef PLURAL
......@@ -170,8 +179,8 @@ static config_var_t _option_vars[] = {
VAR("NoPublish", BOOL, NoPublish, "0"),
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
VAR("NumCpus", UINT, NumCpus, "1"),
VAR("NumHelperNodes", UINT, NumHelperNodes, "3"),
VAR("ORListenAddress", LINELIST, ORListenAddress, NULL),
VAR("NumEntryNodes", UINT, NumEntryNodes, "3"),
VAR("ORListenAddress", LINELIST, ORListenAddress, NULL),
VAR("ORPort", UINT, ORPort, "0"),
VAR("OutboundBindAddress", STRING, OutboundBindAddress, NULL),
VAR("PathlenCoinWeight", DOUBLE, PathlenCoinWeight, "0.3"),
......@@ -203,7 +212,7 @@ static config_var_t _option_vars[] = {
VAR("TrackHostExits", CSV, TrackHostExits, NULL),
VAR("TrackHostExitsExpire",INTERVAL, TrackHostExitsExpire, "30 minutes"),
OBSOLETE("TrafficShaping"),
VAR("UseHelperNodes", BOOL, UseHelperNodes, "0"),
VAR("UseEntryNodes", BOOL, UseEntryNodes, "0"),
VAR("User", STRING, User, NULL),
VAR("V1AuthoritativeDirectory",BOOL, V1AuthoritativeDir, "0"),
VAR("VersioningAuthoritativeDirectory",BOOL,VersioningAuthoritativeDir, "0"),
......@@ -216,18 +225,17 @@ static config_var_t _option_vars[] = {
{ name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), \
initvalue, NULL }
static config_var_t _state_vars[] = {
VAR("AccountingBytesReadInterval", MEMUNIT, AccountingBytesReadInInterval,
NULL),
VAR("AccountingBytesReadInterval", MEMUNIT,
AccountingBytesReadInInterval, NULL),
VAR("AccountingBytesWrittenInInterval", MEMUNIT,
AccountingBytesWrittenInInterval, NULL),
VAR("AccountingExpectedUsage", MEMUNIT, AccountingExpectedUsage, NULL),
VAR("AccountingIntervalStart", ISOTIME, AccountingIntervalStart, NULL),
VAR("AccountingSecondsActive", INTERVAL, AccountingSecondsActive, NULL),
VAR("HelperNode", LINELIST_S, HelperNodes, NULL),
VAR("HelperNodeDownSince", LINELIST_S, HelperNodes, NULL),
VAR("HelperNodeUnlistedSince", LINELIST_S, HelperNodes, NULL),
VAR("HelperNodes", LINELIST_V, HelperNodes, NULL),
VAR("LastWritten", ISOTIME, LastWritten, NULL),
VAR("EntryNode", LINELIST_S, EntryNodes, NULL),
VAR("EntryNodeDownSince", LINELIST_S, EntryNodes, NULL),
VAR("EntryNodeUnlistedSince", LINELIST_S, EntryNodes, NULL),
VAR("EntryNodes", LINELIST_V, EntryNodes, NULL),
VAR("BWHistoryReadEnds", ISOTIME, BWHistoryReadEnds, NULL),
VAR("BWHistoryReadInterval", UINT, BWHistoryReadInterval, NULL),
......@@ -236,6 +244,8 @@ static config_var_t _state_vars[] = {
VAR("BWHistoryWriteInterval", UINT, BWHistoryWriteInterval, NULL),
VAR("BWHistoryWriteValues", CSV, BWHistoryWriteValues, NULL),
VAR("LastWritten", ISOTIME, LastWritten, NULL),
{ NULL, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
};
......@@ -359,7 +369,7 @@ static config_format_t state_format = {
sizeof(or_state_t),
OR_STATE_MAGIC,
STRUCT_OFFSET(or_state_t, _magic),
NULL,
_state_abbrevs,
_state_vars,
(validate_fn_t)or_state_validate,
state_description
......@@ -595,9 +605,6 @@ options_act(or_options_t *old_options)
return -1;
}
if (options->EntryNodes && strlen(options->EntryNodes))
options->UseHelperNodes = 0;
if (running_tor) {
len = strlen(options->DataDirectory)+32;
fn = tor_malloc(len);
......@@ -681,8 +688,8 @@ options_act(or_options_t *old_options)
/* Check for transitions that need action. */
if (old_options) {
if (options->UseHelperNodes && !old_options->UseHelperNodes) {
info(LD_CIRC,"Switching to helper nodes; abandoning previous circuits");
if (options->UseEntryNodes && !old_options->UseEntryNodes) {
info(LD_CIRC,"Switching to entry nodes; abandoning previous circuits");
circuit_mark_all_unused_circs();
circuit_expire_all_dirty_circs();
}
......@@ -2116,8 +2123,8 @@ options_validate(or_options_t *old_options, or_options_t *options)
if (options->HashedControlPassword && options->CookieAuthentication)
REJECT("Cannot set both HashedControlPassword and CookieAuthentication");
if (options->UseHelperNodes && ! options->NumHelperNodes)
REJECT("Cannot enable UseHelperNodes with NumHelperNodes set to 0");
if (options->UseEntryNodes && ! options->NumEntryNodes)
REJECT("Cannot enable UseEntryNodes with NumEntryNodes set to 0");
if (check_nickname_list(options->ExitNodes, "ExitNodes"))
result = -1;
......@@ -3512,7 +3519,7 @@ static int
or_state_validate(or_state_t *old_state, or_state_t *state)
{
const char *err;
if (helper_nodes_parse_state(state, 0, &err)<0) {
if (entry_nodes_parse_state(state, 0, &err)<0) {
warn(LD_GENERAL, "Unable to parse helper nodes: %s", err);
return -1;
}
......@@ -3528,7 +3535,7 @@ or_state_set(or_state_t *new_state)
if (global_state)
config_free(&state_format, global_state);
global_state = new_state;
if (helper_nodes_parse_state(global_state, 1, &err)<0)
if (entry_nodes_parse_state(global_state, 1, &err)<0)
warn(LD_GENERAL,"Unparseable helper nodes state: %s",err);
if (rep_hist_load_state(global_state, &err)<0)
warn(LD_GENERAL,"Unparseable bandwidth history state: %s",err);
......@@ -3603,7 +3610,7 @@ or_state_save(void)
size_t len;
char *fname;
helper_nodes_update_state(global_state);
entry_nodes_update_state(global_state);
rep_hist_update_state(global_state);
if (!global_state->dirty)
......
......@@ -346,7 +346,7 @@ connection_about_to_close_connection(connection_t *conn)
if (conn->state != OR_CONN_STATE_OPEN) {
if (connection_or_nonopen_was_started_here(conn)) {
rep_hist_note_connect_failed(conn->identity_digest, time(NULL));
helper_node_set_status(conn->identity_digest, 0);
entry_node_set_status(conn->identity_digest, 0);
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
}
} else if (conn->hold_open_until_flushed) {
......
......@@ -452,7 +452,7 @@ connection_or_connect(uint32_t addr, uint16_t port, const char *id_digest)
* Tor server. */
if (!options->HttpsProxy) {
router_mark_as_down(conn->identity_digest);
helper_node_set_status(conn->identity_digest, 0);
entry_node_set_status(conn->identity_digest, 0);
}
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
connection_free(conn);
......@@ -625,7 +625,7 @@ connection_or_check_valid_handshake(connection_t *conn, char *digest_rcvd)
"Identity key not as expected for router at %s:%d: wanted %s "
"but got %s",
conn->address, conn->port, expected, seen);
helper_node_set_status(conn->identity_digest, 0);
entry_node_set_status(conn->identity_digest, 0);
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED);
as_advertised = 0;
}
......@@ -687,7 +687,7 @@ connection_tls_finish_handshake(connection_t *conn)
control_event_or_conn_status(conn, OR_CONN_EVENT_CONNECTED);
if (started_here) {
rep_hist_note_connect_succeeded(conn->identity_digest, time(NULL));
if (helper_node_set_status(conn->identity_digest, 1) < 0) {
if (entry_node_set_status(conn->identity_digest, 1) < 0) {
/* pending circs get closed in circuit_about_to_close_connection() */
return -1;
}
......
......@@ -1247,7 +1247,7 @@ list_getinfo_options(void)
"config/names List of configuration options, types, and documentation.\n"
"desc/id/* Server descriptor by hex ID\n"
"desc/name/* Server descriptor by nickname.\n"
"helper-nodes Which nodes will we use as helpers?\n"
"entry-nodes Which nodes will we use as entry nodes?\n"
"info/names List of GETINFO options, types, and documentation.\n"
"network-status List of hex IDs, nicknames, server statuses.\n"
"orconn-status Status of each current OR connection.\n"
......@@ -1268,8 +1268,10 @@ handle_getinfo_helper(const char *question, char **answer)
*answer = tor_strdup(get_torrc_fname());
} else if (!strcmpstart(question, "accounting/")) {
return accounting_getinfo_helper(question, answer);
} else if (!strcmpstart(question, "helper-nodes")) {
return helper_nodes_getinfo_helper(question, answer);
} else if (!strcmpstart(question, "helper-nodes")) { /* deprecated */
return entry_nodes_getinfo(question, answer);
} else if (!strcmpstart(question, "entry-nodes")) {
return entry_nodes_getinfo(question, answer);
} else if (!strcmpstart(question, "config/")) {
return config_getinfo_helper(question, answer);
} else if (!strcmp(question, "info/names")) {
......
......@@ -1471,7 +1471,7 @@ tor_free_all(int postfork)
dns_free_all();
clear_pending_onions();
circuit_free_all();
helper_nodes_free_all();
entry_nodes_free_all();
connection_free_all();
if (!postfork) {
config_free_all();
......
......@@ -1348,9 +1348,9 @@ typedef struct {
* log whether it was DNS-leaking or not? */
int HardwareAccel; /**< Boolean: Should we enable OpenSSL hardware
* acceleration where available? */
int UseHelperNodes; /**< Boolean: Do we try to enter from a smallish number
* of fixed nodes? */
int NumHelperNodes; /**< How many helper nodes do we try to establish? */
int UseEntryNodes; /**< Boolean: Do we try to enter from a smallish number
* of fixed nodes? */
int NumEntryNodes; /**< How many helper nodes do we try to establish? */
int RephistTrackTime; /**< How many seconds do we keep rephist info? */
int FastFirstHopPK; /**< If Tor believes it is safe, should we save a third
* of our PK time by sending CREATE_FAST cells? */
......@@ -1371,7 +1371,7 @@ typedef struct {
int AccountingSecondsActive;
uint64_t AccountingExpectedUsage;
config_line_t *HelperNodes;
config_line_t *EntryNodes;
time_t BWHistoryReadEnds;
int BWHistoryReadInterval;
......@@ -1469,12 +1469,12 @@ void extend_info_free(extend_info_t *info);
routerinfo_t *build_state_get_exit_router(cpath_build_state_t *state);
const char *build_state_get_exit_nickname(cpath_build_state_t *state);
int helper_node_set_status(const char *digest, int succeeded);
void helper_nodes_set_status_from_directory(void);
void helper_nodes_update_state(or_state_t *state);
int helper_nodes_parse_state(or_state_t *state, int set, const char **err);
int helper_nodes_getinfo_helper(const char *question, char **answer);
void helper_nodes_free_all(void);
int entry_node_set_status(const char *digest, int succeeded);
void entry_nodes_set_status_from_directory(void);
void entry_nodes_update_state(or_state_t *state);
int entry_nodes_parse_state(or_state_t *state, int set, const char **err);
int entry_nodes_getinfo(const char *question, char **answer);
void entry_nodes_free_all(void);
/********************************* circuitlist.c ***********************/
......
......@@ -2695,7 +2695,7 @@ routers_update_all_from_networkstatus(void)
}
}
helper_nodes_set_status_from_directory();
entry_nodes_set_status_from_directory();
if (!have_warned_about_old_version) {
int n_recent = 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment