summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-05-02 09:12:04 +0000
committerRoger Dingledine <arma@torproject.org>2007-05-02 09:12:04 +0000
commit1b95bbdba60c857b679d8df4af27df0f8571c934 (patch)
treeccef7197f20bd2871cf6df97573aea5235fcfcc7 /src/or/router.c
parent87c19c0c491ab80e7b2eec5ad8075e89daee086a (diff)
downloadtor-1b95bbdba60c857b679d8df4af27df0f8571c934.tar.gz
tor-1b95bbdba60c857b679d8df4af27df0f8571c934.zip
New config option V2AuthoritativeDirectory that all directory
authorities should set. This will let future authorities choose not to serve V2 directory information. Also, go through and revamp all the authdir_mode stuff so it tries to do the right thing if you're an auth but not a V1 or V2 auth. svn:r10092
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/or/router.c b/src/or/router.c
index abb183fbb7..188a428a0d 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -377,7 +377,7 @@ init_keys(void)
(uint16_t)options->ORPort,
digest,
options->V1AuthoritativeDir, /* v1 authority */
- 1, /* v2 authority */
+ options->V2AuthoritativeDir, /* v2 authority */
options->HSAuthoritativeDir /*hidserv authority*/);
}
return 0; /* success */
@@ -594,12 +594,37 @@ authdir_mode(or_options_t *options)
{
return options->AuthoritativeDir != 0;
}
+/** Return true iff we believe ourselves to be a v1 authoritative
+ * directory server.
+ */
+int
+authdir_mode_v1(or_options_t *options)
+{
+ return authdir_mode(options) && options->V1AuthoritativeDir != 0;
+}
+/** Return true iff we believe ourselves to be a v2 authoritative
+ * directory server.
+ */
+int
+authdir_mode_v2(or_options_t *options)
+{
+ return authdir_mode(options) && options->V2AuthoritativeDir != 0;
+}
+/** Return true iff we are an authoritative directory server that
+ * handles descriptors -- including receiving posts, creating directories,
+ * and testing reachability.
+ */
+int
+authdir_mode_handles_descs(or_options_t *options)
+{
+ return authdir_mode_v1(options) || authdir_mode_v2(options);
+}
/** Return true iff we try to stay connected to all ORs at once.
*/
int
clique_mode(or_options_t *options)
{
- return authdir_mode(options);
+ return authdir_mode_handles_descs(options);
}
/** Return true iff we are trying to be a server.
@@ -647,7 +672,7 @@ proxy_mode(or_options_t *options)
* - We have ORPort set
* and
* - We believe we are reachable from the outside; or
- * - We have the AuthoritativeDirectory option set.
+ * - We are an authoritative directory server.
*/
static int
decide_if_publishable_server(void)
@@ -660,7 +685,7 @@ decide_if_publishable_server(void)
return 0;
if (!server_mode(options))
return 0;
- if (options->AuthoritativeDir)
+ if (authdir_mode(options))
return 1;
return check_whether_orport_reachable();
@@ -695,8 +720,8 @@ consider_publishable_server(int force)
* Clique maintenance -- to be phased out.
*/
-/** Return true iff this OR should try to keep connections open to all
- * other ORs. */
+/** Return true iff we believe this OR tries to keep connections open
+ * to all other ORs. */
int
router_is_clique_mode(routerinfo_t *router)
{
@@ -1128,7 +1153,7 @@ check_descriptor_ipaddress_changed(time_t now)
* headers. */
static uint32_t last_guessed_ip = 0;
-/** A directory authority told us our IP address is <b>suggestion</b>.
+/** A directory server told us our IP address is <b>suggestion</b>.
* If this address is different from the one we think we are now, and
* if our computer doesn't actually know its IP address, then switch. */
void