diff options
author | Roger Dingledine <arma@torproject.org> | 2007-06-09 07:05:19 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-06-09 07:05:19 +0000 |
commit | a97c3b8c2da5d1f1e0ac793e7ad79b8288a87bc3 (patch) | |
tree | 9d36eb6c00798193c27192fba6bfc34ab2e0775c | |
parent | 8dfde75ef68afe952058aa938f53707f98b9178c (diff) | |
download | tor-a97c3b8c2da5d1f1e0ac793e7ad79b8288a87bc3.tar.gz tor-a97c3b8c2da5d1f1e0ac793e7ad79b8288a87bc3.zip |
Be clearer on the various roles for auth dir types.
Bridge authorities no longer write bridge descriptors to their
cached-routers file -- this gets complex because of extrainfo documents.
svn:r10545
-rw-r--r-- | doc/TODO | 30 | ||||
-rw-r--r-- | src/or/config.c | 3 | ||||
-rw-r--r-- | src/or/connection_or.c | 2 | ||||
-rw-r--r-- | src/or/directory.c | 4 | ||||
-rw-r--r-- | src/or/dirserv.c | 24 | ||||
-rw-r--r-- | src/or/main.c | 4 | ||||
-rw-r--r-- | src/or/or.h | 5 | ||||
-rw-r--r-- | src/or/router.c | 24 |
8 files changed, 70 insertions, 26 deletions
@@ -87,7 +87,7 @@ Things we'd like to do in 0.2.0.x: - While we're at it, let v3 authorities have fqdns lines. - Start caching consensus documents once authorities make them - Start downloading and using consensus documents once caches serve them - . 104: Long and Short Router Descriptors (by Jun 1) + . 104: Long and Short Router Descriptors . Finalize proposal o Implement parsing for extra-info documents o Have routers generate extra-info documents. @@ -102,7 +102,7 @@ Things we'd like to do in 0.2.0.x: o Implement option to download and cache extra-info documents. o Improve the 'retry' logic on extra-info documents. - Drop bandwidth history from router-descriptors - - 105: Version negotiation for the Tor protocol (finalize by Jun 1) + - 105: Version negotiation for the Tor protocol - 108: Base "Stable" Flag on Mean Time Between Failures - 109: No more than one server per IP address o 103: Splitting identity key from regularly used signing key @@ -194,7 +194,7 @@ Things we'd like to do in 0.2.0.x: networkstatus generation; eliminate duplicate code. - Include "v" line in getinfo values. - Features: - - Traffic priorities (by Jun 1) + - Traffic priorities - Ability to prioritize own traffic over relayed traffic. o Implement a DNS proxy o Make a listener type. @@ -208,13 +208,13 @@ Things we'd like to do in 0.2.0.x: - A better UI for authority ops. - Follow weasel's proposal, crossed with mixminion dir config format - Write a proposal - - Bridges users (rudimentary version) (By Jun 1) - - Ability to specify bridges manually - D cache of bridges that we've learned about and use but aren't + - Bridges users (rudimentary version) + o Ability to specify bridges manually + - cache of bridges that we've learned about and use but aren't manually listed in the torrc. D and some mechanism for specifying that we want to stop using a given bridge in this cache. - - Config option 'UseBridges' that bridge users can turn on. + . Config option 'UseBridges' that bridge users can turn on. - uses bridges as first hop rather than entry guards. D Do we want to maintain our own set of entryguards that we use after the bridge? Open research question; let's say no for 0.2.0 @@ -223,20 +223,22 @@ Things we'd like to do in 0.2.0.x: N - Design/implement the "local-status" or something like it, from the "Descriptor purposes: how to tell them apart" section of http://archives.seul.org/or/dev/May-2007/msg00008.html - - Bridges operators (rudimentary version) (By Jun 1) + - Bridges operators (rudimentary version) - Ability to act as dir cache without a dir port. - - Bridges publish to bridge authorities + o Bridges publish to bridge authorities - Fix BEGIN_DIR so that you connect to bridge of which you only know IP (and optionally fingerprint), and then use BEGIN_DIR to learn more about it. - - Bridges authorities (rudimentary version) (By Jun 1) - - Rudimentary "do not publish networkstatus" option for bridge + - Bridges authorities (rudimentary version) + o Rudimentary "do not publish networkstatus" option for bridge authorities. - Clients can ask bridge authorities for more bridges. - - Bridges (not necessarily by Jun 1) + D Should do reachability testing but only on the purpose==bridge + descriptors we have. + - Bridges - Clients can ask bridge authorities for updates on known bridges. - More TLS normalization work: make Tor less easily - fingerprinted. (Researched by Jun 1) + fingerprinted. - Directory system improvements - config option to publish what ports you listen on, beyond ORPort/DirPort. It should support ranges and bit prefixes (?) too. @@ -266,7 +268,7 @@ N - Design/implement the "local-status" or something like it, from the - can we deprecate 'getinfo network-status'? - can we deprecate the FastFirstHopPK config option? P - Packaging: -P - Can we switch to polipo? (Jun 1) +P - Can we switch to polipo? P - If we haven't replaced privoxy, lock down its configuration in all packages, as documented in tor-doc-unix.html P - Figure out why dll's compiled in mingw don't work right in WinXP. diff --git a/src/or/config.c b/src/or/config.c index 97e1a50020..1a04c311e7 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -3713,7 +3713,8 @@ parse_dir_server_line(const char *line, int validate_only) fingerprint = smartlist_join_strings(items, "", 0, NULL); if (strlen(fingerprint) != HEX_DIGEST_LEN) { - log_warn(LD_CONFIG, "Key digest for DirServer is wrong length."); + log_warn(LD_CONFIG, "Key digest for DirServer is wrong length %d.", + (int)strlen(fingerprint)); goto err; } if (base16_decode(digest, DIGEST_LEN, fingerprint, HEX_DIGEST_LEN)<0) { diff --git a/src/or/connection_or.c b/src/or/connection_or.c index b0b8b80311..817f491349 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -676,7 +676,7 @@ connection_or_check_valid_handshake(or_connection_t *conn, int started_here, END_OR_CONN_REASON_OR_IDENTITY); as_advertised = 0; } - if (authdir_mode_handles_descs(options)) { + if (authdir_mode_tests_reachability(options)) { /* We initiated this connection to address:port. Drop all routers * with the same address:port and a different key. */ diff --git a/src/or/directory.c b/src/or/directory.c index 3290b0f4f8..a0ed7393ed 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1997,7 +1997,9 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers, if (authdir_mode_handles_descs(options) && !strcmp(url,"/tor/")) { /* server descriptor post */ const char *msg = NULL; - int r = dirserv_add_multiple_descriptors(body, &msg); + uint8_t purpose = authdir_mode_bridge(options) ? + ROUTER_PURPOSE_CONTROLLER : ROUTER_PURPOSE_GENERAL; + int r = dirserv_add_multiple_descriptors(body, purpose, &msg); tor_assert(msg); if (r > 0) dirserv_get_directory(); /* rebuild and write to disk */ diff --git a/src/or/dirserv.c b/src/or/dirserv.c index b00f68dab8..2bc99e261a 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -515,7 +515,8 @@ authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg, /** As for dirserv_add_descriptor, but accepts multiple documents, and * returns the most severe error that occurred for any one of them. */ int -dirserv_add_multiple_descriptors(const char *desc, const char **msg) +dirserv_add_multiple_descriptors(const char *desc, uint8_t purpose, + const char **msg) { int r=100; /* higher than any actual return value. */ int r_tmp; @@ -530,6 +531,17 @@ dirserv_add_multiple_descriptors(const char *desc, const char **msg) if (!router_parse_list_from_string(&s, NULL, list, SAVED_NOWHERE, 0)) { SMARTLIST_FOREACH(list, routerinfo_t *, ri, { msg_out = NULL; + + /* Assign the purpose. + * XXX020 Perhaps this should get pushed into + * router_parse_list_from_string()? Also, tie it somehow into + * router_load_single_router()? Lastly, does extrainfo_t want + * a purpose field too, or can we just piggyback off the one + * in routerinfo_t? */ + ri->purpose = purpose; + if (purpose != ROUTER_PURPOSE_GENERAL) + ri->cache_info.do_not_cache = 1; + r_tmp = dirserv_add_descriptor(ri, &msg_out); if (r_tmp < r) { r = r_tmp; @@ -544,6 +556,11 @@ dirserv_add_multiple_descriptors(const char *desc, const char **msg) if (!router_parse_list_from_string(&s, NULL, list, SAVED_NOWHERE, 1)) { SMARTLIST_FOREACH(list, extrainfo_t *, ei, { msg_out = NULL; + + /* XXX020 see above note on purpose fields */ + if (purpose != ROUTER_PURPOSE_GENERAL) + ei->cache_info.do_not_cache = 1; + r_tmp = dirserv_add_extrainfo(ei, &msg_out); if (r_tmp < r) { r = r_tmp; @@ -842,7 +859,7 @@ list_server_status(smartlist_t *routers, char **router_status_out, or_options_t *options = get_options(); /* We include v2 dir auths here too, because they need to answer * controllers. Eventually we'll deprecate this whole function. */ - int authdir = authdir_mode_handles_descs(options); + int authdir = authdir_mode_publishes_statuses(options); tor_assert(router_status_out); rs_entries = smartlist_create(); @@ -1260,8 +1277,9 @@ dirserv_pick_cached_dir_obj(cached_dir_t *cache_src, or_options_t *options = get_options(); int authority = (auth_type == V1_AUTHORITY && authdir_mode_v1(options)) || (auth_type == V2_AUTHORITY && authdir_mode_v2(options)); + /* XXX020 eventually use authdir_mode_publishes_statuses() here */ - if (!authority || authdir_mode_bridge(options)) { /* XXX020 */ + if (!authority || authdir_mode_bridge(options)) { return cache_src; } else { /* We're authoritative. */ diff --git a/src/or/main.c b/src/or/main.c index 3608b1791b..ef72f49ab4 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -916,7 +916,7 @@ run_scheduled_events(time_t now) if (accounting_is_enabled(options)) accounting_run_housekeeping(now); - if (now % 10 == 0 && (authdir_mode_handles_descs(options)) && + if (now % 10 == 0 && (authdir_mode_tests_reachability(options)) && !we_are_hibernating()) { /* try to determine reachability of the other Tor servers */ dirserv_test_reachability(0); @@ -1329,7 +1329,7 @@ do_main_loop(void) } directory_info_has_arrived(time(NULL),1); - if (authdir_mode_handles_descs(get_options())) { + if (authdir_mode_tests_reachability(get_options())) { /* the directory is already here, run startup things */ dirserv_test_reachability(1); } diff --git a/src/or/or.h b/src/or/or.h index 7d199fa6b8..7220800db8 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2684,7 +2684,8 @@ int dirserv_add_own_fingerprint(const char *nickname, crypto_pk_env_t *pk); int dirserv_load_fingerprint_file(void); void dirserv_free_fingerprint_list(void); const char *dirserv_get_nickname_by_digest(const char *digest); -int dirserv_add_multiple_descriptors(const char *desc, const char **msg); +int dirserv_add_multiple_descriptors(const char *desc, uint8_t purpose, + const char **msg); int dirserv_add_descriptor(routerinfo_t *ri, const char **msg); int getinfo_helper_dirserv_unregistered(control_connection_t *conn, const char *question, char **answer); @@ -3127,6 +3128,8 @@ int authdir_mode(or_options_t *options); int authdir_mode_v1(or_options_t *options); int authdir_mode_v2(or_options_t *options); int authdir_mode_handles_descs(or_options_t *options); +int authdir_mode_publishes_statuses(or_options_t *options); +int authdir_mode_tests_reachability(or_options_t *options); int authdir_mode_bridge(or_options_t *options); int clique_mode(or_options_t *options); int server_mode(or_options_t *options); diff --git a/src/or/router.c b/src/or/router.c index db433f5b52..7571b30da6 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -714,12 +714,30 @@ 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. + * is willing to receive or serve descriptors on its dirport. */ int authdir_mode_handles_descs(or_options_t *options) { + return authdir_mode_v1(options) || authdir_mode_v2(options) || + authdir_mode_bridge(options); +} +/** Return true iff we are an authoritative directory server that + * publishes its own network statuses. + */ +int +authdir_mode_publishes_statuses(or_options_t *options) +{ + if (authdir_mode_bridge(options)) + return 0; + return authdir_mode_v1(options) || authdir_mode_v2(options); +} +/** Return true iff we are an authoritative directory server that + * tests reachability of the descriptors it learns about. + */ +int +authdir_mode_tests_reachability(or_options_t *options) +{ return authdir_mode_v1(options) || authdir_mode_v2(options); } /** Return true iff we believe ourselves to be a bridge authoritative @@ -735,7 +753,7 @@ authdir_mode_bridge(or_options_t *options) int clique_mode(or_options_t *options) { - return authdir_mode_handles_descs(options); + return authdir_mode_tests_reachability(options); } /** Return true iff we are trying to be a server. |