Commit Graph

36677 Commits

Author SHA1 Message Date
Nick Mathewson
cce7d1edaf Merge branch 'mr_240_squashed' 2020-12-21 13:23:42 -05:00
David Goulet
f4cbcde2da test: Fix memleak in test/load_stats_file
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-21 13:18:20 -05:00
Karsten Loesing
5dd6304f36 Fix timestamp parser in new load_stats_file.
The previous parser only considered stats files _starting_ with the
timestamp tag, not stats files having the timestamp tag in a later
position. While this applies to all current stats files, a future
stats file might look differently. Better to fix the function now than
be surprised in another 9 years from now.

This commit also adds a test case for such future stats, and it fixes
stats file paths in newly added unit tests.
2020-12-21 13:18:20 -05:00
David Goulet
c934fced31 relay: Report the entire content of a stats file
It turns out that 9 years ago, we stopped appending data into stats file and
rather overwrite everytime we have new stats (see commit
a6a127c833)

The load_stats_file() function was still thinking that we could have the same
line many times in the file which turns out to be false since 9 years ago.
However, that did not cause problem until IPv6 connection stats came along
which introduced a new line in conn-stats: "ipv6-conn-bi-direct ...".

Before, that file contained a single line starting with the tag
"conn-bi-direct".  That very tag appears also in the IPv6 tag (see above) so
the load_stats_file() function would consider that the IPv6 line as the last
tag to be appeneded to the file and fail to report the line above (for IPv4).
It would actually truncate the IPv6 line and report it (removing the "ipv6-"
part).

In other words, "conn-bi-direct" was not reported and instead
"ipv6-conn-bi-direct" was used without the "ipv6-" part.

This commit refactors the entire function so that now it looks for a
"timestamp tag" to validate and then if everything is fine, returns the entire
content of the file. The refactor simplifies the function, adds logging in
case of failures and modernize it in terms of coding standard.

Unit tests are also added that makes sure the loaded content matches the
entire file if timestamp validation passes.

Fixes #40226

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-21 13:18:20 -05:00
Alexander Færøy
db5f7b4250 Merge remote-tracking branch 'tor-gitlab/mr/211' 2020-12-18 14:22:23 +00:00
Alexander Færøy
b645fbdb54 Merge remote-tracking branch 'tor-gitlab/mr/207' 2020-12-18 14:19:24 +00:00
David Goulet
5527aef56f Merge branch 'maint-0.4.5' 2020-12-17 08:25:29 -05:00
David Goulet
d45354d5ea Merge branch 'tor-gitlab/mr/243' into maint-0.4.5 2020-12-17 08:25:18 -05:00
George Kadianakis
d89974c5c6 Fix Keccak undefined behavior on exotic platforms.
Bug reported and diagnosed in:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975977

Fixes bug #40210.
2020-12-17 13:49:17 +02:00
Alexander Færøy
0bd4cd8101 Merge remote-tracking branch 'tor-gitlab/mr/230' 2020-12-16 20:55:03 +00:00
Alexander Færøy
66597b9291 Merge branch 'maint-0.4.5' 2020-12-16 20:39:01 +00:00
Alexander Færøy
5a2d01ae57 Merge branch 'tor-gitlab/mr/234' into maint-0.4.5 2020-12-16 20:38:23 +00:00
David Goulet
ee6ad0e592 config: Catch missing Bridge for ClientTransportPlugin
When making sure we have a Bridge line with a ClientTransportPlugin, we
now check in the managed proxy list and so we can catch any missing
ClientTransportPlugin for a Bridge line.

Fixes #40106

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-16 20:37:57 +00:00
Alexander Færøy
66b1a9a5c1 Merge branch 'maint-0.4.5' 2020-12-16 20:31:46 +00:00
Alexander Færøy
b83777f7b2 Merge remote-tracking branch 'tor-gitlab/mr/238' into maint-0.4.5 2020-12-16 20:31:10 +00:00
Alexander Færøy
2d68fdc94c Merge branch 'maint-0.4.5' 2020-12-16 20:29:19 +00:00
Alexander Færøy
7998ea2f18 Merge remote-tracking branch 'tor-gitlab/mr/237' into maint-0.4.5 2020-12-16 20:29:03 +00:00
David Goulet
8b2d32435d build: Add "make lsp" command
Generates the compile_commands.json file using the "bear" application so the
ccls server can be more efficient with our code base.

Closes #40227

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-16 19:19:12 +02:00
David Goulet
1430d5ff63 Merge branch 'maint-0.4.5' 2020-12-15 11:58:22 -05:00
David Goulet
4a77aa6e82 Merge branch 'tor-gitlab/mr/239' into maint-0.4.5 2020-12-15 11:58:13 -05:00
George Kadianakis
93f2de8523 Merge branch 'maint-0.4.5' 2020-12-15 16:29:01 +02:00
George Kadianakis
c731a4efec Merge remote-tracking branch 'tor-gitlab/mr/205' into maint-0.4.5 2020-12-15 16:28:49 +02:00
George Kadianakis
c05ae61f26 Merge remote-tracking branch 'tor-gitlab/mr/205' 2020-12-15 16:28:04 +02:00
Nick Mathewson
c4fe66e342 Socks5: handle truncated client requests correctly
Previously, our code would send back an error if the socks5 request
parser said anything but DONE.  But there are other non-error cases,
like TRUNCATED: we shouldn't send back errors for them.

This patch lowers the responsibility for setting the error message
into the parsing code, since the actual type of the error message
will depend on what problem was encountered.

Fixes bug 40190; bugfix on 0.3.5.1-alpha.
2020-12-14 10:14:03 -05:00
David Goulet
15b0d30a55 configure: Revert back the static libevent path
From c618c4f279, we changed the static
libevent.a path to be able to use the git repository or tarball directly but
that broke the "make install" setup that Tor Browser is using with Android.

In other words, the git repository and tarball put the "libevent.a" in
".libs/" where "make install" puts it in "lib/".

Using the --with-libevent-dir=..., which is mandatory for static libevent,
autoconf will take the path and use it for the includes (-I) and library (-L)
for which if it finds a "include/" and a "lib/" in the root, it will use
those.

However, with the git repo or tarball, the "lib/" doesn't exists thus autoconf
sets the library search path to be at the root and thus fails to find the
libevent.a in ".libs/".

This is a whole lot more work to make both cases work in our configure.ac thus
I'm reverting the change here to the Tor Browser case works again and the work
around for others is to either symlink the libevent.a at the root or use a
temporary make install directory.

One long term fix here would likely be to ask libevent to symblink the .a into
the root along the .la files and likely do the same for .so. Or, use the
"lib/" structure to contain the .a + .so files. Would be better than doing
ninji-tsu in our configure.ac

Fixes #40225

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-11 09:52:23 -05:00
George Kadianakis
04b271af9f Merge remote-tracking branch 'tor-gitlab/mr/232' 2020-12-11 15:56:13 +02:00
Nick Mathewson
34baa1bdc3 Tweak the documentation for approved-routers
Document !badexit, and improve the documentation for !invalid.

Closes #40188.
2020-12-09 14:08:55 -05:00
Nick Mathewson
ce1c3c6898 Fix a typo in coverage builds.
We should be using TOR_STATIC_LDFLAGS, not TOR_STATIC_LDFALGS.

Bug not in any released version of Tor.
2020-12-09 13:31:34 -05:00
Nick Mathewson
2bfb76b927 Merge branch 'mr_224_squashed' 2020-12-09 10:03:45 -05:00
Alexander Færøy
ed3f46a385 Announce URL to bridge status page when starting Tor as a bridge relay.
This patch makes Tor announce the relay specific bridge status page URL
when Tor is starting up before bootstrap occours.

See: tor#30477
2020-12-09 10:03:11 -05:00
Daniel Pinto
bd0046c9ec Avoid sandbox bug warning when unglobbing patterns #40094
Adds a more user-friendly error message when the configuration is
reloaded and a new %include is added that makes its unglobbing
access files/folders not allowed by the seccomp sandbox.
2020-12-08 15:00:43 -05:00
Nick Mathewson
baef0843a4 Fix a couple of documentation comments related to #40094 2020-12-08 14:59:28 -05:00
David Goulet
6e83a52077 Merge branch 'maint-0.4.5' 2020-12-08 14:51:43 -05:00
David Goulet
e74f168bb4 relay: Avoid log reachability test for bandwidth test circuit
Fixes #40205

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-08 14:51:31 -05:00
George Kadianakis
f280c171e2 Merge branch 'mr/233' 2020-12-08 16:54:18 +02:00
Nick Mathewson
558aaf1c32 Command-line arguments: be better at detecting absent optional args.
Previously, "--list-fingerprint --quiet" was an error.  Now, the
handler for optional arguments to "--list-fingerprint" can tell that
"--quiet" is a flag, not an argument.

This only affects flags that take an _optional_ argument, so you can
still put your torrc file in a location starting with "-".

Closes #40223.
2020-12-08 16:53:57 +02:00
David Goulet
2d0a7f2e89 Merge branch 'maint-0.4.5' 2020-12-08 09:15:06 -05:00
David Goulet
c618c4f279 configure: Fix the --enable-static-tor switch
The "-static" compile flag was set globally which means that all autoconf test
were attempting to be built statically and lead to failures of detecting
OpenSSL libraries and others.

This commit adds this flag only to the "tor" binary build.

There is also a fix on where to find libevent.a since it is using libtool, it
is in .libs/.

At this commit, there are still warnings being emitted that informs the user
that the built binary must still be linked dynamically with glibc.

Fixes #40111

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-12-08 09:14:49 -05:00
Nick Mathewson
a09eb66cc7 Merge remote-tracking branch 'tor-gitlab/mr/219' 2020-12-08 08:19:37 -05:00
Neel Chauhan
599af15159 Fix formatting in comment in parse_port_config() 2020-12-03 20:50:18 -08:00
Nick Mathewson
b50fcdc2e7 Changes file for #40213 / !227 2020-12-02 10:32:39 -05:00
Nick Mathewson
6c602026e8 Detect extra bytes in HAProxy inbuf when transitioning to OR handshake
This shouldn't be possible, but let's add it for defense-in-depth.

Closes #40017.
2020-12-02 10:07:26 -05:00
Daniel Pinto
328f38a59f Use atomic ops to access lock_owner in WIN32 tor_mutex_t #17927 2020-11-30 02:54:13 +00:00
Samanta Navarro
2a06b7c3b8 Support Python 3.8 in hs_build_address.py
The Python code is such a nice addition to the documentation and the C
code for better understanding of onion v3 address generation. Straight
to the point and easy to understand.

Unfortunately it did not work with my distribution's Python version. I
have adjusted the code to support Python 3.8 (tested with 3.8.6) and
to still be compatible with Python 2.
2020-11-28 11:38:43 +00:00
Alexander Færøy
7640631539 Fix build on 32-bit Windows.
Currently Tor fails with the following error:

    src/test/test_stats.c: In function ‘test_rephist_v3_onions’:
    src/test/test_stats.c:527:22: error: overflow in implicit constant conversion [-Werror=overflow]
       update_approx_time(10101010101);

This patch changes the constant passed to update_approx_time() to avoid
the overflow in the implicit conversion.

See: tor#40199
2020-11-25 17:16:24 +00:00
David Goulet
fd80979786 Merge branch 'tor-gitlab/mr/221' 2020-11-24 10:26:17 -05:00
Nick Mathewson
94fc207d42 Remove changes files for things that went out in 0.4.5.2-alpha or earlier 2020-11-23 14:15:31 -05:00
Nick Mathewson
eb1a010476 copy 0.4.5.2-alpha changelog forward. 2020-11-23 14:12:13 -05:00
Roger Dingledine
4f1e38ec8e fix two trivial comment mistakes 2020-11-23 14:08:42 -05:00
Nick Mathewson
ff2b7ae1f3 Merge branch 'maint-0.4.5' into master
"ours" to avoid version bump.
2020-11-23 14:04:05 -05:00