Commit Graph

862 Commits

Author SHA1 Message Date
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
George Kadianakis
4413b98190 Merge branch 'tor-github/pr/1456' 2019-10-29 21:29:13 +08: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
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
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
e7993dc046 Merge branch 'ticket31241_v3' 2019-10-25 08:10:39 -04:00
teor
a91f52a443
Merge branch 'maint-0.4.2' 2019-10-25 10:38:22 +10:00
teor
c8aa3cc17d
Merge remote-tracking branch 'tor-github/pr/1466' into maint-0.4.2 2019-10-25 10:38:01 +10:00
Nick Mathewson
dc6d7f072d Make foo_validate() functions call config_validate().
The former foo_validate() functions are now toplevel
legacy_validate_fn callbacks.  The new foo_validate() functions now
call them.

This change lets us remove the old shared_random disk state
validation callback entirely.
2019-10-24 20:30:32 -04:00
Nick Mathewson
4a248bafba Rename validate_fn{,_t} to start with "legacy_".
The current API of this callback mixes responsibilities, including:
  * validation
  * transition checking
  * processing (modifying) the configuration object.

These will have to be disentangled piece by piece, so for now, we'll
have "legacy" validate functions as well.

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        validate_fn_t legacy_validate_fn_t \
        validate_fn legacy_validate_fn
2019-10-24 20:30:32 -04:00
Nick Mathewson
27dbf20bf4 Use named-member syntax for initializing config_format_t objects
I'm about to mess with their lists of callbacks, and I don't want to
proliferate lists where we say "NULL, NULL, NULL, ..."
2019-10-24 20:30:32 -04:00
teor
c00602cc34
Merge branch 'maint-0.4.2' 2019-10-25 09:42:14 +10:00
teor
acd27f4b41
Merge remote-tracking branch 'tor-github/pr/1464' into maint-0.4.2 2019-10-25 09:41:48 +10:00
David Goulet
3867ca4925 dir: Return 503 code when rejecting single hop request
Single hop rejection (POST and GET) for HS v3 descriptor now return a 503 code
which is more accurate code from dir-spec.txt and from other rejection case in
the code.

For instance if you are not a relay and you get a POST request, a 503 code is
sent back with a rejection message.

Part of #31958

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-24 11:25:05 -04:00
David Goulet
985717675c dir: Remove connection_dir_is_anonymous() logging
First, remove the HSDir mention which should not be in that generic function.
Second, move them to debug() level since they are possible error case.

Part of #31958

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-24 11:23:31 -04:00
David Goulet
09468cc58b dir: Look if circuit is closed in connection_dir_is_anonymous()
Before inspecting the p_chan, we must check if the circuit is marked for close
because if it is the case, the channels are nullified from the circuit.

Several valid cases can mark the circuit for close of the directory
connection.

Fixes #31958

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-24 11:08:25 -04:00
David Goulet
ed57a04a65 hs-v3: Remove a BUG() caused by an acceptable race
hs_client_purge_state() and hs_cache_clean_as_client() can remove a descriptor
from the client cache with a NEWNYM or simply when the descriptor expires.

Which means that for an INTRO circuit being established during that time, once
it opens, we lookup the descriptor to get the IP object but hey surprised, no
more descriptor.

The approach here is minimalist that is accept the race and close the circuit
since we can not continue. Before that, the circuit would stay opened and the
client wait the SockTimeout.

Fixers #28970.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-24 08:50:01 -04:00
teor
20606b8a15
Merge remote-tracking branch 'tor-github/pr/1447' 2019-10-24 10:00:47 +10:00
David Goulet
b6c24eb484 hs-v3: Remove the circuit_established intro flag
Only use the HS circuit map to know if an introduction circuit is established
or not. No need for a flag to keep state of something we already have in the
circuit map. Furthermore, the circuit map gets cleaned up properly so it will
always have the "latest truth".

This commit also removes a unit test that was testing specifically that flag
but now we rely solely on the HS circuit map which is also tested few lines
below the removed test.

Fixes #32094

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-23 11:51:23 -04:00
teor
34509e78c6
Merge remote-tracking branch 'tor-github/pr/1449' 2019-10-23 22:59:16 +10:00
teor
27965f1ef2
Merge remote-tracking branch 'tor-github/pr/1284' into maint-0.3.5 2019-10-23 08:30:48 +10:00
teor
003be727c4
Merge remote-tracking branch 'tor-github/pr/1256' into maint-0.3.5 2019-10-23 08:28:03 +10:00
teor
339c18d6c7
Tidy whitespace around some STMT_BEGINs and STMT_ENDs 2019-10-23 07:37:39 +10:00
Nick Mathewson
6bc2b41e54 config validation: make the "old_options" argument const.
We can't do this with the "options" argument yet, since several
places in the code change those right now.
2019-10-22 14:24:09 -04:00
Nick Mathewson
697d99e504 validate_fn(): remove now-unused defaults and from_setconf.
These arguments were only used by options_validate, and are now
ignored even there.
2019-10-22 13:52:40 -04:00
Nick Mathewson
931a5db2a7 Re-run make autostyle. 2019-10-22 09:40:31 -04:00
Nick Mathewson
b2d487ae22 Merge branch 'ticket31705_v2' into ticket31705_v2_merged
Conflicts:
	src/feature/dirparse/authcert_parse.c
	src/feature/dirparse/ns_parse.c
	src/feature/hs/hs_service.c
	src/lib/conf/conftesting.h
	src/lib/log/log.h
	src/lib/thread/threads.h
	src/test/test_options.c

These conflicts were mostly related to autostyle improvements, with
one or two due to doxygen fixes.
2019-10-22 09:39:06 -04:00
Nick Mathewson
54c5366aa1 feature/control: wrap some problem macros in COCCI 2019-10-22 09:32:13 -04:00
Nick Mathewson
ef5d1e6b65 consdiff disable a macro when running with COCCI 2019-10-22 09:32:13 -04:00
Nick Mathewson
d9bad0203b Disable a couple of iterator macros when COCCI is defined. 2019-10-22 09:32:13 -04:00
Nick Mathewson
b867e97ce6 With COCCI defined, avoid PERIODIC_EVENT.
Coccinelle doesn't understand the particular pattern of token
pasting we have going on here.
2019-10-22 09:32:05 -04:00
Nick Mathewson
630d8c7a1a With coccinelle, avoid includes in the middle of an expression. 2019-10-22 09:24:25 -04:00
Nick Mathewson
2d013bbe5c Merge remote-tracking branch 'tor-github/pr/1417' 2019-10-22 08:36:32 -04:00
Nick Mathewson
8378ad29e6 routermode.h: turn a comment into a doxygen comment. 2019-10-21 12:47:17 -04:00
Nick Mathewson
7dc78aca29 Merge remote-tracking branch 'tor-github/pr/1430' 2019-10-21 12:43:26 -04:00
teor
7a72e71f74
Merge remote-tracking branch 'tor-github/pr/1434' 2019-10-21 15:24:22 +10:00
teor
92fa5239fc
control/getinfo: Use standard error handling
Use BUG() for coding errors, and `< 0` for error checks.

Fix to 31684.
2019-10-21 13:57:02 +10:00
teor
3b2525c375
Fix changes file and string typos
Part of 31684.
2019-10-21 13:56:58 +10:00
AmreshVenugopal
6413b2102f
control: Add GETINFO support for dumping microdesc consensus
- Allows control port to read microdesc consensus using:
GETINFO dir/status-vote/microdesc/consensus

add: Helper function `getinfo_helper_current_consensus`
test: check if GETINFO commands return expected consensus data.

Resolves 31684.
2019-10-21 13:54:55 +10:00
teor
042116e1fd
Merge branch 'maint-0.4.2' 2019-10-20 22:09:00 +10:00