aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuitpadding.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2019-04-17 06:09:06 +0000
committerNick Mathewson <nickm@torproject.org>2019-05-13 14:30:35 -0400
commit621ea2315b3f53a9ef4ace9f3f6cb2f03a241042 (patch)
tree5262598079ea1e36fb4c3845beebf98bb0ff5ce8 /src/core/or/circuitpadding.c
parentf4064d6ce214b4b79017280a6c9db9b3f945ece1 (diff)
downloadtor-621ea2315b3f53a9ef4ace9f3f6cb2f03a241042.tar.gz
tor-621ea2315b3f53a9ef4ace9f3f6cb2f03a241042.zip
Bug 29203: Provide ReducedCircuitPadding torrc and consensus params
Diffstat (limited to 'src/core/or/circuitpadding.c')
-rw-r--r--src/core/or/circuitpadding.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index dcd8f645c4..8d2749906b 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -82,6 +82,7 @@ static double circpad_distribution_sample(circpad_distribution_t dist);
/** Cached consensus params */
static uint8_t circpad_padding_disabled;
+static uint8_t circpad_padding_reduced;
static uint8_t circpad_global_max_padding_percent;
static uint16_t circpad_global_allowed_cells;
static uint16_t circpad_max_circ_queued_cells;
@@ -1086,6 +1087,10 @@ circpad_new_consensus_params(const networkstatus_t *ns)
networkstatus_get_param(ns, "circpad_padding_disabled",
0, 0, 1);
+ circpad_padding_reduced =
+ networkstatus_get_param(ns, "circpad_padding_reduced",
+ 0, 0, 1);
+
circpad_global_allowed_cells =
networkstatus_get_param(ns, "circpad_global_allowed_cells",
0, 0, UINT16_MAX-1);
@@ -1662,6 +1667,14 @@ circpad_machine_conditions_met(origin_circuit_t *circ,
if (circpad_padding_disabled || !get_options()->CircuitPadding)
return 0;
+ /* If the consensus or our torrc has selected reduced connection padding,
+ * then only allow this machine if it is flagged as acceptable under
+ * reduced padding conditions */
+ if (circpad_padding_reduced || get_options()->ReducedCircuitPadding) {
+ if (!machine->conditions.reduced_padding_ok)
+ return 0;
+ }
+
if (!(circpad_circ_purpose_to_mask(TO_CIRCUIT(circ)->purpose)
& machine->conditions.purpose_mask))
return 0;