aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/circuitpadding.h
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-02-25 14:59:28 +0200
committerNick Mathewson <nickm@torproject.org>2019-03-13 10:36:26 -0400
commita71999462b8d185c70169c4cba3efde6e55393ce (patch)
tree25dc5363c326e9489dc85cc78a92094e0883c0d9 /src/core/or/circuitpadding.h
parent18de065cbbcd9863842fc7f773033f295a0000dc (diff)
downloadtor-a71999462b8d185c70169c4cba3efde6e55393ce.tar.gz
tor-a71999462b8d185c70169c4cba3efde6e55393ce.zip
Fix test prob distr parameters that caused warnings.
They were causing the following warnings in circuitpadding/circuitpadding_sample_distribution: src/lib/math/prob_distr.c:1311:17: runtime error: division by zero SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/lib/math/prob_distr.c:1311:17 in src/lib/math/prob_distr.c:1219:49: runtime error: division by zero SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/lib/math/prob_distr.c:1219:49 in because the distributions were called with erroneous parameters (e.g. geometric distribution with p=0). We now defined these test probability distributions with more realistic parameters. As far as the circuitpadding_sample_distribution() test is concerned, it doesn't matter if the distributions return values outside of [0,10] since we already restrict the values into that interval using min=0 and max=10 (and RTT estimate is disabled).
Diffstat (limited to 'src/core/or/circuitpadding.h')
-rw-r--r--src/core/or/circuitpadding.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/or/circuitpadding.h b/src/core/or/circuitpadding.h
index 74f9f35c98..fefdf2ba94 100644
--- a/src/core/or/circuitpadding.h
+++ b/src/core/or/circuitpadding.h
@@ -198,14 +198,23 @@ typedef enum {
* These can be used instead of histograms for the inter-packet
* timing distribution, or to specify a distribution on the number
* of cells that can be sent while in a specific state of the state
- * machine. */
+ * machine.
+ *
+ * Each distribution takes up to two parameters which are described below. */
typedef enum {
+ /* No probability distribution is used */
CIRCPAD_DIST_NONE = 0,
+ /* Uniform distribution: param1 is lower bound and param2 is upper bound */
CIRCPAD_DIST_UNIFORM = 1,
+ /* Logistic distribution: param1 is Mu, param2 is sigma. */
CIRCPAD_DIST_LOGISTIC = 2,
+ /* Log-logistic distribution: param1 is Alpha, param2 is 1.0/Beta */
CIRCPAD_DIST_LOG_LOGISTIC = 3,
+ /* Geometric distribution: param1 is 'p' (success probability) */
CIRCPAD_DIST_GEOMETRIC = 4,
+ /* Weibull distribution: param1 is k, param2 is Lambda */
CIRCPAD_DIST_WEIBULL = 5,
+ /* Generalized Pareto distribution: param1 is sigma, param2 is xi */
CIRCPAD_DIST_PARETO = 6
} circpad_distribution_type_t;