aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2018-10-23 20:55:10 +0000
committerGeorge Kadianakis <desnacked@riseup.net>2019-01-02 15:12:16 +0200
commit659a4f06d46a0e8e4f391eda3b6d86f2ab6e4db9 (patch)
treef33207b1bf0355076b244b161b2bb093c8840c34 /src/core
parent70e9245f6feecceee96f0ea8d426e1a5a6fc9b8d (diff)
downloadtor-659a4f06d46a0e8e4f391eda3b6d86f2ab6e4db9.tar.gz
tor-659a4f06d46a0e8e4f391eda3b6d86f2ab6e4db9.zip
Circuit padding ProtoVer plumbing.
This helps us to determine if a middle node can pad to us or not. Co-authored-by: George Kadianakis <desnacked@riseup.net>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/or.h4
-rw-r--r--src/core/or/protover.c7
-rw-r--r--src/core/or/protover.h1
-rw-r--r--src/core/or/versions.c2
4 files changed, 13 insertions, 1 deletions
diff --git a/src/core/or/or.h b/src/core/or/or.h
index ca373d8ed5..f297bc9267 100644
--- a/src/core/or/or.h
+++ b/src/core/or/or.h
@@ -836,6 +836,10 @@ typedef struct protover_summary_flags_t {
* service rendezvous point supporting version 3 as seen in proposal 224.
* This requires HSRend=2. */
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;
} 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 e80fbfae81..c0c09c9d17 100644
--- a/src/core/or/protover.c
+++ b/src/core/or/protover.c
@@ -39,6 +39,9 @@ static int protocol_list_contains(const smartlist_t *protos,
static const struct {
protocol_type_t protover_type;
const char *name;
+/* If you add a new protocol here, you probably also want to add
+ * parsing for it in routerstatus_parse_entry_from_string() so that
+ * it is set in routerstatus_t */
} PROTOCOL_NAMES[] = {
{ PRT_LINK, "Link" },
{ PRT_LINKAUTH, "LinkAuth" },
@@ -49,6 +52,7 @@ static const struct {
{ PRT_HSREND, "HSRend" },
{ PRT_DESC, "Desc" },
{ PRT_MICRODESC, "Microdesc"},
+ { PRT_PADDING, "Padding"},
{ PRT_CONS, "Cons" }
};
@@ -396,7 +400,8 @@ protover_get_supported_protocols(void)
"LinkAuth=3 "
#endif
"Microdesc=1-2 "
- "Relay=1-2";
+ "Relay=1-2 "
+ "Padding=1";
}
/** The protocols from protover_get_supported_protocols(), as parsed into a
diff --git a/src/core/or/protover.h b/src/core/or/protover.h
index 7319d2f8c4..ffd4f2c18e 100644
--- a/src/core/or/protover.h
+++ b/src/core/or/protover.h
@@ -43,6 +43,7 @@ typedef enum protocol_type_t {
PRT_DESC,
PRT_MICRODESC,
PRT_CONS,
+ PRT_PADDING,
} protocol_type_t;
bool protover_contains_long_protocol_names(const char *s);
diff --git a/src/core/or/versions.c b/src/core/or/versions.c
index 7bd1f5899f..736313a9cd 100644
--- a/src/core/or/versions.c
+++ b/src/core/or/versions.c
@@ -448,6 +448,8 @@ 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);
protover_summary_flags_t *new_cached = tor_memdup(out, sizeof(*out));
cached = strmap_set(protover_summary_map, protocols, new_cached);