mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
protover: Sort version flags by their underlying protocols
Also fix some comment typos, mainly ">=" when the code says "=". Part of 33226.
This commit is contained in:
parent
e787e521af
commit
51f32140b4
@ -830,6 +830,10 @@ typedef struct protover_summary_flags_t {
|
|||||||
* the v3 protocol detailed in proposal 224. This requires HSIntro=4. */
|
* the v3 protocol detailed in proposal 224. This requires HSIntro=4. */
|
||||||
unsigned int supports_ed25519_hs_intro : 1;
|
unsigned int supports_ed25519_hs_intro : 1;
|
||||||
|
|
||||||
|
/** True iff this router has a protocol list that allows it to support the
|
||||||
|
* ESTABLISH_INTRO DoS cell extension. Requires HSIntro=5. */
|
||||||
|
unsigned int supports_establish_intro_dos_extension : 1;
|
||||||
|
|
||||||
/** True iff this router has a protocol list that allows it to be an hidden
|
/** True iff this router has a protocol list that allows it to be an hidden
|
||||||
* service directory supporting version 3 as seen in proposal 224. This
|
* service directory supporting version 3 as seen in proposal 224. This
|
||||||
* requires HSDir=2. */
|
* requires HSDir=2. */
|
||||||
@ -841,12 +845,9 @@ typedef struct protover_summary_flags_t {
|
|||||||
unsigned int supports_v3_rendezvous_point: 1;
|
unsigned int supports_v3_rendezvous_point: 1;
|
||||||
|
|
||||||
/** True iff this router has a protocol list that allows clients to
|
/** True iff this router has a protocol list that allows clients to
|
||||||
* negotiate hs circuit setup padding. Requires Padding>=2. */
|
* negotiate hs circuit setup padding. Requires Padding=2. */
|
||||||
unsigned int supports_hs_setup_padding : 1;
|
unsigned int supports_hs_setup_padding : 1;
|
||||||
|
|
||||||
/** True iff this router has a protocol list that allows it to support the
|
|
||||||
* ESTABLISH_INTRO DoS cell extension. Requires HSIntro>=5. */
|
|
||||||
unsigned int supports_establish_intro_dos_extension : 1;
|
|
||||||
} protover_summary_flags_t;
|
} protover_summary_flags_t;
|
||||||
|
|
||||||
typedef struct routerinfo_t routerinfo_t;
|
typedef struct routerinfo_t routerinfo_t;
|
||||||
|
@ -434,25 +434,31 @@ memoize_protover_summary(protover_summary_flags_t *out,
|
|||||||
|
|
||||||
memset(out, 0, sizeof(*out));
|
memset(out, 0, sizeof(*out));
|
||||||
out->protocols_known = 1;
|
out->protocols_known = 1;
|
||||||
|
|
||||||
out->supports_extend2_cells =
|
out->supports_extend2_cells =
|
||||||
protocol_list_supports_protocol(protocols, PRT_RELAY, 2);
|
protocol_list_supports_protocol(protocols, PRT_RELAY, 2);
|
||||||
|
|
||||||
out->supports_ed25519_link_handshake_compat =
|
out->supports_ed25519_link_handshake_compat =
|
||||||
protocol_list_supports_protocol(protocols, PRT_LINKAUTH, 3);
|
protocol_list_supports_protocol(protocols, PRT_LINKAUTH, 3);
|
||||||
out->supports_ed25519_link_handshake_any =
|
out->supports_ed25519_link_handshake_any =
|
||||||
protocol_list_supports_protocol_or_later(protocols, PRT_LINKAUTH, 3);
|
protocol_list_supports_protocol_or_later(protocols, PRT_LINKAUTH, 3);
|
||||||
|
|
||||||
out->supports_ed25519_hs_intro =
|
out->supports_ed25519_hs_intro =
|
||||||
protocol_list_supports_protocol(protocols, PRT_HSINTRO, 4);
|
protocol_list_supports_protocol(protocols, PRT_HSINTRO, 4);
|
||||||
|
out->supports_establish_intro_dos_extension =
|
||||||
|
protocol_list_supports_protocol(protocols, PRT_HSINTRO, 5);
|
||||||
|
|
||||||
out->supports_v3_hsdir =
|
out->supports_v3_hsdir =
|
||||||
protocol_list_supports_protocol(protocols, PRT_HSDIR,
|
protocol_list_supports_protocol(protocols, PRT_HSDIR,
|
||||||
PROTOVER_HSDIR_V3);
|
PROTOVER_HSDIR_V3);
|
||||||
|
|
||||||
out->supports_v3_rendezvous_point =
|
out->supports_v3_rendezvous_point =
|
||||||
protocol_list_supports_protocol(protocols, PRT_HSREND,
|
protocol_list_supports_protocol(protocols, PRT_HSREND,
|
||||||
PROTOVER_HS_RENDEZVOUS_POINT_V3);
|
PROTOVER_HS_RENDEZVOUS_POINT_V3);
|
||||||
|
|
||||||
out->supports_hs_setup_padding =
|
out->supports_hs_setup_padding =
|
||||||
protocol_list_supports_protocol(protocols, PRT_PADDING,
|
protocol_list_supports_protocol(protocols, PRT_PADDING,
|
||||||
PROTOVER_HS_SETUP_PADDING);
|
PROTOVER_HS_SETUP_PADDING);
|
||||||
out->supports_establish_intro_dos_extension =
|
|
||||||
protocol_list_supports_protocol(protocols, PRT_HSINTRO, 5);
|
|
||||||
|
|
||||||
protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
|
protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
|
||||||
cached = strmap_set(protover_summary_map, protocols, new_cached);
|
cached = strmap_set(protover_summary_map, protocols, new_cached);
|
||||||
|
@ -1193,18 +1193,7 @@ node_supports_ed25519_hs_intro(const node_t *node)
|
|||||||
return node_get_protover_summary_flags(node)->supports_ed25519_hs_intro;
|
return node_get_protover_summary_flags(node)->supports_ed25519_hs_intro;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return true iff <b>node</b> supports the DoS ESTABLISH_INTRO cell
|
/** Return true iff <b>node</b> can be a rendezvous point for hidden
|
||||||
* extenstion. */
|
|
||||||
int
|
|
||||||
node_supports_establish_intro_dos_extension(const node_t *node)
|
|
||||||
{
|
|
||||||
tor_assert(node);
|
|
||||||
|
|
||||||
return node_get_protover_summary_flags(node)->
|
|
||||||
supports_establish_intro_dos_extension;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Return true iff <b>node</b> supports to be a rendezvous point for hidden
|
|
||||||
* service version 3 (HSRend=2). */
|
* service version 3 (HSRend=2). */
|
||||||
int
|
int
|
||||||
node_supports_v3_rendezvous_point(const node_t *node)
|
node_supports_v3_rendezvous_point(const node_t *node)
|
||||||
@ -1219,6 +1208,17 @@ node_supports_v3_rendezvous_point(const node_t *node)
|
|||||||
return node_get_protover_summary_flags(node)->supports_v3_rendezvous_point;
|
return node_get_protover_summary_flags(node)->supports_v3_rendezvous_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return true iff <b>node</b> supports the DoS ESTABLISH_INTRO cell
|
||||||
|
* extenstion. */
|
||||||
|
int
|
||||||
|
node_supports_establish_intro_dos_extension(const node_t *node)
|
||||||
|
{
|
||||||
|
tor_assert(node);
|
||||||
|
|
||||||
|
return node_get_protover_summary_flags(node)->
|
||||||
|
supports_establish_intro_dos_extension;
|
||||||
|
}
|
||||||
|
|
||||||
/** Return the RSA ID key's SHA1 digest for the provided node. */
|
/** Return the RSA ID key's SHA1 digest for the provided node. */
|
||||||
const uint8_t *
|
const uint8_t *
|
||||||
node_get_rsa_id_digest(const node_t *node)
|
node_get_rsa_id_digest(const node_t *node)
|
||||||
|
Loading…
Reference in New Issue
Block a user