From 85c80adf4a75e1f44250379a4806796a26e861e3 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 14 Jul 2017 16:37:13 -0400 Subject: prop224: HSDir v3 support is >= 0.3.0.8 Because of bug #22447, we have to select nodes that are at least this version. Signed-off-by: David Goulet --- src/or/routerparse.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/or/routerparse.c') diff --git a/src/or/routerparse.c b/src/or/routerparse.c index f4e87a00d8..ec63aef4d4 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -2718,6 +2718,11 @@ routerstatus_parse_entry_from_string(memarea_t *area, tor_version_as_new_as(tok->args[0], "0.2.4.8-alpha"); rs->protocols_known = 1; } + if (!strcmpstart(tok->args[0], "Tor ") && found_protocol_list) { + /* Bug #22447 forces us to filter on this version. */ + rs->supports_v3_hsdir = + tor_version_as_new_as(tok->args[0], "0.3.0.8"); + } if (vote_rs) { vote_rs->version = tor_strdup(tok->args[0]); } -- cgit v1.2.3-54-g00ecf From 440eaa9b22573cdb0d38bf5c13200cc1077a453f Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Thu, 3 Aug 2017 16:08:17 +0300 Subject: Correctly assign HSDir flags based on protocol list In Nick's words: "We want to always return false if the platform is a Tor version, and it is not as new as 0.3.0.8 -- but if the platform is not a Tor version, or if the version is as new as 0.3.0.8, then we want to obey the protocol list. That way, other implementations of our protocol won't have to claim any particular Tor version, and future versions of Tor will have the freedom to drop this protocol in the distant future." --- src/or/nodelist.c | 9 +++++++-- src/or/routerparse.c | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src/or/routerparse.c') diff --git a/src/or/nodelist.c b/src/or/nodelist.c index abbe15ecc2..e900b51455 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -800,9 +800,14 @@ node_supports_v3_hsdir(const node_t *node) if (node->ri->protocol_list == NULL) { return 0; } + /* Bug #22447 forces us to filter on tor version: + * If platform is a Tor version, and older than 0.3.0.8, return False. + * Else, obey the protocol list. */ if (node->ri->platform) { - /* Bug #22447 forces us to filter on this version. */ - return tor_version_as_new_as(node->ri->platform, "0.3.0.8"); + if (!strcmpstart(node->ri->platform, "Tor ") && + !tor_version_as_new_as(node->ri->platform, "0.3.0.8")) { + return 0; + } } return protocol_list_supports_protocol(node->ri->protocol_list, PRT_HSDIR, PROTOVER_HSDIR_V3); diff --git a/src/or/routerparse.c b/src/or/routerparse.c index ec63aef4d4..db42a44ee4 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -2706,7 +2706,8 @@ routerstatus_parse_entry_from_string(memarea_t *area, rs->supports_ed25519_hs_intro = protocol_list_supports_protocol(tok->args[0], PRT_HSINTRO, 4); rs->supports_v3_hsdir = - protocol_list_supports_protocol(tok->args[0], PRT_HSDIR, 2); + protocol_list_supports_protocol(tok->args[0], PRT_HSDIR, + PROTOVER_HSDIR_V3); } if ((tok = find_opt_by_keyword(tokens, K_V))) { tor_assert(tok->n_args == 1); @@ -2720,8 +2721,9 @@ routerstatus_parse_entry_from_string(memarea_t *area, } if (!strcmpstart(tok->args[0], "Tor ") && found_protocol_list) { /* Bug #22447 forces us to filter on this version. */ - rs->supports_v3_hsdir = - tor_version_as_new_as(tok->args[0], "0.3.0.8"); + if (!tor_version_as_new_as(tok->args[0], "0.3.0.8")) { + rs->supports_v3_hsdir = 0; + } } if (vote_rs) { vote_rs->version = tor_strdup(tok->args[0]); -- cgit v1.2.3-54-g00ecf