]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
hs: Remove HSv3 rendezvous circuit flag used for node selection
authorDavid Goulet <dgoulet@torproject.org>
Tue, 11 Mar 2025 14:54:51 +0000 (10:54 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Thu, 20 Mar 2025 13:50:36 +0000 (09:50 -0400)
This was put in when HSv2 and v3 were co-existing. Now, the network requires
HSRend=2 which is v3 by default.

This is a simple cleanup of an internal flag used to identify a launch of a
RPv3 circuit.

Related to #41023

Signed-off-by: David Goulet <dgoulet@torproject.org>
src/core/or/circuitbuild.c
src/core/or/circuitbuild.h
src/core/or/circuitlist.c
src/core/or/circuituse.c
src/core/or/circuituse.h
src/feature/nodelist/node_select.h
src/feature/nodelist/routerlist.c
src/test/test_entrynodes.c

index dc1912294b27eba9b07fa91be7890eddb66a82d4..032b6def6ca76ab6f4542a067d42f7d516dd85e0 100644 (file)
@@ -486,15 +486,10 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t *exit_ei, int flags)
 {
   origin_circuit_t *circ;
   int err_reason = 0;
-  int is_hs_v3_rp_circuit = 0;
-
-  if (flags & CIRCLAUNCH_IS_V3_RP) {
-    is_hs_v3_rp_circuit = 1;
-  }
 
   circ = origin_circuit_init(purpose, flags);
 
-  if (onion_pick_cpath_exit(circ, exit_ei, is_hs_v3_rp_circuit) < 0 ||
+  if (onion_pick_cpath_exit(circ, exit_ei) < 0 ||
       onion_populate_cpath(circ) < 0) {
     circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NOPATH);
     return NULL;
@@ -535,7 +530,7 @@ circuit_establish_circuit_conflux,(const uint8_t *conflux_nonce,
   TO_CIRCUIT(circ)->conflux_pending_nonce =
     tor_memdup(conflux_nonce, DIGEST256_LEN);
 
-  if (onion_pick_cpath_exit(circ, exit_ei, 0) < 0 ||
+  if (onion_pick_cpath_exit(circ, exit_ei) < 0 ||
       onion_populate_cpath(circ) < 0) {
     circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NOPATH);
     return NULL;
@@ -1679,10 +1674,6 @@ choose_good_exit_server_general(router_crn_flags_t flags)
   IF_BUG_ONCE(flags & CRN_DIRECT_CONN)
     return NULL;
 
-  /* This isn't the function for picking rendezvous nodes. */
-  IF_BUG_ONCE(flags & CRN_RENDEZVOUS_V3)
-    return NULL;
-
   /* We only want exits to extend if we cannibalize the circuit.
    * But we don't require IPv6 extends yet. */
   IF_BUG_ONCE(flags & CRN_INITIATE_IPV6_EXTEND)
@@ -2121,8 +2112,7 @@ cpath_build_state_to_crn_ipv6_extend_flag(const cpath_build_state_t *state,
  *
  * Return 0 if ok, -1 if circuit should be closed. */
 STATIC int
-onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei,
-                      int is_hs_v3_rp_circuit)
+onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei)
 {
   cpath_build_state_t *state = circ->build_state;
 
@@ -2150,8 +2140,6 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei,
      * (Guards are always direct, middles are never direct.) */
     if (state->onehop_tunnel)
       flags |= CRN_DIRECT_CONN;
-    if (is_hs_v3_rp_circuit)
-      flags |= CRN_RENDEZVOUS_V3;
     if (state->need_conflux)
       flags |= CRN_CONFLUX;
     const node_t *node =
index c76259fc29b3d28f79e7b8436a52ad4ca0a7c4aa..8a756b9e399ba188fb53558faff8e31e3dd47ee4 100644 (file)
@@ -85,8 +85,7 @@ MOCK_DECL(STATIC int, count_acceptable_nodes, (const smartlist_t *nodes,
 STATIC int onion_extend_cpath(origin_circuit_t *circ);
 
 STATIC int
-onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei,
-                      int is_hs_v3_rp_circuit);
+onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit_ei);
 STATIC int cpath_build_state_to_crn_flags(const cpath_build_state_t *state);
 STATIC int cpath_build_state_to_crn_ipv6_extend_flag(
                                              const cpath_build_state_t *state,
index b90c7ebb58965e6cd1976bee13a4d7ad41105b74..6b454cab27dea82d7102255dd0f01c3a709b3364 100644 (file)
@@ -1822,30 +1822,6 @@ circuit_get_next_by_purpose(origin_circuit_t *start, uint8_t purpose)
   return NULL;
 }
 
-/** We might cannibalize this circuit: Return true if its last hop can be used
- *  as a v3 rendezvous point. */
-static int
-circuit_can_be_cannibalized_for_v3_rp(const origin_circuit_t *circ)
-{
-  if (!circ->build_state) {
-    return 0;
-  }
-
-  extend_info_t *chosen_exit = circ->build_state->chosen_exit;
-  if (BUG(!chosen_exit)) {
-    return 0;
-  }
-
-  const node_t *rp_node = node_get_by_id(chosen_exit->identity_digest);
-  if (rp_node) {
-    if (node_supports_v3_rendezvous_point(rp_node)) {
-      return 1;
-    }
-  }
-
-  return 0;
-}
-
 /** We are trying to create a circuit of purpose <b>purpose</b> and we are
  *  looking for cannibalizable circuits. Return the circuit purpose we would be
  *  willing to cannibalize. */
@@ -1975,13 +1951,6 @@ circuit_find_to_cannibalize(uint8_t purpose_to_produce, extend_info_t *info,
           } while (hop != circ->cpath);
         }
 
-        if ((flags & CIRCLAUNCH_IS_V3_RP) &&
-            !circuit_can_be_cannibalized_for_v3_rp(circ)) {
-          log_debug(LD_GENERAL, "Skipping uncannibalizable circuit for v3 "
-                    "rendezvous point.");
-          goto next;
-        }
-
         if (!best || (best->build_state->need_uptime && !need_uptime))
           best = circ;
       next: ;
index abfb51c662a84bbfaf56a3cc6c6ec02c9b9fff96..4b5d52d1a1971745767bc39acf4bacd7e723c9d9 100644 (file)
@@ -2523,7 +2523,6 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn,
       if (desired_circuit_purpose == CIRCUIT_PURPOSE_C_REND_JOINED &&
           new_circ_purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND &&
           ENTRY_TO_EDGE_CONN(conn)->hs_ident) {
-        flags |= CIRCLAUNCH_IS_V3_RP;
         log_info(LD_GENERAL, "Getting rendezvous circuit to v3 service!");
       }
 
index aa572f321265a150cd9c9aac92f3b97edfd42316..abef0f95dee4f588c24f7133b67917f3b53e52d4 100644 (file)
@@ -44,9 +44,6 @@ void circuit_build_failed(origin_circuit_t *circ);
 /** Flag to set when the last hop of a circuit doesn't need to be an
  * exit node. */
 #define CIRCLAUNCH_IS_INTERNAL      (1<<3)
-/** Flag to set when we are trying to launch a v3 rendezvous circuit. We need
- *  to apply some additional filters on the node picked. */
-#define CIRCLAUNCH_IS_V3_RP         (1<<4)
 /** Flag to set when we are trying to launch a self-testing circuit to our
  *  IPv6 ORPort. We need to apply some additional filters on the second-last
  *  node in the circuit. (We are both the client and the last node in the
index cc2e656e70ae773fe70ee98536c161890d2258ff..9dba333fe23d48b91f6ec710526dac0f36796863 100644 (file)
@@ -29,9 +29,6 @@ typedef enum router_crn_flags_t {
   /* On clients, if choosing a node for a direct connection, only provide
    * nodes that satisfy ClientPreferIPv6OR. */
   CRN_PREF_ADDR = 1<<5,
-  /* On clients, only provide nodes with HSRend=2 protocol version which
-   * is required for hidden service version 3. */
-  CRN_RENDEZVOUS_V3 = 1<<6,
   /* On clients, only provide nodes that can initiate IPv6 extends. */
   CRN_INITIATE_IPV6_EXTEND = 1<<7,
   /* On clients, only provide nodes that support Conflux (Relay=5). */
index 63de68dda79230b95b41c7fa0f1a504d171f10d7..9687a4dc3c4264a37a02d9c665489a135c66e471 100644 (file)
@@ -556,7 +556,6 @@ router_can_choose_node(const node_t *node, int flags)
   const bool need_desc = (flags & CRN_NEED_DESC) != 0;
   const bool pref_addr = (flags & CRN_PREF_ADDR) != 0;
   const bool direct_conn = (flags & CRN_DIRECT_CONN) != 0;
-  const bool rendezvous_v3 = (flags & CRN_RENDEZVOUS_V3) != 0;
   const bool initiate_ipv6_extend = (flags & CRN_INITIATE_IPV6_EXTEND) != 0;
   const bool need_conflux = (flags & CRN_CONFLUX) != 0;
 
@@ -588,11 +587,6 @@ router_can_choose_node(const node_t *node, int flags)
    * 0.3.1.0-alpha. */
   if (node_allows_single_hop_exits(node))
     return false;
-  /* Exclude relays that can not become a rendezvous for a hidden service
-   * version 3. */
-  if (rendezvous_v3 &&
-      !node_supports_v3_rendezvous_point(node))
-    return false;
   /* Exclude relay that don't do conflux if requested. */
   if (need_conflux && !node_supports_conflux(node)) {
     return false;
index 118b66dfa78c189044e5c08aede043353d3c857a..fd2f16cf11e9541af7b85525995bd50c72b7604d 100644 (file)
@@ -2982,7 +2982,7 @@ test_entry_guard_basic_path_selection(void *arg)
   oc->build_state = tor_malloc_zero(sizeof(cpath_build_state_t));
 
   /* First pick the exit and pin it on the build_state */
-  retval = onion_pick_cpath_exit(oc, NULL, 0);
+  retval = onion_pick_cpath_exit(oc, NULL);
   tt_int_op(retval, OP_EQ, 0);
 
   /* Extend path 3 times. First we pick guard, then middle, then exit. */
@@ -3050,7 +3050,7 @@ test_entry_guard_vanguard_path_selection(void *arg)
 
   /* First pick the exit and pin it on the build_state */
   tt_int_op(oc->build_state->desired_path_len, OP_EQ, 0);
-  retval = onion_pick_cpath_exit(oc, NULL, 0);
+  retval = onion_pick_cpath_exit(oc, NULL);
   tt_int_op(retval, OP_EQ, 0);
 
   /* Ensure that vanguards make 4-hop circuits by default */