commit fb3704b45982e6a97dbad4e2d6e9cf7ba8fd1151
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Wed Dec 9 13:10:53 2020 -0500
New consensus method to find bwweightscale & maxunmeasuredbw correctly.
Our original code for parsing these parameters out of our list of
parameters pre-dated us having the
dirvote_get_intermediate_param_value() function... and it was buggy.
Specifically, it would reject any " ... K=V ..." value
where there were additional …
[View More]unconverted characters after the V, and
use the default value instead,
We haven't run into this yet because we've never voted for
bwweightscale to be anything besides the default 10000, or
maxunmeasuredbw to be anything besides the default 20.
This requires a new consensus method because it is a change in how
consensuses are computed.
Fixes bug 19011; bugfix on 0.2.2.10-alpha.
---
changes/bug19011 | 7 +++
src/feature/dirauth/dirvote.c | 115 +++++++++++++++++++++++-------------------
src/feature/dirauth/dirvote.h | 10 +++-
src/test/test_dirvote.c | 25 +++++++++
4 files changed, 105 insertions(+), 52 deletions(-)
diff --git a/changes/bug19011 b/changes/bug19011
new file mode 100644
index 0000000000..de178fd438
--- /dev/null
+++ b/changes/bug19011
@@ -0,0 +1,7 @@
+ o Minor bugfixes (directory authorities, voting):
+ - Add a new consensus method (31) to support any future changes that
+ authorities decide to make to the value of bwweightscale or
+ maxunmeasuredbw. Previously, there was a bug that prevented the
+ authorities from parsing these consensus parameters correctly under
+ most circumstances.
+ Fixes bug 19011; bugfix on 0.2.2.10-alpha.
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
index a1f9bb28ae..4f494a75a3 100644
--- a/src/feature/dirauth/dirvote.c
+++ b/src/feature/dirauth/dirvote.c
@@ -1757,26 +1757,14 @@ networkstatus_compute_consensus(smartlist_t *votes,
}
{
- char *max_unmeasured_param = NULL;
- /* XXXX Extract this code into a common function. Or don't! see #19011 */
- if (params) {
- if (strcmpstart(params, "maxunmeasuredbw=") == 0)
- max_unmeasured_param = params;
- else
- max_unmeasured_param = strstr(params, " maxunmeasuredbw=");
- }
- if (max_unmeasured_param) {
- int ok = 0;
- char *eq = strchr(max_unmeasured_param, '=');
- if (eq) {
- max_unmeasured_bw_kb = (uint32_t)
- tor_parse_ulong(eq+1, 10, 1, UINT32_MAX, &ok, NULL);
- if (!ok) {
- log_warn(LD_DIR, "Bad element '%s' in max unmeasured bw param",
- escaped(max_unmeasured_param));
- max_unmeasured_bw_kb = DEFAULT_MAX_UNMEASURED_BW_KB;
- }
- }
+ if (consensus_method < MIN_METHOD_FOR_CORRECT_BWWEIGHTSCALE) {
+ max_unmeasured_bw_kb = (int32_t) extract_param_buggy(
+ params, "maxunmeasuredbw", DEFAULT_MAX_UNMEASURED_BW_KB);
+ } else {
+ max_unmeasured_bw_kb = dirvote_get_intermediate_param_value(
+ param_list, "maxunmeasurdbw", DEFAULT_MAX_UNMEASURED_BW_KB);
+ if (max_unmeasured_bw_kb < 1)
+ max_unmeasured_bw_kb = 1;
}
}
@@ -2326,38 +2314,16 @@ networkstatus_compute_consensus(smartlist_t *votes,
smartlist_add_strdup(chunks, "directory-footer\n");
{
- int64_t weight_scale = BW_WEIGHT_SCALE;
- char *bw_weight_param = NULL;
-
- // Parse params, extract BW_WEIGHT_SCALE if present
- // DO NOT use consensus_param_bw_weight_scale() in this code!
- // The consensus is not formed yet!
- /* XXXX Extract this code into a common function. Or not: #19011. */
- if (params) {
- if (strcmpstart(params, "bwweightscale=") == 0)
- bw_weight_param = params;
- else
- bw_weight_param = strstr(params, " bwweightscale=");
- }
-
- if (bw_weight_param) {
- int ok=0;
- char *eq = strchr(bw_weight_param, '=');
- if (eq) {
- weight_scale = tor_parse_long(eq+1, 10, 1, INT32_MAX, &ok,
- NULL);
- if (!ok) {
- log_warn(LD_DIR, "Bad element '%s' in bw weight param",
- escaped(bw_weight_param));
- weight_scale = BW_WEIGHT_SCALE;
- }
- } else {
- log_warn(LD_DIR, "Bad element '%s' in bw weight param",
- escaped(bw_weight_param));
- weight_scale = BW_WEIGHT_SCALE;
- }
+ int64_t weight_scale;
+ if (consensus_method < MIN_METHOD_FOR_CORRECT_BWWEIGHTSCALE) {
+ weight_scale = extract_param_buggy(params, "bwweightscale",
+ BW_WEIGHT_SCALE);
+ } else {
+ weight_scale = dirvote_get_intermediate_param_value(
+ param_list, "bwweightscale", BW_WEIGHT_SCALE);
+ if (weight_scale < 1)
+ weight_scale = 1;
}
-
added_weights = networkstatus_compute_bw_weights_v10(chunks, G, M, E, D,
T, weight_scale);
}
@@ -2459,6 +2425,53 @@ networkstatus_compute_consensus(smartlist_t *votes,
return result;
}
+/** Extract the value of a parameter from a string encoding a list of
+ * parameters, badly.
+ *
+ * This is a deliberately buggy implementation, for backward compatibility
+ * with versions of Tor affected by #19011. Once all authorities have
+ * upgraded to consensus method 31 or later, then we can throw away this
+ * function. */
+STATIC int64_t
+extract_param_buggy(const char *params,
+ const char *param_name,
+ int64_t default_value)
+{
+ int64_t value = default_value;
+ const char *param_str = NULL;
+
+ if (params) {
+ char *prefix1 = NULL, *prefix2=NULL;
+ tor_asprintf(&prefix1, "%s=", param_name);
+ tor_asprintf(&prefix2, " %s=", param_name);
+ if (strcmpstart(params, prefix1) == 0)
+ param_str = params;
+ else
+ param_str = strstr(params, prefix2);
+ tor_free(prefix1);
+ tor_free(prefix2);
+ }
+
+ if (param_str) {
+ int ok=0;
+ char *eq = strchr(param_str, '=');
+ if (eq) {
+ value = tor_parse_long(eq+1, 10, 1, INT32_MAX, &ok, NULL);
+ if (!ok) {
+ log_warn(LD_DIR, "Bad element '%s' in %s",
+ escaped(param_str), param_name);
+ value = default_value;
+ }
+ } else {
+ log_warn(LD_DIR, "Bad element '%s' in %s",
+ escaped(param_str), param_name);
+ value = default_value;
+ }
+ }
+
+ return value;
+}
+
/** Given a list of networkstatus_t for each vote, return a newly allocated
* string containing the "package" lines for the vote. */
STATIC char *
diff --git a/src/feature/dirauth/dirvote.h b/src/feature/dirauth/dirvote.h
index 4f48e45dc3..7d30a51d08 100644
--- a/src/feature/dirauth/dirvote.h
+++ b/src/feature/dirauth/dirvote.h
@@ -53,7 +53,7 @@
#define MIN_SUPPORTED_CONSENSUS_METHOD 28
/** The highest consensus method that we currently support. */
-#define MAX_SUPPORTED_CONSENSUS_METHOD 30
+#define MAX_SUPPORTED_CONSENSUS_METHOD 31
/**
* Lowest consensus method where microdescriptor lines are put in canonical
@@ -65,6 +65,11 @@
* See #7869 */
#define MIN_METHOD_FOR_UNPADDED_NTOR_KEY 30
+/** Lowest consensus method for which we use the correct algorithm for
+ * extracting the bwweightscale= and maxunmeasuredbw= parameters. See #19011.
+ */
+#define MIN_METHOD_FOR_CORRECT_BWWEIGHTSCALE 31
+
/** Default bandwidth to clip unmeasured bandwidths to using method >=
* MIN_METHOD_TO_CLIP_UNMEASURED_BW. (This is not a consensus method; do not
* get confused with the above macros.) */
@@ -256,6 +261,9 @@ STATIC
char *networkstatus_get_detached_signatures(smartlist_t *consensuses);
STATIC microdesc_t *dirvote_create_microdescriptor(const routerinfo_t *ri,
int consensus_method);
+STATIC int64_t extract_param_buggy(const char *params,
+ const char *param_name,
+ int64_t default_value);
/** The recommended relay protocols for this authority's votes.
* Recommending a new protocol causes old tor versions to log a warning.
diff --git a/src/test/test_dirvote.c b/src/test/test_dirvote.c
index b5e57ad071..d92d1aaf90 100644
--- a/src/test/test_dirvote.c
+++ b/src/test/test_dirvote.c
@@ -656,6 +656,30 @@ done:
ROUTER_FREE(pppp);
}
+static void
+test_dirvote_parse_param_buggy(void *arg)
+{
+ (void)arg;
+
+ /* Tests for behavior with bug emulation to migrate away from bug 19011. */
+ tt_i64_op(extract_param_buggy("blah blah", "bwweightscale", 10000),
+ OP_EQ, 10000);
+ tt_i64_op(extract_param_buggy("bwweightscale=7", "bwweightscale", 10000),
+ OP_EQ, 7);
+ tt_i64_op(extract_param_buggy("bwweightscale=7 foo=9",
+ "bwweightscale", 10000),
+ OP_EQ, 10000);
+ tt_i64_op(extract_param_buggy("foo=7 bwweightscale=777 bar=9",
+ "bwweightscale", 10000),
+ OP_EQ, 10000);
+ tt_i64_op(extract_param_buggy("foo=7 bwweightscale=1234",
+ "bwweightscale", 10000),
+ OP_EQ, 1234);
+
+ done:
+ ;
+}
+
#define NODE(name, flags) \
{ \
#name, test_dirvote_##name, (flags), NULL, NULL \
@@ -668,4 +692,5 @@ struct testcase_t dirvote_tests[] = {
NODE(get_sybil_by_ip_version_ipv4, TT_FORK),
NODE(get_sybil_by_ip_version_ipv6, TT_FORK),
NODE(get_all_possible_sybil, TT_FORK),
+ NODE(parse_param_buggy, 0),
END_OF_TESTCASES};
[View Less]
commit a6a41b4ec022899a3b817199cfe19dcee9bfc83a
Author: gus <gus(a)torproject.org>
Date: Tue Dec 22 15:33:08 2020 -0500
Add sticker pack and remove Tor masks. Fix #22
---
content/contents.lr | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/content/contents.lr b/content/contents.lr
index f0691d49..463f460a 100644
--- a/content/contents.lr
+++ b/content/contents.lr
@@ -34,23 +34,23 @@ single_five: 50000
---
single_four: 25000
---
-single_one: …
[View More]5000
+single_one: 2500
---
single_three: 12500
---
single_two: 7500
---
-sticker_perk_single_description: Get our limited-edition Use Tor mask and fight the surveillance pandemic.
+sticker_perk_single_description: A collection of our favorite logo stickers for decorating your stuff and covering your cams.
---
-sticker_perk_single_image: /static/images/donate/mask-use-tor.png
+sticker_perk_single_image: /static/images/donate/stickerpack-1.png
---
-sticker_perk_single_label: Mask
+sticker_perk_single_label: Sticker Pack
---
-sticker_perk_monthly_description: Get our limited-edition Use Tor mask and fight the surveillance pandemic (Monthly).
+sticker_perk_monthly_description: A collection of our favorite logo stickers for decorating your stuff (Monthly).
---
-sticker_perk_monthly_image: /static/images/donate/mask-use-tor.png
+sticker_perk_monthly_image: /static/images/donate/stickerpack-1.png
---
-sticker_perk_monthly_label: Mask
+sticker_perk_monthly_label: Sticker Pack
---
sweatshirt_perk_single_description: Your generous support of Tor gets you this high-quality zip hoodie.
---
[View Less]
commit 1949afef98df186671935e676b8c6979291dade2
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Tue Jan 12 16:44:14 2021 -0500
Copy forward the changelog for 0.4.5.3-rc.
---
ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 62e00c17c8..c68aa99e16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,67 @@
+Changes in version 0.4.5.3-rc - 2021-01-12
+ Tor 0.4.5.3-rc is the …
[View More]first release candidate in its series. It fixes
+ several bugs, including one that broke onion services on certain older
+ ARM CPUs, and another that made v3 onion services less reliable.
+
+ Though we anticipate that we'll be doing a bit more clean-up between
+ now and the stable release, we expect that our remaining changes will
+ be fairly simple. There will be at least one more release candidate
+ before 0.4.5.x is stable.
+
+ o Major bugfixes (onion service v3):
+ - Stop requiring a live consensus for v3 clients and services, and
+ allow a "reasonably live" consensus instead. This allows v3 onion
+ services to work even if the authorities fail to generate a
+ consensus for more than 2 hours in a row. Fixes bug 40237; bugfix
+ on 0.3.5.1-alpha.
+
+ o Minor features (crypto):
+ - Fix undefined behavior on our Keccak library. The bug only
+ appeared on platforms with 32-byte CPU cache lines (e.g. armv5tel)
+ and would result in wrong digests. Fixes bug 40210; bugfix on
+ 0.2.8.1-alpha. Thanks to Bernhard Übelacker, Arnd Bergmann and
+ weasel for diagnosing this.
+
+ o Minor features (documentation):
+ - Mention the "!badexit" directive that can appear in an authority's
+ approved-routers file, and update the description of the
+ "!invalid" directive. Closes ticket 40188.
+
+ o Minor bugfixes (compilation):
+ - Fix a compilation warning about unreachable fallthrough
+ annotations when building with "--enable-all-bugs-are-fatal" on
+ some compilers. Fixes bug 40241; bugfix on 0.3.5.4-alpha.
+ - Fix the "--enable-static-tor" switch to properly set the "-static"
+ compile option onto the tor binary only. Fixes bug 40111; bugfix
+ on 0.2.3.1-alpha.
+
+ o Minor bugfixes (config, bridge):
+ - Really fix the case where torrc has a missing ClientTransportPlugin
+ but is configured with a Bridge line and UseBridges. Previously,
+ we didn't look at the managed proxy list and thus would fail for
+ the "exec" case. Fixes bug 40106; bugfix on 0.4.5.1-alpha.
+
+ o Minor bugfixes (logging, relay):
+ - Log our address as reported by the directory authorities, if none
+ was configured or detected before. Fixes bug 40201; bugfix
+ on 0.4.5.1-alpha.
+ - When a launching bandwidth testing circuit, don't incorrectly call
+ it a reachability test, or trigger a "CHECKING_REACHABILITY"
+ control event. Fixes bug 40205; bugfix on 0.4.5.1-alpha.
+
+ o Minor bugfixes (relay, statistics):
+ - Report the correct connection statistics in our extrainfo
+ documents. Previously there was a problem in the file loading
+ function which would wrongly truncate a state file, causing the
+ wrong information to be reported. Fixes bug 40226; bugfix
+ on 0.4.5.1-alpha.
+
+ o Minor bugfixes (SOCKS5):
+ - Handle partial SOCKS5 messages correctly. Previously, our code
+ would send an incorrect error message if it got a SOCKS5 request
+ that wasn't complete. Fixes bug 40190; bugfix on 0.3.5.1-alpha.
+
+
Changes in version 0.4.5.2-alpha - 2020-11-23
Tor 0.4.5.2-alpha is the second alpha release in the 0.4.5.x series.
It fixes several bugs present in earlier releases, including one that
[View Less]
commit 01be7cc5350d7fabe9be79e4097305f0890e34e6
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Tue Jan 12 16:08:07 2021 -0500
Bump to 0.4.5.3-rc-dev
---
configure.ac | 4 ++--
contrib/win32build/tor-mingw.nsi.in | 2 +-
src/win32/orconfig.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index f74d8ec9db..6d50dc9508 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl …
[View More]Copyright (c) 2007-2019, The Tor Project, Inc.
dnl See LICENSE for licensing information
AC_PREREQ([2.63])
-AC_INIT([tor],[0.4.5.3-rc])
+AC_INIT([tor],[0.4.5.3-rc-dev])
AC_CONFIG_SRCDIR([src/app/main/tor_main.c])
AC_CONFIG_MACRO_DIR([m4])
@@ -16,7 +16,7 @@ configure_flags="$*"
# version number changes. Tor uses it to make sure that it
# only shuts down for missing "required protocols" when those protocols
# are listed as required by a consensus after this date.
-AC_DEFINE(APPROX_RELEASE_DATE, ["2021-01-11"], # for 0.4.5.3-rc
+AC_DEFINE(APPROX_RELEASE_DATE, ["2021-01-12"], # for 0.4.5.3-rc-dev
[Approximate date when this software was released. (Updated when the version changes.)])
# "foreign" means we don't follow GNU package layout standards
diff --git a/contrib/win32build/tor-mingw.nsi.in b/contrib/win32build/tor-mingw.nsi.in
index 42af899563..1b6141079d 100644
--- a/contrib/win32build/tor-mingw.nsi.in
+++ b/contrib/win32build/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!insertmacro GetParameters
-!define VERSION "0.4.5.3-rc"
+!define VERSION "0.4.5.3-rc-dev"
!define INSTALLER "tor-${VERSION}-win32.exe"
!define WEBSITE "https://www.torproject.org/"
!define LICENSE "LICENSE"
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index c29c37c974..93ba701f18 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -217,7 +217,7 @@
#define USING_TWOS_COMPLEMENT
/* Version number of package */
-#define VERSION "0.4.5.3-rc"
+#define VERSION "0.4.5.3-rc-dev"
#define HAVE_STRUCT_SOCKADDR_IN6
#define HAVE_STRUCT_IN6_ADDR
[View Less]