Nick Mathewson
5e27caa60c
compat_compiler: add a macro to prevent coverity deadcode warnings.
...
The POSSIBLE(e) macro evaluates to the value of (e), but does so in
a way that a static analyzer will not conclude that (e) is
impossible. We can use this when we expect our regular compilers to
eliminate deadcode, but we don't want coverity to complain about it.
Part of a fix for 32960.
2020-01-15 10:21:18 -05:00
teor
5fa7c1b13f
Merge remote-tracking branch 'tor-github/pr/1661'
2020-01-16 00:46:31 +10:00
Nick Mathewson
08bbb6b8d9
Merge branch 'ticket32892_043_01_squashed'
2020-01-14 13:31:20 -05:00
David Goulet
59dac38ebe
chan: Remove dead var cell handler from channel_t
...
The variable lenght cells are handled directly by
channel_tls_handle_var_cell() from an OR connection reading its inbuf. The
channel var cell handler (agnostic) was never used.
Closes #32892
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-14 13:31:08 -05:00
Nick Mathewson
165a92e33f
Replace an assertion with a check-and-log
...
We hit this assertion with bug 32868, but I'm stymied figuring out
how we wound up with a routerstatus like this. This patch is a
diagnostic to attempt to figure out what is going on, and to avoid a
crash in the meantime.
2020-01-14 13:16:39 -05:00
Nick Mathewson
c948db4252
Merge remote-tracking branch 'tor-github/pr/1636'
2020-01-14 12:46:14 -05:00
Nick Mathewson
c2dc94d8eb
Merge branch 'ticket32883'
2020-01-14 12:42:41 -05:00
Nick Mathewson
dec11793ba
Merge branch 'ticket32825_squashed'
2020-01-14 12:42:19 -05:00
Nick Mathewson
ac7d6f3c05
Rename UTIL_TEST_NO_WIN to reflect intent
...
Now that these tests are skipped on windows _and_ android, we should
name the macro that skips them after the functionality that the
tests depend on.
Closes last part of 32825.
2020-01-14 12:42:13 -05:00
Nick Mathewson
75741c6b3a
Merge remote-tracking branch 'tor-github/pr/1659'
2020-01-14 12:40:07 -05:00
Neel Chauhan
8d288eb3a7
Deprecate the ClientAutoIPv6ORPort option
2020-01-13 14:55:16 -08:00
Nick Mathewson
73ac1add3f
Split core/include.am into per-subdirectory include.am files
...
Closes ticket 32137.
2020-01-13 09:34:17 -05:00
David Goulet
bbe90e3ec1
hs-v2: Always check rend_cache validity before using it
...
When looking up an entry in the rend_cache, stop asserting that it exists but
rather confirm it exists and if not, return that no entry was found.
The reason for that is because the hs_circ_cleanup_on_free() function (which
can end up looking at the rend_cache) can be called from the
circuit_free_all() function that is called _after_ the rend cache is cleaned
up in tor_free_all().
We could fix the free all ordering but then it will just hide a future bug.
Instead, handle a missing rend_cache as a valid use case as in while we are in
the cleanup process.
As Tor becomes more modular, it is getting more and more difficult to ensure
subsystem callstack ordering thus this fix aims at making the HSv2 subsystem
more robust at being called while tor is pretty much in any kind of state.
Fixes #32847 .
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-13 09:25:26 -05:00
Nick Mathewson
5888db4967
Merge branch 'disable_ns_macro'
2020-01-09 16:02:41 -05:00
Nick Mathewson
93894fb770
Merge branch 'ticket22029_attempt_squashed'
2020-01-09 15:27:32 -05:00
Neel Chauhan
9129de7017
Add dirserv_load_fingerprint_file() test
2020-01-09 15:27:26 -05:00
Neel Chauhan
d0068be0dd
Allow ed25519 keys to be banned in approved-routers
2020-01-09 15:27:26 -05:00
Nick Mathewson
e28e41dd78
Fix wide lines from NS() removal fallout.
2020-01-09 11:43:49 -05:00
Nick Mathewson
42c6fc851e
Remove NS*() macros from test.h.
...
We never used them very much, and although they had potential to
clarify some of our tests, they also made some of the logic harder
for people to follow. Clang-format can't make head or tail of them,
so the time has come to say goodbye to them.
2020-01-09 11:09:31 -05:00
Nick Mathewson
23c77f79fd
Remove all usage of the NS*() macros in test*.c
...
This is an automatically generated commit, made with the following
kludgey perl script. It results in a number of wide lines, which
I'll clean up in a subsequent commit.
#/usr/bin/perl -w -i
$mod = "NS_MODULE";
$submod = "NS_SUBMODULE";
$last_was_empty = 0;
while (<>) {
s/\bASPECT\(\s*(\w+)\s*,\s*(\w+)\s*\)/$1_$2/;
if (/# *define +NS_MODULE +(\w+)/) {
$mod = $1;
next;
} elsif (/# *define +NS_SUBMODULE +(\w+)/) {
$submod = $1;
next;
}
next if (/#undef NS_(SUB)?MODULE/);
s/NS\(\s*test_main\s*\)/test_${mod}_${submod}/;
s/NS\(\s*(\w+)\s*\)/${mod}_${submod}_$1/g;
s/NS_FULL\(\\s*(\w+)\s*,\s*(\w+),\s*(\w+)\s*\)/$1_$2_$3/;
s/^(\s*)NS_MOCK\(\s*(\w+)\s*\)/$1MOCK($2,\n$1 ${mod}_${submod}_$2)/;
s/NS_UNMOCK\(\s*(\w+)\s*\)/UNMOCK($1)/;
s/TEST_CASE\(\s*(\w+)\s*\)/{ "$1", test_${mod}_$1, TT_FORK, NULL, NULL }/;
s/TEST_CASE_ASPECT\(\s*(\w+)\s*,\s*(\w+)\s*\)/{ "$1_$2", test_${mod}_$1_$2, TT_FORK, NULL, NULL }/;
s/NS_DECL\(\s*([^,]+)\s*,\s*([^,]+)\s*,\s*(\(.*)\);/static $1 ${mod}_${submod}_$2$3;\nATTR_UNUSED static int ${mod}_${submod}_$2_called = 0;/;
s/\bCALLED\(\s*(\w+)\s*\)/${mod}_${submod}_$1_called/;
if (/^$/) {
print if (! $last_was_empty);
$last_was_empty = 1;
} else {
$last_was_empty = 0;
print;
}
if (eof) {
$mod = "NS_MODULE";
$submod = "NS_SUBMODULE";
$last_was_empty = 0;
}
}
# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date: Thu Jan 9 10:26:10 2020 -0500
#
# On branch disable_ns_macro
# Changes to be committed:
# modified: src/test/test_accounting.c
# modified: src/test/test_compat_libevent.c
# modified: src/test/test_dir.c
# modified: src/test/test_dir_handle_get.c
# modified: src/test/test_dns.c
# modified: src/test/test_options.c
# modified: src/test/test_procmon.c
# modified: src/test/test_rendcache.c
# modified: src/test/test_router.c
# modified: src/test/test_routerset.c
# modified: src/test/test_status.c
# modified: src/test/test_tortls.c
# modified: src/test/test_tortls_openssl.c
# modified: src/test/test_util_format.c
# modified: src/test/test_util_process.c
#
# Untracked files:
# experiments/
# locate_options.sh
# un_ns.pl
#
# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date: Thu Jan 9 10:26:10 2020 -0500
#
# On branch disable_ns_macro
# Changes to be committed:
# modified: src/test/test_accounting.c
# modified: src/test/test_compat_libevent.c
# modified: src/test/test_dir.c
# modified: src/test/test_dir_handle_get.c
# modified: src/test/test_dns.c
# modified: src/test/test_options.c
# modified: src/test/test_procmon.c
# modified: src/test/test_rendcache.c
# modified: src/test/test_router.c
# modified: src/test/test_routerset.c
# modified: src/test/test_status.c
# modified: src/test/test_tortls.c
# modified: src/test/test_tortls_openssl.c
# modified: src/test/test_util_format.c
# modified: src/test/test_util_process.c
#
# Untracked files:
# experiments/
# locate_options.sh
# un_ns.pl
#
2020-01-09 11:09:22 -05:00
Nick Mathewson
c9855f23c1
Replace various NS_MODULE/SUBMODULE vals with shorter names.
...
This will help avoid wide lines in our output.
2020-01-09 11:08:18 -05:00
Nick Mathewson
e2fcfc6e52
Put all NS_DECL invocations on single lines.
...
This is going to make my script happier; these lines will soon
disappear.
2020-01-09 10:06:35 -05:00
Nick Mathewson
1ffba2f121
Always define NS_MODULE and NS_SUBMODULE when NS is used.
...
When these macros aren't defined, the expansions of the NS macros
can get particularly ugly.
2020-01-09 09:56:41 -05:00
Nick Mathewson
e45810113b
Merge branch 'pre_formatter_cleanups_squashed'
2020-01-09 07:32:39 -05:00
Nick Mathewson
3ad518cd97
process.h: include stdbool.h
...
We use bool, so we should include stdbool.
2020-01-09 07:30:35 -05:00
Nick Mathewson
ca9d605fa7
conscache.h: declare config_line_t structure.
...
This frees us from a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
09f03e6e3f
Turn authdir_mode_v3() into a non-inline function
...
This change means that authmode.h no longer needs to see
or_options_t, and frees us from an ordering dependency.
2020-01-09 07:30:35 -05:00
Nick Mathewson
2f7a2c42d2
Include ht.h in all headers that use HT_ENTRY()
...
Without this change, compilation success depends on include order in
several tricky ways.
2020-01-09 07:30:35 -05:00
Nick Mathewson
afa36682f9
consdiffmgr.h: use struct declarations for several types
...
This prevents a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
06d977b569
hs_circuitmap.h: use a struct declaration
...
This fixes a case where our compilation would depend on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
887bf05c24
routerparse.h: include parsecommon.h when exposing token table.
...
Without this include, our compilation depends more on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
774d1092fd
process.h: add a struct declaration for buf_t.
...
This lets us avoid a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
dd5dda78f6
timers.h: add declaration for timeval.
...
This frees us from some dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
25354171b5
lib/conf: include torint.h in files that use it.
...
This frees us from some dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
8d4b4aa932
control_hs.h: use a couple of struct delcarations
...
Doing this frees us from some assumptions about include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
8b7eeea39d
connection.h: new includes and struct declarations
...
Using these frees us from several dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
c4ac5adc4a
siphash.h: include stdint.
...
Doing this gives us a valid uint64_t type, freeing us from
dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
6a6486a7bf
hs_circuit: use struct declaration.
...
This frees us from a dependency on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
d7b8377c28
or_options_st.h: Add an include and a struct declaration.
...
This frees us from some dependencies on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
8bb686d8a0
Include x509.h in tortls_internal.h.
...
This gives us the definition of tor_x509_cert_impl_t, and makes us
less dependent on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
b1dceeca5a
Include sys/types.h in fdio.h, for "off_t".
...
Otherwise our compilation depends on include order.
2020-01-09 07:30:35 -05:00
Nick Mathewson
7b0d8834f2
Use raw_assert in ht.h
...
Also, include torerr.h from ht.h if we are using raw_assert.
Otherwise, our includes need to be ordered so that ht.h comes after
util_log.h.
2020-01-09 07:30:35 -05:00
Nick Mathewson
73b83b8f1a
Remove extra ; from tt_assert() macro definition.
...
We were actually omitting the semicolon in a few places, leading to
confusing indentation and some cocci failures.
2020-01-09 07:30:35 -05:00
Nick Mathewson
3ce2304c6d
Use new ENABLE/DISABLE_GCC_WARNING
...
This is an automated commit, generated by:
perl -i -pe 'next if /define/; s/((?:ENABLE|DISABLE)_GCC_WARNING)\(([A-Za-z0-9_\-]+)\)/$1(\"-W$2\")/' src/*/*/*.[ch] src/*/*.[ch]
2020-01-09 07:30:35 -05:00
Nick Mathewson
792e5b2403
Replace DISABLE/ENABLE_GCC_WARNING with something that will confuse clang-format less
2020-01-09 07:30:35 -05:00
Nick Mathewson
a48cb9fa43
core/include.am: spelling fix
2020-01-08 20:50:02 -05:00
Nick Mathewson
4f02812242
It's 2020. Update the copyright dates with "make update-copyright"
2020-01-08 18:39:17 -05:00
Nick Mathewson
2d27a3ecc0
Run "make autostyle"; add an endif comment
2020-01-08 18:38:24 -05:00
teor
a58cffe195
router: Improve port search function comments
2020-01-08 17:47:08 +10:00
Roger Dingledine
81fd8aad24
speaking of utf-8, remove strange char from comment
2020-01-07 18:25:17 -05:00
Nick Mathewson
e231cd5b61
Merge branch 'ticket32845_squashed'
2020-01-07 10:16:15 -05:00
teor
0e3fd4df99
string: Check UTF-8 string pointer and length
...
If they are inconsistent, output a raw bug log.
Part of 32845.
2020-01-07 10:16:08 -05:00
Nick Mathewson
17a1ae025a
Merge remote-tracking branch 'tor-github/pr/1640'
2020-01-07 08:59:31 -05:00
Nick Mathewson
c48068ece3
test_helpers: add a missing free for CID 1457527.
2020-01-07 08:22:02 -05:00
Nick Mathewson
f2aeaaf71d
Add new state to connection_proxy_state_to_string()
...
Also, add a CTASSERT() to make sure that we don't let this array get
out-of-sync again.
Found by coverity; this is CID 1457528.
2020-01-07 08:09:27 -05:00
teor
d62dbb6762
string: Add extra UTF-8 test cases
...
These test cases are validated differently by some
programming languages, because those languages have
incorrect UTF-8 implementations.
We want to make sure that tor validates them correctly.
Closes ticket 32845.
2020-01-07 17:05:48 +10:00
Neel Chauhan
ee015d36f8
Space the a-d unsigned ints in tor_inet_aton()
2020-01-06 20:20:38 -08:00
Nick Mathewson
1b63eea66c
Merge branch 'haxxpop/tcp_proxy_squashed' into tcp_proxy_squshed_and_merged
2020-01-06 13:41:20 -05:00
Suphanat Chunhapanya
4264717ca3
test: HTTP CONNECT protocol
2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
de58a49a2d
test: HAPRoxy protocol
2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
41b9dca07b
test: Implement haproxy
2020-01-06 13:39:10 -05:00
Suphanat Chunhapanya
119004e87d
circuit: Implement haproxy
2020-01-06 13:39:10 -05:00
Nick Mathewson
1f498220bd
Merge remote-tracking branch 'tor-github/pr/1620'
2020-01-06 13:28:10 -05:00
Nick Mathewson
48f7341783
Merge branch 'maint-0.4.2'
2020-01-06 13:24:01 -05:00
Nick Mathewson
6da989cfe8
Merge remote-tracking branch 'tor-github/pr/1612' into maint-0.4.2
2020-01-06 13:20:57 -05:00
Nick Mathewson
4f6901d7cc
When initializing pthreads, always set the main thread.
...
Fixes bug 32884. This is a bugfix on 0.3.3.1-alpha, when we started
allowing restart-in-process with tor_api.h.
2020-01-06 09:37:12 -05:00
Nick Mathewson
b6f099672b
Make ntmain.h functions stubs when NT_SERVICE not enabled.
...
This lets us simplify main.c a little, and avoid a practracker
exception.
Followup from #32883 .
2020-01-06 09:25:23 -05:00
Nick Mathewson
5c240db0bf
Restore feature where nt-services detect non-"run_tor" modes.
...
Followup for #32883 .
2020-01-06 09:25:23 -05:00
Nick Mathewson
54eec5342d
Initialize publish/subscribe code when running as an NT service.
...
Fixes bug 32778; bugfix on 0.4.1.1-alpha.
2020-01-06 09:22:57 -05:00
Nick Mathewson
13216f848a
Merge branch 'maint-0.4.2'
2020-01-06 08:08:59 -05:00
Nick Mathewson
16e94dc7a7
Merge branch 'maint-0.4.1' into maint-0.4.2
2020-01-06 08:06:54 -05:00
Peter Gerber
b9d81282e0
Fix sandbox crash during reload of logging configuration
...
Allow calls to dup() which was introduced in commit a22fbab986
.
From a security perspective, I don't think this should impact the
security of the sandbox significantly. As far as I can tell, there
is nothing an adversary can do with a duplicated FD that can't be
done with the original.
2020-01-05 15:24:45 +00:00
Neel Chauhan
b062e0f0a4
Fix spacing in tor_sscanf() call in tor_inet_aton()
2019-12-20 14:11:03 -05:00
Neel Chauhan
01c6fde326
Fix spacing in tor_inet_aton() function header
2019-12-20 14:10:43 -05:00
Nick Mathewson
5c6fc5250e
test_util: remove UTIL_LEGACY_NO_WIN.
...
It was only used in one place.
2019-12-20 09:57:52 -05:00
Hans-Christoph Steiner
a96317a79d
Android: skip tests that check UNIX user account setup
...
* there is no ~ or HOME in Android
* UIDs and GIDs in Android represent apps, not users, and Android apps
cannot ever change UIDs
This should be replaced by whatever @nmathewson wants to name this stuff:
https://github.com/torproject/tor/pull/1436
2019-12-20 09:53:16 -05:00
Nick Mathewson
33a0f15b21
Merge branch 'bug29819_035'
2019-12-20 07:37:47 -05:00
teor
8c23ac4ae7
Replace several C identifiers.
...
This is an automated commit, generated by this command:
./scripts/maint/rename_c_identifier.py \
EXPOSE_CLEAN_BACKTRACE BACKTRACE_PRIVATE \
TOR_CHANNEL_INTERNAL_ CHANNEL_OBJECT_PRIVATE \
CHANNEL_PRIVATE_ CHANNEL_FILE_PRIVATE \
EXPOSE_ROUTERDESC_TOKEN_TABLE ROUTERDESC_TOKEN_TABLE_PRIVATE \
SCHEDULER_PRIVATE_ SCHEDULER_PRIVATE
2019-12-20 13:27:58 +10:00
teor
cd160291a7
Code Style: Delete headers that are included twice
...
These changes were created using the "make autostyle" from
32522, and then split into commits.
2019-12-20 09:53:31 +10:00
teor
d8b868e483
Code Style: Delete PRIVATE defines that are never used
...
Some ".c" files define *_PRIVATE macros, but those macros are
not used in any header file. Delete them.
These changes were created using the "make autostyle" from
32522, and then split into commits.
2019-12-20 09:50:50 +10:00
teor
57b6678d52
Run "make autostyle"
2019-12-20 09:45:53 +10:00
Nick Mathewson
1bdbb4e9eb
Change conf_examples test for ConsensusParams option.
2019-12-19 12:09:03 -05:00
Nick Mathewson
42e31b5c45
Mark TestingEstimatedDescriptorPropagationTime as obsolete.
...
We stopped looking at this option in 85cf6dcba3
, back when we
implemented the minimal pieces of prop275. Since then, we've had
code to validate and adjust this option, and to give it a different
value in testing networks, but the option hasn't actually done
anything.
We can safely mark it as OBSOLETE, since doing so does not make any
old configuration get rejected.
Closes ticket 32807.
2019-12-19 11:04:48 -05:00
Nick Mathewson
3210598c30
Move TestingDirVote{Exit,Guard,HSdir}{,IsStrict} to dirauth module
2019-12-19 10:42:44 -05:00
Nick Mathewson
87f7c2d018
Correct the type for config_decl_ROUTERSET
...
This needs to be a point so that the CONF_VAR() macro can work
correctly.
2019-12-19 10:42:10 -05:00
Nick Mathewson
3739503404
Move TestingMin{Exit,Fast}FlagThreshold to dirauth module.
2019-12-19 10:14:09 -05:00
Nick Mathewson
cde5abfdc6
Move TestingDirAuthTimeToLearnReachability into dirauth module.
2019-12-19 10:08:22 -05:00
Nick Mathewson
be9bc5981f
Move MinMeasuredBWsForAuthToIgnoreAdvertised to dirauth module.
2019-12-19 09:51:11 -05:00
Nick Mathewson
0c7fd83123
Move ConsensusParams to dirauth module.
2019-12-19 09:46:14 -05:00
Nick Mathewson
77dea66e19
Move MinUptimeHidServDirectoryV2 to dirauth module.
2019-12-19 09:43:25 -05:00
Nick Mathewson
b1d029b9a1
Move AuthDirTestEd25519LinkKeys to the dirauth module.
2019-12-19 09:38:25 -05:00
Nick Mathewson
f4f70e1f13
Move AuthDirSharedRandomness to dirauth module.
2019-12-19 09:34:27 -05:00
Nick Mathewson
99874ecc1d
Move AuthDirPinKeys to dirauth module.
2019-12-19 09:34:18 -05:00
Nick Mathewson
9386b0b28a
Move AuthDirListBadExits to dirauth module.
2019-12-19 09:24:57 -05:00
Nick Mathewson
eedab30a7b
Move AuthDirHasIPv6Connectivity into dirauth module.
2019-12-19 09:19:02 -05:00
Nick Mathewson
bc0f1076d5
Move get_foo_options() test helpers into a new test module.
...
Some of these helpers will be needed in multiple places in the unit
tests, so we should move them now.
2019-12-19 09:19:02 -05:00
Nick Mathewson
7d5e360c3b
Move BW-guarantee options in to dirauth module.
2019-12-19 08:57:47 -05:00
Nick Mathewson
ea91edff15
Dirauth options: move versioning options to dirauth module
...
This commit moves VersioningAuthoritativeDirectory,
RecommendedClientVersions, and RecommendedServerVersions.
2019-12-19 08:57:47 -05:00
Nick Mathewson
a6ba56761b
Merge branch 'dirauth_config_squashed'
2019-12-19 07:55:06 -05:00
Nick Mathewson
13df744921
Declare relay/dirauth subsystem levels in a header.
...
This way, we can't get out of sync between the two declarations.
2019-12-19 07:54:56 -05:00
Nick Mathewson
8d474e4dc5
Add an integration test for options disabled by dirauth subsystem.
2019-12-19 07:54:56 -05:00
Nick Mathewson
ffa3499d81
Add config object for dirauth; move one option there.
...
I've chosen the "AuthDirMaxServersPerAddr" option here for
simplicity, since it is used literally nowhere else besides the dirauth
module. Once we have all the infrastructure in place for this, we
can move more options into this structure.
2019-12-19 07:54:56 -05:00
Nick Mathewson
419ba97df5
Allow struct_magic to be disabled.
...
When a subsystem is disabled, there will be no corresponding object
allocated, and no magic numbers on it.
2019-12-19 07:54:56 -05:00
Nick Mathewson
9082a6db3f
Support a flag to indicate that a config var is disabled
...
Like "obsolete" variables, these variables produce a warning when
you try to set them, but the warning says that the relevant module
doesn't have support.
The confdecl macros now have a CONF_CONTEXT that you can define to
make all the modules in a given table disabled.
2019-12-19 07:54:56 -05:00
Nick Mathewson
5e2318165d
Add "stub" files for disabled modules.
...
These modules are only built when the selected modules are disabled.
The provide stub implementations of the subsystem blocks. Later,
other stub implementations could move here.
Having real subsystem blocks here will let us handle disabled
configuration options better.
2019-12-19 07:54:56 -05:00
George Kadianakis
b7304027f6
Merge branch 'tor-github/pr/1587'
2019-12-18 14:19:15 +02:00
Nick Mathewson
08bfc2d71a
Merge branch 'ticket32172_once_again'
2019-12-17 15:02:06 -05:00
Peter Gerber
0d64bafcfe
Correct how we use libseccomp
...
This fixes a startup crash with libseccomp v2.4.0 if Sandbox is
set to 1.
2019-12-17 09:47:28 -05:00
Nick Mathewson
5f9808d1d7
Merge remote-tracking branch 'tor-github/pr/1596'
2019-12-17 09:39:50 -05:00
David Goulet
47d69d981e
Merge branch 'tor-github/pr/1608'
2019-12-17 09:30:19 -05:00
Nick Mathewson
b4977d1aa9
Fix formatting in tor_assertf() message in struct_check_magic().
...
Closes 32771; bugfix on 0.4.2.1-alpha.
2019-12-16 15:31:23 -05:00
Nick Mathewson
df5c81fec0
Merge branch 'bug32765_041' into bug32771_042
2019-12-16 15:27:18 -05:00
Nick Mathewson
1b619a627c
Use CHECK_PRINTF() for printf-like functions in util_bug.h
2019-12-16 15:14:13 -05:00
Neel Chauhan
ec35593e42
Compact lines in test_e2e_rend_circuit_setup()
2019-12-16 14:26:12 -05:00
Neel Chauhan
f684fd79e9
Remove extra space from helper_get_circ_and_stream_for_test() call in test_e2e_rend_circuit_setup()
2019-12-16 14:19:55 -05:00
teor
648399d6c2
Merge remote-tracking branch 'tor-github/pr/1505'
2019-12-16 08:15:19 +10:00
Nick Mathewson
1d0ccda595
Add torint.h include to confdecl.h.
...
This change allows other modules to include confdecl.h without
having first to include integer types they might not even use.
2019-12-15 11:46:05 -05:00
teor
0bb879e821
src/ext: Add __future__ imports for python 3 compatibility
...
Closes ticket 32732.
2019-12-12 15:59:47 +10:00
teor
1619f14a04
python: Add __future__ imports for python 3 compatibility
...
Except for src/ext, which we may not want to modify.
Closes ticket 32732.
2019-12-12 15:58:51 +10:00
Taylor Yu
0fd49c6663
Document high-level architecture goals
...
Create a high-level description of the long-term software architecture
goals. Closes ticket 32206.
2019-12-10 16:47:38 -06:00
Hans-Christoph Steiner
4d4cbf739f
set up tmp dir for test suite to run on Android
...
There is no /tmp or mkdtemp on Android, there is /data/local/tmp for
root and the shell user. So this fakes mkdtemp. Also, FYI, tor might
not like the default perms of /data/local/tmp, e.g. 0770.
https://trac.torproject.org/projects/tor/ticket/32172
2019-12-10 15:55:40 -05:00
Neel Chauhan
a8b5b9a1bc
In cancel_descriptor_fetches(), use connection_list_by_type_purpose() instead of connection_list_by_type_state()
2019-12-10 12:00:38 -05:00
George Kadianakis
a38014e5c6
Merge branch 'tor-github/pr/1581'
2019-12-10 18:34:00 +02:00
David Goulet
fc32349adc
hs-v3: Handle client rendezvous circuit timeout
...
With v3, the "pending_final_cpath" of a circuit is always NULL which means
that for v3, established client rendezvous circuit waiting for the intro point
to ACK, will always end up timing out quickly.
This can increase the delays to which you connect to a service since in order
to succeed, the rendezvous circuit needs to fully established
(CIRCUIT_PURPOSE_C_REND_JOINED) within the cutoff of the introduction circuit
as well which is these days around 2-3 seconds.
Fixes #32021
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-12-10 18:33:48 +02:00
David Goulet
71767b06ae
Merge branch 'tor-github/pr/1583'
2019-12-10 09:42:09 -05:00
George Kadianakis
c959ea7558
hs-v3: Fix memory leak in test_hs_control_store_permanent_creds()
2019-12-10 09:42:05 -05:00
Nick Mathewson
b7d18f8610
bump to 0.4.2.5-dev
2019-12-09 16:03:31 -05:00
Nick Mathewson
7174a80edd
bump to 0.4.1.7-dev
2019-12-09 16:02:36 -05:00
Nick Mathewson
b9504f788c
Bump version to 0.4.0.6-dev
2019-12-09 16:01:56 -05:00
Nick Mathewson
0c4f0ec977
bump to 0.3.5.9-dev
2019-12-09 16:01:11 -05:00
Taylor Yu
bfe38878b2
Rename control_reply_add_1kv
...
Part of ticket 30984.
2019-12-09 09:55:04 -06:00
Taylor Yu
9b196f1563
simplify getinfo using reply lines
...
Simplify handle_control_getinfo() by using the new reply lines
abstraction. Previously, this function explicitly checked for whether
it should generate a MidReplyLine, a DataReplyLine, or an
EndReplyLine. control_write_reply_lines() now abstracts this check.
Part of #30984 .
2019-12-08 22:40:00 -06:00
Taylor Yu
a08f43ba04
use control reply lines for protocolinfo
...
Simplify handle_control_protocolinfo() by using the new reply line
abstraction.
Part of #30984 .
2019-12-08 22:40:00 -06:00
Taylor Yu
2143bae6c4
refactor handle_control_protocolinfo
...
Factor out the parts of handle_control_protocolinfo() that assemble
the AUTHMETHODS and COOKIEFILE strings.
Part of #30984 .
2019-12-08 22:40:00 -06:00
Taylor Yu
c744d23c8d
simplify getconf by using reply lines
...
In handle_control_getconf(), use the new control reply line
abstraction to simplify output generation. Previously, this function
explicitly checked for whether it should generate a MidReplyLine or an
EndReplyLine. control_write_reply_lines() now abstracts this check.
Part of #30984 .
2019-12-08 22:40:00 -06:00
Taylor Yu
1a68a18093
reply lines structures
...
Part of #30984 .
2019-12-08 22:40:00 -06:00
Taylor Yu
1e8bb79bbe
add KV_RAW to kvline.c
...
Add the KV_RAW flag to kvline_encode(). This allows generation of
output that is compatible with some quirks of the control protocol.
Part of #30984 .
2019-12-08 17:09:43 -06:00
Taylor Yu
4b22c739fe
clean up kvline_can_encode_lines()
...
Add a check for '=' characters in needs_escape(). This simplifies the
logic in kvline_can_encode_lines().
Part of #30984 .
2019-12-08 17:09:42 -06:00
Nick Mathewson
089466eff3
Merge branch 'maint-0.4.2'
2019-12-06 16:02:08 -05:00
Nick Mathewson
3248630fc8
Merge branch 'maint-0.4.1' into maint-0.4.2
2019-12-06 16:02:08 -05:00
Nick Mathewson
6513102b9d
Merge branch 'maint-0.4.0' into maint-0.4.1
2019-12-06 16:02:08 -05:00
Nick Mathewson
c7ca3fc186
Merge branch 'maint-0.3.5' into maint-0.4.0
2019-12-06 16:02:07 -05:00
Nick Mathewson
74cae547e5
Merge branch 'maint-0.2.9' into maint-0.3.5
2019-12-06 16:02:07 -05:00
Karsten Loesing
b7b467d3af
Update geoip and geoip6 to the December 3 2019 database.
2019-12-06 11:50:35 +01:00
Nick Mathewson
0a33522b62
Bump to 0.4.2.5
2019-12-05 13:32:30 -05:00
Nick Mathewson
8933c7908d
bump version to 0.4.1.7
2019-12-05 13:31:46 -05:00
Nick Mathewson
e66533befa
Bump to 0.4.0.6
2019-12-05 13:31:01 -05:00
Nick Mathewson
c53567c36f
Bump version to 0.3.5.9
2019-12-05 13:29:49 -05:00
teor
cfa9cc34aa
Merge branch 'maint-0.4.0' into maint-0.4.1
2019-12-05 10:14:01 +10:00
teor
92fb099067
Merge branch 'maint-0.3.5' into maint-0.4.0
2019-12-05 10:13:53 +10:00
teor
46057ec5ae
Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
2019-12-05 10:13:15 +10:00
teor
aee966cb06
Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
2019-12-05 10:11:18 +10:00
Nick Mathewson
fcb5656128
Merge branch 'ticket32609_squashed'
2019-12-04 12:15:28 -05:00
teor
9ad569c71d
practracker: Add missing .may_include files
...
All of these files contain "*.h", except for:
* src/app/config/.may_include
* src/test/.may_include
which also contain "*.inc".
This change prevents includes of "*.c" files, and other
unusually named files.
Part of 32609.
2019-12-04 12:15:22 -05:00
George Kadianakis
2693bf47e8
control-port: Include HS address in ONION_CLIENT_AUTH_VIEW reply.
2019-12-04 13:33:07 +02:00
David Goulet
3b64c6b6fc
hs-v3: Fix NULL deref. in hs_circ_service_get_established_intro_circ()
...
Found by Stem regression tests. Reported by atagar.
Fixes #32664
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-12-03 10:11:42 -05:00
David Goulet
65759f2901
Merge branch 'tor-github/pr/1563'
2019-12-03 09:22:21 -05:00
George Kadianakis
12305b6bb6
hsv3: ONION_CLIENT_AUTH_REMOVE now also removes the credential file.
2019-12-03 09:22:17 -05:00
George Kadianakis
8ed8707f0a
hsv3: Abstract parts of hs_config_client_authorization() into func.
...
Now we have a function that reads a file and returns a credential. We need that
for the REMOVE control port command.
2019-12-03 09:22:17 -05:00
George Kadianakis
763f337290
hsv3: Start refactoring hs_config_client_authorization().
...
- Remove key_dir which is useless.
- Kill an indentation layer.
We want to make it cleaner and slimmer so that we can reuse parts of it in the
REMOVE command for removing the right client auth file.
2019-12-03 09:22:17 -05:00
George Kadianakis
9395a0c765
hsv3: Remove support for client auth nicknames.
...
Because the function that parses client auth credentials saved on
disk (parse_auth_file_content()) is not future compatible, there is no way to
add support for storing the nickname on the disk. Hence, nicknames cannot
persist after Tor restart making them pretty much useless.
In the future we can introduce nicknames by adding a new file format for client
auth credentials, but this was not deemed worth doing at this stage.
2019-12-03 09:22:17 -05:00
George Kadianakis
c7c9899bc4
hsv3: Add tests for permanently storing auth credentials.
...
Remove Permanent flag from old tests, and make a new test that does all the
permanent things.
2019-12-03 09:22:17 -05:00
George Kadianakis
70572b9abd
hsv3: Implement permanent storage of auth credentials.
...
- See hs_client_register_auth_credentials() for the entry point.
- Also set the permanent flag for credentials we read from the filesystem.
- Also add some missing documentation.
2019-12-03 09:22:17 -05:00
teor
df6c5382ad
Merge branch 'pr-1569-squashed'
2019-12-03 12:57:06 +10:00
Nick Mathewson
92a6803e1d
Distribute checkSpaceTest.sh and run it when we have perl.
2019-12-03 12:56:53 +10:00
Nick Mathewson
f63cf2158b
Merge branch 'ticket32207'
2019-12-02 11:41:40 -05:00
Nick Mathewson
af7416bfad
Link to mainloop_pubsub.[ch] when describing delivery policies
2019-12-02 11:41:16 -05:00
George Kadianakis
53bdd21179
Merge branch 'tor-github/pr/1559'
2019-12-02 12:52:44 +02:00
teor
96e620caaf
Merge remote-tracking branch 'tor-github/pr/1574'
2019-12-01 17:53:06 +10:00
teor
41a3930129
control: Update an outdated function comment
...
Cleanup after 31531.
2019-11-29 10:55:27 +10:00
teor
f8f278f8c4
control: Remove an unused function return value
...
Cleanup after 31531.
2019-11-29 10:54:42 +10:00
teor
7a69b3aebc
control: Rename a function variable
...
Cleanup after 31531.
2019-11-29 10:53:32 +10:00
teor
7572988ea9
control: Remove an unnecessary header in control_events.h
...
And replace it with a struct forward declaration.
Also, move all the headers in the file before the forward
declaration.
Cleanup after 31531.
2019-11-29 10:50:09 +10:00
George Kadianakis
68a00c4951
Merge branch 'tor-github/pr/1573'
2019-11-27 15:36:26 +02:00
David Goulet
c508513014
test: Add unit tests for closing intro circ on failure
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
a423cec670
hs-v3: Remove unused hs_service_intro_circ_has_closed()
...
Since the removal of ip->circuit_established, this function does litterally
nothing so clean it up.
Part of #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
cbc495453c
hs-v3: Give a cleanup type to hs_circ_cleanup()
...
By centralizing the circuit cleanup type that is: on close, free and
repurpose, some actions on the circuit can not happen for a certain cleanup
type or for all types.
This passes a cleanup type so the HS subsystem (v2 and v3) can take actions
based on the type of cleanup.
For instance, there is slow code that we do not run on a circuit close but
rather only on free.
Part of #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
7f83c43594
hs-v3: Note client intro circuit failure
...
Report back to the v3 subsystem any introduction point client circuit failure
so they can be noted down in the failure cache.
Fixes #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
David Goulet
1aafe3376e
hs-v2: Modernize rend_client_circuit_cleanup() code
...
Old and messy code path. Structure it in a more pleasant and readable way. No
behavior change with this refactor.
Part of #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-27 14:52:09 +02:00
Neel Chauhan
99cf3f99c0
Make control_event_conf_changed() take a config_line_t
2019-11-26 22:12:23 -05:00
Neel Chauhan
96a15bece7
If statements to getresuid() and getresgid() in setuid.c shouldn't have an extra space
2019-11-26 21:58:31 -05:00
teor
5ec4fb7558
crypt_ops: Fix some weird macro spacing
2019-11-26 11:03:22 +10:00
teor
e66fde45f1
Code Style: Remove double newlines in win32/orconfig.h
...
There's no reason for them to be in there.
Part of 32522.
2019-11-26 11:02:58 +10:00
teor
d7fdab49f7
test/controller: Stop including a ".c" source file
...
Part of 32522.
2019-11-26 11:02:05 +10:00
teor
2a71a58d4f
test: Fix a python double-space
2019-11-26 11:00:39 +10:00
Nick Mathewson
31f8b4fa65
Merge branch 'stream-socks-auth' into bug19859_merged
2019-11-25 07:58:02 -05:00
teor
26071aa3be
Merge branch 'maint-0.4.0' into maint-0.4.1
2019-11-25 12:37:07 +10:00
teor
055f5d4d1b
Merge branch 'maint-0.3.5' into maint-0.4.0
2019-11-25 12:36:59 +10:00
teor
c17ab20ac0
Merge remote-tracking branch 'tor-github/pr/1441' into maint-0.4.0
2019-11-25 12:36:41 +10:00
teor
ed6f2f61a2
Merge remote-tracking branch 'tor-github/pr/1396' into maint-0.4.0
2019-11-25 12:35:58 +10:00
teor
501b5174d8
Merge remote-tracking branch 'tor-github/pr/1464' into maint-0.3.5
2019-11-25 12:35:11 +10:00
teor
400cee261e
Merge remote-tracking branch 'tor-github/pr/1422' into maint-0.3.5
2019-11-25 12:34:29 +10:00
teor
54c01119ed
Merge remote-tracking branch 'tor-github/pr/1405' into maint-0.3.5
2019-11-25 12:33:55 +10:00
teor
83424cb62f
Merge remote-tracking branch 'tor-github/pr/1395' into maint-0.3.5
2019-11-25 12:33:14 +10:00
teor
f9812ee5f7
Merge remote-tracking branch 'tor-github/pr/1394' into maint-0.3.5
2019-11-25 12:29:43 +10:00
Nick Mathewson
1d117e826f
process_descs.c: rename confusing identifiers
...
The FP_ identifiers referred to fingerprints, but they also applied
to address ranges. The router_status_t name invited confusion with
routerstasus_t. Fixes ticket 29826.
This is an automated commit, generated by this command:
./scripts/maint/rename_c_identifier.py \
router_status_t rtr_flags_t \
FP_INVALID RTR_INVALID \
FP_BADEXIT RTR_BADEXIT \
FP_REJECT RTR_REJECT
2019-11-23 15:33:13 -05:00
Nick Mathewson
ff7d0ebcfe
Fix a low-impact memory leak in options_act_reversible()
...
Found by Coverity as CID 1455953
Fixes bug 32575; bug not in any released Tor.
2019-11-22 09:04:36 -05:00
Nick Mathewson
cf22841e3b
ht.h: improve documentation for HT_NEXT_RMV.
2019-11-21 11:56:42 -05:00
Nick Mathewson
da15448eb8
Merge branch 'ticket32209'
2019-11-21 08:26:20 -05:00
Nick Mathewson
55fac8dafc
config.md: suggestions from teor
2019-11-21 08:26:12 -05:00
Nick Mathewson
d8ff7d0236
Merge branch 'reversible_3'
2019-11-21 07:49:18 -05:00
George Kadianakis
f23d4df091
Merge branch 'tor-github/pr/1555'
2019-11-21 13:03:44 +02:00
David Goulet
709d7fba11
hs-v3: Return bad address SOCKS5 extended error
...
If ExtendedErrors is set for the SocksPort, an invalid .onion address now
returns the 0xF6 error code per prop304.
Closes #30022
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-21 13:02:29 +02:00
David Goulet
00136c9430
hs-v2: Move v2 circuit cleanup actions into hs_circ_cleanup()
...
Refactor to decomplexify circuit_about_to_free() and finally have one single
entry point into the HS subsystems (v2 and v3) for when a circuit is freed.
With this, hs_circ_cleanup() becomes the one and only entry point when a
circuit is freed which then routes to the right subsystem version for any
actions to be taken.
This moves a big chunk of code from circuituse.c to rendclient.c. No behavior
change. Next commit will refactor it to reduce our technical debt.
Part of #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-20 10:25:52 -05:00
David Goulet
588794771f
circ: Add hidden service helper functions
...
Functions to correctly identify HS circuit type and version.
Part of #32020
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-20 10:25:52 -05:00
Nick Mathewson
b33f3c960d
options_act_reversible: add more comments to explain ordering
2019-11-20 09:49:25 -05:00
Nick Mathewson
a3d06179ce
Typo/grammar fixes.
2019-11-20 09:28:12 -05:00
Nick Mathewson
acb97cfa68
log config: Set safelogging_changed even if we aren't running Tor.
2019-11-20 09:26:47 -05:00
Nick Mathewson
89c355b386
Some tests for log changes, commit, and rollback
2019-11-20 09:26:47 -05:00
Nick Mathewson
a30d143228
Make KeyDirectory's GroupReadable behave the same as CacheDirectory's.
...
In #26913 we solved a bug where CacheDirectoryGroupReadable would
override DataDirectoryGroupReadable when the two directories are the
same. We never did the same for KeyDirectory, though, because
that's a rare setting.
Now that I'm testing this code, though, fixing this issue seems
fine. Fixes bug #27992 ; bugfix on 0.3.3.1-alpha.
2019-11-20 09:26:47 -05:00
Nick Mathewson
3094651fa3
New unit tests for options_create_directories().
2019-11-20 09:26:47 -05:00
Nick Mathewson
9951afe177
parseconf test: ControlSocketsGroupWriteable without ControlSocket.
2019-11-20 09:26:47 -05:00
Nick Mathewson
cd8c96ce02
Typo fix in warning message about ControlSocket
2019-11-20 09:26:47 -05:00
Nick Mathewson
cf7580ab06
Free options objects for which validation fails.
...
Also free options objects when we discard them due to
TestingTorOptions.
Fixes bug 32555; bug not in any released Tor.
2019-11-20 09:14:08 -05:00
Nick Mathewson
929b46f44a
Split listener configuration out of options_act_reversible()
2019-11-19 16:05:07 -05:00
Nick Mathewson
5060007f4b
Split log configuration out of options_act_reversible().
2019-11-19 16:03:32 -05:00
Nick Mathewson
20c24e72d9
options_act_reversible(): Extract more startup-only pieces.
...
These have to happen after opening listeners and before opening logs :/
2019-11-19 16:03:10 -05:00
Nick Mathewson
006ce47ffa
Extract a function for one-time-only pre-reversible options.
...
These changes _only_ happen at startup, and happen before _any_
reversible option change is set.
2019-11-19 16:03:10 -05:00
Nick Mathewson
effed7fb1c
Move some ControlSocket checks to options_validate_cb()
...
There is no reason for them be in options_act_reversible().
2019-11-19 16:03:10 -05:00
George Kadianakis
21b3303657
Rename REGISTER_SUCCESS_ALSO_DECRYPTED to REGISTER_SUCCESS_AND_DECRYPTED.
2019-11-18 19:21:45 +02:00
George Kadianakis
97fd75169d
Various minor improvements after David's review.
...
- Fix a wrong log message
- Introduce a cap for the nickname size
- Change some 'if' statements to 'switch'.
2019-11-18 19:21:41 +02:00
George Kadianakis
ce422a9d4a
hs-v3: Decrypt pending descriptors when we get new client auth creds.
2019-11-18 19:21:34 +02:00
George Kadianakis
b996d55bcd
control-port: Tests for ONION_CLIENT_AUTH_VIEW.
2019-11-18 19:19:10 +02:00
George Kadianakis
db6a48b6bf
control-port: Implement ONION_CLIENT_AUTH_VIEW.
2019-11-18 19:19:00 +02:00
George Kadianakis
ee4b2287c6
control-port: Tests for ONION_CLIENT_AUTH_REMOVE.
2019-11-18 19:18:56 +02:00
George Kadianakis
8330b4dc2a
control-port: Implement ONION_CLIENT_AUTH_REMOVE.
2019-11-18 19:18:49 +02:00
George Kadianakis
46f4415022
control-port: Tests for ONION_CLIENT_AUTH_ADD.
2019-11-18 19:18:45 +02:00
George Kadianakis
00fdaaee1e
control-port: Implement ONION_CLIENT_AUTH_ADD.
2019-11-18 19:16:01 +02:00
George Kadianakis
d28b6792cb
Merge branch 'tor-github/pr/1423'
2019-11-18 19:06:53 +02:00
David Goulet
3892ac7c71
test: Unit test for the hs cache decrypt on new auth
...
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
c0dd5324b3
test: Unit test for the SOCKS5 HS client auth errors
...
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
68a004d147
hs-v3: Improve documentation of hs_cache_client_descriptor_t
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
48a9f8a63f
hs-v3: Function to re-parse unencrypted descriptor
...
We now keep descriptor that we can't decode due to missing client
authorization in the cache.
This new function is used when new client authorization are added and to tell
the client cache to retry decoding.
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
fbc18c8989
hs-v3: Refactor descriptor dir fetch done code
...
This commit extract most of the code that dirclient.c had to handle the end of
a descriptor directory requests (fetch). It is moved into hs_client.c in order
to have one single point of entry and the rest is fully handled by the HS
subsystem.
As part of #30382 , depending on how the descriptor ended up stored (decoded or
not), different SOCKS error code can be returned.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
80f241907c
hs-v3: Set extended error if .onion is invalid
...
In order to achieve this, the parse_extended_hostname() had to be refactored
to return either success or failure and setting the hostname type in the given
parameter.
The reason for that is so it can detect invalid onion addresses that is having
a ".onion", the right length but just not passing validation.
That way, we can send back the prop304 ExtendedError "X'F1' Onion Service
Descriptor Is Invalid" to notify the SOCKS connection of the invalid onion
address.
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
542402cd60
hs-v3: Set extended error when missing/bad client auth
...
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
fb1d212021
hs-v3: Set extended error when descriptor is not found
...
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
7bba8bf72f
hs-v3: Return descriptor decoding status when storing as client
...
This will allow us to callback into the HS subsytem depending on the decoding
status and return an extended SOCKS5 error code depending on the decoding
issue.
This is how we'll be able to tell the SocksPort connection if we are missing
or have bad client authorization for a service.
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
96a53221b0
hs-v3: Keep descriptor in cache if client auth is missing or bad
...
We now keep the descriptor in the cache, obviously not decoded, if it can't be
decrypted for which we believe client authorization is missing or unusable
(bad).
This way, it can be used later once the client authorization are added or
updated.
Part of #30382
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
teor
c34fb3413d
Merge remote-tracking branch 'tor-github/pr/1517'
2019-11-18 11:21:37 +10:00
Nick Mathewson
183f89ccac
Merge remote-tracking branch 'tor-github/pr/1545'
2019-11-16 15:30:00 -05:00
Nick Mathewson
b0c1634ce9
Merge remote-tracking branch 'tor-github/pr/1544'
2019-11-16 15:29:14 -05:00
Nick Mathewson
59ba61a690
Make structs declared by tor_queues.h macros also follow naming rules
2019-11-16 15:27:08 -05:00
Nick Mathewson
cc271afeda
map.h: replace maptype with mapname_t
...
This change makes our macro bodies consistent with our naming
expectations for structs and types outside macro bodies.
2019-11-16 15:20:47 -05:00
Nick Mathewson
0c80c2e45f
handles.h: replace structname with structname_t
...
This change makes our macro bodies consistent with our naming
expectations for structs and types outside macro bodies.
2019-11-16 15:20:32 -05:00
Nick Mathewson
5a1a60e65e
Revise struct names in examples in comments to end with _t
2019-11-16 15:12:35 -05:00
Nick Mathewson
d700dc7801
Topic documentation on our publish-subscribe architecture.
2019-11-16 14:31:49 -05:00
Nick Mathewson
0e4e96b9bf
High-level documentation of configuration in Tor.
...
Closes ticket 32209.
2019-11-15 16:25:00 -05:00
Neel Chauhan
c8859eb754
Remove the extra whitespace around the DARWIN #defines
2019-11-15 15:05:53 -05:00
Neel Chauhan
4874b00065
Remove the extra whitespace in the lines_eq() if statement in consdiff_gen_diff()
2019-11-15 14:56:47 -05:00
Nick Mathewson
8b91680d5c
Doxygen: rename all .dox files to end with .md
...
Using a standard ending here will let other tools that expect
markdown understand our output here.
This commit was automatically generated with:
for fn in $(find src -name '*.dox'); do \
git mv "$fn" "${fn%.dox}.md"; \
done
2019-11-15 09:28:12 -05:00
Nick Mathewson
3a7369d0cf
Doxygen: remove /** and **/ from all .dox files
...
This is an automatically generated commit, made with:
find src -name '*.dox' | \
xargs perl -i -ne 'print unless (m#^\s*/?\*\*/?\s*$#);'
2019-11-15 09:23:51 -05:00
Nick Mathewson
97b5ff2b1d
Merge branch 'ticket32211'
2019-11-15 09:10:11 -05:00
Nick Mathewson
8746fedce4
Initialization documents: incorporate feedback from review.
...
(Thanks, Taylor!)
2019-11-15 09:00:54 -05:00
Nick Mathewson
6d81ca845c
bump version to 0.4.2.4-rc-dev
2019-11-15 08:06:09 -05:00
teor
825f52784d
Merge remote-tracking branch 'tor-github/pr/1535'
2019-11-15 12:11:32 +10:00
teor
b58e5091b7
Merge remote-tracking branch 'tor-github/pr/1533'
2019-11-15 12:11:22 +10:00
teor
d8d36c7dc3
Merge remote-tracking branch 'tor-github/pr/1536'
2019-11-15 11:28:29 +10:00
Nick Mathewson
d57a04b648
Avoid redundant typedef of or_options_t and smartlist_t in *_config.h
...
Fixes bug 32495.
2019-11-14 15:43:53 -05:00
Nick Mathewson
cf79ffaf1e
Fix 32-bit warnings in test_circuitmux.c
...
Fixes bug 32496; bug not in any released Tor.
2019-11-14 11:04:10 -05:00
Nick Mathewson
a76b7cd8b5
Merge remote-tracking branch 'tor-github/pr/1531'
2019-11-14 09:58:37 -05:00
teor
d19f370aa2
Run "make autostyle"
2019-11-14 16:28:39 +10:00
teor
0df8bcfb6f
relay: Disable relay_sys when the relay module is disabled
...
Closes ticket 32245.
2019-11-14 16:27:06 +10:00
teor
88c2a23c4b
relay: Disable relay_periodic when the relay module is disabled
...
Closes ticket 32244.
2019-11-14 16:17:17 +10:00
teor
ef00b1ce0f
dirauth: Remove a HAVE_MODULE_DIRAUTH inside a function
...
There are now no HAVE_MODULE_{DIRAUTH,RELAY} inside functions.
Closes ticket 32163.
2019-11-14 15:43:27 +10:00
teor
aa3e2bbd4b
test/parseconf: Warn when the expected_log* file is missing
...
Part of 32451.
2019-11-14 12:57:59 +10:00
teor
ced434c586
test/parseconf: Update conf_examples to use expected_log
...
Part of 32451.
2019-11-14 12:57:34 +10:00
teor
c7838c71fb
test/parseconf: Add failure cases in conf_failures/
...
These failure cases can be used to test the failure behaviour
and failure logs of test_parseconf.sh.
See the README for details.
Part of 32451.
2019-11-14 11:57:50 +10:00
teor
51a6c0c8fd
test/parseconf: Stop adding newlines to *_printf
...
Cleanup after 32451.
2019-11-14 11:57:50 +10:00
teor
2c4ada729e
test/parseconf: Show tor command lines on failure
...
Part of 32451.
2019-11-14 11:57:50 +10:00
teor
a5628cf5b3
test/parseconf: Refactor and simplify, stage 2
...
Remove more duplicate code.
Eliminate some arguments.
Rewrite some comments.
Cleanup after 32451.
2019-11-14 10:55:21 +10:00
teor
39046019ec
test/parseconf: Refactor and standardise, stage 1
...
Remove duplicate code, and standardise similar behaviour.
Add some additional error checking.
Cleanup after 32451.
2019-11-14 10:55:21 +10:00
teor
b4b3060f69
test/parseconf: Rename some functions, and reformat
...
Part of 32451.
2019-11-14 10:55:21 +10:00
teor
e6ca32fae3
test/parseconf: Use consistent formatting
...
Make spacing, quotes, and env vars consistent.
Cleanup after 32451 and 32468.
2019-11-14 10:55:21 +10:00
teor
4514bfe9c2
test/parseconf: Stop ignoring --dump-config failures
...
When we added the $FILTER for Windows newlines, we made
the pipeline always exit successfully, even if tor failed.
Fixes bug 32468; bugfix on 0.4.2.1-alpha.
2019-11-14 10:55:21 +10:00
teor
7ef44100c4
test/parseconf: Standardise output messages
...
Part of 32451.
2019-11-14 10:55:21 +10:00
teor
3df6432006
test/parseconf: Add an expected_log file
...
The "expected_log" file is a set of patterns that matches the
output of "tor --verify-config". Unlike "error", it expects a
successful exit status.
Part of 32451.
2019-11-14 10:55:21 +10:00
teor
4cf5d4cb3c
test/parseconf: Rewrite the included files section
...
Part of 32451.
2019-11-14 10:55:21 +10:00
teor
735d5f5b7e
test/parseconf: Split the file list into sections
...
There are lots of different files now, so having Config and Result
sections is helpful.
Part of 32451.
2019-11-14 10:55:21 +10:00
Nick Mathewson
70755eca00
Bump version to 0.4.2.4-rc.
2019-11-12 16:39:37 -05:00
Nick Mathewson
6744f6b6bb
HACKING/design: move 01c-time.md into doxygen.
2019-11-12 12:14:14 -05:00
JeremyRand
f487da518a
Bug 19859: Fix double-free in unit test
2019-11-12 17:13:04 +00:00
Nick Mathewson
b0f9ecdbb1
Move 01g-strings.md into doxygen.
2019-11-12 12:09:53 -05:00
Nick Mathewson
d1a1631a05
01f-threads.md becomes threading.dox.
2019-11-12 12:05:05 -05:00
Nick Mathewson
91f377deec
HACKING/design: turn the remaining parts of crypto into a certs doc
2019-11-12 12:01:33 -05:00
teor
233ccef6d8
Merge branch 'maint-0.4.2'
2019-11-12 10:10:01 +10:00
teor
9be51e8a8e
test/parseconf: Add tests for ignored options
...
These tests will also pass on 0.4.3, with the original implementation,
and with the new implementation in 32404.
Part of 32295 and 32404.
2019-11-12 10:09:40 +10:00
teor
2ee04fc309
config: Log the option name when skipping an obsolete option
...
This is a basic fix for 0.4.2 only. The fix for 0.4.3 and later
is in 32404.
Fixes bug 32295; bugfix on 0.4.2.1-alpha.
2019-11-12 10:07:12 +10:00
Nick Mathewson
3d1a7d7dd7
Light grammar edits
2019-11-11 12:26:09 -05:00
Nick Mathewson
7c3378fb8d
Merge remote-tracking branch 'tor-github/pr/1338'
2019-11-11 12:20:14 -05:00
Nick Mathewson
01af3a55f4
Merge remote-tracking branch 'tor-github/pr/1524'
2019-11-11 11:57:31 -05:00
Nick Mathewson
4462766d32
Merge branch 'ticket32404'
2019-11-11 11:54:14 -05:00
Nick Mathewson
9d562bba40
clarify OBSOLETE vs IGNORE.
2019-11-11 11:54:02 -05:00
liberat
4ae77e15d0
Test case for SOCKS5 RESOLVE_PTR with IPv6 address in brackets.
...
This was not supported previously, but provides symmetry with other
SOCKS requests, which also support addresses written in brackets.
2019-11-11 15:41:56 +00:00
liberat
b7c7474130
Test case for SOCKS5 RESOLVE_PTR with binary IPv6 address.
...
This tests the handling of binary v6 addresses, which works correctly
in older versions but was broken in 0.3.5.1-alpha.
2019-11-11 15:35:21 +00:00
liberat
4e4c4e72d7
Handle binary IPv6 addresses and bracketed strings in RESOLVE_PTR.
...
When a SOCKS5 client sends a RESOLVE_PTR request, it must include
either an IPv4 or IPv6 address. In the past this was required to be a
binary address (address types 1 or 4), but since the refactoring of
SOCKS5 support in Tor 0.3.5.1-alpha, strings (address type 3) are also
allowed if they represent an IPv4 or IPv6 literal.
However, when a binary IPv6 address is provided,
parse_socks5_client_request converts it into a string enclosed in
brackets. This doesn't match what string_is_valid_ipv6_address
expects, so this would fail with the error "socks5 received
RESOLVE_PTR command with hostname type. Rejecting."
By replacing string_is_valid_ipv4_address/string_is_valid_ipv6_address
with tor_addr_parse, we accept strings both with and without brackets.
This fixes the handling of binary addresses, and also improves
symmetry with CONNECT and RESOLVE requests.
Fixes bug 32315.
2019-11-11 15:34:38 +00:00
Nick Mathewson
ee33bf5ee0
Doxygen: close an unterminated <b>.
2019-11-11 10:23:41 -05:00
Nick Mathewson
ff930c3305
doxygen: use <tt> and # to avoid interpreting # as a link.
2019-11-11 10:23:13 -05:00
Nick Mathewson
29eb7b07ef
Merge branch 'maint-0.4.0' into maint-0.4.1
2019-11-11 10:14:04 -05:00
Nick Mathewson
a920597f62
Merge branch 'maint-0.4.1' into maint-0.4.2
2019-11-11 10:14:04 -05:00
Nick Mathewson
eb8ea92cf9
Merge branch 'maint-0.4.2'
2019-11-11 10:14:04 -05:00
Nick Mathewson
329aa1c48e
Merge branch 'maint-0.3.5' into maint-0.4.0
2019-11-11 10:14:03 -05:00
Nick Mathewson
7beaaed245
Merge branch 'maint-0.2.9' into maint-0.3.5
2019-11-11 10:14:03 -05:00
teor
2d651f4f6a
test/parseconf: Add basic parsing tests
...
And document the "%include" behaviour.
Closes 32450.
2019-11-11 13:04:28 +10:00
Nick Mathewson
2d508f8fa5
Not const.
2019-11-10 16:14:38 -05:00
Nick Mathewson
a6d22d7fc2
Improve subsys documentation; add initialization documentation.
2019-11-10 16:13:23 -05:00
Karsten Loesing
853b6ad095
Update geoip and geoip6 to the November 6 2019 database.
2019-11-09 10:10:19 +01:00
Nick Mathewson
a08969e460
Refactor "OBSOLETE" type
...
It no longer warns, and is now defined in terms of an "IGNORE" type.
(The "IGNORE" type is the same as "OBSOLETE", except that it is not
reported as obsolete. It should be useful for disabled modules.)
Closes ticket 32404.
2019-11-07 11:01:25 -05:00
Nick Mathewson
36af84ba50
New configuration flag to warn that a variable is obsolete.
...
Part of 32404.
2019-11-07 09:14:44 -05:00
Nick Mathewson
f6c9ca3a1d
Merge branch 'config_subsys_v4'
2019-11-07 08:59:42 -05:00
Nick Mathewson
31a6a6512f
Rename probability distribution names to end with "_t".
...
I needed to do this by hand, since we also use these for function
names, variable names, macro expansion, and a little token pasting.
2019-11-07 08:56:07 -05:00
Nick Mathewson
0644530df2
ntmain: make service_fns struct anonymous.
2019-11-07 08:45:08 -05:00
Nick Mathewson
4845ab53f0
Make all our struct names end with "_t".
...
This is an automated commit, generated by this command:
./scripts/maint/rename_c_identifier.py \
address_ttl_s address_ttl_t \
aes_cnt_cipher aes_cnt_cipher_t \
authchallenge_data_s authchallenge_data_t \
authenticate_data_s authenticate_data_t \
cached_bw_event_s cached_bw_event_t \
cbuf cbuf_t \
cell_ewma_s cell_ewma_t \
certs_data_s certs_data_t \
channel_idmap_entry_s channel_idmap_entry_t \
channel_listener_s channel_listener_t \
channel_s channel_t \
channel_tls_s channel_tls_t \
circuit_build_times_s circuit_build_times_t \
circuit_muxinfo_s circuit_muxinfo_t \
circuitmux_policy_circ_data_s circuitmux_policy_circ_data_t \
circuitmux_policy_data_s circuitmux_policy_data_t \
circuitmux_policy_s circuitmux_policy_t \
circuitmux_s circuitmux_t \
coord coord_t \
cpuworker_job_u cpuworker_job_u_t \
cv_testinfo_s cv_testinfo_t \
ddmap_entry_s ddmap_entry_t \
dircollator_s dircollator_t \
dist_ops dist_ops_t \
ecdh_work_s ecdh_work_t \
ewma_policy_circ_data_s ewma_policy_circ_data_t \
ewma_policy_data_s ewma_policy_data_t \
fp_pair_map_entry_s fp_pair_map_entry_t \
fp_pair_map_s fp_pair_map_t \
guard_selection_s guard_selection_t \
mbw_cache_entry_s mbw_cache_entry_t \
outbuf_table_ent_s outbuf_table_ent_t \
queued_event_s queued_event_t \
replyqueue_s replyqueue_t \
rsa_work_s rsa_work_t \
sandbox_cfg_elem sandbox_cfg_elem_t \
scheduler_s scheduler_t \
smp_param smp_param_t \
socket_table_ent_s socket_table_ent_t \
state_s state_t \
threadpool_s threadpool_t \
timeout_cb timeout_cb_t \
tor_libevent_cfg tor_libevent_cfg_t \
tor_threadlocal_s tor_threadlocal_t \
url_table_ent_s url_table_ent_t \
worker_state_s worker_state_t \
workerthread_s workerthread_t \
workqueue_entry_s workqueue_entry_t
2019-11-07 08:41:22 -05:00
Nick Mathewson
582cee723a
Fix various doxygen comments in feature/hs.
2019-11-07 08:13:31 -05:00
Nick Mathewson
de7053b896
Adjustments to 32406 per review
...
When we are failing because of a lack of a _required_ engine, note
that the engine was "required".
When engines are disabled, any required engine should cause a
failure.
2019-11-07 07:42:58 -05:00
Nick Mathewson
c550990400
Add a test for 32406 (AccelName with "!").
...
This also lets us test a failing set_options().
2019-11-07 07:28:43 -05:00
Nick Mathewson
32a2f96f82
Add the ability to fail when a hardware accelerator is missing.
...
Closes ticket 32406.
2019-11-07 07:28:43 -05:00
Nick Mathewson
27a4438805
conf_examples test for crypto_accel
2019-11-07 07:28:43 -05:00
Nick Mathewson
280a9a4760
Move netstatus (mainloop) state fields into mainloop's state.
2019-11-07 07:28:43 -05:00
Nick Mathewson
3afbb29bee
subsysmgr: use IDX_NONE is an exception value, not -1.
2019-11-07 07:28:43 -05:00
Nick Mathewson
0f0a9bdf33
Stop using "config_suite_offset=-1" to indicate "no config suite."
...
Instead, create a separate "has_config_suite" boolean, so that only
top-level formats with config_suites need to declare an offset at
all.
2019-11-07 07:28:43 -05:00
Nick Mathewson
0d8504e70b
crypto config: do not change the user's value of HardwareAccel.
...
We still interpret "AccelName" as turning on the "HardwareAccel"
feature, but we no longer modify the user's options here.
Fixes bug 32382; bugfix on 0.2.2.1-alpha when we added openssl
engine support.
2019-11-07 07:28:43 -05:00
Nick Mathewson
8cd3e66d93
Use new configuration architecture for crypto options
...
This is a comparatively simple change.
2019-11-07 07:28:43 -05:00
Nick Mathewson
b06e9d8ad5
Add testing-only functions to get the subsystem config/state indices
2019-11-07 07:28:43 -05:00
Nick Mathewson
52c0ab4af3
Add subsys functions for receiving/flushing states and options.
...
These functions are in the subsystem, not in the config_format_t,
since they are about how the format is _used_, not about _what it
is_.
2019-11-07 07:28:43 -05:00
Nick Mathewson
7ac4f9d5ec
Give subsystems optional config formats and state formats.
...
The formats, when provided, are now added to the global config_mgr_t
objects.
2019-11-07 07:28:43 -05:00
Nick Mathewson
a7cfddc8d1
Make a new structure for tracking subsystem status.
...
We used to have only one boolean per subsystem, but we're about to
have a little more information.
2019-11-07 07:28:43 -05:00
Nick Mathewson
8638989308
Expose get_obj() functions from confmgt.c.
...
The subsysmgr code wants to use them.
2019-11-07 07:28:43 -05:00
Nick Mathewson
1d108894e7
Define a low-level version of the confdecl table macros
...
This version uses the enum rather than the type definitions, to
avoid layering violations and linking problems.
2019-11-07 07:28:43 -05:00
Nick Mathewson
683d4c2bc8
Add FOO_type_defn globals so that confdecl.h can refer to them.
2019-11-07 07:28:43 -05:00
Nick Mathewson
19cac400d9
Macros for declaring configuration structs and variable-tables
...
In our old design, we had to declare configuration structures (like
or_options_t) and variable tables (like option_vars_) separately,
and we used some magic to enforce their consistency (see
conftesting.h).
With this design, we write a single definition for the configuration
object and its fields, and use C macros to expand it either into a
structure, or a variable table. Since they are both made from the
same source, they can't become inconsistent.
The two designs can coexist happily, and we can migrate from one to
the other at our convenience.
2019-11-07 07:28:43 -05:00
Nick Mathewson
4541a59019
lib/cc: Define the standard C macro pasting trick in one place.
...
This file is a workaround for the issue that if you say `a ## b` to
create a token that is the name of a macro, the C preprocessor won't
expand that macro. So you can't say this:
#define FOO__SQUARE(x) ((x)*(x))
#define FOO__CUBE(x) ((x)*(x)*(x))
#define FOO(func, x) FOO__##func(x)
Instead, the standard C trick is to add a layer of indirection:
#define PASTE(a,b) PASTE__(a,b)
#define PASTE__(a,b) a ## b
#define FOO__SQUARE(x) ((x)*(x))
#define FOO__CUBE(x) ((x)*(x)*(x))
#define FOO(func, x) PASTE(FOO__, func)(x)
We should use this kind of trick sparingly, since it gets confusing.
2019-11-07 07:28:43 -05:00
teor
a0820bc00d
test/parseconf: Update config parsing tests for 32410
2019-11-07 11:44:51 +10:00
teor
aaef9a2519
relay: Stop failing on startup when the relay module is disabled
...
When the relay module is disabled, make "ClientOnly 1" and
"DirCache 0" by default. (But keep "ClientOnly 0" and
"DirCache 1" as the defaults for the unit tests.)
And run "make autostyle".
Part of ticket 32410.
2019-11-07 11:43:41 +10:00
teor
57f43bcb03
Run "make autostyle"
2019-11-07 10:56:17 +10:00
teor
e466c84ed3
Merge branch 'maint-0.4.2'
2019-11-07 10:51:48 +10:00
teor
1f3bf10d3f
Merge remote-tracking branch 'tor-github/pr/1513' into maint-0.4.2
2019-11-07 10:51:22 +10:00
teor
10982d5997
Merge remote-tracking branch 'tor-github/pr/1512'
2019-11-07 10:35:50 +10:00
Nick Mathewson
9687efb386
Add a bunch of doxygen for things in src/lib.
2019-11-06 14:40:20 -05:00
Nick Mathewson
b994397f1a
entrynodes.h: make a comment into doxygen.
2019-11-06 13:08:04 -05:00
Nick Mathewson
9663ac0027
int_type_params_t: add documentation.
2019-11-06 13:07:13 -05:00
Nick Mathewson
88796637e5
dispatch_cfg_st.h: make comments into doxygen.
2019-11-06 13:05:36 -05:00
Nick Mathewson
c6c02658cf
hs_ident.c: make comments into doxygen.
2019-11-06 13:05:13 -05:00
Nick Mathewson
92b3f60ebc
hs_ident.h: make comments into doxygen.
2019-11-06 13:03:40 -05:00
Nick Mathewson
2ab5b7520e
Add missing **/ to core_or.dox
2019-11-06 12:56:02 -05:00
Nick Mathewson
3ae87c3c7f
Turn the "dataflow" document into a doxygen page.
2019-11-06 12:50:57 -05:00
Nick Mathewson
4d70e725d1
Do not try to shut down the event loop when it is not initialized.
...
Doing so caused us to crash in some unusual circumstances, such as
using --verify-config to verify a configuration that failed during
the options_act() stage.
Fixes bug 32407; bugfix on 0.3.3.1-alpha.
2019-11-06 11:33:23 -05:00
David Goulet
49cb7d6ec4
Merge branch 'tor-github/pr/1491'
2019-11-06 10:23:33 -05:00
Nick Mathewson
1ee17dc07a
OwningControllerFD should be immutable, not OwningControllerProcess.
...
This is a mistake I made when marking options as immutable.
Fixes bug 32399. Bug not in any released Tor.
2019-11-06 08:37:32 -05:00
David Goulet
1407e2b169
test: Fix DoS heartbeat unit test after adding INTRO2
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-06 08:09:35 -05:00