summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2019-08-12 13:15:31 -0500
committerMike Perry <mikeperry-git@torproject.org>2019-08-12 14:06:08 -0500
commitb2821b72bc4e228934b5187ae5015230e7cbd26b (patch)
tree5b91a58246f75f0a50d914432cd75e76e738b430
parentb14bb12e39d3ccb95a9e5d9cf3eda8428c129520 (diff)
downloadtor-b2821b72bc4e228934b5187ae5015230e7cbd26b.tar.gz
tor-b2821b72bc4e228934b5187ae5015230e7cbd26b.zip
Bug 31356: Propogate protover padding support to circpad
-rw-r--r--src/core/or/circuitpadding.c5
-rw-r--r--src/core/or/or.h4
-rw-r--r--src/core/or/protover.h2
-rw-r--r--src/core/or/versions.c5
-rw-r--r--src/test/test_circuitpadding.c4
5 files changed, 12 insertions, 8 deletions
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index cdebda33f6..a62cdcf9e6 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -2696,8 +2696,9 @@ circpad_node_supports_padding(const node_t *node)
{
if (node->rs) {
log_fn(LOG_INFO, LD_CIRC, "Checking padding: %s",
- node->rs->pv.supports_padding ? "supported" : "unsupported");
- return node->rs->pv.supports_padding;
+ node->rs->pv.supports_hs_setup_padding ?
+ "supported" : "unsupported");
+ return node->rs->pv.supports_hs_setup_padding;
}
log_fn(LOG_INFO, LD_CIRC, "Empty routerstatus in padding check");
diff --git a/src/core/or/or.h b/src/core/or/or.h
index db6d089582..ab258629a6 100644
--- a/src/core/or/or.h
+++ b/src/core/or/or.h
@@ -841,8 +841,8 @@ typedef struct protover_summary_flags_t {
unsigned int supports_v3_rendezvous_point: 1;
/** True iff this router has a protocol list that allows clients to
- * negotiate link-level padding. Requires Padding>=1. */
- unsigned int supports_padding : 1;
+ * negotiate hs circuit setup padding. Requires Padding>=2. */
+ unsigned int supports_hs_setup_padding : 1;
} protover_summary_flags_t;
typedef struct routerinfo_t routerinfo_t;
diff --git a/src/core/or/protover.h b/src/core/or/protover.h
index d8e541735f..af45a31aeb 100644
--- a/src/core/or/protover.h
+++ b/src/core/or/protover.h
@@ -28,6 +28,8 @@ struct smartlist_t;
#define PROTOVER_HS_INTRO_V3 4
/** The protover version number that signifies HSv3 rendezvous point support */
#define PROTOVER_HS_RENDEZVOUS_POINT_V3 2
+/** The protover that signals support for HS circuit setup padding machines */
+#define PROTOVER_HS_SETUP_PADDING 2
/** List of recognized subprotocols. */
/// C_RUST_COUPLED: src/rust/protover/ffi.rs `translate_to_rust`
diff --git a/src/core/or/versions.c b/src/core/or/versions.c
index 2a572d4704..06417bb4eb 100644
--- a/src/core/or/versions.c
+++ b/src/core/or/versions.c
@@ -448,8 +448,9 @@ memoize_protover_summary(protover_summary_flags_t *out,
out->supports_v3_rendezvous_point =
protocol_list_supports_protocol(protocols, PRT_HSREND,
PROTOVER_HS_RENDEZVOUS_POINT_V3);
- out->supports_padding =
- protocol_list_supports_protocol(protocols, PRT_PADDING, 1);
+ out->supports_hs_setup_padding =
+ protocol_list_supports_protocol(protocols, PRT_PADDING,
+ PROTOVER_HS_SETUP_PADDING);
protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
cached = strmap_set(protover_summary_map, protocols, new_cached);
diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c
index 236f4a192d..25f8fd311b 100644
--- a/src/test/test_circuitpadding.c
+++ b/src/test/test_circuitpadding.c
@@ -90,10 +90,10 @@ static void
nodes_init(void)
{
padding_node.rs = tor_malloc_zero(sizeof(routerstatus_t));
- padding_node.rs->pv.supports_padding = 1;
+ padding_node.rs->pv.supports_hs_setup_padding = 1;
non_padding_node.rs = tor_malloc_zero(sizeof(routerstatus_t));
- non_padding_node.rs->pv.supports_padding = 0;
+ non_padding_node.rs->pv.supports_hs_setup_padding = 0;
}
static void