From bcbc8c51cbc026e73e831f6641f5d1fd6ebebd9d Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 3 Mar 2011 23:51:07 -0500 Subject: [PATCH 1/7] Do not serve encrypt-only descriptors with the "all" request. Reported by piebeer --- src/or/dirserv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 1649bd7408..7db6c19a33 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2699,6 +2699,8 @@ dirserv_get_routerdesc_fingerprints(smartlist_t *fps_out, const char *key, SMARTLIST_FOREACH(rl->routers, routerinfo_t *, r, smartlist_add(fps_out, tor_memdup(r->cache_info.identity_digest, DIGEST_LEN))); + /* Treat "all" requests as if they were unencrypted */ + for_unencrypted_conn = 1; } else if (!strcmp(key, "authority")) { routerinfo_t *ri = router_get_my_routerinfo(); if (ri) From b3918b3bbbfa9097246d63746c8b540eff2ec8e8 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 6 Mar 2011 18:20:28 +0100 Subject: [PATCH 2/7] Disallow reject6 and accept6 lines in descriptors This fixes a remotely triggerable assert on directory authorities, who don't handle descriptors with ipv6 contents well yet. We will want to revert this once we're ready to handle ipv6. Issue raised by lorth on #tor, who wasn't able to use Tor anymore. Analyzed with help from Christian Fromme. Fix suggested by arma. Bugfix on 0.2.1.3-alpha. --- src/or/routerparse.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/or/routerparse.c b/src/or/routerparse.c index aa0687d883..d76b00698f 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -222,8 +222,6 @@ typedef struct token_rule_t { static token_rule_t routerdesc_token_table[] = { T0N("reject", K_REJECT, ARGS, NO_OBJ ), T0N("accept", K_ACCEPT, ARGS, NO_OBJ ), - T0N("reject6", K_REJECT6, ARGS, NO_OBJ ), - T0N("accept6", K_ACCEPT6, ARGS, NO_OBJ ), T1_START( "router", K_ROUTER, GE(5), NO_OBJ ), T1( "signing-key", K_SIGNING_KEY, NO_ARGS, NEED_KEY_1024 ), T1( "onion-key", K_ONION_KEY, NO_ARGS, NEED_KEY_1024 ), From fb421c00052cfebda33c4d42346c7eeef30f865f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 6 Mar 2011 13:15:32 -0500 Subject: [PATCH 3/7] Changes file for ipv6 parsing issue --- changes/ipv6_crash | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changes/ipv6_crash diff --git a/changes/ipv6_crash b/changes/ipv6_crash new file mode 100644 index 0000000000..2b04355a57 --- /dev/null +++ b/changes/ipv6_crash @@ -0,0 +1,3 @@ + o Major bugfixes (directory authority) + - Fix a crash in parsing router descriptors containing IPv6 + addresses. Bugfix on 0.2.1.3-alpha. From 8b01fd7badc893b849d4394a2b72d422eecf7913 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 6 Mar 2011 13:16:53 -0500 Subject: [PATCH 4/7] exit_policy_is_general_exit is IPv4 only; it should admit it. --- src/or/policies.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/or/policies.c b/src/or/policies.c index 0a8fd7328e..f8c36c784b 100644 --- a/src/or/policies.c +++ b/src/or/policies.c @@ -880,6 +880,8 @@ exit_policy_is_general_exit(smartlist_t *policy) for (i = 0; i < 3; ++i) { SMARTLIST_FOREACH(policy, addr_policy_t *, p, { + if (tor_addr_family(&p->addr) != AF_INET) + continue; /* IPv4 only for now */ if (p->prt_min > ports[i] || p->prt_max < ports[i]) continue; /* Doesn't cover our port. */ if (p->maskbits > 8) From 3da0837b0b114bb320a244679325d25d664752c1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 6 Mar 2011 13:26:38 -0500 Subject: [PATCH 5/7] Revert "Disallow reject6 and accept6 lines in descriptors" This reverts commit b3918b3bbbfa9097246d63746c8b540eff2ec8e8. --- src/or/routerparse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/or/routerparse.c b/src/or/routerparse.c index d76b00698f..aa0687d883 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -222,6 +222,8 @@ typedef struct token_rule_t { static token_rule_t routerdesc_token_table[] = { T0N("reject", K_REJECT, ARGS, NO_OBJ ), T0N("accept", K_ACCEPT, ARGS, NO_OBJ ), + T0N("reject6", K_REJECT6, ARGS, NO_OBJ ), + T0N("accept6", K_ACCEPT6, ARGS, NO_OBJ ), T1_START( "router", K_ROUTER, GE(5), NO_OBJ ), T1( "signing-key", K_SIGNING_KEY, NO_ARGS, NEED_KEY_1024 ), T1( "onion-key", K_ONION_KEY, NO_ARGS, NEED_KEY_1024 ), From b231026c42ea5cd884b4bde25cde3ba2c6e5ca98 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 6 Mar 2011 13:35:24 -0500 Subject: [PATCH 6/7] changes file for careful_with_all_descs --- changes/all_descs | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changes/all_descs diff --git a/changes/all_descs b/changes/all_descs new file mode 100644 index 0000000000..10711b2621 --- /dev/null +++ b/changes/all_descs @@ -0,0 +1,4 @@ + o Major bugfixes (bridge authority) + - Do not allow encrypte requests for "all" bridges to return all + bridges. + From 2ce132e335d60c7ef1d01aa00db5ab4c5b7d674f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 6 Mar 2011 13:31:06 -0500 Subject: [PATCH 7/7] Oops, here's the *REAL* fix for the ipv6 issue We need to _REJECT_ descriptors with accept6/reject6 lines. If we let them onto the network , other un-upgraded tors will crash. --- changes/ipv6_crash | 5 +++-- src/or/routerparse.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changes/ipv6_crash b/changes/ipv6_crash index 2b04355a57..02f8aaa41c 100644 --- a/changes/ipv6_crash +++ b/changes/ipv6_crash @@ -1,3 +1,4 @@ - o Major bugfixes (directory authority) + o Major bugfixes: - Fix a crash in parsing router descriptors containing IPv6 - addresses. Bugfix on 0.2.1.3-alpha. + addresses. This one crashed the directory authorities when somebody + fired up some experimental code. Bugfix on 0.2.1.3-alpha. diff --git a/src/or/routerparse.c b/src/or/routerparse.c index aa0687d883..1faa177edf 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -1369,6 +1369,12 @@ router_parse_entry_from_string(const char *s, const char *end, router->has_old_dnsworkers = 1; } + if (find_opt_by_keyword(tokens, K_REJECT6) || + find_opt_by_keyword(tokens, K_ACCEPT6)) { + log_warn(LD_DIR, "Rejecting router with reject6/accept6 line: they crash " + "older Tors."); + goto err; + } exit_policy_tokens = find_all_exitpolicy(tokens); if (!smartlist_len(exit_policy_tokens)) { log_warn(LD_DIR, "No exit policy tokens in descriptor.");