aboutsummaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-03-14 16:34:33 -0400
committerNick Mathewson <nickm@torproject.org>2011-03-14 16:34:33 -0400
commite91a8c5589be1f562563a73c6e866a3b84afee87 (patch)
tree98df41dbc7dfe797cf47c583c6869c8e7decdc0d /src/or/routerlist.c
parentf1c365b032e058e7342b632006435ecc175475a3 (diff)
parent0588330c1d66960353c412812d1d073fdb37e310 (diff)
downloadtor-e91a8c5589be1f562563a73c6e866a3b84afee87.tar
tor-e91a8c5589be1f562563a73c6e866a3b84afee87.tar.gz
Merge remote branch 'origin/maint-0.2.2'
Resolved nontrivial conflict around rewrite_x_address_for_bridge and learned_bridge_descriptor. Now, since leanred_bridge_descriptor works on nodes, we must make sure that rewrite_node_address_for_bridge also works on nodes. Conflicts: src/or/circuitbuild.c
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 66066f68d..1205fd123 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3233,7 +3233,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
int from_cache, int from_fetch)
{
const char *id_digest;
- int authdir = authdir_mode_handles_descs(get_options(), router->purpose);
+ or_options_t *options = get_options();
+ int authdir = authdir_mode_handles_descs(options, router->purpose);
int authdir_believes_valid = 0;
routerinfo_t *old_router;
networkstatus_t *consensus = networkstatus_get_latest_consensus();
@@ -3339,6 +3340,20 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
return ROUTER_NOT_IN_CONSENSUS;
}
+ /* If we're reading a bridge descriptor from our cache, and we don't
+ * recognize it as one of our currently configured bridges, drop the
+ * descriptor. Otherwise we could end up using it as one of our entry
+ * guards even if it isn't in our Bridge config lines. */
+ if (router->purpose == ROUTER_PURPOSE_BRIDGE && from_cache &&
+ !authdir_mode_bridge(options) &&
+ !routerinfo_is_a_configured_bridge(router)) {
+ log_info(LD_DIR, "Dropping bridge descriptor for '%s' because we have "
+ "no bridge configured at that address.", router->nickname);
+ *msg = "Router descriptor was not a configured bridge.";
+ routerinfo_free(router);
+ return ROUTER_WAS_NOT_WANTED;
+ }
+
/* If we have a router with the same identity key, choose the newer one. */
if (old_router) {
if (!in_consensus && (router->cache_info.published_on <=