aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2021-09-14 16:31:48 -0400
committerMike Perry <mikeperry-git@torproject.org>2022-02-22 19:28:33 +0000
commitbaaabb503c9c9fc81e0d95b2d5baeefef7423b7a (patch)
tree3ca1259e597855b96b53a73f8690b18edbc737dc /src/core
parentbd2e9a44097ff85934bc1c34f4fce2017a7a92c8 (diff)
downloadtor-baaabb503c9c9fc81e0d95b2d5baeefef7423b7a.tar.gz
tor-baaabb503c9c9fc81e0d95b2d5baeefef7423b7a.zip
Use protover to signal support for ntor3 + congestion control.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/circuituse.c3
-rw-r--r--src/core/or/extendinfo.c14
-rw-r--r--src/core/or/extendinfo.h3
-rw-r--r--src/core/or/or.h4
-rw-r--r--src/core/or/protover.c2
-rw-r--r--src/core/or/versions.c9
6 files changed, 29 insertions, 6 deletions
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c
index 2ec391eca0..104e898d6c 100644
--- a/src/core/or/circuituse.c
+++ b/src/core/or/circuituse.c
@@ -2462,7 +2462,8 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn,
digest,
NULL, /* Ed25519 ID */
NULL, NULL, /* onion keys */
- &addr, conn->socks_request->port);
+ &addr, conn->socks_request->port,
+ NULL);
} else { /* ! (want_onehop && conn->chosen_exit_name[0] == '$') */
/* We will need an onion key for the router, and we
* don't have one. Refuse or relax requirements. */
diff --git a/src/core/or/extendinfo.c b/src/core/or/extendinfo.c
index f33e887e7d..ca2288e0a4 100644
--- a/src/core/or/extendinfo.c
+++ b/src/core/or/extendinfo.c
@@ -35,7 +35,8 @@ extend_info_new(const char *nickname,
const ed25519_public_key_t *ed_id,
crypto_pk_t *onion_key,
const curve25519_public_key_t *ntor_key,
- const tor_addr_t *addr, uint16_t port)
+ const tor_addr_t *addr, uint16_t port,
+ const protover_summary_flags_t *pv)
{
extend_info_t *info = tor_malloc_zero(sizeof(extend_info_t));
if (rsa_id_digest)
@@ -57,7 +58,10 @@ extend_info_new(const char *nickname,
extend_info_add_orport(info, addr, port);
}
- info->supports_ntor3_and_param_negotiation = false; // TODO: set this.
+ if (pv) {
+ info->supports_ntor3_and_param_negotiation =
+ pv->supports_ntor3_and_param_negotiation;
+ }
return info;
}
@@ -152,7 +156,8 @@ extend_info_from_node(const node_t *node, int for_direct_connect)
rsa_pubkey,
curve_pubkey,
&ap.addr,
- ap.port);
+ ap.port,
+ &node->ri->pv);
} else if (valid_addr && node->rs && node->md) {
info = extend_info_new(node->rs->nickname,
node->identity,
@@ -160,7 +165,8 @@ extend_info_from_node(const node_t *node, int for_direct_connect)
rsa_pubkey,
curve_pubkey,
&ap.addr,
- ap.port);
+ ap.port,
+ &node->rs->pv);
}
crypto_pk_free(rsa_pubkey);
diff --git a/src/core/or/extendinfo.h b/src/core/or/extendinfo.h
index ffe8317431..8781cc7047 100644
--- a/src/core/or/extendinfo.h
+++ b/src/core/or/extendinfo.h
@@ -17,7 +17,8 @@ extend_info_t *extend_info_new(const char *nickname,
const struct ed25519_public_key_t *ed_id,
crypto_pk_t *onion_key,
const struct curve25519_public_key_t *ntor_key,
- const tor_addr_t *addr, uint16_t port);
+ const tor_addr_t *addr, uint16_t port,
+ const struct protover_summary_flags_t *pv);
extend_info_t *extend_info_from_node(const node_t *r, int for_direct_connect);
extend_info_t *extend_info_dup(extend_info_t *info);
void extend_info_free_(extend_info_t *info);
diff --git a/src/core/or/or.h b/src/core/or/or.h
index 3911797563..409f4a0fea 100644
--- a/src/core/or/or.h
+++ b/src/core/or/or.h
@@ -732,6 +732,10 @@ typedef struct protover_summary_flags_t {
* negotiate hs circuit setup padding. Requires Padding=2. */
unsigned int supports_hs_setup_padding : 1;
+ /** True iff this router supports ntor3 _and_ supports negotiating
+ * additional circuit parameters via the handshake used in ntor3.
+ */
+ unsigned int supports_ntor3_and_param_negotiation : 1;
} protover_summary_flags_t;
typedef struct routerinfo_t routerinfo_t;
diff --git a/src/core/or/protover.c b/src/core/or/protover.c
index bd9cc60115..63e9a33b72 100644
--- a/src/core/or/protover.c
+++ b/src/core/or/protover.c
@@ -430,6 +430,8 @@ protover_get_supported_protocols(void)
* XXX: WARNING!
*/
+ /* TODO: Add a new Relay=* and a new FlowCtrl=* version to indicate support
+ * for Ntorv3 and prop324. Make sure they get into the spec. */
return
"Cons=1-2 "
"Desc=1-2 "
diff --git a/src/core/or/versions.c b/src/core/or/versions.c
index b9fad22c04..322121b43f 100644
--- a/src/core/or/versions.c
+++ b/src/core/or/versions.c
@@ -482,6 +482,15 @@ memoize_protover_summary(protover_summary_flags_t *out,
protocol_list_supports_protocol(protocols, PRT_PADDING,
PROTOVER_HS_SETUP_PADDING);
+ /* TODO: Set these flags based on real values.
+ out->supports_ntor3_and_param_negotiation =
+ protocol_list_supports_protocol(protocols, PRT_RELAY,
+ XXXX)
+ &&
+ protocol_list_supports_protocol(protocols, PRT_FLOWCTRL,
+ XXXX);
+ */
+
protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
cached = strmap_set(protover_summary_map, protocols, new_cached);
tor_assert(!cached);