Commit Graph

24600 Commits

Author SHA1 Message Date
George Kadianakis
7fa624537c Merge branch 'tor-github/pr/1269' 2019-09-03 17:11:25 +03:00
Nick Mathewson
a617001fd4 Merge remote-tracking branch 'tor-github/pr/1279' 2019-09-03 09:47:25 -04:00
Nick Mathewson
52342327c7 madvise: tolerate EINVAL and ENOSYS
These errors can occur if we are built on a system with support for
madvise(MADV_NOFORK) but then we are run on a system whose kernel
does not support that flag.

If the error is something that we don't tolerate at all, we now log
it before crashing.

Fixes bug 31570.  I am calling this a bugfix on 0.4.1.1-alpha, where
we actually started using the map_anon code.
2019-09-02 14:49:53 -04:00
Nick Mathewson
01bda9bed1 Merge branch 'maint-0.4.1' 2019-09-02 14:11:32 -04:00
Nick Mathewson
e3a458e441 Merge branch 'ticket12399_035' into maint-0.4.1 2019-09-02 14:11:18 -04:00
rl1987
05fa1689eb Change loglevel of message 'Hash of session info was not as expected' 2019-09-02 14:09:39 -04:00
Neel Chauhan
d22ed05dc0 Space out the arguments to the cell functions in rend_process_relay_cell() 2019-08-30 18:58:00 -04:00
teor
a52a5e0099
Merge branch 'maint-0.3.5' into maint-0.4.0 2019-08-30 23:33:01 +10:00
teor
1132dc9f75
Merge remote-tracking branch 'tor-github/pr/1181' into maint-0.3.5 2019-08-30 23:24:05 +10:00
teor
b66712d85b
Merge remote-tracking branch 'tor-github/pr/1117' into maint-0.3.5 2019-08-30 23:22:18 +10:00
teor
4662cbec7b
Merge remote-tracking branch 'tor-github/pr/1114' into maint-0.3.5 2019-08-30 23:20:59 +10:00
teor
c55591825f
torerr: Try harder to flush raw assert messages before process termination
Some platforms (macOS, maybe others?) can swallow the last write before an
abort. This issue is probably caused by a race condition between write
buffer cache flushing, and process termination. So we write an extra
newline, to make sure that the message always gets through.

Fixes bug 31571; bugfix on 0.3.5.1-alpha.
2019-08-30 21:51:11 +10:00
teor
65a1d86491
torerr: Log the Tor backtrace version when a raw assertion fails
Part of 31571.
2019-08-30 21:51:07 +10:00
teor
743bc0028b
backtrace: Log the Tor backtrace version whenever we log a backtrace
Previously, we just logged it in the crash handler.

Part of 31571.
2019-08-30 21:51:03 +10:00
teor
e2a7d08aa7
backtrace: Always set a backtrace Tor version
We want to report the tor version, even on platforms that don't have
backtrace support (like Android).

This commit stores the backtrace Tor version, regardless of USE_BACKTRACE.

Preparation for 31571.
2019-08-30 21:50:57 +10:00
Nick Mathewson
fb0e8966f0 Stub more functions in dirvote headers to fix more of 31552. 2019-08-29 11:18:42 -04:00
Nick Mathewson
4256ee0d37 Stub out some more functions in dirvote/*.h, fix compilation.
This fixes LTO compilation for Android and -O0 compilation in
general, when --disable-module-dirauth is provided.

Fixes bug 31552; bugfix on 0.4.1.1-alpha.
2019-08-29 09:50:38 -04:00
Nick Mathewson
c281fa0da2 Describe clear_cfg_fn_t better. 2019-08-29 09:14:51 -04:00
David Goulet
960d989415 Merge branch 'tor-github/pr/1257' 2019-08-29 08:56:04 -04:00
David Goulet
7c99a4ddde Merge branch 'maint-0.4.1' 2019-08-29 08:55:58 -04:00
David Goulet
ff905f8e1e Merge branch 'tor-github/pr/1256' into maint-0.4.1 2019-08-29 08:55:31 -04:00
David Goulet
337b733cfc Merge branch 'tor-github/pr/1255' into maint-0.4.1 2019-08-29 08:55:27 -04:00
teor
063cf9cd23 string: macOS --enable-fragile-hardening uses safe string functions
Comment-only change.
2019-08-29 13:10:34 +10:00
teor
ec6fbf1ca6 nodelist: Use safe string functions in describe.c
Rewrite format_node_description() and router_get_verbose_nickname() to
use strlcpy() and strlcat(). The previous implementation used memcpy()
and pointer arithmetic, which was error-prone.

Closes ticket 31545. This is CID 1452819.
2019-08-29 13:09:08 +10:00
Nick Mathewson
1ef084c5fc test_confparse: verify that clearing a routerset sets it to NULL. 2019-08-28 12:28:17 -04:00
Nick Mathewson
f0c1f96adc Document configuration type definition functions for routerset_t
These functions are all used to implement the ROUTERSET_type_defn
object, which maps strings to and from routerset_t configuration
variables for the configuration module.
2019-08-28 12:23:36 -04:00
Nick Mathewson
2074fed664 Routerset config parsing: represent empty sets as NULL.
routerset_t has two representations of an empty routerset: NULL, and
a set containing no elements.  But some of our config code assumes
that empty routersets are represented as NULL.  So let's give it
what it assumes.

Fixes bug 31495. Bugfix on e16b90b88a76; but not in any released
Tor.
2019-08-28 11:53:28 -04:00
Nick Mathewson
04ab357df8 Remove extraneous "n" from comment in routerset.c 2019-08-28 11:39:31 -04:00
Nick Mathewson
b1d7ddfb02 Merge branch 'ticket31240v2' into ticket31240v2_merged_2 2019-08-28 09:46:59 -04:00
Nick Mathewson
a3e99c5f1e Add a test for clear_fn support in handling non-managed fields 2019-08-28 09:42:17 -04:00
Nick Mathewson
577e628743 Fix typo in a comment on config_mgr_get_obj_mutable() 2019-08-28 09:42:17 -04:00
Nick Mathewson
c967b5c9ba Add a test for dumping a compound configuration 2019-08-28 09:42:17 -04:00
Nick Mathewson
8db3859cc6 Simple tests for nested configuration formats
One test makes sure that the toplevel magic numbers are distinct.

One test makes sure that we can parse a configuration object
with two sub-objects.
2019-08-28 09:42:17 -04:00
Nick Mathewson
d9fe9f5ede Confmgr tests: test deprecations and abbreviations. 2019-08-28 09:42:17 -04:00
Nick Mathewson
e4162cdb38 Start on test cases for the multi-object feature of confmgr.
This test case, at this point, only constructs the confmgr object.
More code to come.
2019-08-28 09:42:17 -04:00
Nick Mathewson
cb5f8ace79 Tests for config_find_option_name()
Fix a bug in config_find_option_name() where it did not consider
the abbreviations table.
2019-08-28 09:42:17 -04:00
Nick Mathewson
aa3f0c4788 Add tests for variable-listing functions.
This discovered a bug related to an extra & in
config_mgr_list_deprecated_vars(): fix that.
2019-08-28 09:42:17 -04:00
Nick Mathewson
380d3ee168 Better explain config_clear_fn_t 2019-08-28 09:42:17 -04:00
Nick Mathewson
06da2c0d28 Document or_state_t.substates_ 2019-08-28 09:42:17 -04:00
Nick Mathewson
3af1cee6d9 Document or_options_t.subconfigs_ 2019-08-28 09:42:17 -04:00
Nick Mathewson
12d980027a document return lifespans for config_mgr_list_vars() 2019-08-28 09:42:17 -04:00
Nick Mathewson
9cfc811c37 Fix typo in comment about FallbackDir handling 2019-08-28 09:42:17 -04:00
Nick Mathewson
3a530ae535 Document types for config_get_changes() 2019-08-28 09:42:17 -04:00
Nick Mathewson
760d0c056f finish a comment explaining all_abbrevs 2019-08-28 09:42:17 -04:00
Nick Mathewson
638e58379a Partial support for multiplicity in configuration objects
A configuration manager, in addition to a top-level format object,
may now also know about a suite of sub-formats.  Top-level
configuration objects, in turn, may now have a suite of
sub-objects.
2019-08-28 09:40:53 -04:00
Nick Mathewson
38b770bbbb Make a config_suite_t type to hold multiple config sub-objects
Right now, it doesn't do anything; this patch is meant to make sure
that we're doing memory management correctly.
2019-08-28 09:40:53 -04:00
Nick Mathewson
47654d3249 Refactor config free logic to use a single path.
The right way to free a config object is now to wrap config_free(),
always.  Instead of creating an alternative free function, objects
should provide an alternative clear callback to free any fields that
the configuration manager doesn't manage.

This lets us simplify our code a little, and lets us extend the
confparse.c code to manage additional fields in config_free.
2019-08-28 09:40:53 -04:00
Nick Mathewson
3d1f9f583a Use special magic to enforce manager/object connection.
Every time we finalize a config manager, we now generate a new magic
number for it, so that we'll get an assertion failure if we ever try
to use an object with a different configuration manager than the one
that generated it.
2019-08-28 09:40:46 -04:00
George Kadianakis
78e084a12e Merge branch 'tor-github/pr/1267' 2019-08-27 11:47:46 +03:00
George Kadianakis
92a8573d22 Merge branch 'tor-github/pr/1258' 2019-08-27 11:45:18 +03:00
George Kadianakis
0d7f76d7ca Merge branch 'tor-github/pr/1234' 2019-08-27 11:44:13 +03:00
George Kadianakis
5782cee71d Merge branch 'tor-github/pr/1237' 2019-08-27 11:43:10 +03:00
Nick Mathewson
8af92b6577 test_address: parenthesize macro arguments.
It's good style to always add parentheses when using macro
arguments, in case somebody someday provides an argument that
contains an operator you don't expect, or causes the expression to
parse differently.
2019-08-26 20:03:16 -04:00
Nick Mathewson
5eca338107 In tests, make sure that "ri" is freed on all paths.
In Tor's tests, the tt_*() macros can call "goto done" on failure.
When that happens, we need to make sure that all of our allocated
memory still gets freed, or else Coverity will complain.
2019-08-26 20:03:11 -04:00
Neel Chauhan
c8e69e63f9 Add test for dirserv_router_has_valid_address() 2019-08-26 20:02:11 -04:00
Neel Chauhan
d9a7d47798 Check for private IPv6 addresses in dirserv_router_has_valid_address() 2019-08-26 18:21:56 -04:00
David Goulet
d819dfbded Merge branch 'tor-github/pr/1239' 2019-08-26 14:35:27 -04:00
David Goulet
cbe5f9571f test: Unit tests HS DoS torrc options
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:47 +03:00
David Goulet
461d231289 hs-v3: Refactor DoS cell extension parameters validation
Move everything to its own function in order to better log, document and tests
the introduction point validation process.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:47 +03:00
David Goulet
1c4607b132 hs-v3: Clarify comment in hs_dos.c
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:47 +03:00
David Goulet
292e9b0c00 hs-v3: Log info INTRO2 DoS defenses service values
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:47 +03:00
David Goulet
a98f5099c4 hs-v3: Missing intro circuit INTRO2 DoS enabled flag
When consensus changes, we also need to update the circuit INTRO2 defenses
enabled flag and not only the token bucket.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:47 +03:00
David Goulet
94a2221708 hs-v3: Privatize access to HS DoS consensus param
Remove the public functions returning the HS DoS consensus param or default
values as it is exclusively used internally now.

Rename the param_* variables to consensus_param_* for better code semantic.

Finally, make some private functions available to unit tests.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
184c76e339 hs-v3: Cleanup usage of consensus param in hs_dos.c
This commit makes it that the hs_dos.c file only uses the consensus parameter
variables set when we initialize and when the consensus changes.

There is no need to call each time networkstatus_get_param(), which is
expensive, when we want access to a consensus value.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
David Goulet
82639a8c7b hs-v3: Move to hs_dos.c INTRO2 defenses initialization
A bit cleaner especially that the next commit(s) will make the consensus param
interface private to hs_dos.c so we expose as little as we can outside of the
subsystem.

Part of #30924

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-08-26 15:53:46 +03:00
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