Commit Graph

9715 Commits

Author SHA1 Message Date
Nick Mathewson
511822529a Revise fix for bug 32178 (spaces at end of log msg).
The loop in the earlier patch would invoke undefined behavior in two
ways: First, it would check whether it was looking at a space before
it checked whether the pointer was in-range.  Second, it would let a
pointer reach a position _before_ the start of a string, which is
not allowed.

I've removed the assertion about empty messages: empty messages can
be their own warning IMO.

I've also added tests for this formatting code, to make sure it
actually works.
2020-10-28 09:41:51 -04:00
Amadeusz Pawlik
4520fbc05e adds change file 2020-10-28 09:09:00 -04:00
Neel Chauhan
09b3af578d Stop forcing IPv4 and IPv6 traffic on non-SOCKSPorts 2020-10-27 17:57:48 -07:00
Neel Chauhan
0c79cddc6b Avoid asserts with flag 2020-10-27 14:47:42 -07:00
David Goulet
f2e4204590 changes: File for ticket 40063, the MetricsPort
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet
26cfac1880 Merge branch 'tor-gitlab/mr/176' into maint-0.4.4 2020-10-27 10:18:16 -04:00
David Goulet
6338fc2afa Merge branch 'tor-gitlab/mr/173' 2020-10-27 09:43:04 -04:00
David Goulet
683c794273 Merge branch 'tor-gitlab/mr/176' 2020-10-27 09:36:16 -04:00
Nick Mathewson
c90535c539 Merge branch 'maint-0.4.4' 2020-10-26 16:39:31 -04:00
Nick Mathewson
c1bcc1da03 Make ticket40164 compliant with style 2020-10-26 16:39:24 -04:00
George Kadianakis
07f2a06c61 Merge remote-tracking branch 'tor-gitlab/mr/169' into master 2020-10-26 17:04:58 +02:00
Nick Mathewson
f43fe890dd Merge remote-tracking branch 'tor-gitlab/mr/127' 2020-10-23 11:47:40 -04:00
Nick Mathewson
fd58e74ddc Update required/recommended protocol lists more systematically
First I began with a set of candidates:

  The client's _required_ list starts with all the protocols
  supported by every release in 0.2.9-stable through current
  master.

  The client's _required_ list starts with all the protocols
  supported by every release in 0.3.5-stable through current
  master.

  Everybody's _recommended_ list starts with all the protocols
  supported by every release in 0.3.5-stable through current master.

Then I removed the protocol versions that we do not actually want to
require or recommend:

  DirCache=1 (deprecated)
  HSDir=1, HSIntro=1-3, HSRend=1 (deprecated)
  (All HS* protocol requirements for clients)
  Link=1-3 (deprecated)
  LinkAuth=1 (obsolete)
  Relay=1 (obsolete)
2020-10-23 11:23:08 -04:00
Nick Mathewson
2908086694 Merge branch 'combined_libs' 2020-10-23 10:33:07 -04:00
Nick Mathewson
e834702f9d Changes file for ticket 40127 2020-10-23 10:32:08 -04:00
Roger Dingledine
00118355f5 Turn ConsensusParams into a Linelist
Make it possible to specify multiple ConsensusParams torrc
lines.

Now directory authority operators can for example put the
main ConsensusParams config in one torrc file and then add to it
from a different torrc file.

Closes ticket 40164.
2020-10-22 03:26:03 -04:00
Nick Mathewson
c9ddf191cf Make "check-changes" work on bug32671. 2020-10-21 07:44:54 -04:00
Daniel Pinto
bb9707420e Allow mutiple lines on configuration for ROUTERSET entries. #28361
Affected entries are: EntryNodes, ExcludeNodes, ExcludeExitNodes,
ExitNodes, MiddleNodes, HSLayer2Nodes and HSLayer3Nodes.
2020-10-21 01:53:50 +01:00
Guinness
0668437b58
Set is_padding_timer_scheduled to 0
When calling `circpad_send_padding_cell_for_callback()`, the flag
`is_padding_timer_scheduled` was not resetted to 0 which caused an issue
in the circpad simulator.
This commit fixes this problem.

Fixes #32671.
2020-10-20 21:04:33 +02:00
Nick Mathewson
66cd12e044 reindent changes/ticket40053 2020-10-20 09:03:51 -04:00
Nick Mathewson
579f200efc Merge branch 'mr_175_squashed' 2020-10-20 09:03:26 -04:00
Guinness
5248d08ede Consider 301 as an error like 404
Tor does not follow redirects when bootstraping so we encountered an
error.

Fixes #40053
2020-10-20 08:57:42 -04:00
George Kadianakis
19302a1dfd Merge remote-tracking branch 'tor-gitlab/mr/148' into master 2020-10-20 13:26:19 +03:00
Nick Mathewson
151d446aa1 Merge remote-tracking branch 'tor-gitlab/mr/167' 2020-10-19 11:15:20 -04:00
Nick Mathewson
d872c69255 Update required/recommended protocol versions.
Cons=1 is the old format of consensuses, without ed25519 keys. It
  is no longer required or recommended.

  Cons=2 is the new format of consensuses, with ed25519 keys. It
  is now required.

  (Similarly for Desc=1,2 and Microdesc=1,2)

No supported client or relay versions should be affected by this
change, since these versions are supported by clients and relays
running 0.2.9 and later.  It will only take effect once enough
authorities vote for it.

Closes ticket 40162.
2020-10-18 16:23:53 -04:00
Nick Mathewson
e934d713b3 Mark as required fields from prop315.
This change breaks some unit tests; it's time to fix those in
subsequent commits.
2020-10-15 18:02:16 -04:00
Nick Mathewson
5718f38c85 Add ed25519 identities to relay descriptions.
(Or at least, to all those relay descriptions that derive from
format_node_description()).

Closes #22668.
2020-10-15 10:29:01 -04:00
Nick Mathewson
33fb51a111 Protover: simplify implementation structure to use 64-bit property
Now that prop318 is in, we can simplify our representation for
protocol range sets to just be a bitmask.
2020-10-14 13:09:29 -04:00
Nick Mathewson
4a80dde43c Merge branch 'prop318_limit_protover_035' into prop318_limit_protover_045 2020-10-14 11:31:58 -04:00
Nick Mathewson
dd63b97288 Implement proposal 318: Limit protovers to 0..63
In brief: we go through a lot of gymnastics to handle huge protover
numbers, but after years of development we're not even close to 10
for any of our current versions.  We also have a convenient
workaround available in case we ever run out of protocols: if (for
example) we someday need Link=64, we can just add Link2=0 or
something.

This patch is a minimal patch to change tor's behavior; it doesn't
take advantage of the new restrictions.

Implements #40133 and proposal 318.
2020-10-14 11:28:37 -04:00
David Goulet
bb249a221f Merge branch 'tor-gitlab/mr/170' 2020-10-14 09:46:44 -04:00
Nick Mathewson
a251cff0c3 Add changes file for 40139 (removing usecreatefast and useoptimisticdata 2020-10-13 14:42:59 -04:00
Alexander Færøy
78aa037c41 Merge remote-tracking branch 'tor-gitlab/mr/161' 2020-10-13 13:50:14 +00:00
Neel Chauhan
05242f5555 Pass the SOCKS request address in relay begin cells 2020-10-12 20:46:42 -07:00
Alex Xu (Hello71)
29065db381 dirclient: print bandwidth usage on one line (#40159) 2020-10-08 09:48:38 -04:00
Nick Mathewson
c4812698c3 Remove long-obsolete members from the state file.
Tor has a feature to preserve unrecognized state file entries in
order to maintain forward compatibility.  But this feature, along
with some unused code that we never actually removed, led to us
keeping items that were of no use to the user, other than at worst
to preserve ancient information about them.

This commit adds a feature to remove obsolete entries when we load
the file.

Closes ticket 40137.
2020-10-07 20:46:37 +03:00
Nick Mathewson
2ceea13140 Merge remote-tracking branch 'tor-gitlab/mr/164' 2020-10-07 09:42:37 -04:00
Nick Mathewson
741edf1b45 Merge remote-tracking branch 'tor-github/pr/1827/head' into maint-0.3.5 2020-10-07 09:29:07 -04:00
David Goulet
17e9d40c16 Merge branch 'tor-gitlab/mr/159' 2020-10-07 09:00:10 -04:00
Nick Mathewson
de03f7a13d Changes file for autoconf improvements in 40138 2020-10-07 09:00:06 -04:00
Nick Mathewson
40f0db75bd Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:38:30 -04:00
David Goulet
b404f085ad hs-v2: Add deprecation warning for service
If at least one service is configured as a version 2, a log warning is emitted
once and only once.

Closes #40003

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-07 08:38:23 -04:00
Nick Mathewson
0e2e517019 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-07 08:35:18 -04:00
Neel Chauhan
884cad3edf Make HSFETCH take the decoded length into account, not the base32 one 2020-10-07 08:35:12 -04:00
Nick Mathewson
3e9fa5a029 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:29:31 -04:00
Nick Mathewson
5f5587ee50 Merge remote-tracking branch 'tor-gitlab/mr/77' into maint-0.3.5 2020-10-07 08:29:23 -04:00
Nick Mathewson
701a1936fa Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:26:04 -04:00
Nick Mathewson
ad7ffa5240 Merge remote-tracking branch 'tor-gitlab/mr/79' into maint-0.3.5 2020-10-07 08:25:55 -04:00
Nick Mathewson
98e14720b5 Merge remote-tracking branch 'tor-github/pr/1661/head' into maint-0.3.5 2020-10-07 08:14:46 -04:00
Nick Mathewson
9587512578 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:10:08 -04:00
Nick Mathewson
968b6c30c1 Merge remote-tracking branch 'tor-gitlab/mr/43' into maint-0.3.5 2020-10-07 08:09:59 -04:00
Nick Mathewson
8505dd5e37 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-07 08:08:02 -04:00
Nick Mathewson
9029444482 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:08:01 -04:00
Nick Mathewson
e0e0ef713e Merge remote-tracking branch 'tor-gitlab/mr/137' into maint-0.3.5 2020-10-07 08:07:53 -04:00
Nick Mathewson
8a561fc5bf Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:05:40 -04:00
Nick Mathewson
84a5bd48e2 Merge remote-tracking branch 'tor-gitlab/mr/103' into maint-0.3.5 2020-10-07 08:05:31 -04:00
Nick Mathewson
b5a88e8d47 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:01:37 -04:00
Nick Mathewson
ed6a328297 Merge branch 'mr_124_squashed' into maint-0.3.5 2020-10-07 08:00:59 -04:00
Nick Mathewson
c5ba8b6221 Parallelize src/test/test into chunks.
First, we introduce a flag to teach src/test/test to split its work
into chunks.  Then we replace our invocation of src/test/test in our
"make check" target with a set of 8 scripts that invoke the first
8th of the tests, the second 8th, and so on.

This change makes our "make -kj4 check" target in our hardened
gitlab build more than twice as fast, since src/test/test was taking
the longest to finish.

Closes 40098.
2020-10-07 08:00:49 -04:00
George Kadianakis
438aba6c0b Merge branch 'maint-0.4.4' into master 2020-10-07 13:42:57 +03:00
George Kadianakis
a914ac5d7c Merge remote-tracking branch 'tor-gitlab/mr/154' into maint-0.4.4 2020-10-07 13:32:17 +03:00
George Kadianakis
84e825598a Merge branch 'maint-0.4.4' into master 2020-10-07 13:29:16 +03:00
George Kadianakis
149b7a2418 Merge remote-tracking branch 'tor-gitlab/mr/163' into maint-0.4.4 2020-10-07 13:29:00 +03:00
Alexander Færøy
5f61e19d8a Expose TOR_PT_OUTBOUND_BIND_ADDRESS_{V4,V6} to Pluggable Transports.
This patch adds support for exposing the environment variables
`TOR_PT_OUTBOUND_BIND_ADDRESS_V4` and `TOR_PT_OUTBOUND_BIND_ADDRESS_V6` to
Pluggable Transport proccesses. These two values will contain the IPv4
and IPv6 address that the user have specified in torrc that they wish
the PT to use for all outgoing IP packets.

It is important to note here that it is up to the indvidual Pluggable
Transport if they are willing to honor these values or ignore them
completely.

One can test this feature using the following dummy PT written in POSIX
shell script:

    #!/bin/sh

    echo "LOG SEVERITY=warning MESSAGE=\"Value for IPv4: ${TOR_PT_OUTBOUND_BIND_ADDRESS_V4}\""
    echo "LOG SEVERITY=warning MESSAGE=\"Value for IPv6: ${TOR_PT_OUTBOUND_BIND_ADDRESS_V6}\""

    while true ; do
        sleep 1
    done

with the following entries in your torrc:

    OutboundBindAddressPT 203.0.113.4
    OutboundBindAddress 203.0.113.5
    OutboundBindAddressPT 2001:db8::4
    OutboundBindAddress 2001:db8::5

See: https://bugs.torproject.org/5304
2020-10-06 09:30:11 -04:00
Daniel Pinto
304ae473ca Fix %include bug with pattern with */ on glibc < 2.19 #40141
Fix bug where %including a pattern ending in */ would include
files and folders (instead of folders only) in versions of
glibc < 2.19.
2020-10-03 04:10:52 +01:00
Nick Mathewson
f5ddc45647 Merge branch 'bug40133_035' into bug40133_043 2020-09-28 10:37:14 -04:00
Nick Mathewson
79d7773968 Merge branch 'maint-0.3.5' into bug40133_035 2020-09-28 10:35:12 -04:00
Nick Mathewson
5c9b4a0060 Remove support for old android "logcat" API
This is apparently obsolete; syslog is modern instead.  If users
have an android log configured, given them a syslog if we can.

Closes #32181.
2020-09-23 12:33:58 -04:00
Nick Mathewson
ca16433eb7 Update changes file 2020-09-23 12:09:27 -04:00
vnepveu
43672f9fca Implement IPv6 sybil protection.
[This is a squashed patch for ticket 7193, based on taking a "git
   diff" for the original branch, then applying it with "git apply
   -3".  I earlier attempted to squash the branch with "git rebase",
   but there were too many conflicts. --nickm]
2020-09-23 11:30:15 -04:00
David Goulet
beffad8529 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-09-22 13:47:08 -04:00
David Goulet
b6429430c6 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-09-22 13:47:08 -04:00
David Goulet
3f8201f229 Merge branch 'maint-0.4.4' 2020-09-22 13:47:08 -04:00
David Goulet
4dbbc000b5 Merge branch 'tor-gitlab/mr/145' 2020-09-22 13:39:55 -04:00
David Goulet
faf89ec6c2 srv: Remove spammy debug log
Fixes #40135

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-22 11:06:34 -04:00
Nick Mathewson
88d99fc1bd Fix warnings when using two unusual options together.
The option `--enable-all-bugs-are-fatal` when used with
`--disable-module-relay` caused GCC to warn about functions that
it thought should be labeled noreturn.

I've tried a couple of approaches, but disabling the warning on
these functions seems to be the best approach.

Fixed #40129; bugfix on 0.4.4.1-alpha.
2020-09-22 10:07:14 -04:00
Alexander Færøy
485990641b Merge remote-tracking branch 'tor-gitlab/mr/137' 2020-09-18 14:51:54 +00:00
Nick Mathewson
781ab9eea4 Add flag for whether an OR conn "counts" for bootstrap tracking
We set this flag if we've launched the connection in order to
satisfy an origin circuit, or when we decide the connection _would_
satisfy an origin circuit.  These are the only or_connections we
want to consider for bootstrapping: other or_connections are opened
because of client EXTEND requests, and they may succeed or fail
because of the clients' confusion or misconfiguration.

Closes #25061.
2020-09-18 10:03:57 -04:00
David Goulet
2ddbfc64af Merge branch 'maint-0.3.5' into maint-0.4.3 2020-09-18 09:45:25 -04:00
David Goulet
2e3603d96d Merge branch 'maint-0.4.3' into maint-0.4.4 2020-09-18 09:45:25 -04:00
David Goulet
e8a4482335 Merge branch 'maint-0.4.4' 2020-09-18 09:45:25 -04:00
Nick Mathewson
7945e075a4 Fix underflow in rend_cache/free_all test.
We already fixed these in #40099 and #40125.

This patch fixes #40126.  Bugfix on 0.2.8.1-alpha.
2020-09-17 14:04:54 -04:00
Nick Mathewson
404c224c71 Merge branch 'maint-0.4.4' 2020-09-17 13:56:40 -04:00
Nick Mathewson
078194ecaf Merge branch 'maint-0.3.5' into maint-0.4.3 2020-09-17 13:56:40 -04:00
Nick Mathewson
54cd2578ef Merge branch 'maint-0.4.3' into maint-0.4.4 2020-09-17 13:56:40 -04:00
David Goulet
47f1d19f8e test: Increment rend cache allocation before freeing
The rend_cache/entry_free was missing the rend cache allocation increment
before freeing the object.

Without it, it had an underflow bug:

  Sep 17 08:40:13.845 [warn] rend_cache_decrement_allocation(): Bug: Underflow
  in rend_cache_decrement_allocation (on Tor 0.4.5.0-alpha-dev
  7eef9ced61)

Fixes #40125

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-17 13:00:23 -04:00
Nick Mathewson
5d1d7afcd3 Use the correct SIGNED_KEY_TYPE value for signing->link certs
Our code was using [01] as for the key type of signed->link certs,
which was incorrect.  The value should be [03], to indicate that the
value as the SHA256 of an x.509 cert.

Fortunately, nothing cares about this value, so there shouldn't be
compatibility issues.

Fixes bug 40124; bugfix on 0.2.7.2-alpha.
2020-09-17 08:42:25 -04:00
Nick Mathewson
7d6986b6a4 Remove changes files that will appear in 0.4.4.5 2020-09-14 14:23:13 -04:00
Nick Mathewson
020e8e41c6 Resolve a compilation warning in test_connection.c
Instead of casting an enum to a void and back, use a string --
that's better C anyway.

Fixes bug 40113; bugfix on 0.2.9.3-alpha.
2020-09-14 11:50:38 -04:00
David Goulet
12c7583126 Merge branch 'maint-0.4.4' 2020-09-08 11:14:12 -04:00
George Kadianakis
85a1e6c601 statistics: Properly count all rendezvous cells (avoid undercounting).
tl;dr We were not counting cells flying from the client to the service, but we
were counting cells flying from the service to the client.

When a rendezvous cell arrives from the client to the RP, the RP forwards it to
the service.

For this to happen, the cell first passes through command_process_relay_cell()
which normally does the statistics counting. However because the `rend_circ`
circuit was not flagged with `circuit_carries_hs_traffic_stats` in
rend_mid_rendezvous(), the cell is not counted there.

Then the cell goes to circuit_receive_relay_cell() which has a special code
block based on `rend_splice` specifically for rendezvous cells, and the cell
gets directly passed to `rend_circ` via a direct call to
circuit_receive_relay_cell(). The cell never passes through
command_process_relay_cell() ever again and hence is never counted by our
rephist module.

The fix here is to flag the `rend_circ` circuit with
`circuit_carries_hs_traffic_stats` so that the cell is counted as soon as it
hits command_process_relay_cell().

Furthermore we avoid double-counting cells since the special code block of
circuit_receive_relay_cell() makes us count rendezvous cells only as they enter
the RP and not as they exit it.

Fixes #40117.
2020-09-07 13:30:21 +03:00
David Goulet
ea339227c2 conn: Remove assert on new listener connection when retrying
Opening a new listener connection can fail in many ways like a bind()
permission denied on a low port for instance.

And thus, we should expect to handle an error when creating a new one instead
of assert() on it.

To hit the removed assert:

  ORPort 80
  KeepBindCapabilities 0

Start tor. Then edit torrc:

  ORPort <some-IP>:80

HUP tor and the assert is hit.

Fixes #40073

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-01 10:01:21 -04:00
Alexander Færøy
3c884bc9e0 Merge remote-tracking branch 'tor-gitlab/mr/136' 2020-08-26 22:15:04 +00:00
George Kadianakis
d4f3cfe99a Merge branch 'mr/113' 2020-08-25 20:37:04 +03:00
David Goulet
20a990cea3 ci: Add tracing build to Gitlab CI
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-08-25 10:38:48 -04:00
Nick Mathewson
75772ea096 Validate address more carefully when checking self-reachability
Previously, we would treat *any* incoming circuit on a non-local
channel as meaning that our ORPort was reachable.  With this patch,
we make sure that the address that the peer _says_ we have is the
same as the one we're trying to advertise right now.

Closes 20165. Bugfix on 4f5192b280 in 0.1.0.1-rc, when
reachability self-tests were first introduced.
2020-08-25 16:02:59 +03:00
George Kadianakis
cc4e42ee32 Merge remote-tracking branch 'tor-gitlab/mr/115' 2020-08-25 15:43:00 +03:00
David Goulet
6dc0b04319 Merge branch 'maint-0.4.4' 2020-08-25 08:23:06 -04:00
George Kadianakis
53cd1c9710 Avoid guard-related warning when upgrading from 043 to 044.
Fixes #40105.
2020-08-25 15:09:57 +03:00
George Kadianakis
4b9ed14d9b Merge remote-tracking branch 'tor-gitlab/mr/108' 2020-08-25 15:02:04 +03:00