Commit 60da5d62 authored by David Goulet's avatar David Goulet 🐼
Browse files

Merge branch 'ticket40237_035_01' into ticket40237_043_01

parents 4b39f46a 04b02639
Loading
Loading
Loading
Loading

changes/ticket40237

0 → 100644
+5 −0
Original line number Diff line number Diff line
  o Major bugfixes (onion service v3):
    - Stop requiring a live consensus for v3 clients and services to work. The
      use of a reasonably live consensus will allow v3 to work properly in most
      cases if the network failed to generate a consensus for more than 2 hours
      in a row. Fixes bug 40237; bugfix on 0.3.5.1-alpha.
+2 −1
Original line number Diff line number Diff line
@@ -2155,7 +2155,8 @@ hs_service_callback(time_t now, const or_options_t *options)
  /* We need to at least be able to build circuits and that we actually have
   * a working network. */
  if (!have_completed_a_circuit() || net_is_disabled() ||
      networkstatus_get_live_consensus(now) == NULL) {
      !networkstatus_get_reasonably_live_consensus(now,
                                         usable_consensus_flavor())) {
    goto end;
  }

+4 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "feature/hs/hs_common.h"
#include "feature/hs/hs_client.h"
#include "feature/hs/hs_descriptor.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/rend/rendcache.h"

@@ -739,7 +740,9 @@ cached_client_descriptor_has_expired(time_t now,
  /* We use the current consensus time to see if we should expire this
   * descriptor since we use consensus time for all other parts of the protocol
   * as well (e.g. to build the blinded key and compute time periods). */
  const networkstatus_t *ns = networkstatus_get_live_consensus(now);
  const networkstatus_t *ns =
    networkstatus_get_reasonably_live_consensus(now,
      usable_consensus_flavor());
  /* If we don't have a recent consensus, consider this entry expired since we
   * will want to fetch a new HS desc when we get a live consensus. */
  if (!ns) {
+5 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "feature/hs/hs_descriptor.h"
#include "feature/hs/hs_ident.h"
#include "feature/nodelist/describe.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerset.h"
@@ -1207,9 +1208,10 @@ can_client_refetch_desc(const ed25519_public_key_t *identity_pk,
    goto cannot;
  }

  /* Without a live consensus we can't do any client actions. It is needed to
   * compute the hashring for a service. */
  if (!networkstatus_get_live_consensus(approx_time())) {
  /* Without a usable consensus we can't do any client actions. It is needed
   * to compute the hashring for a service. */
  if (!networkstatus_get_reasonably_live_consensus(approx_time(),
                                         usable_consensus_flavor())) {
    log_info(LD_REND, "Can't fetch descriptor for service %s because we "
                      "are missing a live consensus. Stalling connection.",
             safe_str_client(ed25519_fmt(identity_pk)));
+9 −3
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "feature/hs/hs_service.h"
#include "feature/hs_common/shared_random_client.h"
#include "feature/nodelist/describe.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerset.h"
@@ -275,7 +276,9 @@ hs_get_time_period_num(time_t now)
  if (now != 0) {
    current_time = now;
  } else {
    networkstatus_t *ns = networkstatus_get_live_consensus(approx_time());
    networkstatus_t *ns =
      networkstatus_get_reasonably_live_consensus(approx_time(),
                                                  usable_consensus_flavor());
    current_time = ns ? ns->valid_after : approx_time();
  }

@@ -1084,7 +1087,8 @@ hs_in_period_between_tp_and_srv,(const networkstatus_t *consensus, time_t now))
  time_t srv_start_time, tp_start_time;

  if (!consensus) {
    consensus = networkstatus_get_live_consensus(now);
    consensus = networkstatus_get_reasonably_live_consensus(now,
                                                  usable_consensus_flavor());
    if (!consensus) {
      return 0;
    }
@@ -1329,7 +1333,9 @@ hs_get_responsible_hsdirs(const ed25519_public_key_t *blinded_pk,
  sorted_nodes = smartlist_new();

  /* Make sure we actually have a live consensus */
  networkstatus_t *c = networkstatus_get_live_consensus(approx_time());
  networkstatus_t *c =
    networkstatus_get_reasonably_live_consensus(approx_time(),
                                                usable_consensus_flavor());
  if (!c || smartlist_len(c->routerstatus_list) == 0) {
      log_warn(LD_REND, "No live consensus so we can't get the responsible "
               "hidden service directories.");
Loading