mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 15:43:32 +01:00
protover: Support Relay=5 for Conflux (prop329)
Closes #40721 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
447775a5e0
commit
a9fc6c937c
@ -731,6 +731,9 @@ typedef struct protover_summary_flags_t {
|
||||
/** True iff this router supports congestion control.
|
||||
* Requires both FlowCtrl=2 *and* Relay=4 */
|
||||
unsigned int supports_congestion_control : 1;
|
||||
|
||||
/** True iff this router supports conflux. Requires Relay=5 */
|
||||
unsigned int supports_conflux : 1;
|
||||
} protover_summary_flags_t;
|
||||
|
||||
typedef struct routerinfo_t routerinfo_t;
|
||||
|
@ -55,6 +55,7 @@ static const struct {
|
||||
{ PRT_PADDING, "Padding"},
|
||||
{ PRT_CONS, "Cons" },
|
||||
{ PRT_FLOWCTRL, "FlowCtrl"},
|
||||
{ PRT_CONFLUX, "Conflux"},
|
||||
};
|
||||
|
||||
#define N_PROTOCOL_NAMES ARRAY_LENGTH(PROTOCOL_NAMES)
|
||||
@ -386,6 +387,7 @@ protocol_list_supports_protocol_or_later(const char *list,
|
||||
* XXX START OF HAZARDOUS ZONE XXX
|
||||
*/
|
||||
/* All protocol version that this relay version supports. */
|
||||
#define PR_CONFLUX_V "1"
|
||||
#define PR_CONS_V "1-2"
|
||||
#define PR_DESC_V "1-2"
|
||||
#define PR_DIRCACHE_V "2"
|
||||
@ -409,6 +411,7 @@ const char *
|
||||
protover_get_supported(const protocol_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case PRT_CONFLUX: return PR_CONFLUX_V;
|
||||
case PRT_CONS: return PR_CONS_V;
|
||||
case PRT_DESC: return PR_DESC_V;
|
||||
case PRT_DIRCACHE: return PR_DIRCACHE_V;
|
||||
@ -471,6 +474,7 @@ protover_get_supported_protocols(void)
|
||||
*/
|
||||
|
||||
return
|
||||
"Conflux=" PR_CONFLUX_V " "
|
||||
"Cons=" PR_CONS_V " "
|
||||
"Desc=" PR_DESC_V " "
|
||||
"DirCache=" PR_DIRCACHE_V " "
|
||||
|
@ -37,6 +37,8 @@ struct smartlist_t;
|
||||
#define PROTOVER_RELAY_CANONICAL_IPV6 3
|
||||
/** The protover version number where relays can accept ntorv3 */
|
||||
#define PROTOVER_RELAY_NTOR_V3 4
|
||||
/** The protover that signals conflux support. */
|
||||
#define PROTOVER_CONFLUX_V1 1
|
||||
|
||||
/** The protover version number that signifies HSv3 intro point support */
|
||||
#define PROTOVER_HS_INTRO_V3 4
|
||||
@ -72,6 +74,7 @@ typedef enum protocol_type_t {
|
||||
PRT_CONS = 9,
|
||||
PRT_PADDING = 10,
|
||||
PRT_FLOWCTRL = 11,
|
||||
PRT_CONFLUX = 12,
|
||||
} protocol_type_t;
|
||||
|
||||
bool protover_list_is_invalid(const char *s);
|
||||
|
@ -488,6 +488,13 @@ memoize_protover_summary(protover_summary_flags_t *out,
|
||||
protocol_list_supports_protocol(protocols, PRT_RELAY,
|
||||
PROTOVER_RELAY_NTOR_V3);
|
||||
|
||||
/* Conflux requires congestion control. */
|
||||
out->supports_conflux =
|
||||
protocol_list_supports_protocol(protocols, PRT_FLOWCTRL,
|
||||
PROTOVER_FLOWCTRL_CC) &&
|
||||
protocol_list_supports_protocol(protocols, PRT_CONFLUX,
|
||||
PROTOVER_CONFLUX_V1);
|
||||
|
||||
protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
|
||||
cached = strmap_set(protover_summary_map, protocols, new_cached);
|
||||
tor_assert(!cached);
|
||||
|
@ -1205,7 +1205,7 @@ node_ed25519_id_matches(const node_t *node, const ed25519_public_key_t *id)
|
||||
/** Dummy object that should be unreturnable. Used to ensure that
|
||||
* node_get_protover_summary_flags() always returns non-NULL. */
|
||||
static const protover_summary_flags_t zero_protover_flags = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
/** Return the protover_summary_flags for a given node. */
|
||||
@ -1341,6 +1341,15 @@ node_supports_accepting_ipv6_extends(const node_t *node,
|
||||
}
|
||||
}
|
||||
|
||||
/** Return true iff the given node supports conflux (Relay=5) */
|
||||
bool
|
||||
node_supports_conflux(const node_t *node)
|
||||
{
|
||||
tor_assert(node);
|
||||
|
||||
return node_get_protover_summary_flags(node)->supports_conflux;
|
||||
}
|
||||
|
||||
/** Return the RSA ID key's SHA1 digest for the provided node. */
|
||||
const uint8_t *
|
||||
node_get_rsa_id_digest(const node_t *node)
|
||||
|
@ -84,6 +84,7 @@ bool node_supports_establish_intro_dos_extension(const node_t *node);
|
||||
bool node_supports_initiating_ipv6_extends(const node_t *node);
|
||||
bool node_supports_accepting_ipv6_extends(const node_t *node,
|
||||
bool need_canonical_ipv6_conn);
|
||||
bool node_supports_conflux(const node_t *node);
|
||||
|
||||
const uint8_t *node_get_rsa_id_digest(const node_t *node);
|
||||
MOCK_DECL(smartlist_t *,node_get_link_specifier_smartlist,(const node_t *node,
|
||||
|
Loading…
Reference in New Issue
Block a user