[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/release-0.2.2] Add a VoteOnHidServDirectoriesV2 configuration option
commit 1546054d81fcc3462c37aca8a35a510d7f770533
Author: Robert Ransom <rransom.8774@xxxxxxxxx>
Date: Tue May 10 02:06:07 2011 -0700
Add a VoteOnHidServDirectoriesV2 configuration option
---
changes/bug2649a | 5 +++++
doc/tor.1.txt | 5 +++++
src/or/config.c | 1 +
src/or/dirserv.c | 16 +++++++++++-----
src/or/dirvote.h | 2 +-
src/or/networkstatus.c | 2 +-
src/or/or.h | 3 +++
7 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/changes/bug2649a b/changes/bug2649a
new file mode 100644
index 0000000..4ee31eb
--- /dev/null
+++ b/changes/bug2649a
@@ -0,0 +1,5 @@
+ o Minor features:
+ - Add a VoteOnHidServDirectoriesV2 configuration option to allow
+ directory authorities to abstain from voting on assignment of
+ the HSDir consensus flag. Related to bug 2649.
+
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 8aa32e8..9c81198 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -1335,6 +1335,11 @@ DIRECTORY AUTHORITY SERVER OPTIONS
that fine-grained information about nodes can be discarded when it hasn't
changed for a given amount of time. (Default: 24 hours)
+**VoteOnHidServDirectoriesV2** **0**|**1**::
+ When this option is set in addition to **AuthoritativeDirectory**, Tor
+ votes on whether to accept relays as hidden service directories.
+ (Default: 1)
+
HIDDEN SERVICE OPTIONS
----------------------
diff --git a/src/or/config.c b/src/or/config.c
index 44cecf3..96696fe 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -402,6 +402,7 @@ static config_var_t _option_vars[] = {
NULL),
VAR("__OwningControllerProcess",STRING,OwningControllerProcess, NULL),
V(MinUptimeHidServDirectoryV2, INTERVAL, "24 hours"),
+ V(VoteOnHidServDirectoriesV2, BOOL, "1"),
V(_UsingTestNetworkDefaults, BOOL, "0"),
{ NULL, CONFIG_TYPE_OBSOLETE, 0, NULL }
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index d114d86..4da0c4f 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2262,7 +2262,7 @@ void
set_routerstatus_from_routerinfo(routerstatus_t *rs,
routerinfo_t *ri, time_t now,
int naming, int listbadexits,
- int listbaddirs)
+ int listbaddirs, int vote_on_hsdirs)
{
int unstable_version =
!tor_version_as_new_as(ri->platform,"0.1.1.16-rc-cvs");
@@ -2306,7 +2306,7 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs,
rs->is_bad_directory = listbaddirs && ri->is_bad_directory;
rs->is_bad_exit = listbadexits && ri->is_bad_exit;
ri->is_hs_dir = dirserv_thinks_router_is_hs_dir(ri, now);
- rs->is_hs_dir = ri->is_hs_dir;
+ rs->is_hs_dir = vote_on_hsdirs && ri->is_hs_dir;
rs->is_v2_dir = ri->dir_port != 0;
if (!strcasecmp(ri->nickname, UNNAMED_ROUTER_NICKNAME))
@@ -2538,6 +2538,7 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
int naming = options->NamingAuthoritativeDir;
int listbadexits = options->AuthDirListBadExits;
int listbaddirs = options->AuthDirListBadDirs;
+ int vote_on_hsdirs = options->VoteOnHidServDirectoriesV2;
routerlist_t *rl = router_get_routerlist();
time_t now = time(NULL);
time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
@@ -2601,7 +2602,8 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
vrs = tor_malloc_zero(sizeof(vote_routerstatus_t));
rs = &vrs->status;
set_routerstatus_from_routerinfo(rs, ri, now,
- naming, listbadexits, listbaddirs);
+ naming, listbadexits, listbaddirs,
+ vote_on_hsdirs);
if (digestmap_get(omit_as_sybil, ri->cache_info.identity_digest))
clear_status_flags_on_sybil(rs);
@@ -2678,7 +2680,7 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
v3_out->server_versions = server_versions;
v3_out->known_flags = smartlist_create();
smartlist_split_string(v3_out->known_flags,
- "Authority Exit Fast Guard HSDir Stable V2Dir Valid",
+ "Authority Exit Fast Guard Stable V2Dir Valid",
0, SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
if (vote_on_reachability)
smartlist_add(v3_out->known_flags, tor_strdup("Running"));
@@ -2690,6 +2692,8 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
smartlist_add(v3_out->known_flags, tor_strdup("Named"));
smartlist_add(v3_out->known_flags, tor_strdup("Unnamed"));
}
+ if (vote_on_hsdirs)
+ smartlist_add(v3_out->known_flags, tor_strdup("HSDir"));
smartlist_sort_strings(v3_out->known_flags);
if (options->ConsensusParams) {
@@ -2754,6 +2758,7 @@ generate_v2_networkstatus_opinion(void)
int versioning = options->VersioningAuthoritativeDir;
int listbaddirs = options->AuthDirListBadDirs;
int listbadexits = options->AuthDirListBadExits;
+ int vote_on_hsdirs = options->VoteOnHidServDirectoriesV2;
const char *contact;
char *version_lines = NULL;
smartlist_t *routers = NULL;
@@ -2846,7 +2851,8 @@ generate_v2_networkstatus_opinion(void)
char *version = version_from_platform(ri->platform);
set_routerstatus_from_routerinfo(&rs, ri, now,
- naming, listbadexits, listbaddirs);
+ naming, listbadexits, listbaddirs,
+ vote_on_hsdirs);
if (digestmap_get(omit_as_sybil, ri->cache_info.identity_digest))
clear_status_flags_on_sybil(&rs);
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index 67540a3..de11fcf 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -62,7 +62,7 @@ const cached_dir_t *dirvote_get_vote(const char *fp, int flags);
void set_routerstatus_from_routerinfo(routerstatus_t *rs,
routerinfo_t *ri, time_t now,
int naming, int listbadexits,
- int listbaddirs);
+ int listbaddirs, int vote_on_hsdirs);
void router_clear_status_flags(routerinfo_t *ri);
networkstatus_t *
dirserv_generate_networkstatus_vote_obj(crypto_pk_env_t *private_key,
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 1aa4e4a..b0ef74b 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -2105,7 +2105,7 @@ networkstatus_getinfo_by_purpose(const char *purpose_string, time_t now)
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, ri, now, 0, 0, 0);
+ set_routerstatus_from_routerinfo(&rs, ri, now, 0, 0, 0, 0);
smartlist_add(statuses, networkstatus_getinfo_helper_single(&rs));
});
diff --git a/src/or/or.h b/src/or/or.h
index 456dce2..70308e0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2517,8 +2517,11 @@ typedef struct {
* we don't need to? */
int HidServDirectoryV2; /**< Do we participate in the HS DHT? */
+ int VoteOnHidServDirectoriesV2; /**< As a directory authority, vote on
+ * assignment of the HSDir flag? */
int MinUptimeHidServDirectoryV2; /**< As directory authority, accept hidden
* service directories after what time? */
+
int FetchUselessDescriptors; /**< Do we fetch non-running descriptors too? */
int AllDirActionsPrivate; /**< Should every directory action be sent
* through a Tor circuit? */
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits