Commit 06031b44 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

touchups and refactorings on bug 18616 branch

no behavior changes
parent b6ba6afa
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
  o Major bugfixes (directory mirrors):
    - Fix broken DirPort self-checks. Decide to advertise begindir
      support the same way we decide to advertise DirPorts.
      Add additional config options that might change the content of
      a relay's descriptor.
      Avoid checking ORPort reachability when the network is disabled.
      Resolves #18616, bugfix on 0c8e042c30946faa in #12538 in
      0.2.8.1-alpha. Patch by "teor".
    - Decide whether to advertise begindir support the same way we decide
      whether to advertise our DirPort. These decisions being out of sync
      led to surprising behavior like advertising begindir support when
      our hibernation config options made us not advertise a DirPort.
      Resolves bug 18616; bugfix on 0.2.8.1-alpha. Patch by teor.

  o Minor bugfixes:
    - Consider more config options when relays decide whether to regenerate
      their descriptor. Fixes more of bug 12538; bugfix on 0.2.8.1-alpha.
    - Resolve some edge cases where we might launch an ORPort reachability
      check even when DisableNetwork is set. Noticed while fixing bug
      18616; bugfix on 0.2.3.9-alpha.
+1 −1
Original line number Diff line number Diff line
@@ -984,7 +984,7 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
        }
        control_event_client_status(LOG_NOTICE, "CIRCUIT_ESTABLISHED");
        clear_broken_connection_map(1);
        if (server_mode(options) && !check_whether_orport_reachable()) {
        if (server_mode(options) && !check_whether_orport_reachable(options)) {
          inform_testing_reachability();
          consider_testing_reachability(1, 1);
        }
+3 −2
Original line number Diff line number Diff line
@@ -1426,7 +1426,7 @@ static void
circuit_testing_opened(origin_circuit_t *circ)
{
  if (have_performed_bandwidth_test ||
      !check_whether_orport_reachable()) {
      !check_whether_orport_reachable(get_options())) {
    /* either we've already done everything we want with testing circuits,
     * or this testing circuit became open due to a fluke, e.g. we picked
     * a last hop where we already had the connection open due to an
@@ -1443,7 +1443,8 @@ circuit_testing_opened(origin_circuit_t *circ)
static void
circuit_testing_failed(origin_circuit_t *circ, int at_last_hop)
{
  if (server_mode(get_options()) && check_whether_orport_reachable())
  const or_options_t *options = get_options();
  if (server_mode(options) && check_whether_orport_reachable(options))
    return;

  log_info(LD_GENERAL,
+9 −6
Original line number Diff line number Diff line
@@ -2143,6 +2143,7 @@ getinfo_helper_events(control_connection_t *control_conn,
                      const char *question, char **answer,
                      const char **errmsg)
{
  const or_options_t *options = get_options();
  (void) control_conn;
  if (!strcmp(question, "circuit-status")) {
    smartlist_t *status = smartlist_new();
@@ -2279,17 +2280,19 @@ getinfo_helper_events(control_connection_t *control_conn,
      *answer = tor_strdup(directories_have_accepted_server_descriptor()
                           ? "1" : "0");
    } else if (!strcmp(question, "status/reachability-succeeded/or")) {
      *answer = tor_strdup(check_whether_orport_reachable() ? "1" : "0");
      *answer = tor_strdup(check_whether_orport_reachable(options) ?
                            "1" : "0");
    } else if (!strcmp(question, "status/reachability-succeeded/dir")) {
      *answer = tor_strdup(check_whether_dirport_reachable() ? "1" : "0");
      *answer = tor_strdup(check_whether_dirport_reachable(options) ?
                            "1" : "0");
    } else if (!strcmp(question, "status/reachability-succeeded")) {
      tor_asprintf(answer, "OR=%d DIR=%d",
                   check_whether_orport_reachable() ? 1 : 0,
                   check_whether_dirport_reachable() ? 1 : 0);
                   check_whether_orport_reachable(options) ? 1 : 0,
                   check_whether_dirport_reachable(options) ? 1 : 0);
    } else if (!strcmp(question, "status/bootstrap-phase")) {
      *answer = tor_strdup(last_sent_bootstrap_message);
    } else if (!strcmpstart(question, "status/version/")) {
      int is_server = server_mode(get_options());
      int is_server = server_mode(options);
      networkstatus_t *c = networkstatus_get_latest_consensus();
      version_status_t status;
      const char *recommended;
@@ -2331,7 +2334,7 @@ getinfo_helper_events(control_connection_t *control_conn,
      }
      *answer = bridge_stats;
    } else if (!strcmp(question, "status/fresh-relay-descs")) {
      if (!server_mode(get_options())) {
      if (!server_mode(options)) {
        *errmsg = "Only relays have descriptors";
        return -1;
      }
+2 −2
Original line number Diff line number Diff line
@@ -1133,9 +1133,9 @@ directory_caches_unknown_auth_certs(const or_options_t *options)

/** Return 1 if we want to keep descriptors, networkstatuses, etc around.
 * Else return 0.
 * Check get_options()->DirPort_set and directory_permits_begindir_requests()
 * Check options->DirPort_set and directory_permits_begindir_requests()
 * to see if we are willing to serve these directory documents to others via
 * the DirPort and begindir over ORPort, respectively.
 * the DirPort and begindir-over-ORPort, respectively.
 */
int
directory_caches_dir_info(const or_options_t *options)
Loading