commit 958c46b8caa3479dfaa85acedacb5c7c4ac3c286
parent 03894bfa338435b9198a4ea4cf827d156cef59b1
Author: David Goulet <dgoulet@torproject.org>
Date: Tue, 11 Mar 2025 10:54:51 -0400
hs: Remove HSv3 rendezvous circuit flag used for node selection
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>
Diffstat:
8 files changed, 6 insertions(+), 63 deletions(-)
diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
@@ -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 =
diff --git a/src/core/or/circuitbuild.h b/src/core/or/circuitbuild.h
@@ -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,
diff --git a/src/core/or/circuitlist.c b/src/core/or/circuitlist.c
@@ -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: ;
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
@@ -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!");
}
diff --git a/src/core/or/circuituse.h b/src/core/or/circuituse.h
@@ -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
diff --git a/src/feature/nodelist/node_select.h b/src/feature/nodelist/node_select.h
@@ -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). */
diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c
@@ -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;
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
@@ -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 */