[tor-commits] [tor/maint-0.4.1] Bug 31356: Propogate protover padding support to circpad
nickm at torproject.org
nickm at torproject.org
Mon Aug 19 15:11:46 UTC 2019
commit b2821b72bc4e228934b5187ae5015230e7cbd26b
Author: Mike Perry <mikeperry-git at torproject.org>
Date: Mon Aug 12 13:15:31 2019 -0500
Bug 31356: Propogate protover padding support to circpad
---
src/core/or/circuitpadding.c | 5 +++--
src/core/or/or.h | 4 ++--
src/core/or/protover.h | 2 ++
src/core/or/versions.c | 5 +++--
src/test/test_circuitpadding.c | 4 ++--
5 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index cdebda33f..a62cdcf9e 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 db6d08958..ab258629a 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 d8e541735..af45a31ae 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 2a572d470..06417bb4e 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 236f4a192..25f8fd311 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
More information about the tor-commits
mailing list