Commit Graph

25257 Commits

Author SHA1 Message Date
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
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
teor
22482fd454
test/parseconf: Add support for optional library variants
test_parseconf.sh now supports:
* {error,expected}{,_lzma,_nss,_zstd}{,_no_dirauth,_no_relay_dirauth}
Or any combination of two or more optional libraries.

Closes ticket 32397.
2019-11-06 21:36:42 +10:00
teor
e6b5a1ff93
shellcheck: Fix minor issues in some scripts
Fix minor issues in git-push-all.sh, git-setup-dirs.sh and
test_parseconf.sh.

Fixes bug 32402; not in any released version of tor.
Obviously correct changes to already reviewed code.
2019-11-06 16:21:01 +10:00
teor
de6ceb0bee
Merge branch 'maint-0.4.0' into maint-0.4.1 2019-11-06 11:19:46 +10:00
teor
03e77ef036
Merge branch 'maint-0.3.5' into maint-0.4.0 2019-11-06 11:19:38 +10:00
teor
1bde356bf6
Merge branch 'maint-0.2.9' into maint-0.3.5 2019-11-06 11:19:30 +10:00
teor
4f9a003392
Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1 2019-11-06 11:19:13 +10:00
teor
4abfcb7997
Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5 2019-11-06 11:18:09 +10:00
teor
0e2834a371
Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5 2019-11-06 11:17:43 +10:00
teor
d2e4262ebc
Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5 2019-11-06 11:17:01 +10:00
teor
6bfdd09679
Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5 2019-11-06 11:16:09 +10:00
teor
0650bf3695
Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9 2019-11-06 11:15:45 +10:00
teor
c06d540ff9
Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9 2019-11-06 11:14:53 +10:00
David Goulet
326f82db04 hs-v2: Fix memory leak in error code path
Coverity CID: 1455168

Closes #32356

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-05 08:24:46 -05:00
Nick Mathewson
6e023d5585 Merge remote-tracking branch 'tor-github/pr/1497' 2019-11-05 08:08:38 -05:00
Nick Mathewson
8933789fef Merge branch 'doxygen_libs' 2019-11-05 08:05:49 -05:00
Nick Mathewson
aac80a004f Doxygen: add several missing links. 2019-11-05 08:05:42 -05:00
David Goulet
cd7812b470 test: Handle NULL circuit pointer in new_fake_orcirc
Coverity CID: 1455207

Closes #32376

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-05 08:05:22 -05:00
teor
655603c779
Merge remote-tracking branch 'tor-github/pr/1487'
Combine V_IMMUTABLE and FILENAME changes on PidFile.
2019-11-05 14:26:23 +10:00
teor
b9269d6d0a
Merge remote-tracking branch 'tor-github/pr/1486' 2019-11-05 14:23:56 +10:00
teor
6169469546
Merge remote-tracking branch 'tor-github/pr/1477' 2019-11-05 14:23:10 +10:00
teor
8b91fa7075 config: Run "make autostyle"
Part of 32213.
2019-11-05 12:01:29 +10:00
teor
f10aa77afe config: Wrap a long line in relay_config.c
Part of 32213.
2019-11-05 11:36:19 +10:00
teor
cb8ebc0b4c config: Rename new global functions with a prefix
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        get_dirportfrontpage relay_get_dirportfrontpage \
        parse_port_config port_parse_config \
        count_real_listeners port_count_real_listeners \
        parse_transport_line pt_parse_transport_line \
        ensure_bandwidth_cap config_ensure_bandwidth_cap \
        get_effective_bwrate relay_get_effective_bwrate \
        get_effective_bwburst relay_get_effective_bwburst \
        warn_nonlocal_ext_orports port_warn_nonlocal_ext_orports \
        parse_ports_relay port_parse_ports_relay \
        update_port_set_relay port_update_port_set_relay \
        get_transport_bindaddr_from_config pt_get_bindaddr_from_config \
        get_options_for_server_transport pt_get_options_for_server_transport

It was generated with --no-verify, because it has some long lines.

Part of 32213.
2019-11-05 11:28:57 +10:00
teor
7504711510 test/parseconf: Add conf_examples for relays
Tests relay/relay_config.c.

Part of 32213.
2019-11-05 11:12:59 +10:00
teor
6d52b5ce91 test/parseconf: Add conf_examples for PTs
Tests relay/transport_config.c.

Part of 32213.
2019-11-05 11:12:59 +10:00
teor
233b96d83a test/parseconf: Always show the result file name on failure
Obviously correct fixes on already reviewed code.
2019-11-05 11:12:50 +10:00
teor
3763dd9987 test/parseconf: Run all the tests, even if one fails
Obviously correct fixes on already reviewed code.
2019-11-05 11:08:36 +10:00
teor
1dd6717db5 test/parseconf: Consistenly use FAIL
Obviously correct fixes on already reviewed code.
2019-11-05 11:08:36 +10:00
teor
03618e0d68 test/parseconf: Don't specify a path for 'true'
Obviously correct fixes on already reviewed code.
2019-11-05 11:08:36 +10:00
teor
98637a4782 test/parseconf: Send all errors to stderr
Obviously correct fixes on already reviewed code.
2019-11-05 11:08:36 +10:00
teor
5b04db59f6 test/scripts: Use the same code to find the tor binary
This change makes sure we are always using the coverage binary, when
coverage is enabled.

Fixes bug 32368; bugfix on 0.2.7.3-rc.
2019-11-05 11:07:31 +10:00
teor
f29de4b8d2 confmgt: Stop adding a space, when there is no option value
Fixes bug 32352; bugfix on 0.0.9pre6.
2019-11-05 11:01:28 +10:00
teor
5d85c247e8 test/stats: Add minimal tests for rephist mtbf
Part of 32213.
2019-11-05 10:50:39 +10:00
teor
5d0848ebde test: Split stats into its own file
Part of 32213.
2019-11-05 10:50:39 +10:00
teor
73c0439d48 relay: Refactor tests, and add extra options tests
Part of 32213.
2019-11-05 10:49:56 +10:00
Nick Mathewson
db40202810 Document directories in "app" 2019-11-04 17:23:50 -05:00
Nick Mathewson
a33d1dce8a directory-level documentation for feature/* 2019-11-04 17:07:38 -05:00
Nick Mathewson
e1cdca2e4f directory-level doxygen for "src/core" 2019-11-04 16:28:28 -05:00
Nick Mathewson
607b1ff776 Move much of 00-overview.md into doxygen. 2019-11-04 12:24:46 -05:00
Nick Mathewson
a5085c52d0 Move most of crypto overview into doxygen. 2019-11-04 12:10:28 -05:00
Nick Mathewson
211a2e0a8f Move doc/HACKING/design/01b-collections.md into doxygen. 2019-11-04 12:07:38 -05:00
Nick Mathewson
fb20618e28 Divide 01a-memory.md into doxygen. 2019-11-04 12:04:32 -05:00
Nick Mathewson
76e8effc7b Doxygen: document the rest of the directories in lib.
(This copies documentation from doc/HACKING/design, and edits for
concisensess and clarity.)
2019-11-04 11:51:38 -05:00
Nick Mathewson
fd27136329 Doxygen: fix a remaining \ref-to-directory
This one was missed by the perl script in the last commit because
it spanned a newline.
2019-11-04 11:13:30 -05:00
Nick Mathewson
9b13191192 Doxygen: use \refdir everywhere.
This commit was generated with:

find src -name '*.dox' |xargs perl -i -pe 's{\\ref src/(\S+) \"\S+}{\\refdir{$1}};'
2019-11-04 11:12:27 -05:00
Nick Mathewson
62a473debf Doxygen: Avoid ambiguity in @dir directives
This commit was automatically generated with:

find src -name '*.dox' |xargs perl -i -pe 's{\@dir ([^/])}{\@dir /$1};'
2019-11-04 10:23:36 -05:00
Nick Mathewson
51a9892914 doxygen: Take "lib" descriptions from doc/HACKING/design.
This commit takes descriptions for src/lib and moves them into our
doxygen hierarchy.  I've covered everything from lib/cc through
lib/sandbox here.
2019-11-04 10:21:10 -05:00
Nick Mathewson
b6b1257099 Remove spurious lib/stats doxygen file. 2019-11-04 10:19:23 -05:00
Nick Mathewson
d3af23783c Document our top-level directories 2019-11-04 07:40:20 -05:00
Nick Mathewson
7fc077ed25 Add stub directory-level documentation for most source directories
This includes app, core, feature, lib, and tools, but excludes
ext, test, and trunnel.

This was generated by the following shell script:

cd src
for dname in $(find lib core feature app tools -type d |grep -v \\.deps$); do
    keyword="$(echo "$dname" |sed -e "s/\//_/" )"
    target="${dname}/${keyword}.dox"
    echo "$target"
    cat <<EOF >"$target"
/**
@dir ${dname}
@brief ${dname}
**/
EOF

    git add "$target"
done
2019-11-04 07:40:14 -05:00
teor
51ca6dea08 relay: Simplify relay/transport_config
Minor simplification and refactoring.

Part of 32113.
2019-11-04 13:10:01 +10:00
teor
2dfd18018f relay: Disable server transport options when the module is disabled
This commit:
* disables the ExtORPort, ServerTransportPlugin,
  ServerTransportListenAddress, and ServerTransportOptions options,
when the relay module is disabled.

Part of 32213.
2019-11-04 13:10:01 +10:00
teor
4d9a5c77f8 relay: Simplify some relay_config code
Part of 32213.
2019-11-04 13:10:00 +10:00
teor
d3c8486724 relay: Disable relay config when the module is disabled
This commit:
* disables the ORPort, DirPort, DirCache, and BridgeRelay options,
* sets ClientOnly 1,
* disables relay_config.c and relay/transport_config.c,
* disables test_rebind.sh, and
* modifies the expected results for test_parseconf.sh,
when the relay module is disabled.

Part of 32213.
2019-11-04 13:10:00 +10:00
teor
85e50954d8 relay: Make a transport_config function private
Part of 32213.
2019-11-04 13:10:00 +10:00
teor
fd18d51270 dirauth: Refactor some code and tests
Minor simplification and refactoring.

Make the dirauth tests focus on testing the intention of the code,
rather than option processing order.

Part of 32213.
2019-11-04 13:10:00 +10:00
Nick Mathewson
afc267e887 Add a stub main page for the documentation. 2019-11-03 15:04:35 -05:00
Nick Mathewson
096cbfb8b0 Merge remote-tracking branch 'tor-github/pr/1480' 2019-11-01 09:35:17 -04:00
David Goulet
e85f86bb7b dos: Add HS DoS INTRO2 rejected stats in heartbeat
The DoS heartbeat now contains the number of rejected INTRODUCE2 cell that the
relay has seen.

Closes #31371

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-31 13:57:14 -04:00
David Goulet
ff8823d03c dos: Account rejection in hs_dos_can_send_intro2
This required a small refactoring so we could count properly the INTRO2
sending disallow.

Part of #31371

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-31 13:50:36 -04:00
George Kadianakis
fa0257eda0 Merge branch 'tor-github/pr/1484' 2019-10-31 15:31:14 +08:00
teor
d665458085 config: Delete get_list_of_ports_to_forward()
Tor has not supported automatic port forwarding for some time.
2019-10-31 12:34:20 +10:00
teor
8036954bf5 config: Move warn_nonlocal_ext_orports() to relay
Part of 32213.
2019-10-31 12:34:20 +10:00
teor
23faa03ffc relay/config: Remove direct references to dirauth options
All *AuthoritativeDir* options are now accessed via the authmode
functions in relay_config.c, relay/transport_config.c, and config.c.

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
1d4d2deea1 config: Move dirauth stats actions into the module
This commit:
* moves dirauth stats and mtbf config actions into dirauth_config,
* adds thin wrappers to make the moved code compile.

The moved code is disabled when the dirauth module is disabled.

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
fc5da4ad04 config: Move relay config actions into the relay module
This commit:
* moves relay config actions into relay_config,
* moves get_dirportfrontpage() into relay_config,
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the relay module is disabled. (Some of the checks
are re-ordered, so the order of some warnings may change.)

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
6d03c05665 config: Move server transport actions into the relay module
This commit:
* moves server transport config checks into transport_config.c,
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the relay module is disabled. (Some of the checks
are re-ordered, so the order of some warnings may change.)

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
0a511778eb config: Move bw & other configs into the dirauth module
This commit:
* moves bandwidth checks into dirauth_config, and
* moves some other minor checks into dirauth_config.

The moved code is disabled when the dirauth module is disabled.
(And some of the checks are re-ordered, so the order of some
warnings may change.)

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
d5ca56e254 config: Move accounting/bandwidth config into the relay module
This commit:
* moves accounting and bandwidth checks into relay_config,
* moves testing options checks into relay_config,
* moves some other minor checks into relay_config,
* exposes some code from src/app/config.c
  (we'll refactor it later in 29211), and
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the relay module is disabled. (Some of the checks
are re-ordered, so the order of some warnings may change.)

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
11f283f561 config: Move server transport config into the relay module
This commit:
* creates feature/relay/transport_config.[ch],
* moves server transport config checks into them,
* exposes some code from src/app/config.c
  (we'll refactor it later in 29211), and
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the relay module is disabled. (Some of the checks
are re-ordered, so the order of some warnings may change.)

Part of 32213.
2019-10-31 12:34:20 +10:00
teor
093a127c82 config: Move relay config checks into the relay module
This commit:
* moves relay config checks into relay_config.[ch],
* exposes some code from src/app/config.c
  (we'll refactor it later in 29211), and
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the relay module is disabled. (Some of the checks
are re-ordered, so the order of some warnings may change.)

Part of 32213.
2019-10-31 12:34:19 +10:00
teor
0722b4fdb9 config: Move relay port parsing into the relay module
This commit:
* creates feature/relay/relay_config.[ch],
* moves relay port parsing into them,
* exposes some code from src/app/config.c
  (we'll refactor it later in 29211), and
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the relay module is disabled.

Part of 32213.
2019-10-31 12:34:19 +10:00
teor
f70633d72d dirauth: Remove some outdated config comments
Part of 32213.
2019-10-31 12:34:19 +10:00
teor
3881ac2c86 dirauth: Refactor some config checks
Minor cleanup and simplification.

Part of 32213.
2019-10-31 12:34:19 +10:00
teor
da49c4d78d dirauth: Disable dirauth config when the module is disabled
Part of 32213.
2019-10-31 12:34:19 +10:00
teor
5950566f1d config: Move dirauth config into the dirauth module
This commit:
* creates feature/dirauth/dirauth_config.[ch],
* moves the dirauth config code into them,
* copies some macros from src/app/config.c
  (we'll refactor them later in 29211), and
* adds thin wrappers to make the moved code compile.

No functional changes: the moved code is still enabled,
even if the dirauth module is disabled.

Part of 32213.
2019-10-31 12:34:19 +10:00
teor
a18e84ad01
config: Improve some function comments 2019-10-31 11:11:51 +10:00
teor
4666ca73a1
config: Give warn_about_relative_paths() const args
Also gives make_path_absolute() const args.

Obviously correct fixes to already reviewed code.
2019-10-31 10:53:26 +10:00
Nick Mathewson
a6ad26fd5f Merge remote-tracking branch 'tor-github/pr/1485' 2019-10-30 16:16:12 -04:00
David Goulet
cfc60e566c circ: Add an handle to circuit_t
Closes #32343

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-30 16:12:56 -04:00
Nick Mathewson
5a1dfca071 Fix 32167: comment in config.c 2019-10-30 16:05:48 -04:00
Nick Mathewson
14831ea0ab Use FILENAME to determine which options to check for relative paths
This is part of ticket 32344.
2019-10-30 15:32:12 -04:00
Nick Mathewson
15371d801c Mark more torrc options as FILENAME rather than as STRING.
This will help us reimplement warn_about_relative_paths().

FILENAME options currently are the same as STRINGs in most respects,
except for the type reported to the controller.

In this commit, I'm picking the options to change based on:
  * the current contents of warn_about_relative_paths()
  * options that end with "File".
2019-10-30 15:14:05 -04:00
Nick Mathewson
b985cf2403 Use CFLG_IMMUTABLE to replace much of the options transition cb.
Closes ticket 32344.
2019-10-30 15:05:26 -04:00
Nick Mathewson
2a2c7049b8 Add a CFLG_IMMUTABLE flag to mark a field as unchangeable. 2019-10-30 15:00:53 -04:00
teor
183f9e490f
test: Fix a comment typo in src/test/test_hs_ntor.sh 2019-10-31 00:43:13 +10:00
teor
861b9366df
test: Fix a loop variable bug in test_parseconf.sh
Obviously correct fixes to already reviewed code.
No changes file required: not in any released version of tor.
2019-10-31 00:23:30 +10:00
Neel Chauhan
f81e4aa831 hs-v2: Lookup intro failure cache when picking an intro from descriptor
When picking an intro point from the service descriptor, the client failed to
lookup the failure cache.

It made an HS v2 client re-pick bad intro points for which we already know it
won't work in the first place.

Based on Neel Chauhan original patch.

Fixes #25568

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-30 08:47:21 -04:00
teor
dce1f63d44
fs: Clarify an ambiguous comment about string/pointer equality 2019-10-30 16:15:43 +10:00
George Kadianakis
4413b98190 Merge branch 'tor-github/pr/1456' 2019-10-29 21:29:13 +08:00
teor
30705e8294
app/config: Fix a comment typo in config.c
The options validation is now a callback.

Bugfix on 31241; not in any released version of tor.
2019-10-29 12:40:20 +10:00
David Goulet
ceca6e7c35 ewma: Implement unit tests
At this commit, 93.9% of line coverage and 95.5% of function coverage.

Closes #32196

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
48781c32ca ewma: Move private struct into header private section
Facilitate testing.

Part of #32196.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
bbcded554a test: Implement unit tests for circuitmux.c
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
dba249bc73 test: Add fakecircs.{h|c} helper
Fake circuits are created everywhere in the unit tests. This is an attempt at
centralizing a "fake circuit creation" API like fakechans.c does for channel.

This commit introduces fakecircs.c and changes test_relay.c and
test_circpadding.c which were using roughly the same code.

This will allow easier OR circuit creation for the future tests in
test_circuitmux.c

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
a41ec84914 test: Implement cmux allocate unit test
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
d2e51aca7d test: Remove circuitmux/destroy_cell_queue code duplication
This also rename a function to improve code clarity.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
839bc4814e test: Add testcase setup object for test_cmux
Also remove a scheduler_init() from a test and MOCK the appropriate function
so the test can pass.

This is done in order to minimize initialization functions in the unit test
and try to only go through the testcase setup object.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
7678022e85 cmux: Move circuitmux_s object into header in private section
Step needed in order to access members of the object for unit tests.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
4c95022658 core: Add missing include in destroy_cell_queue_st.h
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00