Commit Graph

24535 Commits

Author SHA1 Message Date
David Goulet
1c554334ac test: Adapt HS DoS test to use latest parameter
We added a flag on the circuit to know if the DoS defenses are enabled or not.
Before, it was solely the consensus parameter.

Part of #30924

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
4c71accc49 test: Handling of ESTABLISH_INTRO DoS extension
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
dde073764c test: Build DoS cell extension
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
aee66c80bd hs-v3: Don't apply DoS defenses if circuit has not been flagged
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
724d9eb84b hs-v3: Parse ESTABLISH_INTRO cell extension
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
d692c5fd03 hs-v3: Encode DoS ESTABLISH_INTRO cell extension
This commit makes tor add the DoS cell extension to the ESTABLISH_INTRO cell
if the defense is enabled on the service side with a torrc option.

Furthermore, the cell extension is only added if the introduction point
supports it. The protover version HSIntro=5 is looked for.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
7faf10495f hs-v3: Rename INTRO2 consensus param getters
Make it clear that these functions return the consensus param only.
Introduction point can not set those values with a torrc option.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
6c79172924 hs-v3: Add protover HSIntro=5
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
5419fd5d9f hs-v3: Implement torrc DoS defenses options
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
e4856d1bbf trunnel: Add prop305 ESTABLISH_INTRO DoS cell extension
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
414e90025d trunnel: Remove typo in cell extention field name
There can be multiple fields in a cell extension but individually, it is
singular.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
Nick Mathewson
cde662e259 clarify usage of __ and ___ prefixes on config options 2019-08-24 17:46:08 -04:00
Nick Mathewson
078ba326a1 Make a function for NODUMP. 2019-08-24 17:40:48 -04:00
Nick Mathewson
eb54fe8f97 Make config_var_is_invisible a function. 2019-08-24 17:32:46 -04:00
Nick Mathewson
65511a45ad Fix comment: ___ options are now that way because of the INVISIBLE flag. 2019-08-24 17:26:02 -04:00
Nick Mathewson
03247c8eaa whitespace fix 2019-08-24 17:11:41 -04:00
Neel Chauhan
14654d5c97 Remove the unused circuit_type field from hs_ident_circuit_t and hs_ident_circuit_new() 2019-08-23 14:04:05 -04:00
teor
55580d063d
hs: Remove an outdated comment 2019-08-23 16:26:44 +10:00
teor
65935f6da7
Merge branch 'bug23818_035' into bug23818_master 2019-08-23 16:26:32 +10:00
teor
e2e1c07fd2
hs: v3 single onion services fall back to 3-hop intro for unreachable nodes
Previously, v3 single onion services failed when all intro nodes were
unreachable via a 1-hop path. Now, we select intros that are only available
via a 3-hop path, and use a 3-hop path to connect to them.

Fixes bug 23507; bugfix on 0.3.2.1-alpha.
2019-08-23 16:22:49 +10:00
teor
229a982405
hs: Always use a 3-hop path when a v3 single onion intro fails
Previously, we always used a 1-hop path, no matter how many times a v3
single onion intro failed.

Fixes bug 23818; bugfix on 0.3.2.1-alpha.
2019-08-23 15:09:55 +10:00
teor
c94904b359
hs: Always use a 3-hop path when a v3 single onion rend fails
Previously, we used a 1-hop path when a single onion rend failed
immediately, and a 3-hop path when it failed after trying to build
a circuit.

Fixes bug 23818; bugfix on 0.3.2.1-alpha.
2019-08-23 15:09:43 +10:00
teor
14b5f40b54
Merge branch 'bug23818_029' into bug23818_035 2019-08-23 15:09:19 +10:00
teor
144084d6fa
rendservice: Always use a 3-hop path when a v2 single onion intro fails
Previously, we always used a 1-hop path, no matter how many times a v2
single onion intro failed.

Fixes bug 23818; bugfix on 0.2.9.3-alpha.
2019-08-23 15:02:20 +10:00
teor
dc08f8ac70
rendservice: Always use a 3-hop path when a v2 single onion rend fails
Previously, we used a 1-hop path when a single onion rend failed
immediately, and a 3-hop path when it failed after trying to build
a circuit.

Fixes bug 23818; bugfix on 0.2.9.3-alpha.
2019-08-23 15:01:48 +10:00
Nick Mathewson
2780cbb9cb Merge branch 'ticket30935' into ticket30935_merged 2019-08-22 17:25:35 -04:00
David Goulet
d475d7c2fb Merge branch 'tor-github/pr/1244' 2019-08-22 17:10:22 -04:00
teor
1ebff4d7f3 test/nodelist: Add unit tests for describe.c
Part of 21003.
2019-08-23 00:02:33 +10:00
teor
e8ba094c3e nodelist: Clear buffers and detect more caller errors in describe.c
Part of 21003.
2019-08-22 23:51:32 +10:00
Nick Mathewson
cc48eff2d3 Merge branch 'ticket31176' into ticket31176_merged 2019-08-21 09:46:20 -04:00
Nick Mathewson
edf5a327c5 Merge branch 'ticket30914' into ticket30914_merged 2019-08-20 13:57:05 -04:00
Nick Mathewson
3b2a732073 bump to 0.4.1.5-dev 2019-08-20 11:15:45 -04:00
Nick Mathewson
0bf980705e Fix a memory-leak warning in test_circuitbuid.c
Coverity wants us to free everything that we are potentially
allocating, even stuff where allocating it would be a bug.  Adding
a smartlist_free() here will fix the warning.

Fixes bug 31452; bugfix on 16a0b7ed67, which is not in
any released Tor.  This is CID 1447292.
2019-08-19 16:21:55 -04:00
Nick Mathewson
87a3c5b110 Fix 64-bit return issue in parse_log_domain()
If unsigned int is 32-bits long, then our old code would give a
wrong result with any log domain whose mask was >= (1<<32).
Fortunately, there are no such log domains right now: the domain
mask is only 64 bits long to accommodate some flags.

Found by coverity as CID 1452041.

Fixes bug 31451; bugfix on 0.4.1.4-rc.
2019-08-19 13:59:57 -04:00
Nick Mathewson
ab92881d9a Update version to 0.4.1.5 2019-08-19 11:35:48 -04:00
Nick Mathewson
e5812c91d6 Merge remote-tracking branch 'tor-github/pr/1231' 2019-08-19 11:34:27 -04:00
Nick Mathewson
29bd43ab03 Merge remote-tracking branch 'tor-github/pr/1224' 2019-08-19 11:26:58 -04:00
Nick Mathewson
6a89b01049 Merge remote-tracking branch 'tor-github/pr/1230' into maint-0.4.1 2019-08-19 11:11:32 -04:00
Nick Mathewson
e7aabfce61 Merge remote-tracking branch 'tor-github/pr/1235' 2019-08-19 11:10:21 -04:00
Nick Mathewson
deccd3aa6a Merge remote-tracking branch 'tor-github/pr/1225' 2019-08-19 11:08:44 -04:00
George Kadianakis
4185ef29fd Merge branch 'tor-github/pr/1122' 2019-08-19 18:06:05 +03:00
George Kadianakis
dfc8c0b536 Merge branch 'tor-github/pr/1214' 2019-08-19 18:04:35 +03:00
George Kadianakis
19e19c1fa8 Merge branch 'tor-github/pr/1154' 2019-08-19 18:03:51 +03:00
George Kadianakis
b257e8e553 Merge remote-tracking branch 'mike/bug31356+logs-rebased2' into bug31356_final 2019-08-19 17:53:00 +03:00
Nick Mathewson
c214402a56 Merge branch 'maint-0.4.1' 2019-08-19 10:37:22 -04:00
Nick Mathewson
90f4ed2335 Merge branch 'maint-0.3.5' into maint-0.4.0 2019-08-19 10:37:21 -04:00
Nick Mathewson
5653b93a1d Merge branch 'maint-0.2.9' into maint-0.3.5 2019-08-19 10:37:21 -04:00
Nick Mathewson
bba64c9882 Merge branch 'maint-0.4.0' into maint-0.4.1 2019-08-19 10:37:21 -04:00
David Goulet
a8e6eab379 Merge branch 'tor-github/pr/1213' 2019-08-19 09:49:33 -04:00
teor
23844bc739 nodelist: Add support for multiple addresses in describe.c
Also prepare for unit tests.

Part of 21003.
2019-08-19 16:41:35 +10:00
teor
03be44e216 nodelist: Remove support for is_named in describe.c
The Named flag is deprecated. Removing support from the formatting code
simplifies the unit tests.

Part of 21003.
2019-08-19 16:40:42 +10:00
teor
81256c079f nodelist: Move router_get_verbose_nickname() declaration
The declaration was in nodelist/routerinfo.h, but the implementation
was in nodelist/describe.h.

Part of 21003.
2019-08-19 16:40:41 +10:00
teor
8a10c0696d test/nodelist: Fix a typo 2019-08-19 16:40:41 +10:00
David Goulet
5a1c3e44f7 dirauth: Change dizum IP address
New IP address from 194.109.206.212 to 45.66.33.45.

Signed request from Alex de Joode, operator of dizum:
https://trac.torproject.org/projects/tor/ticket/31406

Published descriptor by dizum on August 12th, 2019:

--
r dizum fqbq1v2DCDxTj0QDi7+gd1h911U GZmZtCLaPDQNxkhIFj8UcgTRAuA 2019-08-12 15:28:40 45.66.33.45 443 80
s Authority Fast Running Stable V2Dir Valid
v Tor 0.4.0.5
pr Cons=1-2 Desc=1-2 DirCache=1-2 HSDir=1-2 HSIntro=3-4 HSRend=1-2 Link=1-5 LinkAuth=1,3 Microdesc=1-2 Relay=1-2 Padding=1
w Bandwidth=20 Unmeasured=1
p reject 1-65535
--

Finally, confirmed by DNS:

  $ dig +short tor.dizum.com
  45.66.33.45

Closes #31406

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-15 08:20:47 -04:00
Roger Dingledine
9b1aa9a572 fix typo in keypin journal log entry (for dir auths) 2019-08-15 02:32:00 -04:00
Mike Perry
2ea2d6f30a Clarify comment for bug30942 and improve logline. 2019-08-12 14:24:11 -05:00
Mike Perry
b2821b72bc Bug 31356: Propogate protover padding support to circpad 2019-08-12 14:06:08 -05:00
Mike Perry
b14bb12e39 Bug 31356: Bump protover for new padding machines
By binding the protover numbering to specific padding machines, we can make
our padding negotiation simpler. We probably should have done this in the
first place.

This has the side effect that earlier 0.4.1.x-alpha clients won't negotiate
with 0.4.1.x-stable relays, and 0.4.1.x-stable clients won't negotiate with
earlier 0.4.1.x-alpha relays (or 0.4.0.x relays). Since we don't support
alphas after the stable is released, this is fine, so long as it gets in
before the first stable of 0.4.1.x.
2019-08-12 14:02:35 -05:00
Mike Perry
f6bc9d7c7e Bug 30992: Demote logline of wronghop padding to protocol warn.
This can happen, it's not great, but it's not the worst thing in the world
either. Deferring full fix for 0.4.2/later.
2019-08-12 13:46:32 -05:00
Mike Perry
ccd16caeac Additional circpad diagnostic logs
Also add controller circuit id to all relevant circpad loglines. This will
make debugging any future issues like #30992 much easier.
2019-08-12 13:46:32 -05:00
teor
20943d00f1
Merge branch 'maint-0.3.5' into maint-0.4.0 2019-08-12 13:10:05 +10:00
teor
a1d8409ee2
Merge remote-tracking branch 'tor-github/pr/1049' into maint-0.4.0 2019-08-12 09:55:29 +10:00
teor
d253b31cec
Merge remote-tracking branch 'tor-github/pr/1077' into maint-0.3.5 2019-08-12 09:54:35 +10:00
teor
31fb2bceb5
Merge remote-tracking branch 'tor-github/pr/1066' into maint-0.3.5 2019-08-12 09:53:59 +10:00
teor
789fdbed05
Merge remote-tracking branch 'tor-github/pr/1065' into maint-0.3.5 2019-08-12 09:52:56 +10:00
teor
a92b05392e
Merge remote-tracking branch 'tor-github/pr/1056' into maint-0.3.5 2019-08-12 09:51:35 +10:00
teor
224825e7ee
Merge remote-tracking branch 'tor-github/pr/1039' into maint-0.3.5 2019-08-12 09:51:00 +10:00
teor
e5be039494
Merge remote-tracking branch 'tor-github/pr/1034' into maint-0.3.5 2019-08-12 09:50:42 +10:00
teor
f65f4b5c38
Merge remote-tracking branch 'tor-github/pr/1020' into maint-0.3.5 2019-08-12 09:49:53 +10:00
teor
8ea0903222
Merge remote-tracking branch 'tor-github/pr/987' into maint-0.3.5 2019-08-12 09:45:32 +10:00
teor
6ed56ee4ea
Merge remote-tracking branch 'tor-github/pr/952' into maint-0.3.5 2019-08-12 09:44:46 +10:00
teor
2d4772dc47
Merge remote-tracking branch 'tor-github/pr/951' into maint-0.3.5 2019-08-12 09:43:37 +10:00
teor
ef345ab56d
Merge remote-tracking branch 'tor-github/pr/937' into maint-0.3.5 2019-08-12 09:42:15 +10:00
teor
9be65c440b
Merge remote-tracking branch 'tor-github/pr/926' into maint-0.3.5 2019-08-12 09:41:14 +10:00
teor
955cf9620c
Merge remote-tracking branch 'tor-github/pr/911' into maint-0.3.5 2019-08-12 09:40:08 +10:00
teor
3287cae68c
Merge remote-tracking branch 'tor-github/pr/848' into maint-0.3.5 2019-08-12 09:38:46 +10:00
teor
a57e168caa
Merge remote-tracking branch 'tor-github/pr/741' into maint-0.3.5 2019-08-12 09:36:14 +10:00
teor
bad0010808
Merge branch 'maint-0.3.5' into maint-0.4.0 2019-08-10 07:26:21 +10:00
teor
254c1bac45
Merge remote-tracking branch 'tor-github/pr/1078' into maint-0.2.9 2019-08-10 07:21:56 +10:00
teor
e07d08a169
Merge remote-tracking branch 'tor-github/pr/1052' into maint-0.2.9 2019-08-10 07:21:43 +10:00
teor
e0f9a8222b
Merge remote-tracking branch 'tor-github/pr/1229' into maint-0.2.9 2019-08-10 07:21:31 +10:00
Nick Mathewson
37bd7fa50d
Modify "Protect buffers against INT_MAX datalen overflows." for 0.2.9 2019-08-10 07:16:42 +10:00
teor
8a4635a5fe
Merge remote-tracking branch 'tor-github/pr/1081' into maint-0.4.0 2019-08-09 14:05:46 +10:00
teor
654769bcec
Merge remote-tracking branch 'tor-github/pr/1080' into maint-0.3.5 2019-08-09 14:05:26 +10:00
teor
1ba2bd3599
Merge remote-tracking branch 'tor-github/pr/1054' into maint-0.3.5 2019-08-09 14:01:50 +10:00
teor
e3ba9b7a78
Merge remote-tracking branch 'tor-github/pr/920' into maint-0.3.5 2019-08-09 14:00:01 +10:00
teor
1a9555e283
Merge remote-tracking branch 'tor-github/pr/763' into maint-0.3.5 2019-08-09 13:53:52 +10:00
teor
45f30ba5fa
Merge remote-tracking branch 'tor-github/pr/762' into maint-0.2.9 2019-08-09 13:53:34 +10:00
teor
05018d55ca
Merge remote-tracking branch 'tor-github/pr/957' into maint-0.2.9 2019-08-09 13:50:42 +10:00
teor
7502881deb
Merge branch 'bug31343_31374_035' into bug31343_31374_040 2019-08-09 09:51:40 +10:00
teor
65343a966e
Merge remote-tracking branch 'tor-github/pr/1222' into combined31343_31374_035 2019-08-09 09:49:35 +10:00
teor
2bc8989d83
Merge remote-tracking branch 'tor-github/pr/1221' into combined31343_31374_029 2019-08-09 09:48:41 +10:00
Nick Mathewson
0e1fd6d61f Merge branch 'maint-0.4.1' 2019-08-08 15:25:00 -04:00
Nick Mathewson
53d5b67f07 Merge branch 'ticket31374_035' into maint-0.4.1 2019-08-08 15:24:52 -04:00
David Goulet
2e5519da7c hs: Initialize the INTRO2 bucket for legacy intro point
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-08 13:40:10 -04:00
Neel
64d2133a61 Move the connection_edge_process_relay_cell() assignments out of if statements in circuit_receive_relay_cell() 2019-08-08 13:05:46 -04:00
David Goulet
b47adcbcab Merge branch 'tor-github/pr/1183' 2019-08-08 12:30:23 -04:00
David Goulet
0312da75a3 Merge branch 'tor-github/pr/1172' 2019-08-08 12:26:59 -04:00
Nick Mathewson
b560d94ac0 Merge branch 'ticket31374_029' into ticket31374_035 2019-08-08 11:46:24 -04:00
Nick Mathewson
3a280b35ee Fix a warning about casting the results of GetProcAddress.
Fixes bug 31374; bugfix on 0.2.9.1-alpha.
2019-08-08 11:44:19 -04:00
Nick Mathewson
a8f936c817 Merge branch 'maint-0.4.1' 2019-08-08 11:24:08 -04:00
Nick Mathewson
0bc5b7ae95 Merge branch 'ticket31343_040' into maint-0.4.1 2019-08-08 11:23:59 -04:00
Nick Mathewson
7e32db478b Merge branch 'ticket31343_035' into ticket31343_040 2019-08-08 09:40:04 -04:00
Nick Mathewson
a4400a77a5 Merge branch 'ticket31343_029' into ticket31343_035 2019-08-08 09:39:48 -04:00
Nick Mathewson
878f440901 Fix another time_t/long warning for 31343. 2019-08-08 09:38:03 -04:00
Nick Mathewson
cd6cb45372 Restore proper behavior of netinfo skew check
My previous fix removed a comparison, which would have caused us to
warn about every skew instead of skews of over an hour.
2019-08-08 09:15:42 -04:00
Nick Mathewson
35cfe2e776 Merge remote-tracking branch 'tor-github/pr/1208' 2019-08-07 09:49:49 -04:00
Nick Mathewson
f557680aa9 Merge remote-tracking branch 'tor-github/pr/1203' 2019-08-06 13:12:42 -04:00
Nick Mathewson
484b654048 test_token_bucket: negate after casting to signed type.
Previously we tried multiplying by -1 before casting to int32_t,
which would cause us to cast the -1 to an unsigned before we
multiplied.  This gave us compiler warnings on windows.

Fixes bug 31353; bug not in any released Tor.
2019-08-06 11:42:04 -04:00
Nick Mathewson
66437710af test_util: Do not check for ENETUNREACH unless it exists.
Fixes bug 31352; bug not in any released Tor.
2019-08-06 11:35:50 -04:00
Nick Mathewson
79569d86b3 Merge branch 'ticket31343_035' into ticket31343_040 2019-08-06 11:18:40 -04:00
Nick Mathewson
bc9492a938 Merge branch 'ticket31343_029' into ticket31343_035 2019-08-06 11:15:20 -04:00
Nick Mathewson
0849d2a2fd Avoid using labs() on time_t in channeltls.c
On some windows builds, time_t is 64 bits but long is not.  This is
causing appveyor builds to fail.

Also, one of our uses of labs() on time_t was logically incorrect:
it was telling us to accept NETINFO cells up to three minutes
_before_ the message they were responding to, which doesn't make
sense.

This patch adds a time_abs() function that we should eventually move
to intmath.h or something.  For now, though, it will make merges
easier to have it file-local in channeltls.c.

Fixes bug 31343; bugfix on 0.2.4.4-alpha.
2019-08-06 11:11:06 -04:00
David Goulet
c45f0b4ec1 hs-v3: Rename HS DoS default defines
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
David Goulet
90b5422e8e test: Series of fixes for hs_dos.c unit tests
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
David Goulet
e537968548 dos: Update HS intro circuits if parameters change
In case the consensus parameters for the rate/burst changes, we need to update
all already established introduction circuits to the newest value.

This commit introduces a "get all intro circ" function from the HS circuitmap
(v2 and v3) so it can be used by the HS DoS module to go over all circuits and
adjust the INTRODUCE2 token bucket parameters.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
David Goulet
be8bd2a46e hs-v3: Add enable/disable HS DoS introduce parameter
Following prop305 values.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
David Goulet
c5b00c5a51 hs-v3: Add consensus parameters for DoS defenses
Part of #15516

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
David Goulet
fec0a7b7cb test: Add hs_dos.c unit tests
Currently test the only available function which is hs_dos_can_send_intro2()
within the HS anti-DoS subsystem.

Closes #15516

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
David Goulet
9f738be893 hs: Limit the amount of relayed INTRODUCE2
This commit add the hs_dos.{c|h} file that has the purpose of having the
anti-DoS code for onion services.

At this commit, it only has one which is a function that decides if an
INTRODUCE2 can be sent on the given introduction service circuit (S<->IP)
using a simple token bucket.

The rate per second is 25 and allowed burst to 200.

Basic defenses on #15516.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-06 07:58:14 -04:00
George Kadianakis
d7afdb3b0f Merge branch 'tor-github/pr/1195' 2019-08-06 14:51:47 +03:00
Nick Mathewson
720951f056 Teach include-checker about advisory rules
A .may_includes file can be "advisory", which means that some
violations of the rules are expected.  We will track these
violations with practracker, not as automatic errors.
2019-08-05 17:04:00 -04:00
Ali Raheem
57c34e80da #31320 Add IPv6 examples 2019-08-05 19:24:42 +01:00
George Kadianakis
8248812188 Rename handle_relay_command to handle_relay_cell_command .
As per David's review.
2019-08-05 18:03:23 +03:00
George Kadianakis
1e970d17b8 Test that regular cells get ignored in padding circuits. 2019-08-05 18:03:23 +03:00
George Kadianakis
ce477da8a7 Ignore regular cells in padding circuits.
Padding circuits were regular cells that got closed before their padding
machine could finish. This means that they can still receive regular cells from
their past life, but they have no way or reason to answer them anymore. Hence
let's ignore them before they even get to the proper subsystems.
2019-08-05 18:03:23 +03:00
George Kadianakis
7a032c5e48 Split connection_edge_process_relay_cell() in two functions.
One function does the validation, the other does the handling.
2019-08-05 18:02:33 +03:00
Nick Mathewson
54ad92a240 Merge branch 'maint-0.4.1' 2019-08-05 09:59:40 -04:00
George Kadianakis
74c0595965 Ignore regular cells in padding circuits.
Padding circuits were regular cells that got closed before their padding
machine could finish. This means that they can still receive regular cells from
their past life, but they have no way or reason to answer them anymore. Hence
let's ignore them before they even get to the proper subsystems.
2019-08-05 13:48:58 +03:00
Nick Mathewson
fa60fee8d5 practracker: Add unit tests to test script, and test script to makefile
This makes all of the practracker tests get run by make check, and
hence by our CI.

Closes ticket 31304.
2019-08-01 14:01:43 -04:00
David Goulet
6dba86d7c9 Merge branch 'maint-0.4.1' 2019-07-29 12:02:54 -04:00
David Goulet
1d6054f750 Merge branch 'tor-github/pr/1179' into maint-0.4.1 2019-07-29 12:02:47 -04:00
Nick Mathewson
d8264ab62b bump to 0.4.1.4-rc-dev 2019-07-25 21:51:53 -04:00
Nick Mathewson
2722296b95 Merge branch 'maint-0.4.1' 2019-07-25 20:11:47 -04:00
Nick Mathewson
278e65887b Fix more 32-bit errors with domain and tt_int_op 2019-07-25 20:11:33 -04:00
Nick Mathewson
69921a6a8a Merge branch 'maint-0.4.1' 2019-07-25 16:57:32 -04:00
Nick Mathewson
6095bbf74e test: Use a 64-bit comparison for logging domains. 2019-07-25 16:57:06 -04:00
David Goulet
044bb019b6 Merge branch 'maint-0.4.1' 2019-07-25 10:27:41 -04:00
George Kadianakis
af26cd6101 Always check the retval of circpad_machine_current_state(). 2019-07-25 10:24:23 -04:00
George Kadianakis
bd1ac408d8 Remove dead code from circpad_machine_remove_token(). 2019-07-25 10:24:19 -04:00
David Goulet
cfb15d513d Merge branch 'maint-0.4.1' 2019-07-25 09:03:01 -04:00
David Goulet
2a4b156978 Merge branch 'tor-github/pr/1171' into maint-0.4.1 2019-07-25 09:02:53 -04:00
Nick Mathewson
b2a6b52825 Bump version to 0.4.1.4-rc 2019-07-25 09:00:53 -04:00
Nick Mathewson
57e87cc86c Use config_new() to construct configuration objects.
We'll need to do it this way once the objects become more complex.
2019-07-24 15:21:56 -04:00
Nick Mathewson
c32d485942 Remove src/core/ and src/feature dependencies from confparse.c
This C file will eventually belong in lib/confmgt, so it needs to
have only low-level dependencies.  Now that it no longers needs
routerset.c, we can adjust its includes accordingly.

I'm not moving the file yet, since it would make fixup commits on
earlier branches here really hard to do.
2019-07-24 15:21:56 -04:00
Nick Mathewson
a1b2817abe Sort variables in config_mgr_t.all_vars alphabetically 2019-07-24 15:21:56 -04:00
Nick Mathewson
f8b193a74a Make config_var and config_fmt const.
Now that we have a reasonable implementation for overriding the
default options for TestingTorNetwork, we don't need to modify
config_var_t structs any more.  And therefore, we can have constant
format options, like reasonable people.
2019-07-24 15:21:56 -04:00
Nick Mathewson
dde091ebc7 Add a "freeze" function for config_mgr_t objects.
It's important to make sure that we don't change a config_mgr_t
after we start using it to make objects, or we could get into
inconsistent states.  This feature is the start of a safety
mechanism to prevent this problem.
2019-07-24 15:21:56 -04:00
Nick Mathewson
f306d12b58 Refactor handling of TestingTorNetwork
Previously, when TestingTorNetwork was set, we would manually adjust
the initvalue members of a bunch of other config_var_t, and then
re-run the early parts or parsing the options.

Now we treat the initvalue fields as immutable, but instead assign
to them in options_init(), as early as possible.  Rather than
re-running the early parts of options, we just re-call the
options_init_from_string() function.

This patch de-kludges some of our code pretty handily.  I think it
could later handle authorities and fallbacks, but for now I think we
should leave those alone.
2019-07-24 15:21:56 -04:00
Nick Mathewson
7abd43ac5f Change CONFIG_CHECK() macro to not need a config_format_t
We'll want it to check all the subsidiary structures of the
options object.
2019-07-24 15:21:56 -04:00
Nick Mathewson
627ab9dba3 Fix every place in config.c that knew about option_vars_.
Iterating over this array was once a good idea, but now that we are
going to have a separate structure for each submodule's
configuration variables, we should indirect through the config_mgr_t
object.
2019-07-24 15:21:56 -04:00
Nick Mathewson
89a3051365 Lower responsibility for listing changed options into confparse.c 2019-07-24 15:21:56 -04:00
Nick Mathewson
7e91d4f572 Replace config_find_option with a variant that exposes less 2019-07-24 15:21:56 -04:00
Nick Mathewson
769fe81717 Start teaching config_mgr_t to handle sub-objects and sub-formats
The eventual design here will be that multiple config_format_t
objects get registered with a single config_mgr_t.  That
config_mgr_t manages a "top-level" object, which has a pointer to
the other objects.

I had earlier thought of a different design, where there would be no
top-level object, and config_mgr_t would deal with a container
instead.  But this would require a bunch of invasive refactoring
that I don't think we should do just yet.
2019-07-24 15:21:56 -04:00
Nick Mathewson
e8dc513bd0 Add a config_mgr_t type to wrap config_format_t
Remember that our goal in the present refactoring is to allow each
subsystem to declare its own configuration structure and
variables.  To do this, each module will get its own
config_format_t, and so we'll want a different structure that wraps
several config_format_t objects.  This is a "config_mgr_t".
2019-07-24 15:21:56 -04:00
Nick Mathewson
167d873bde Fix clang-detected errors related to log_domain_mask_t 2019-07-24 09:08:48 -04:00
George Kadianakis
2944b091fc Merge branch 'maint-0.4.1' 2019-07-24 12:32:06 +03:00
George Kadianakis
bb33a2f290 Merge branch 'tor-github/pr/1181' into maint-0.4.1 2019-07-24 12:31:56 +03:00
Nick Mathewson
ab1f82ea2a Merge branch 'ticket24963_042_02' 2019-07-23 14:03:30 -04:00
Nick Mathewson
df12ff3dea Add a test for disallowing single-hop introductions.
Code from dgoulet.
2019-07-23 12:42:33 -04:00
Nick Mathewson
f14ce4bce6 Allow NULL circ->p_chan in circuit_is_suitable_for_introduce1()
This shouldn't be possible while Tor is running, but the tests can
hit this code.  Rather than force the tests to add a dummy channel
object, let's just tolerate their incompletely built circuits.
2019-07-23 12:36:40 -04:00
Nick Mathewson
ab1f39322c Merge remote-tracking branch 'tor-github/pr/1185' 2019-07-23 12:32:14 -04:00
Nick Mathewson
f6db290e5a Merge remote-tracking branch 'tor-github/pr/1186' 2019-07-23 12:30:19 -04:00
David Goulet
ef2dd1ba96 Merge branch 'tor-github/pr/1116' 2019-07-23 09:46:29 -04:00
David Goulet
2fce1274de Merge branch 'tor-github/pr/1153' 2019-07-23 09:43:36 -04:00
pulls
c2f6064325 Improve circpad documentation.
Patch by Tobias Pulls.
2019-07-23 12:44:43 +03:00
George Kadianakis
5aa526c2d8 circpad: some more logging changes.
- Add an info log when receiving a STOP command.
- Keep warning if we receive padding from a wrong hop.
2019-07-23 12:22:26 +03:00
Mike Perry
a3089662c0 More LOG_PROTOCOL_WARN.
Make origin-side messages about padding negotiation failure into
LOG_PROTOCOL_WARN.

I'm not sure I like this either.. But the negotiation refusal case might
happen naturally due to consensus drift, and is functionally no different than
a corrupted cell.
2019-07-23 12:22:25 +03:00
Mike Perry
86f298441b Make some warns into protocol warns
I'm not sure I agree with this option.
2019-07-23 12:22:24 +03:00
Mike Perry
065f25c2ce Bug 30649: Check that machine is absent before warn 2019-07-23 12:22:15 +03:00
pulls
fd1f285189 transition when we send our first padding packet, not on received 2019-07-23 11:52:25 +03:00
pulls
5f95b37f6c remove specified target_hopnum from relay-side machines (only for origin-side machines) 2019-07-23 11:52:25 +03:00
Neel Chauhan
232aa8570d Space out first connection_edge_process_relay_cell() line in circuit_receive_relay_cell() 2019-07-19 20:50:25 -04:00
Nick Mathewson
5fb070a14d Extract the log_domain_t type to a lower-level header
This way, both err and log may depend on it.
2019-07-19 10:17:22 -04:00
Nick Mathewson
f682de609b Adjust tor_log.rs for 64-bit log domains. 2019-07-19 10:07:32 -04:00
Nick Mathewson
a9379d6750 Set 'routerlist' global to NULL before freeing it.
There is other code that uses this value, and some of it is
apparently reachable from inside router_dir_info_changed(), which
routerlist_free() apparently calls.  (ouch!)  This is a minimal fix
to try to resolve the issue without causing other problems.

Fixes bug 31003. I'm calling this a bugfix on 0.1.2.2-alpha, where
the call to router_dir_info_changed() was added to routerlist_free().
2019-07-19 09:49:52 -04:00
Tobias Stoeckmann
17458a87d7 Prevent UB on signed overflow.
Overflowing a signed integer in C is an undefined behaviour.
It is possible to trigger this undefined behaviour in tor_asprintf on
Windows or systems lacking vasprintf.

On these systems, eiter _vscprintf or vsnprintf is called to retrieve
the required amount of bytes to hold the string. These functions can
return INT_MAX. The easiest way to recreate this is the use of a
specially crafted configuration file, e.g. containing the line:

FirewallPorts AAAAA<in total 2147483610 As>

This line triggers the needed tor_asprintf call which eventually
leads to an INT_MAX return value from _vscprintf or vsnprintf.

The needed byte for \0 is added to the result, triggering the
overflow and therefore the undefined behaviour.

Casting the value to size_t before addition fixes the behaviour.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-07-19 09:21:32 -04:00
rl1987
ffce19a9ec Make tor-print-ed-signing-cert output RFC1123 and unix timestamps as well 2019-07-10 11:36:26 +03:00
Nick Mathewson
2e55fa9587 Adjust log callback type to use log_domain_mask_t 2019-07-08 14:11:02 -04:00
Nick Mathewson
4512578e49 Add a compile-time assertion to prevent a recurrence of 31080. 2019-07-08 13:41:35 -04:00
Nick Mathewson
09c692e72b Use a 64-bit mask for log domains, and fix a conflict
When we added LD_MESG, we created a conflict with the LD_NO_MOCK
flag.  We now need 64 bits for log domains in order to fix this
issue.

Fixes bug 31080; bugfix on 0.4.1.1-alpha.
2019-07-08 13:32:45 -04:00
Nick Mathewson
d972f29d8d Move declaration of LD_NO_MESG to make conflict more apparent. 2019-07-08 13:00:31 -04:00
George Kadianakis
5303dbe624 Merge branch 'tor-github/pr/1152' 2019-07-04 17:14:06 +03:00
Nick Mathewson
3e34840a77 Make config_lines_eq() take const arguments. 2019-07-03 10:27:38 -04:00
Nick Mathewson
daed2e39ad Revert "Add a function to append an existing line to a config line list."
This reverts commit 5a2ab886ba.
2019-07-03 10:21:49 -04:00
Nick Mathewson
e3ccf37e25 Fix @file directive in var_type_def_st.h 2019-07-03 10:19:57 -04:00
David Goulet
ef2123c7c7 hs-v3: Disallow single hop client to post/get a descriptor
Closes #24964

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-07-03 08:21:16 -04:00
Nick Mathewson
fdbd139495 Merge remote-tracking branch 'tor-github/pr/1136' 2019-07-02 13:33:50 -04:00
Nick Mathewson
cf92c096ad Merge remote-tracking branch 'tor-github/pr/1120' 2019-07-02 13:33:37 -04:00
Nick Mathewson
c0ea6f9c64 Merge branch 'maint-0.4.1' 2019-07-01 14:25:13 -04:00
Nick Mathewson
1dd9527897 Merge branch 'maint-0.2.9' into maint-0.3.5 2019-07-01 14:25:12 -04:00
Nick Mathewson
2a42d6be27 Merge branch 'maint-0.3.5' into maint-0.4.0 2019-07-01 14:25:12 -04:00
Nick Mathewson
5e16601000 Merge branch 'maint-0.4.0' into maint-0.4.1 2019-07-01 14:25:12 -04:00
Roger Dingledine
a5911c4551 get rid of accidental second space 2019-06-29 22:26:00 -04:00
Nick Mathewson
ea154a6108 Coverity: fix memory leak on error in test function.
The function make_intro_from_plaintext() in test_introduce.c would
leak memory if we ever hit a failure from our underlying crypto
functions.  This kind of failure should be impossible, but it's best
to be safe here.

Bugfix on 0.2.4.1-alpha.
2019-06-28 12:36:53 -04:00
Nick Mathewson
5fa2b32200 Coverity: fix test issues with always-present 'service' var.
Coverity is worried that we check "service" at the end of these test
functions, since it doesn't see any way to reach the cleanup code
without having first dereferenced the variable.

Removing the check would be unwise in this case: instead we add a
tt_assert check before using "service" so that coverity thinks that
the check is doing something useful.

Bugfix on 0.3.2.1-alpha.
2019-06-28 12:36:44 -04:00
Nick Mathewson
68792f77e5 Fix a few coverity unitinitialzed-value warnings in the unit tests.
Coverity can't see that it is not in fact going to read
uninitialized memory here, so we initialize these values
unconditionally.

Bugfix on 0.4.0.1-alpha.
2019-06-28 12:33:27 -04:00
Nick Mathewson
f55598f870 Coverity: different implementation for csiphash
Coverity has had trouble figuring out our csiphash implementation,
and has given spurious warnings about its behavior.

This patch changes the csiphash implementation when coverity is in
use, so that coverity can figure out that we are not about to read
beyond the provided input.

Closes ticket 31025.
2019-06-28 12:07:38 -04:00
Nick Mathewson
0fa3dc3228 begin_cell_parse(): Add an assertion to please coverity.
Coverity doesn't understand that if begin_cell_parse() returns 0 and
sets is_begindir to 0, its address field will always be set.

Fixes bug 30126; bugfix on 0.2.4.7-alpha; Fixes CID 1447296.
2019-06-28 11:29:51 -04:00
teor
f3b2a81ce7
fallback: apply the second fallback list from 2019
Update the fallback directory mirrors by merging the current list with:
fallback_dirs_2019-06-28-08-58-39_AU_f0437a39ddbc8459.inc

Part of 28795, see that ticket for logs.
2019-06-28 21:16:50 +10:00