From: Nick Mathewson Date: Tue, 18 Sep 2012 20:20:01 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/maint-0.2.3' X-Git-Tag: tor-0.2.4.3-alpha~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=920c76a2fcc843bc58b79195414d3ed4b693e76e;p=thirdparty%2Ftor.git Merge remote-tracking branch 'origin/maint-0.2.3' --- 920c76a2fcc843bc58b79195414d3ed4b693e76e diff --cc src/or/circuitbuild.c index 515312f0ea,ffc7b5eaf8..840031da57 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@@ -2648,17 -2645,25 +2648,33 @@@ pathbias_count_first_hop(origin_circuit RATELIM_INIT(FIRST_HOP_NOTICE_INTERVAL); char *rate_msg = NULL; + /* We can't do path bias accounting without entry guards. + * Testing and controller circuits also have no guards. */ + if (get_options()->UseEntryGuards == 0 || + circ->_base.purpose == CIRCUIT_PURPOSE_TESTING || + circ->_base.purpose == CIRCUIT_PURPOSE_CONTROLLER) { + return 0; + } + /* Completely ignore one hop circuits */ - if (circ->build_state->onehop_tunnel) { - tor_assert(circ->build_state->desired_path_len == 1); + if (circ->build_state->onehop_tunnel || + circ->build_state->desired_path_len == 1) { + /* Check for inconsistency */ + if (circ->build_state->desired_path_len != 1 || + !circ->build_state->onehop_tunnel) { + if ((rate_msg = rate_limit_log(&first_hop_notice_limit, + approx_time()))) { + log_info(LD_BUG, + "One-hop circuit has length %d. Path state is %s. " + "Circuit is a %s currently %s. %s", + circ->build_state->desired_path_len, + pathbias_state_to_string(circ->path_state), + circuit_purpose_to_string(circ->_base.purpose), + circuit_state_to_string(circ->_base.state), + rate_msg); + } + tor_fragile_assert(); + } return 0; } @@@ -2750,17 -2755,25 +2766,33 @@@ pathbias_count_success(origin_circuit_ RATELIM_INIT(SUCCESS_NOTICE_INTERVAL); char *rate_msg = NULL; + /* We can't do path bias accounting without entry guards. + * Testing and controller circuits also have no guards. */ + if (get_options()->UseEntryGuards == 0 || + circ->_base.purpose == CIRCUIT_PURPOSE_TESTING || + circ->_base.purpose == CIRCUIT_PURPOSE_CONTROLLER) { + return; + } + /* Ignore one hop circuits */ - if (circ->build_state->onehop_tunnel) { - tor_assert(circ->build_state->desired_path_len == 1); + if (circ->build_state->onehop_tunnel || + circ->build_state->desired_path_len == 1) { + /* Check for consistency */ + if (circ->build_state->desired_path_len != 1 || + !circ->build_state->onehop_tunnel) { + if ((rate_msg = rate_limit_log(&success_notice_limit, + approx_time()))) { + log_info(LD_BUG, + "One-hop circuit has length %d. Path state is %s. " + "Circuit is a %s currently %s. %s", + circ->build_state->desired_path_len, + pathbias_state_to_string(circ->path_state), + circuit_purpose_to_string(circ->_base.purpose), + circuit_state_to_string(circ->_base.state), + rate_msg); + } + tor_fragile_assert(); + } return; }