Commit Graph

25011 Commits

Author SHA1 Message Date
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
teor
bf16efeb07
nodelist: fix a comment typo in routerset.h 2019-10-28 23:44:08 +10:00
David Goulet
b98631d280 Merge branch 'tor-github/pr/1476' 2019-10-28 08:47:57 -04:00
Nick Mathewson
25d66a3391 add missing docs in crypto_digest* 2019-10-28 08:27:42 -04:00
Nick Mathewson
f751cc020f Documentation cleanup in confmacros.h 2019-10-26 17:24:22 -04:00
Nick Mathewson
b314b68d61 Fix doxygen HTML warnings in src/feature. 2019-10-26 12:07:09 -04:00
Nick Mathewson
68f8086041 doxygen: add @file declarations for src/feature/
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 12:05:28 -04:00
Nick Mathewson
30c6ab5150 doxygen: add @file declarations for src/app
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:41:43 -04:00
Nick Mathewson
5f299feb82 doxygen: add @file declarations for src/core/crypto
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:39:17 -04:00
Nick Mathewson
ff7a70ca09 doxygen: add @file declarations for src/core/or
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:37:25 -04:00
Nick Mathewson
943fd734f9 doxygen: add @file declarations for src/core/mainloop
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:26:06 -04:00
Nick Mathewson
4d4a3eeeb1 doxygen: add @file declarations for src/core/proto
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.

These declarations also turned up a doxygen warning for
proto_socks.c; I fixed that too.
2019-10-26 11:21:25 -04:00
Nick Mathewson
39d09ea081 doxygen: add @file declarations for src/lib
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.

These declarations also turned up a doxygen warning for
crypto_ope.c; I fixed that too.
2019-10-26 11:13:29 -04:00
Nick Mathewson
16dffa523e Rename confparse.[ch] identifiers to confmgt.[ch] identifiers.
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        confparse.h confmgt.h \
        confparse.c confmgt.c \
        CONFPARSE_PRIVATE CONFMGT_PRIVATE \
        TOR_CONFPARSE_H TOR_CONFMGT_H
2019-10-26 10:09:03 -04:00
Nick Mathewson
2402d95715 Rename confparse.[ch] to confmgt.[ch]
This will break compilation until includes etc are fixed.
2019-10-26 10:07:14 -04:00
Nick Mathewson
407fb0c35c Move config_format_t and allied definitions into conftypes.h
Since these are needed by every module that is _configurable_, they
belong in lib/conf, not lib/confmgt.
2019-10-26 10:05:03 -04:00
Nick Mathewson
e7993dc046 Merge branch 'ticket31241_v3' 2019-10-25 08:10:39 -04:00
Nick Mathewson
63f2a310cb config,state: check magic in all callbacks. 2019-10-25 08:09:05 -04:00
Nick Mathewson
aa6b4b62db confparse: Add a function to check the magic of a toplevel object. 2019-10-25 08:08:43 -04:00
teor
0ae530c8f6
test: Use SEVERITY_MASK_IDX() to find the LOG_* mask indexes
In the unit tests.

Fixes a regression to bug 31334; bug not in any released version of tor.
2019-10-25 17:23:46 +10:00
teor
60aa6dac34
Merge remote-tracking branch 'tor-github/pr/1467' 2019-10-25 17:17:39 +10:00
teor
a91f52a443
Merge branch 'maint-0.4.2' 2019-10-25 10:38:22 +10:00