aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/feature/nodelist/nodelist.c2
-rw-r--r--src/rust/protover/protover.rs8
6 files changed, 20 insertions, 4 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);
diff --git a/src/feature/nodelist/nodelist.c b/src/feature/nodelist/nodelist.c
index d94e73f48f..15b3f7b600 100644
--- a/src/feature/nodelist/nodelist.c
+++ b/src/feature/nodelist/nodelist.c
@@ -1106,7 +1106,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
};
/** Return the protover_summary_flags for a given node. */
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index 8624afeafa..0b2a78c210 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -46,6 +46,7 @@ pub enum Protocol {
LinkAuth,
Microdesc,
Relay,
+ Padding,
}
impl fmt::Display for Protocol {
@@ -73,6 +74,7 @@ impl FromStr for Protocol {
"LinkAuth" => Ok(Protocol::LinkAuth),
"Microdesc" => Ok(Protocol::Microdesc),
"Relay" => Ok(Protocol::Relay),
+ "Padding" => Ok(Protocol::Padding),
_ => Err(ProtoverError::UnknownProtocol),
}
}
@@ -163,7 +165,8 @@ pub(crate) fn get_supported_protocols_cstr() -> &'static CStr {
Link=1-5 \
LinkAuth=3 \
Microdesc=1-2 \
- Relay=1-2"
+ Relay=1-2 \
+ Padding=1"
)
} else {
cstr!(
@@ -176,7 +179,8 @@ pub(crate) fn get_supported_protocols_cstr() -> &'static CStr {
Link=1-5 \
LinkAuth=1,3 \
Microdesc=1-2 \
- Relay=1-2"
+ Relay=1-2 \
+ Padding=1"
)
}
}