summaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-08-30 10:13:22 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-07 08:35:28 -0400
commitc527cde82f74849ec3b183159d20441019b77e2e (patch)
tree4a11946ed0460378926fbbf991079c3d66cc0562 /src/or/routerlist.c
parent209bfe715cc8c1c59b2578c406749a0d4a5bd8cb (diff)
downloadtor-c527cde82f74849ec3b183159d20441019b77e2e.tar.gz
tor-c527cde82f74849ec3b183159d20441019b77e2e.zip
prop224: Pick rendezvous point of protover HSRend=2
Version 3 hidden service needs rendezvous point that have the protocol version HSRend >= 2 else the rendezvous cells are rejected. Fixes #23361 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 9894019476..da2dff600e 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2799,6 +2799,7 @@ router_choose_random_node(smartlist_t *excludedsmartlist,
const int need_desc = (flags & CRN_NEED_DESC) != 0;
const int pref_addr = (flags & CRN_PREF_ADDR) != 0;
const int direct_conn = (flags & CRN_DIRECT_CONN) != 0;
+ const int rendezvous_v3 = (flags & CRN_RENDEZVOUS_V3) != 0;
smartlist_t *sl=smartlist_new(),
*excludednodes=smartlist_new();
@@ -2810,12 +2811,19 @@ router_choose_random_node(smartlist_t *excludedsmartlist,
rule = weight_for_exit ? WEIGHT_FOR_EXIT :
(need_guard ? WEIGHT_FOR_GUARD : WEIGHT_FOR_MID);
- /* Exclude relays that allow single hop exit circuits. This is an obsolete
- * option since 0.2.9.2-alpha and done by default in 0.3.1.0-alpha. */
- SMARTLIST_FOREACH(nodelist_get_list(), node_t *, node,
+ SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), node_t *, node) {
if (node_allows_single_hop_exits(node)) {
+ /* Exclude relays that allow single hop exit circuits. This is an
+ * obsolete option since 0.2.9.2-alpha and done by default in
+ * 0.3.1.0-alpha. */
smartlist_add(excludednodes, node);
- });
+ } else if (rendezvous_v3 &&
+ !node_supports_v3_rendezvous_point(node)) {
+ /* Exclude relays that do not support to rendezvous for a hidden service
+ * version 3. */
+ smartlist_add(excludednodes, node);
+ }
+ } SMARTLIST_FOREACH_END(node);
if ((r = routerlist_find_my_routerinfo()))
routerlist_add_node_and_family(excludednodes, r);