aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog159
-rw-r--r--changes/bug101694
-rw-r--r--changes/bug104498
-rw-r--r--changes/bug10722_msg5
-rw-r--r--changes/bug108416
-rw-r--r--changes/bug108845
-rw-r--r--changes/bug109045
-rw-r--r--changes/bug109285
-rw-r--r--changes/bug109296
-rw-r--r--changes/bug109877
-rw-r--r--changes/bug110479
-rw-r--r--changes/bug110488
-rw-r--r--changes/bug111184
-rw-r--r--changes/bug58244
-rw-r--r--changes/bug5824-24
-rw-r--r--changes/bug87883
-rw-r--r--changes/bug90995
-rw-r--r--changes/bug92225
-rw-r--r--changes/bug9656
-rw-r--r--changes/bug96863
-rw-r--r--changes/feature490012
-rw-r--r--changes/geoip-february20143
-rw-r--r--changes/geoip-february2014-regcountry3
-rw-r--r--changes/geoip6-february20143
-rw-r--r--changes/sigsafe_fmt_warning4
-rw-r--r--changes/ticket55284
-rw-r--r--changes/ticket91765
-rw-r--r--configure.ac2
-rw-r--r--contrib/tor-mingw.nsi.in2
-rw-r--r--doc/HACKING16
-rw-r--r--doc/tor.1.txt26
-rw-r--r--src/common/crypto.c2
-rw-r--r--src/common/sandbox.c2
-rw-r--r--src/ext/tinytest.c150
-rw-r--r--src/ext/tinytest.h19
-rw-r--r--src/ext/tinytest_demo.c49
-rw-r--r--src/ext/tinytest_macros.h19
-rw-r--r--src/or/config.c30
-rw-r--r--src/or/connection.c25
-rw-r--r--src/or/connection.h2
-rw-r--r--src/or/connection_or.c8
-rw-r--r--src/or/control.c13
-rw-r--r--src/or/control.h3
-rw-r--r--src/or/entrynodes.c21
-rw-r--r--src/or/entrynodes.h1
-rw-r--r--src/or/microdesc.c2
-rw-r--r--src/or/networkstatus.c36
-rw-r--r--src/or/networkstatus.h2
-rw-r--r--src/or/nodelist.c8
-rw-r--r--src/or/policies.c22
-rw-r--r--src/or/routerlist.c6
-rw-r--r--src/test/test.c38
-rw-r--r--src/test/test.h12
-rw-r--r--src/test/test_extorport.c4
-rw-r--r--src/test/test_routerkeys.c2
-rw-r--r--src/win32/orconfig.h2
56 files changed, 539 insertions, 280 deletions
diff --git a/ChangeLog b/ChangeLog
index 78c509452..6e329fe0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,160 @@
+Changes in version 0.2.5.3-alpha - 2014-03-22
+ Tor 0.2.5.3-alpha includes all the fixes from 0.2.4.21. It contains
+ two new anti-DoS features for Tor relays, resolves a bug that kept
+ SOCKS5 support for IPv6 from working, fixes several annoying usability
+ issues for bridge users, and removes more old code for unused
+ directory formats.
+
+ The Tor 0.2.5.x release series is now in patch-freeze: no feature
+ patches not already written will be considered for inclusion in 0.2.5.x.
+
+ o Major features (relay security, DoS-resistance):
+ - When deciding whether we have run out of memory and we need to
+ close circuits, also consider memory allocated in buffers for
+ streams attached to each circuit.
+
+ This change, which extends an anti-DoS feature introduced in
+ 0.2.4.13-alpha and improved in 0.2.4.14-alpha, lets Tor exit relays
+ better resist more memory-based DoS attacks than before. Since the
+ MaxMemInCellQueues option now applies to all queues, it is renamed
+ to MaxMemInQueues. This feature fixes bug 10169.
+ - Avoid hash-flooding denial-of-service attacks by using the secure
+ SipHash-2-4 hash function for our hashtables. Without this
+ feature, an attacker could degrade performance of a targeted
+ client or server by flooding their data structures with a large
+ number of entries to be stored at the same hash table position,
+ thereby slowing down the Tor instance. With this feature, hash
+ table positions are derived from a randomized cryptographic key,
+ and an attacker cannot predict which entries will collide. Closes
+ ticket 4900.
+ - Decrease the lower limit of MaxMemInQueues to 256 MBytes (but leave
+ the default at 8GBytes), to better support Raspberry Pi users. Fixes
+ bug 9686; bugfix on 0.2.4.14-alpha.
+
+ o Minor features (bridges, pluggable transports):
+ - Bridges now write the SHA1 digest of their identity key
+ fingerprint (that is, a hash of a hash of their public key) to
+ notice-level logs, and to a new hashed-fingerprint file. This
+ information will help bridge operators look up their bridge in
+ Globe and similar tools. Resolves ticket 10884.
+ - Improve the message that Tor displays when running as a bridge
+ using pluggable transports without an Extended ORPort listener.
+ Also, log the message in the log file too. Resolves ticket 11043.
+
+ o Minor features (other):
+ - Add a new option, PredictedPortsRelevanceTime, to control how long
+ after having received a request to connect to a given port Tor
+ will try to keep circuits ready in anticipation of future requests
+ for that port. Patch from "unixninja92"; implements ticket 9176.
+ - Generate a warning if any ports are listed in the SocksPolicy,
+ DirPolicy, AuthDirReject, AuthDirInvalid, AuthDirBadDir, or
+ AuthDirBadExit options. (These options only support address
+ ranges.) Fixes part of ticket 11108.
+ - Update geoip and geoip6 to the February 7 2014 Maxmind GeoLite2
+ Country database.
+
+ o Minor bugfixes (new since 0.2.5.2-alpha, also in 0.2.4.21):
+ - Build without warnings under clang 3.4. (We have some macros that
+ define static functions only some of which will get used later in
+ the module. Starting with clang 3.4, these give a warning unless the
+ unused attribute is set on them.) Resolves ticket 10904.
+ - Fix build warnings about missing "a2x" comment when building the
+ manpages from scratch on OpenBSD; OpenBSD calls it "a2x.py".
+ Fixes bug 10929; bugfix on 0.2.2.9-alpha. Patch from Dana Koch.
+
+ o Minor bugfixes (client):
+ - Improve the log message when we can't connect to a hidden service
+ because all of the hidden service directory nodes hosting its
+ descriptor are excluded. Improves on our fix for bug 10722, which
+ was a bugfix on 0.2.0.10-alpha.
+ - Raise a control port warning when we fail to connect to all of
+ our bridges. Previously, we didn't inform the controller, and
+ the bootstrap process would stall. Fixes bug 11069; bugfix on
+ 0.2.1.2-alpha.
+ - Exit immediately when a process-owning controller exits.
+ Previously, tor relays would wait for a little while after their
+ controller exited, as if they had gotten an INT signal -- but this
+ was problematic, since there was no feedback for the user. To do a
+ clean shutdown, controllers should send an INT signal and give Tor
+ a chance to clean up. Fixes bug 10449; bugfix on 0.2.2.28-beta.
+ - Stop attempting to connect to bridges before our pluggable
+ transports are configured (harmless but resulted in some erroneous
+ log messages). Fixes bug 11156; bugfix on 0.2.3.2-alpha.
+ - Fix connections to IPv6 addresses over SOCKS5. Previously, we were
+ generating incorrect SOCKS5 responses, and confusing client
+ applications. Fixes bug 10987; bugfix on 0.2.4.7-alpha.
+
+ o Minor bugfixes (relays and bridges):
+ - Avoid crashing on a malformed resolv.conf file when running a
+ relay using Libevent 1. Fixes bug 8788; bugfix on 0.1.1.23.
+ - Non-exit relays no longer launch mock DNS requests to check for
+ DNS hijacking. This has been unnecessary since 0.2.1.7-alpha, when
+ non-exit relays stopped servicing DNS requests. Fixes bug 965;
+ bugfix on 0.2.1.7-alpha. Patch from Matt Pagan.
+ - Bridges now report complete directory request statistics. Related
+ to bug 5824; bugfix on 0.2.2.1-alpha.
+ - Bridges now never collect statistics that were designed for
+ relays. Fixes bug 5824; bugfix on 0.2.3.8-alpha.
+ - Stop giving annoying warning messages when we decide not to launch
+ a pluggable transport proxy that we don't need (because there are
+ no bridges configured to use it). Resolves ticket 5018; bugfix
+ on 0.2.5.2-alpha.
+ - Give the correct URL in the warning message when trying to run a
+ relay on an ancient version of Windows. Fixes bug 9393.
+
+ o Minor bugfixes (backtrace support):
+ - Support automatic backtraces on more platforms by using the
+ "-fasynchronous-unwind-tables" compiler option. This option is
+ needed for platforms like 32-bit Intel where "-fomit-frame-pointer"
+ is on by default and table generation is not. This doesn't yet
+ add Windows support; only Linux, OSX, and some BSDs are affected.
+ Reported by 'cypherpunks'; fixes bug 11047; bugfix on 0.2.5.2-alpha.
+ - Avoid strange behavior if two threads hit failed assertions at the
+ same time and both try to log backtraces at once. (Previously, if
+ this had happened, both threads would have stored their intermediate
+ results in the same buffer, and generated junk outputs.) Reported by
+ "cypherpunks". Fixes bug 11048; bugfix on 0.2.5.2-alpha.
+ - Fix a compiler warning in format_number_sigsafe(). Bugfix on
+ 0.2.5.2-alpha; patch from Nick Hopper.
+
+ o Minor bugfixes (unit tests):
+ - Fix a small bug in the unit tests that might have made the tests
+ call 'chmod' with an uninitialized bitmask. Fixes bug 10928;
+ bugfix on 0.2.5.1-alpha. Patch from Dana Koch.
+
+ o Removed code:
+ - Remove all remaining code related to version-0 hidden service
+ descriptors: they have not been in use since 0.2.2.1-alpha. Fixes
+ the rest of bug 10841.
+
+ o Documentation:
+ - Document in the manpage that "KBytes" may also be written as
+ "kilobytes" or "KB", that "Kbits" may also be written as
+ "kilobits", and so forth. Closes ticket 9222.
+ - Document that the ClientOnly config option overrides ORPort.
+ Our old explanation made ClientOnly sound as though it did
+ nothing at all. Resolves bug 9059.
+ - Explain that SocksPolicy, DirPolicy, and similar options don't
+ take port arguments. Fixes the other part of ticket 11108.
+ - Fix a comment about the rend_server_descriptor_t.protocols field
+ to more accurately describe its range. Also, make that field
+ unsigned, to more accurately reflect its usage. Fixes bug 9099;
+ bugfix on 0.2.1.5-alpha.
+ - Fix the manpage's description of HiddenServiceAuthorizeClient:
+ the maximum client name length is 16, not 19. Fixes bug 11118;
+ bugfix on 0.2.1.6-alpha.
+
+ o Code simplifications and refactoring:
+ - Get rid of router->address, since in all cases it was just the
+ string representation of router->addr. Resolves ticket 5528.
+
+ o Test infrastructure:
+ - Update to the latest version of tinytest.
+ - Improve the tinytest implementation of string operation tests so
+ that comparisons with NULL strings no longer crash the tests; they
+ now just fail, normally. Fixes bug 9004; bugfix on 0.2.2.4-alpha.
+
+
Changes in version 0.2.4.21 - 2014-02-28
Tor 0.2.4.21 further improves security against potential adversaries who
find breaking 1024-bit crypto doable, and backports several stability
@@ -59,7 +216,7 @@ Changes in version 0.2.4.21 - 2014-02-28
flag set. Fixes bug 10470; bugfix on 0.2.3.3-alpha / 0.2.3.16-alpha.
-Changes in version 0.2.5.2-alpha - 2013-02-13
+Changes in version 0.2.5.2-alpha - 2014-02-13
Tor 0.2.5.2-alpha includes all the fixes from 0.2.4.18-rc and 0.2.4.20,
like the "poor random number generation" fix and the "building too many
circuits" fix. It also further improves security against potential
diff --git a/changes/bug10169 b/changes/bug10169
deleted file mode 100644
index 979c4e428..000000000
--- a/changes/bug10169
+++ /dev/null
@@ -1,4 +0,0 @@
- o Major features:
- - Also consider stream buffer sizes when calculating OOM
- conditions. Rename MaxMemInCellQueues to MaxMemInQueues. Fixes
- bug 10169.
diff --git a/changes/bug10449 b/changes/bug10449
deleted file mode 100644
index 93811f07b..000000000
--- a/changes/bug10449
+++ /dev/null
@@ -1,8 +0,0 @@
- o Minor bugfixes:
- - Exit immediately when exiting because of dropped connection from
- a process-owning controller. Previously, if we were running in
- server mode, we would wait for a little while as in the when we
- got an INT signal--but this was problematic, since there was no
- feedback for the user. Controllers that want to do a clean
- shutdown should send an INT signal, and let the user know what's
- going on. Fix for bug 10449; bugfix on 0.2.2.28-beta. \ No newline at end of file
diff --git a/changes/bug10722_msg b/changes/bug10722_msg
deleted file mode 100644
index fbfa37c26..000000000
--- a/changes/bug10722_msg
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor bugfixes:
- - Log an improved message when excluding hidden service directory
- nodes prevents a hidden service from working.
- Improves on our fix for bug #10722, which was a bugfix on
- 0.2.0.10-alpha. \ No newline at end of file
diff --git a/changes/bug10841 b/changes/bug10841
deleted file mode 100644
index 5b065a8b2..000000000
--- a/changes/bug10841
+++ /dev/null
@@ -1,6 +0,0 @@
- o Removed code
- - Remove all code for hidden service authorities to accept and serve
- version 0 descriptors and left-over code for hidden services and
- hidden service clients to upload and fetch version 0 descriptors.
- Version 0 descriptors are not in use anymore since 0.2.2.1-alpha.
- Fixes the rest of bug 10841.
diff --git a/changes/bug10884 b/changes/bug10884
deleted file mode 100644
index 815d893de..000000000
--- a/changes/bug10884
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor features:
- - Bridges write the SHA1 digest of their identity key fingerprint to
- notice-level logs and to hashed-fingerprint, so that bridge
- operators can look up their bridge in Globe and similar tools.
-
diff --git a/changes/bug10904 b/changes/bug10904
deleted file mode 100644
index 6f551ea41..000000000
--- a/changes/bug10904
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor bugfixes (compilation):
- - Build without warnings under clang 3.4. (We have some macros that
- define static functions only some of which will get used later in
- the module. Starting with clang 3.4, these give a warning unless the
- unused attribute is set on them.)
diff --git a/changes/bug10928 b/changes/bug10928
deleted file mode 100644
index 86bc5aa46..000000000
--- a/changes/bug10928
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor bugfixes (unit tests);
- - Fix a small bug in the unit tests that might have made the tests
- call 'chmod' with an uninitialized bitmask.
- Fixes bug 10928; bugfix on 0.2.5.1-alpha. Patch from Dana Koch.
-
diff --git a/changes/bug10929 b/changes/bug10929
deleted file mode 100644
index acf396047..000000000
--- a/changes/bug10929
+++ /dev/null
@@ -1,6 +0,0 @@
- - Minor bugfixes:
- - Fix build warnings about missing "a2x" comment when building the
- manpages from scratch on OpenBSD; OpenBSD calls it "a2x.py".
- Fixes bug 10929; bugfix on tor-0.2.2.9-alpha. Patch from
- Dana Koch.
-
diff --git a/changes/bug10987 b/changes/bug10987
deleted file mode 100644
index cc5dd8ff5..000000000
--- a/changes/bug10987
+++ /dev/null
@@ -1,7 +0,0 @@
- o Minor bugfixes
-
- - Fix IPv6 support when using the SocksPort with SOCKS5. Using IPv6
- through a SOCKS5 using the SocksPort option will now work with
- this fix. This part of the code has never been updated to support
- IPv6 thus this does not fix a previously introduced regression.
- Fixes bug 10987; bugfix on 0.2.4.7-alpha.
diff --git a/changes/bug11047 b/changes/bug11047
deleted file mode 100644
index 25acd8e36..000000000
--- a/changes/bug11047
+++ /dev/null
@@ -1,9 +0,0 @@
- o Minor bugfixes:
-
- - Build using the -fasynchronous-unwind-tables option so that more
- platforms (in particular, ones like 32-bit Intel where the
- -fomit-frame-pointer option is on by default and table
- generation is not) will support generating backtraces. This
- doesn't yet add Windows support yet; only Linux, OSX, and some BSD
- are affected. Reported by 'cypherpunks'; fixes bug 11047; bugfix
- on 0.2.5.2-alpha.
diff --git a/changes/bug11048 b/changes/bug11048
deleted file mode 100644
index 684abf959..000000000
--- a/changes/bug11048
+++ /dev/null
@@ -1,8 +0,0 @@
- o Minor bugfixes:
-
- - Avoid strange behavior if two threads hit failed asswertions
- at the same time and both try to log backtraces at
- once. (Previously, if this had happened, both threads would
- have stored their intermediate results in the same buffer, and
- generated junk outputs.) Reported by "cypherpunks". Fixes bug
- 11048; bugfix on 0.2.5.2-alpha.
diff --git a/changes/bug11118 b/changes/bug11118
deleted file mode 100644
index 6354ab2db..000000000
--- a/changes/bug11118
+++ /dev/null
@@ -1,4 +0,0 @@
- o Documentation:
- - Fix the max client name length in the manpage's description of
- HiddenServiceAuthorizeClient description: it should have been
- 16, not 19. Fixes bug 11118; bugfix on 0.2.1.6-alpha.
diff --git a/changes/bug5824 b/changes/bug5824
deleted file mode 100644
index 15d366fe5..000000000
--- a/changes/bug5824
+++ /dev/null
@@ -1,4 +0,0 @@
- o Minor bugfixes:
- - Bridges now never collect statistics that were designed for relays.
- Fix for bug 5824; bugfix on 0.2.3.8-alpha.
-
diff --git a/changes/bug5824-2 b/changes/bug5824-2
deleted file mode 100644
index f5963ca4c..000000000
--- a/changes/bug5824-2
+++ /dev/null
@@ -1,4 +0,0 @@
- o Minor bugfixes:
- - Bridges now report complete directory request statistics. Related to
- bug 5824; bugfix on 0.2.2.1-alpha.
-
diff --git a/changes/bug8788 b/changes/bug8788
deleted file mode 100644
index 26fb5bc4f..000000000
--- a/changes/bug8788
+++ /dev/null
@@ -1,3 +0,0 @@
- o Minor bugfixes:
- - Avoid crashing on a malformed resolv.conf file when running a
- server using Libevent 1. Fixes bug 8788; bugfix on 0.1.1.23.
diff --git a/changes/bug9099 b/changes/bug9099
deleted file mode 100644
index 5cd963ea8..000000000
--- a/changes/bug9099
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor bugfixes:
- - Fix a comment about the rend_server_descriptor_t.protocols field
- to more accurately describe its range. Also, make that
- field unsigned, to more accurately reflect its usage.
- Fixes bug 9099; bugfix on 0.2.1.5-alpha.
diff --git a/changes/bug9222 b/changes/bug9222
deleted file mode 100644
index bd6627711..000000000
--- a/changes/bug9222
+++ /dev/null
@@ -1,5 +0,0 @@
- o Documentation:
-
- - Document in the manpage that "KBytes" may also be written as
- "kilobytes" or "KB", that "Kbits" may also be written as
- "kilobits", and so forth. Closes ticket #9222.
diff --git a/changes/bug965 b/changes/bug965
deleted file mode 100644
index d0870d038..000000000
--- a/changes/bug965
+++ /dev/null
@@ -1,6 +0,0 @@
- o Minor bugfixes:
-
- - Non-exit servers no longer launch mock DNS requests to check for
- DNS hijacking. This has been unnecessary since 0.2.1.7-alpha,
- when non-exit servers stopped servicing DNS requests. Fixes bug
- 965; bugfix on 0.2.1.7-alpha. Patch from Matt Pagan.
diff --git a/changes/bug9686 b/changes/bug9686
deleted file mode 100644
index 82a8f4447..000000000
--- a/changes/bug9686
+++ /dev/null
@@ -1,3 +0,0 @@
- o Minor changes:
- - Decrease the lower limit of MaxMemInQueues to 256 MBytes, to
- appease raspberry pi users. Fixes bug 9686. \ No newline at end of file
diff --git a/changes/feature4900 b/changes/feature4900
deleted file mode 100644
index 378ce12ae..000000000
--- a/changes/feature4900
+++ /dev/null
@@ -1,12 +0,0 @@
- o Minor features:
-
- - Avoid hash-flooding denial-of-service attacks by using the secure
- SipHash-2-4 hash function for our hashtables. Without this
- feature, an attacker could degrade performance of a targeted
- client or server by flooding their data structures with a large
- number of data entries all calculated to be stored at the same
- hash table position, thereby degrading hash table
- performance. With this feature, hash table positions are derived
- from a randomized cryptographic key using SipHash-2-4, and an
- attacker cannot predict which entries will collide.
- Closes ticket 4900.
diff --git a/changes/geoip-february2014 b/changes/geoip-february2014
deleted file mode 100644
index f8657b468..000000000
--- a/changes/geoip-february2014
+++ /dev/null
@@ -1,3 +0,0 @@
- o Minor features:
- - Update to the February 7 2014 Maxmind GeoLite2 Country database.
-
diff --git a/changes/geoip-february2014-regcountry b/changes/geoip-february2014-regcountry
deleted file mode 100644
index c2ddf092a..000000000
--- a/changes/geoip-february2014-regcountry
+++ /dev/null
@@ -1,3 +0,0 @@
- o Minor features:
- - Fix our version of the February 7 2014 Maxmind GeoLite2 Country database.
-
diff --git a/changes/geoip6-february2014 b/changes/geoip6-february2014
deleted file mode 100644
index af30be00b..000000000
--- a/changes/geoip6-february2014
+++ /dev/null
@@ -1,3 +0,0 @@
- o Minor features:
- - Update geoip6 to the February 7 2014 Maxmind GeoLite2 Country
- database.
diff --git a/changes/sigsafe_fmt_warning b/changes/sigsafe_fmt_warning
deleted file mode 100644
index eeb471028..000000000
--- a/changes/sigsafe_fmt_warning
+++ /dev/null
@@ -1,4 +0,0 @@
- o Minor bugfixes (compilation):
- - Fix a 64-to-32-conversion warning in format_number_sigsafe().
- Bugfix on 0.2.5.2-alpha; patch from Nick Hopper.
-
diff --git a/changes/ticket5528 b/changes/ticket5528
deleted file mode 100644
index 69b2c1d16..000000000
--- a/changes/ticket5528
+++ /dev/null
@@ -1,4 +0,0 @@
- o Code simplifications and refactoring:
- - Get rid of router->address, since in all cases it was just the
- string representation of router->addr. Resolves ticket 5528.
-
diff --git a/changes/ticket9176 b/changes/ticket9176
deleted file mode 100644
index 53c30e330..000000000
--- a/changes/ticket9176
+++ /dev/null
@@ -1,5 +0,0 @@
- o Minor features:
-
- - Made PREDICTED_CIRCS_RELEVANCE_TIME configurable from config
- file with a new option, PredictedPortsRelevanceTime. Implements
- ticket #9176. Patch by unixninja92.
diff --git a/configure.ac b/configure.ac
index c11cf842d..6e4104196 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
dnl Copyright (c) 2007-2013, The Tor Project, Inc.
dnl See LICENSE for licensing information
-AC_INIT([tor],[0.2.5.2-alpha])
+AC_INIT([tor],[0.2.5.3-alpha-dev])
AC_CONFIG_SRCDIR([src/or/main.c])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
diff --git a/contrib/tor-mingw.nsi.in b/contrib/tor-mingw.nsi.in
index 7533c5ac2..d14ff791b 100644
--- a/contrib/tor-mingw.nsi.in
+++ b/contrib/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!insertmacro GetParameters
-!define VERSION "0.2.5.2-alpha"
+!define VERSION "0.2.5.3-alpha-dev"
!define INSTALLER "tor-${VERSION}-win32.exe"
!define WEBSITE "https://www.torproject.org/"
!define LICENSE "LICENSE"
diff --git a/doc/HACKING b/doc/HACKING
index 39eafec20..4b98cadb3 100644
--- a/doc/HACKING
+++ b/doc/HACKING
@@ -93,7 +93,7 @@ down bugs.
Jenkins
~~~~~~~
-http://jenkins.torproject.org
+https://jenkins.torproject.org
Dmalloc
~~~~~~~
@@ -449,10 +449,11 @@ of them and reordering to focus on what users and funders would find
interesting and understandable.
2.1) Make sure that everything that wants a bug number has one.
+ Make sure that everything which is a bugfix says what version
+ it was a bugfix on.
2.2) Concatenate them.
- 2.3) Sort them by section. Within each section, try to make the
- first entry or two and the last entry most interesting: they're
- the ones that skimmers tend to read.
+ 2.3) Sort them by section. Within each section, sort by "version it's
+ a bugfix on", else by numerical ticket order.
2.4) Clean them up:
@@ -474,6 +475,10 @@ interesting and understandable.
Present and imperative tense: not past.
+ 'Relays', not 'servers' or 'nodes' or 'Tor relays'.
+
+ "Stop FOOing", not "Fix a bug where we would FOO".
+
Try not to let any given section be longer than about a page. Break up
long sections into subsections by some sort of common subtopic. This
guideline is especially important when organizing Release Notes for
@@ -514,8 +519,7 @@ in their approved versions list.
"include/versions.wmi" and "Makefile" to note the new version. From your
website checkout, run ./publish to build and publish the website.
-9) Email Erinn and weasel (cc'ing tor-assistants) that a new tarball
-is up. This step should probably change to mailing more packagers.
+9) Email the packagers (cc'ing tor-assistants) that a new tarball is up.
10) Add the version number to Trac. To do this, go to Trac, log in,
select "Admin" near the top of the screen, then select "Versions" from
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 89608f7dc..e4679bf3f 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -702,12 +702,13 @@ The following options are useful only for clients (that is, if
number like 60. (Default: 0)
[[ClientOnly]] **ClientOnly** **0**|**1**::
- If set to 1, Tor will under no circumstances run as a relay or serve
- directory requests. This config option is mostly meaningless: we
- added it back when we were considering having Tor clients auto-promote
- themselves to being relays if they were stable and fast enough. The
- current behavior is simply that Tor is a client unless ORPort or
- DirPort are configured. (Default: 0)
+ If set to 1, Tor will not run as a relay or serve
+ directory requests, even if the ORPort, ExtORPort, or DirPort options are
+ set. (This config option is
+ mostly unnecessary: we added it back when we were considering having
+ Tor clients auto-promote themselves to being relays if they were stable
+ and fast enough. The current behavior is simply that Tor is a client
+ unless ORPort, ExtORPort, or DirPort are configured.) (Default: 0)
[[ExcludeNodes]] **ExcludeNodes** __node__,__node__,__...__::
A list of identity fingerprints, nicknames, country codes and address
@@ -1041,7 +1042,8 @@ The following options are useful only for clients (that is, if
[[SocksPolicy]] **SocksPolicy** __policy__,__policy__,__...__::
Set an entrance policy for this server, to limit who can connect to the
SocksPort and DNSPort ports. The policies have the same form as exit
- policies below.
+ policies below, except that port specifiers are ignored. Any address
+ not matched by some entry in the policy is accepted.
[[SocksTimeout]] **SocksTimeout** __NUM__::
Let a socks connection wait NUM seconds handshaking, and NUM seconds
@@ -1838,7 +1840,9 @@ if DirPort is non-zero):
[[DirPolicy]] **DirPolicy** __policy__,__policy__,__...__::
Set an entrance policy for this server, to limit who can connect to the
- directory ports. The policies have the same form as exit policies above.
+ directory ports. The policies have the same form as exit policies above,
+ except that port specifiers are ignored. Any address not matched by
+ some entry in the policy is accepted.
[[FetchV2Networkstatus]] **FetchV2Networkstatus** **0**|**1**::
If set, we try to fetch the (obsolete, unused) version 2 network status
@@ -1882,7 +1886,11 @@ DIRECTORY AUTHORITY SERVER OPTIONS
[[AuthDirBadDir]] **AuthDirBadDir** __AddressPattern...__::
Authoritative directories only. A set of address patterns for servers that
will be listed as bad directories in any network status document this
- authority publishes, if **AuthDirListBadDirs** is set.
+ authority publishes, if **AuthDirListBadDirs** is set. +
+ +
+ (The address pattern syntax here and in the options below
+ is the same as for exit policies, except that you don't need to say
+ "accept" or "reject", and ports are not needed.)
[[AuthDirBadExit]] **AuthDirBadExit** __AddressPattern...__::
Authoritative directories only. A set of address patterns for servers that
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 80d835131..12a695b9c 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -3100,7 +3100,7 @@ openssl_locking_cb_(int mode, int n, const char *file, int line)
(void)file;
(void)line;
if (!openssl_mutexes_)
- /* This is not a really good fix for the
+ /* This is not a really good fix for the
* "release-freed-lock-from-separate-thread-on-shutdown" problem, but
* it can't hurt. */
return;
diff --git a/src/common/sandbox.c b/src/common/sandbox.c
index 6b7874883..577528988 100644
--- a/src/common/sandbox.c
+++ b/src/common/sandbox.c
@@ -1326,7 +1326,7 @@ sigsys_debugging(int nr, siginfo_t *info, void *void_context)
if (!ctx)
return;
- syscall = ctx->uc_mcontext.gregs[REG_SYSCALL];
+ syscall = (int) ctx->uc_mcontext.gregs[REG_SYSCALL];
format_dec_number_sigsafe(syscall, number, sizeof(number));
tor_log_err_sigsafe("(Sandbox) Caught a bad syscall attempt (syscall ",
diff --git a/src/ext/tinytest.c b/src/ext/tinytest.c
index 4d9afacce..3a8e33105 100644
--- a/src/ext/tinytest.c
+++ b/src/ext/tinytest.c
@@ -31,6 +31,8 @@
#include <string.h>
#include <assert.h>
+#ifndef NO_FORKING
+
#ifdef _WIN32
#include <windows.h>
#else
@@ -39,6 +41,17 @@
#include <unistd.h>
#endif
+#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060 && \
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070)
+/* Workaround for a stupid bug in OSX 10.6 */
+#define FORK_BREAKS_GCOV
+#include <vproc.h>
+#endif
+#endif
+
+#endif /* !NO_FORKING */
+
#ifndef __GNUC__
#define __attribute__(x)
#endif
@@ -58,6 +71,8 @@ static int opt_nofork = 0; /**< Suppress calls to fork() for debugging. */
static int opt_verbosity = 1; /**< -==quiet,0==terse,1==normal,2==verbose */
const char *verbosity_flag = "";
+const struct testlist_alias_t *cfg_aliases=NULL;
+
enum outcome { SKIP=2, OK=1, FAIL=0 };
static enum outcome cur_test_outcome = 0;
const char *cur_test_prefix = NULL; /**< prefix of the current test group */
@@ -71,6 +86,7 @@ static char commandname[MAX_PATH+1];
static void usage(struct testgroup_t *groups, int list_groups)
__attribute__((noreturn));
+static int process_test_option(struct testgroup_t *groups, const char *test);
static enum outcome
testcase_run_bare_(const struct testcase_t *testcase)
@@ -99,6 +115,8 @@ testcase_run_bare_(const struct testcase_t *testcase)
#define MAGIC_EXITCODE 42
+#ifndef NO_FORKING
+
static enum outcome
testcase_run_forked_(const struct testgroup_t *group,
const struct testcase_t *testcase)
@@ -160,6 +178,9 @@ testcase_run_forked_(const struct testgroup_t *group,
if (opt_verbosity>0)
printf("[forking] ");
pid = fork();
+#ifdef FORK_BREAKS_GCOV
+ vproc_transaction_begin(0);
+#endif
if (!pid) {
/* child. */
int test_r, write_r;
@@ -196,16 +217,19 @@ testcase_run_forked_(const struct testgroup_t *group,
#endif
}
+#endif /* !NO_FORKING */
+
int
testcase_run_one(const struct testgroup_t *group,
const struct testcase_t *testcase)
{
enum outcome outcome;
- if (testcase->flags & TT_SKIP) {
+ if (testcase->flags & (TT_SKIP|TT_OFF_BY_DEFAULT)) {
if (opt_verbosity>0)
- printf("%s%s: SKIPPED\n",
- group->prefix, testcase->name);
+ printf("%s%s: %s\n",
+ group->prefix, testcase->name,
+ (testcase->flags & TT_SKIP) ? "SKIPPED" : "DISABLED");
++n_skipped;
return SKIP;
}
@@ -218,9 +242,13 @@ testcase_run_one(const struct testgroup_t *group,
cur_test_name = testcase->name;
}
+#ifndef NO_FORKING
if ((testcase->flags & TT_FORK) && !(opt_forked||opt_nofork)) {
outcome = testcase_run_forked_(group, testcase);
} else {
+#else
+ {
+#endif
outcome = testcase_run_bare_(testcase);
}
@@ -247,7 +275,7 @@ testcase_run_one(const struct testgroup_t *group,
}
int
-tinytest_set_flag_(struct testgroup_t *groups, const char *arg, unsigned long flag)
+tinytest_set_flag_(struct testgroup_t *groups, const char *arg, int set, unsigned long flag)
{
int i, j;
size_t length = LONGEST_TEST_NAME;
@@ -257,12 +285,23 @@ tinytest_set_flag_(struct testgroup_t *groups, const char *arg, unsigned long fl
length = strstr(arg,"..")-arg;
for (i=0; groups[i].prefix; ++i) {
for (j=0; groups[i].cases[j].name; ++j) {
+ struct testcase_t *testcase = &groups[i].cases[j];
snprintf(fullname, sizeof(fullname), "%s%s",
- groups[i].prefix, groups[i].cases[j].name);
- if (!flag) /* Hack! */
- printf(" %s\n", fullname);
+ groups[i].prefix, testcase->name);
+ if (!flag) { /* Hack! */
+ printf(" %s", fullname);
+ if (testcase->flags & TT_OFF_BY_DEFAULT)
+ puts(" (Off by default)");
+ else if (testcase->flags & TT_SKIP)
+ puts(" (DISABLED)");
+ else
+ puts("");
+ }
if (!strncmp(fullname, arg, length)) {
- groups[i].cases[j].flags |= flag;
+ if (set)
+ testcase->flags |= flag;
+ else
+ testcase->flags &= ~flag;
++found;
}
}
@@ -275,15 +314,69 @@ usage(struct testgroup_t *groups, int list_groups)
{
puts("Options are: [--verbose|--quiet|--terse] [--no-fork]");
puts(" Specify tests by name, or using a prefix ending with '..'");
- puts(" To skip a test, list give its name prefixed with a colon.");
+ puts(" To skip a test, prefix its name with a colon.");
+ puts(" To enable a disabled test, prefix its name with a plus.");
puts(" Use --list-tests for a list of tests.");
if (list_groups) {
puts("Known tests are:");
- tinytest_set_flag_(groups, "..", 0);
+ tinytest_set_flag_(groups, "..", 1, 0);
}
exit(0);
}
+static int
+process_test_alias(struct testgroup_t *groups, const char *test)
+{
+ int i, j, n, r;
+ for (i=0; cfg_aliases && cfg_aliases[i].name; ++i) {
+ if (!strcmp(cfg_aliases[i].name, test)) {
+ n = 0;
+ for (j = 0; cfg_aliases[i].tests[j]; ++j) {
+ r = process_test_option(groups, cfg_aliases[i].tests[j]);
+ if (r<0)
+ return -1;
+ n += r;
+ }
+ return n;
+ }
+ }
+ printf("No such test alias as @%s!",test);
+ return -1;
+}
+
+static int
+process_test_option(struct testgroup_t *groups, const char *test)
+{
+ int flag = TT_ENABLED_;
+ int n = 0;
+ if (test[0] == '@') {
+ return process_test_alias(groups, test + 1);
+ } else if (test[0] == ':') {
+ ++test;
+ flag = TT_SKIP;
+ } else if (test[0] == '+') {
+ ++test;
+ ++n;
+ if (!tinytest_set_flag_(groups, test, 0, TT_OFF_BY_DEFAULT)) {
+ printf("No such test as %s!\n", test);
+ return -1;
+ }
+ } else {
+ ++n;
+ }
+ if (!tinytest_set_flag_(groups, test, 1, flag)) {
+ printf("No such test as %s!\n", test);
+ return -1;
+ }
+ return n;
+}
+
+void
+tinytest_set_aliases(const struct testlist_alias_t *aliases)
+{
+ cfg_aliases = aliases;
+}
+
int
tinytest_main(int c, const char **v, struct testgroup_t *groups)
{
@@ -321,24 +414,18 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups)
return -1;
}
} else {
- const char *test = v[i];
- int flag = TT_ENABLED_;
- if (test[0] == ':') {
- ++test;
- flag = TT_SKIP;
- } else {
- ++n;
- }
- if (!tinytest_set_flag_(groups, test, flag)) {
- printf("No such test as %s!\n", v[i]);
+ int r = process_test_option(groups, v[i]);
+ if (r<0)
return -1;
- }
+ n += r;
}
}
if (!n)
- tinytest_set_flag_(groups, "..", TT_ENABLED_);
+ tinytest_set_flag_(groups, "..", 1, TT_ENABLED_);
+#ifdef _IONBF
setvbuf(stdout, NULL, _IONBF, 0);
+#endif
++in_tinytest_main;
for (i=0; groups[i].prefix; ++i)
@@ -385,3 +472,22 @@ tinytest_set_test_skipped_(void)
cur_test_outcome = SKIP;
}
+char *
+tinytest_format_hex_(const void *val_, unsigned long len)
+{
+ const unsigned char *val = val_;
+ char *result, *cp;
+ size_t i;
+
+ if (!val)
+ return strdup("null");
+ if (!(result = malloc(len*2+1)))
+ return strdup("<allocation failure>");
+ cp = result;
+ for (i=0;i<len;++i) {
+ *cp++ = "0123456789ABCDEF"[val[i] >> 4];
+ *cp++ = "0123456789ABCDEF"[val[i] & 0x0f];
+ }
+ *cp = 0;
+ return result;
+}
diff --git a/src/ext/tinytest.h b/src/ext/tinytest.h
index bcac9f079..ed07b26bc 100644
--- a/src/ext/tinytest.h
+++ b/src/ext/tinytest.h
@@ -32,8 +32,10 @@
#define TT_SKIP (1<<1)
/** Internal runtime flag for a test we've decided to run. */
#define TT_ENABLED_ (1<<2)
+/** Flag for a test that's off by default. */
+#define TT_OFF_BY_DEFAULT (1<<3)
/** If you add your own flags, make them start at this point. */
-#define TT_FIRST_USER_FLAG (1<<3)
+#define TT_FIRST_USER_FLAG (1<<4)
typedef void (*testcase_fn)(void *);
@@ -64,6 +66,12 @@ struct testgroup_t {
};
#define END_OF_GROUPS { NULL, NULL}
+struct testlist_alias_t {
+ const char *name;
+ const char **tests;
+};
+#define END_OF_ALIASES { NULL, NULL }
+
/** Implementation: called from a test to indicate failure, before logging. */
void tinytest_set_test_failed_(void);
/** Implementation: called from a test to indicate that we're skipping. */
@@ -72,14 +80,19 @@ void tinytest_set_test_skipped_(void);
int tinytest_get_verbosity_(void);
/** Implementation: Set a flag on tests matching a name; returns number
* of tests that matched. */
-int tinytest_set_flag_(struct testgroup_t *, const char *, unsigned long);
+int tinytest_set_flag_(struct testgroup_t *, const char *, int set, unsigned long);
+/** Implementation: Put a chunk of memory into hex. */
+char *tinytest_format_hex_(const void *, unsigned long);
/** Set all tests in 'groups' matching the name 'named' to be skipped. */
#define tinytest_skip(groups, named) \
- tinytest_set_flag_(groups, named, TT_SKIP)
+ tinytest_set_flag_(groups, named, 1, TT_SKIP)
/** Run a single testcase in a single group. */
int testcase_run_one(const struct testgroup_t *,const struct testcase_t *);
+
+void tinytest_set_aliases(const struct testlist_alias_t *aliases);
+
/** Run a set of testcases from an END_OF_GROUPS-terminated array of groups,
as selected from the command line. */
int tinytest_main(int argc, const char **argv, struct testgroup_t *groups);
diff --git a/src/ext/tinytest_demo.c b/src/ext/tinytest_demo.c
index be95ce4c1..634e112cb 100644
--- a/src/ext/tinytest_demo.c
+++ b/src/ext/tinytest_demo.c
@@ -35,6 +35,13 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <time.h>
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
/* ============================================================ */
@@ -148,6 +155,10 @@ test_memcpy(void *ptr)
memcpy(db->buffer2, db->buffer1, sizeof(db->buffer1));
tt_str_op(db->buffer1, ==, db->buffer2);
+ /* tt_mem_op() does a memcmp, as opposed to the strcmp in tt_str_op() */
+ db->buffer2[100] = 3; /* Make the buffers unequal */
+ tt_mem_op(db->buffer1, <, db->buffer2, sizeof(db->buffer1));
+
/* Now we've allocated memory that's referenced by a local variable.
The end block of the function will clean it up. */
mem = strdup("Hello world.");
@@ -162,6 +173,27 @@ test_memcpy(void *ptr)
free(mem);
}
+void
+test_timeout(void *ptr)
+{
+ time_t t1, t2;
+ (void)ptr;
+ t1 = time(NULL);
+#ifdef _WIN32
+ Sleep(5000);
+#else
+ sleep(5);
+#endif
+ t2 = time(NULL);
+
+ tt_int_op(t2-t1, >=, 4);
+
+ tt_int_op(t2-t1, <=, 6);
+
+ end:
+ ;
+}
+
/* ============================================================ */
/* Now we need to make sure that our tests get invoked. First, you take
@@ -178,6 +210,10 @@ struct testcase_t demo_tests[] = {
its environment. */
{ "memcpy", test_memcpy, TT_FORK, &data_buffer_setup },
+ /* This flag is off-by-default, since it takes a while to run. You
+ * can enable it manually by passing +demo/timeout at the command line.*/
+ { "timeout", test_timeout, TT_OFF_BY_DEFAULT },
+
/* The array has to end with END_OF_TESTCASES. */
END_OF_TESTCASES
};
@@ -192,6 +228,18 @@ struct testgroup_t groups[] = {
END_OF_GROUPS
};
+/* We can also define test aliases. These can be used for types of tests that
+ * cut across groups. */
+const char *alltests[] = { "+..", NULL };
+const char *slowtests[] = { "+demo/timeout", NULL };
+struct testlist_alias_t aliases[] = {
+
+ { "ALL", alltests },
+ { "SLOW", slowtests },
+
+ END_OF_ALIASES
+};
+
int
main(int c, const char **v)
@@ -211,5 +259,6 @@ main(int c, const char **v)
"tinytest-demo" and "tinytest-demo .." mean the same thing.
*/
+ tinytest_set_aliases(aliases);
return tinytest_main(c, v, groups);
}
diff --git a/src/ext/tinytest_macros.h b/src/ext/tinytest_macros.h
index 9ff69b1d5..db2dfcbe6 100644
--- a/src/ext/tinytest_macros.h
+++ b/src/ext/tinytest_macros.h
@@ -144,6 +144,10 @@
tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt, \
{print_=value_;},{},die_on_fail)
+#define tt_assert_test_type_opt(a,b,str_test,type,test,fmt,die_on_fail) \
+ tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt, \
+ {print_=value_?value_:"<NULL>";},{},die_on_fail)
+
/* Helper: assert that a op b, when cast to type. Format the values with
* printf format fmt on failure. */
#define tt_assert_op_type(a,op,b,type,fmt) \
@@ -163,8 +167,19 @@
(val1_ op val2_),"%p",TT_EXIT_TEST_FUNCTION)
#define tt_str_op(a,op,b) \
- tt_assert_test_type(a,b,#a" "#op" "#b,const char *, \
- (strcmp(val1_,val2_) op 0),"<%s>",TT_EXIT_TEST_FUNCTION)
+ tt_assert_test_type_opt(a,b,#a" "#op" "#b,const char *, \
+ (val1_ && val2_ && strcmp(val1_,val2_) op 0),"<%s>", \
+ TT_EXIT_TEST_FUNCTION)
+
+#define tt_mem_op(expr1, op, expr2, len) \
+ tt_assert_test_fmt_type(expr1,expr2,#expr1" "#op" "#expr2, \
+ const char *, \
+ (val1_ && val2_ && memcmp(val1_, val2_, len) op 0), \
+ char *, "%s", \
+ { print_ = tinytest_format_hex_(value_, (len)); }, \
+ { if (print_) free(print_); }, \
+ TT_EXIT_TEST_FUNCTION \
+ );
#define tt_want_int_op(a,op,b) \
tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_),"%ld",(void)0)
diff --git a/src/or/config.c b/src/or/config.c
index 4c292d82b..19a91ca4c 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1343,6 +1343,19 @@ options_act(const or_options_t *old_options)
}
#endif
+ /* If we are a bridge with a pluggable transport proxy but no
+ Extended ORPort, inform the user that she is missing out. */
+ if (server_mode(options) && options->ServerTransportPlugin &&
+ !options->ExtORPort_lines) {
+ log_notice(LD_CONFIG, "We use pluggable transports but the Extended "
+ "ORPort is disabled. Tor and your pluggable transports proxy "
+ "communicate with each other via the Extended ORPort so it "
+ "is suggested you enable it: it will also allow your Bridge "
+ "to collect statistics about its clients that use pluggable "
+ "transports. Please enable it using the ExtORPort torrc option "
+ "(e.g. set 'ExtORPort auto').");
+ }
+
if (options->SafeLogging_ != SAFELOG_SCRUB_ALL &&
(!old_options || old_options->SafeLogging_ != options->SafeLogging_)) {
log_warn(LD_GENERAL, "Your log may contain sensitive information - you "
@@ -2455,7 +2468,7 @@ options_validate(or_options_t *old_options, or_options_t *options,
!strcmpstart(uname, "Windows Me"))) {
log_warn(LD_CONFIG, "Tor is running as a server, but you are "
"running %s; this probably won't work. See "
- "https://wiki.torproject.org/TheOnionRouter/TorFAQ#ServerOS "
+ "https://www.torproject.org/docs/faq.html#BestOSForRelay "
"for details.", uname);
}
@@ -3272,17 +3285,6 @@ options_validate(or_options_t *old_options, or_options_t *options,
smartlist_free(options_sl);
}
- /* If we are a bridge with a pluggable transport proxy but no
- Extended ORPort, inform the user that she is missing out. */
- if (server_mode(options) && options->ServerTransportPlugin &&
- !options->ExtORPort_lines) {
- log_notice(LD_CONFIG, "We are a bridge with a pluggable transport "
- "proxy but the Extended ORPort is disabled. The "
- "Extended ORPort helps Tor communicate with the pluggable "
- "transport proxy. Please enable it using the ExtORPort "
- "torrc option.");
- }
-
if (options->ConstrainedSockets) {
/* If the user wants to constrain socket buffer use, make sure the desired
* limit is between MIN|MAX_TCPSOCK_BUFFER in k increments. */
@@ -4679,8 +4681,8 @@ parse_client_transport_line(const char *line, int validate_only)
if (is_managed) { /* managed */
if (!validate_only && is_useless_proxy) {
- log_warn(LD_GENERAL, "Pluggable transport proxy (%s) does not provide "
- "any needed transports and will not be launched.", line);
+ log_notice(LD_GENERAL, "Pluggable transport proxy (%s) does not provide "
+ "any needed transports and will not be launched.", line);
}
/* If we are not just validating, use the rest of the line as the
diff --git a/src/or/connection.c b/src/or/connection.c
index 46ce53819..19944161f 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -4164,6 +4164,31 @@ connection_dir_get_by_purpose_and_resource(int purpose,
return NULL;
}
+/** Return 1 if there are any active OR connections apart from
+ * <b>this_conn</b>.
+ *
+ * We use this to guess if we should tell the controller that we
+ * didn't manage to connect to any of our bridges. */
+int
+any_other_active_or_conns(const or_connection_t *this_conn)
+{
+ smartlist_t *conns = get_connection_array();
+ SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) {
+ if (conn == TO_CONN(this_conn)) { /* don't consider this conn */
+ continue;
+ }
+
+ if (conn->type == CONN_TYPE_OR &&
+ !conn->marked_for_close) {
+ log_debug(LD_DIR, "%s: Found an OR connection: %s",
+ __func__, conn->address);
+ return 1;
+ }
+ } SMARTLIST_FOREACH_END(conn);
+
+ return 0;
+}
+
/** Return 1 if <b>conn</b> is a listener conn, else return 0. */
int
connection_is_listener(connection_t *conn)
diff --git a/src/or/connection.h b/src/or/connection.h
index fa076504b..13dcbcd91 100644
--- a/src/or/connection.h
+++ b/src/or/connection.h
@@ -187,6 +187,8 @@ connection_t *connection_get_by_type_state_rendquery(int type, int state,
dir_connection_t *connection_dir_get_by_purpose_and_resource(
int state, const char *resource);
+int any_other_active_or_conns(const or_connection_t *this_conn);
+
#define connection_speaks_cells(conn) ((conn)->type == CONN_TYPE_OR)
int connection_is_listener(connection_t *conn);
int connection_state_is_open(connection_t *conn);
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index dbf05a6fc..82b2971fd 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -714,7 +714,8 @@ connection_or_about_to_close(or_connection_t *or_conn)
reason);
if (!authdir_mode_tests_reachability(options))
control_event_bootstrap_problem(
- orconn_end_reason_to_control_string(reason), reason);
+ orconn_end_reason_to_control_string(reason),
+ reason, or_conn);
}
}
} else if (conn->hold_open_until_flushed) {
@@ -1077,7 +1078,7 @@ connection_or_connect_failed(or_connection_t *conn,
{
control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED, reason);
if (!authdir_mode_tests_reachability(get_options()))
- control_event_bootstrap_problem(msg, reason);
+ control_event_bootstrap_problem(msg, reason, conn);
}
/** <b>conn</b> got an error in connection_handle_read_impl() or
@@ -1708,7 +1709,8 @@ connection_or_client_learned_peer_id(or_connection_t *conn,
if (!authdir_mode_tests_reachability(options))
control_event_bootstrap_problem(
"Unexpected identity in router certificate",
- END_OR_CONN_REASON_OR_IDENTITY);
+ END_OR_CONN_REASON_OR_IDENTITY,
+ conn);
return -1;
}
if (authdir_mode_tests_reachability(options)) {
diff --git a/src/or/control.c b/src/or/control.c
index 1da996992..23e2054f9 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -4879,10 +4879,12 @@ control_event_bootstrap(bootstrap_status_t status, int progress)
/** Called when Tor has failed to make bootstrapping progress in a way
* that indicates a problem. <b>warn</b> gives a hint as to why, and
- * <b>reason</b> provides an "or_conn_end_reason" tag.
+ * <b>reason</b> provides an "or_conn_end_reason" tag. <b>or_conn</b>
+ * is the connection that caused this problem.
*/
MOCK_IMPL(void,
-control_event_bootstrap_problem, (const char *warn, int reason))
+ control_event_bootstrap_problem, (const char *warn, int reason,
+ const or_connection_t *or_conn))
{
int status = bootstrap_percent;
const char *tag, *summary;
@@ -4904,9 +4906,10 @@ control_event_bootstrap_problem, (const char *warn, int reason))
if (reason == END_OR_CONN_REASON_NO_ROUTE)
recommendation = "warn";
- if (get_options()->UseBridges &&
- !any_bridge_descriptors_known() &&
- !any_pending_bridge_descriptor_fetches())
+ /* If we are using bridges and all our OR connections are now
+ closed, it means that we totally failed to connect to our
+ bridges. Throw a warning. */
+ if (get_options()->UseBridges && !any_other_active_or_conns(or_conn))
recommendation = "warn";
if (we_are_hibernating())
diff --git a/src/or/control.h b/src/or/control.h
index 0466de17f..ce605a120 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -93,7 +93,8 @@ void monitor_owning_controller_process(const char *process_spec);
void control_event_bootstrap(bootstrap_status_t status, int progress);
MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn,
- int reason));
+ int reason,
+ const or_connection_t *or_conn));
void control_event_clients_seen(const char *controller_str);
void control_event_transport_launched(const char *mode,
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 37d5fb974..b374ac7a3 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -2207,27 +2207,6 @@ any_bridge_descriptors_known(void)
return choose_random_entry(NULL) != NULL;
}
-/** Return 1 if there are any directory conns fetching bridge descriptors
- * that aren't marked for close. We use this to guess if we should tell
- * the controller that we have a problem. */
-int
-any_pending_bridge_descriptor_fetches(void)
-{
- smartlist_t *conns = get_connection_array();
- SMARTLIST_FOREACH_BEGIN(conns, connection_t *, conn) {
- if (conn->type == CONN_TYPE_DIR &&
- conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC &&
- TO_DIR_CONN(conn)->router_purpose == ROUTER_PURPOSE_BRIDGE &&
- !conn->marked_for_close &&
- conn->linked &&
- conn->linked_conn && !conn->linked_conn->marked_for_close) {
- log_debug(LD_DIR, "found one: %s", conn->address);
- return 1;
- }
- } SMARTLIST_FOREACH_END(conn);
- return 0;
-}
-
/** Return 1 if we have at least one descriptor for an entry guard
* (bridge or member of EntryNodes) and all descriptors we know are
* down. Else return 0. If <b>act</b> is 1, then mark the down guards
diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h
index 772c6662d..73ac017ff 100644
--- a/src/or/entrynodes.h
+++ b/src/or/entrynodes.h
@@ -105,7 +105,6 @@ void retry_bridge_descriptor_fetch_directly(const char *digest);
void fetch_bridge_descriptors(const or_options_t *options, time_t now);
void learned_bridge_descriptor(routerinfo_t *ri, int from_cache);
int any_bridge_descriptors_known(void);
-int any_pending_bridge_descriptor_fetches(void);
int entries_known_but_down(const or_options_t *options);
void entries_retry_all(const or_options_t *options);
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 8052ca998..6419ea79f 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -721,7 +721,7 @@ update_microdesc_downloads(time_t now)
smartlist_t *missing;
digestmap_t *pending;
- if (should_delay_dir_fetches(options))
+ if (should_delay_dir_fetches(options, NULL))
return;
if (directory_too_idle_to_fetch_descriptors(options, now))
return;
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 2b0242b56..49478a734 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -31,6 +31,7 @@
#include "router.h"
#include "routerlist.h"
#include "routerparse.h"
+#include "transports.h"
/** Map from lowercase nickname to identity digest of named server, if any. */
static strmap_t *named_server_map = NULL;
@@ -884,14 +885,37 @@ update_consensus_networkstatus_fetch_time(time_t now)
/** Return 1 if there's a reason we shouldn't try any directory
* fetches yet (e.g. we demand bridges and none are yet known).
- * Else return 0. */
+ * Else return 0.
+
+ * If we return 1 and <b>msg_out</b> is provided, set <b>msg_out</b>
+ * to an explanation of why directory fetches are delayed. (If we
+ * return 0, we set msg_out to NULL.)
+ */
int
-should_delay_dir_fetches(const or_options_t *options)
+should_delay_dir_fetches(const or_options_t *options, const char **msg_out)
{
- if (options->UseBridges && !any_bridge_descriptors_known()) {
- log_info(LD_DIR, "delaying dir fetches (no running bridges known)");
- return 1;
+ if (msg_out) {
+ *msg_out = NULL;
}
+
+ if (options->UseBridges) {
+ if (!any_bridge_descriptors_known()) {
+ if (msg_out) {
+ *msg_out = "No running bridges";
+ }
+ log_info(LD_DIR, "Delaying dir fetches (no running bridges known)");
+ return 1;
+ }
+
+ if (pt_proxies_configuration_pending()) {
+ if (msg_out) {
+ *msg_out = "Pluggable transport proxies still configuring";
+ }
+ log_info(LD_DIR, "Delaying dir fetches (pt proxies still configuring)");
+ return 1;
+ }
+ }
+
return 0;
}
@@ -901,7 +925,7 @@ void
update_networkstatus_downloads(time_t now)
{
const or_options_t *options = get_options();
- if (should_delay_dir_fetches(options))
+ if (should_delay_dir_fetches(options, NULL))
return;
update_consensus_networkstatus_downloads(now);
update_certificate_downloads(now);
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index df5895c4b..1659818f0 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -53,7 +53,7 @@ int networkstatus_nickname_is_unnamed(const char *nickname);
void networkstatus_consensus_download_failed(int status_code,
const char *flavname);
void update_consensus_networkstatus_fetch_time(time_t now);
-int should_delay_dir_fetches(const or_options_t *options);
+int should_delay_dir_fetches(const or_options_t *options,const char **msg_out);
void update_networkstatus_downloads(time_t now);
void update_certificate_downloads(time_t now);
int consensus_is_waiting_for_certs(void);
diff --git a/src/or/nodelist.c b/src/or/nodelist.c
index 737de92ee..3704822c7 100644
--- a/src/or/nodelist.c
+++ b/src/or/nodelist.c
@@ -1477,6 +1477,7 @@ update_router_have_minimum_dir_info(void)
const networkstatus_t *consensus =
networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor());
int using_md;
+ const char *delay_fetches_msg = NULL;
if (!consensus) {
if (!networkstatus_get_latest_consensus())
@@ -1489,10 +1490,9 @@ update_router_have_minimum_dir_info(void)
goto done;
}
- if (should_delay_dir_fetches(get_options())) {
- log_notice(LD_DIR, "no known bridge descriptors running yet; stalling");
- strlcpy(dir_info_status, "No live bridge descriptors.",
- sizeof(dir_info_status));
+ if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) {
+ log_notice(LD_DIR, "Delaying dir fetches: %s", delay_fetches_msg);
+ strlcpy(dir_info_status, "%s", sizeof(dir_info_status));
res = 0;
goto done;
}
diff --git a/src/or/policies.c b/src/or/policies.c
index 6289d70bb..42dc46b7f 100644
--- a/src/or/policies.c
+++ b/src/or/policies.c
@@ -482,10 +482,12 @@ validate_addr_policies(const or_options_t *options, char **msg)
* Ignore port specifiers.
*/
static int
-load_policy_from_option(config_line_t *config, smartlist_t **policy,
+load_policy_from_option(config_line_t *config, const char *option_name,
+ smartlist_t **policy,
int assume_action)
{
int r;
+ int killed_any_ports = 0;
addr_policy_list_free(*policy);
*policy = NULL;
r = parse_addr_policy(config, policy, assume_action);
@@ -504,9 +506,13 @@ load_policy_from_option(config_line_t *config, smartlist_t **policy,
c = addr_policy_get_canonical_entry(&newp);
SMARTLIST_REPLACE_CURRENT(*policy, n, c);
addr_policy_free(n);
+ killed_any_ports = 1;
}
} SMARTLIST_FOREACH_END(n);
}
+ if (killed_any_ports) {
+ log_warn(LD_CONFIG, "Ignoring ports in %s option.", option_name);
+ }
return 0;
}
@@ -516,20 +522,22 @@ int
policies_parse_from_options(const or_options_t *options)
{
int ret = 0;
- if (load_policy_from_option(options->SocksPolicy, &socks_policy, -1) < 0)
+ if (load_policy_from_option(options->SocksPolicy, "SocksPolicy",
+ &socks_policy, -1) < 0)
ret = -1;
- if (load_policy_from_option(options->DirPolicy, &dir_policy, -1) < 0)
+ if (load_policy_from_option(options->DirPolicy, "DirPolicy",
+ &dir_policy, -1) < 0)
ret = -1;
- if (load_policy_from_option(options->AuthDirReject,
+ if (load_policy_from_option(options->AuthDirReject, "AuthDirReject",
&authdir_reject_policy, ADDR_POLICY_REJECT) < 0)
ret = -1;
- if (load_policy_from_option(options->AuthDirInvalid,
+ if (load_policy_from_option(options->AuthDirInvalid, "AuthDirInvalid",
&authdir_invalid_policy, ADDR_POLICY_REJECT) < 0)
ret = -1;
- if (load_policy_from_option(options->AuthDirBadDir,
+ if (load_policy_from_option(options->AuthDirBadDir, "AuthDirBadDir",
&authdir_baddir_policy, ADDR_POLICY_REJECT) < 0)
ret = -1;
- if (load_policy_from_option(options->AuthDirBadExit,
+ if (load_policy_from_option(options->AuthDirBadExit, "AuthDirBadExit",
&authdir_badexit_policy, ADDR_POLICY_REJECT) < 0)
ret = -1;
if (parse_reachable_addresses() < 0)
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 49ea752ba..8d29b89ea 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -669,7 +669,7 @@ authority_certs_fetch_missing(networkstatus_t *status, time_t now)
char id_digest_str[2*DIGEST_LEN+1];
char sk_digest_str[2*DIGEST_LEN+1];
- if (should_delay_dir_fetches(get_options()))
+ if (should_delay_dir_fetches(get_options(), NULL))
return;
pending_cert = fp_pair_map_new();
@@ -4592,7 +4592,7 @@ void
update_router_descriptor_downloads(time_t now)
{
const or_options_t *options = get_options();
- if (should_delay_dir_fetches(options))
+ if (should_delay_dir_fetches(options, NULL))
return;
if (!we_fetch_router_descriptors(options))
return;
@@ -4613,7 +4613,7 @@ update_extrainfo_downloads(time_t now)
int n_no_ei = 0, n_pending = 0, n_have = 0, n_delay = 0;
if (! options->DownloadExtraInfo)
return;
- if (should_delay_dir_fetches(options))
+ if (should_delay_dir_fetches(options, NULL))
return;
if (!router_have_minimum_dir_info())
return;
diff --git a/src/test/test.c b/src/test/test.c
index 456dde141..0ba5da367 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -671,6 +671,7 @@ test_policies(void)
config_line_t line;
smartlist_t *sm = NULL;
char *policy_str = NULL;
+ short_policy_t *short_parsed = NULL;
policy = smartlist_new();
@@ -858,24 +859,28 @@ test_policies(void)
test_short_policy_parse("reject ,1-10,,,,30-40", "reject 1-10,30-40");
/* Try parsing various broken short policies */
- tt_ptr_op(NULL, ==, parse_short_policy("accept 200-199"));
- tt_ptr_op(NULL, ==, parse_short_policy(""));
- tt_ptr_op(NULL, ==, parse_short_policy("rejekt 1,2,3"));
- tt_ptr_op(NULL, ==, parse_short_policy("reject "));
- tt_ptr_op(NULL, ==, parse_short_policy("reject"));
- tt_ptr_op(NULL, ==, parse_short_policy("rej"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 2,3,100000"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 2,3x,4"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 2,3x,4"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 2-"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 2-x"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 1-,3"));
- tt_ptr_op(NULL, ==, parse_short_policy("accept 1-,3"));
+#define TT_BAD_SHORT_POLICY(s) \
+ do { \
+ tt_ptr_op(NULL, ==, (short_parsed = parse_short_policy((s)))); \
+ } while (0)
+ TT_BAD_SHORT_POLICY("accept 200-199");
+ TT_BAD_SHORT_POLICY("");
+ TT_BAD_SHORT_POLICY("rejekt 1,2,3");
+ TT_BAD_SHORT_POLICY("reject ");
+ TT_BAD_SHORT_POLICY("reject");
+ TT_BAD_SHORT_POLICY("rej");
+ TT_BAD_SHORT_POLICY("accept 2,3,100000");
+ TT_BAD_SHORT_POLICY("accept 2,3x,4");
+ TT_BAD_SHORT_POLICY("accept 2,3x,4");
+ TT_BAD_SHORT_POLICY("accept 2-");
+ TT_BAD_SHORT_POLICY("accept 2-x");
+ TT_BAD_SHORT_POLICY("accept 1-,3");
+ TT_BAD_SHORT_POLICY("accept 1-,3");
+
/* Test a too-long policy. */
{
int i;
char *policy = NULL;
- short_policy_t *parsed;
smartlist_t *chunks = smartlist_new();
smartlist_add(chunks, tor_strdup("accept "));
for (i=1; i<10000; ++i)
@@ -884,9 +889,9 @@ test_policies(void)
policy = smartlist_join_strings(chunks, "", 0, NULL);
SMARTLIST_FOREACH(chunks, char *, ch, tor_free(ch));
smartlist_free(chunks);
- parsed = parse_short_policy(policy);/* shouldn't be accepted */
+ short_parsed = parse_short_policy(policy);/* shouldn't be accepted */
tor_free(policy);
- tt_ptr_op(NULL, ==, parsed);
+ tt_ptr_op(NULL, ==, short_parsed);
}
/* truncation ports */
@@ -927,6 +932,7 @@ test_policies(void)
SMARTLIST_FOREACH(sm, char *, s, tor_free(s));
smartlist_free(sm);
}
+ short_policy_free(short_parsed);
}
/** Test encoding and parsing of rendezvous service descriptors. */
diff --git a/src/test/test.h b/src/test/test.h
index a89b558e5..ba82f52ad 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -36,17 +36,7 @@
#define test_strneq(expr1, expr2) tt_str_op((expr1), !=, (expr2))
#define test_mem_op(expr1, op, expr2, len) \
- tt_assert_test_fmt_type(expr1,expr2,#expr1" "#op" "#expr2, \
- const char *, \
- (memcmp(val1_, val2_, len) op 0), \
- char *, "%s", \
- { size_t printlen = (len)*2+1; \
- print_ = tor_malloc(printlen); \
- base16_encode(print_, printlen, value_, \
- (len)); }, \
- { tor_free(print_); }, \
- TT_EXIT_TEST_FUNCTION \
- );
+ tt_mem_op((expr1), op, (expr2), (len))
#define test_memeq(expr1, expr2, len) test_mem_op((expr1), ==, (expr2), len)
#define test_memneq(expr1, expr2, len) test_mem_op((expr1), !=, (expr2), len)
diff --git a/src/test/test_extorport.c b/src/test/test_extorport.c
index 7e38ba57d..b34f5e38d 100644
--- a/src/test/test_extorport.c
+++ b/src/test/test_extorport.c
@@ -363,10 +363,12 @@ test_ext_or_cookie_auth_testvec(void *arg)
}
static void
-ignore_bootstrap_problem(const char *warn, int reason)
+ignore_bootstrap_problem(const char *warn, int reason,
+ const or_connection_t *conn)
{
(void)warn;
(void)reason;
+ (void)conn;
}
static int is_reading = 1;
diff --git a/src/test/test_routerkeys.c b/src/test/test_routerkeys.c
index ff52a7e7c..1c8174b06 100644
--- a/src/test/test_routerkeys.c
+++ b/src/test/test_routerkeys.c
@@ -32,7 +32,7 @@ test_routerkeys_write_fingerprint(void *arg)
set_server_identity_key(key);
set_client_identity_key(crypto_pk_dup_key(key));
- check_private_dir(ddir, CPD_CREATE, NULL);
+ tt_int_op(0, ==, check_private_dir(ddir, CPD_CREATE, NULL));
tt_int_op(crypto_pk_cmp_keys(get_server_identity_key(),key),==,0);
/* Write fingerprint file */
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index 4983b4a7b..ba59e3b71 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -241,7 +241,7 @@
#define USING_TWOS_COMPLEMENT
/* Version number of package */
-#define VERSION "0.2.5.2-alpha"
+#define VERSION "0.2.5.3-alpha-dev"