From d888a8210fc33d9d0ad835c05a2bf8b7b6882830 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 12 Apr 2010 15:38:54 -0400 Subject: [PATCH 1/2] Fix a bug in reading CircPriorityHalflife from consensus When you mean (a=b(c,d)) >= 0, you had better not say (a=b(c,d)>=0). We did the latter, and so whenever CircPriorityHalflife was in the consensus, it was treated as having a value of 1 msec (that is, boolean true). --- changes/read_circpriorityhalflife_correctly | 5 +++++ src/or/relay.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changes/read_circpriorityhalflife_correctly diff --git a/changes/read_circpriorityhalflife_correctly b/changes/read_circpriorityhalflife_correctly new file mode 100644 index 0000000000..9fcbd6923e --- /dev/null +++ b/changes/read_circpriorityhalflife_correctly @@ -0,0 +1,5 @@ + o Major bugfixes: + - Fix a stupid parenthesization error that made every possible value + of CircPriorityHalflifeMsec get treated as "1 msec". Bugfix on + 0.2.2.7-alpha. + diff --git a/src/or/relay.c b/src/or/relay.c index 599d3d9c80..c417cbedcb 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -1865,7 +1865,7 @@ cell_ewma_set_scale_factor(or_options_t *options, networkstatus_t *consensus) source = "CircuitPriorityHalflife in configuration"; } else if (consensus && (halflife_ms = networkstatus_get_param( - consensus, "CircPriorityHalflifeMsec", -1) >= 0)) { + consensus, "CircPriorityHalflifeMsec", -1)) >= 0) { halflife = ((double)halflife_ms)/1000.0; source = "CircPriorityHalflifeMsec in consensus"; } else { From 96a0edf373b52da382206d12716ebd1cb96a1518 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 13 Apr 2010 13:29:30 -0400 Subject: [PATCH 2/2] Rename CircPriorityHalflifeMsec to CircuitPriorityHalflifeMsec Everything that accepted the 'Circ' name handled it wrong, so even now that we fixed the handling of the parameter, we wouldn't be able to set it without making all the 0.2.2.7..0.2.2.10 relays act wonky. This patch makes Tors accept the 'Circuit' name instead, so we can turn on circuit priorities without confusing the versions that treated the 'Circ' name as occasion to act weird. --- changes/read_circpriorityhalflife_correctly | 4 +++- doc/spec/dir-spec.txt | 6 ++++-- src/or/relay.c | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changes/read_circpriorityhalflife_correctly b/changes/read_circpriorityhalflife_correctly index 9fcbd6923e..651e4db284 100644 --- a/changes/read_circpriorityhalflife_correctly +++ b/changes/read_circpriorityhalflife_correctly @@ -2,4 +2,6 @@ - Fix a stupid parenthesization error that made every possible value of CircPriorityHalflifeMsec get treated as "1 msec". Bugfix on 0.2.2.7-alpha. - + - Rename CircPriorityHalflifeMsec to CircuitPriorityHalflifeMsec, + so authorities can tell newer relays about the option without + breaking older ones. diff --git a/doc/spec/dir-spec.txt b/doc/spec/dir-spec.txt index cfe6cd8f92..b88e838f36 100644 --- a/doc/spec/dir-spec.txt +++ b/doc/spec/dir-spec.txt @@ -1149,9 +1149,11 @@ transit in the network at any given time. Obeyed by Tor 0.2.1.20 and later. - "CircPriorityHalflifeMsec" -- the halflife parameter used when + "CircuitPriorityHalflifeMsec" -- the halflife parameter used when weighting which circuit will send the next cell. Obeyed by Tor - 0.2.2.7-alpha and later. + 0.2.2.10-alpha and later. (Versions of Tor between 0.2.2.7-alpha + and 0.2.2.10-alpha recognized a "CircPriorityHalflifeMsec" parameter, + but mishandled it badly.) The authority section of a vote contains the following items, followed in turn by the authority's current key certificate: diff --git a/src/or/relay.c b/src/or/relay.c index c417cbedcb..fab2d8896e 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -1865,9 +1865,9 @@ cell_ewma_set_scale_factor(or_options_t *options, networkstatus_t *consensus) source = "CircuitPriorityHalflife in configuration"; } else if (consensus && (halflife_ms = networkstatus_get_param( - consensus, "CircPriorityHalflifeMsec", -1)) >= 0) { + consensus, "CircuitPriorityHalflifeMsec", -1)) >= 0) { halflife = ((double)halflife_ms)/1000.0; - source = "CircPriorityHalflifeMsec in consensus"; + source = "CircuitPriorityHalflifeMsec in consensus"; } else { halflife = EWMA_DEFAULT_HALFLIFE; source = "Default value";