Commit Graph

159 Commits

Author SHA1 Message Date
David Goulet
ca8b90a843 Merge branch 'tor-github/pr/1668' 2020-01-20 10:44:03 -05:00
Alexander Færøy
ca9a5390ff Don't escape the bridge distribution value.
We already check if there are invalid values in
check_bridge_distribution_setting() and reject the value if that is the
case. We can therefore only have strings of [A-Z] | [a-z] | [0-9] | '-'
| '_' here which is according to the directory specification.

See: https://bugs.torproject.org/32753
2020-01-15 23:41:58 +00:00
teor
f3cbc26bdd
add_c_file: Fix "control line not preceded by a blank line"
Fix dirauth and relay module include.am add_c_file.py
"control line not preceded by a blank line" errors.

Also remove a duplicate ADD_C_FILE: SOURCES in the relay module.

Obviously correct fixes to already-reviewed code.
2020-01-16 09:38:26 +10:00
Alexander Færøy
399ec3130b Remove "hyphae" as a known value for BridgeDistribution.
This patch removes hyphae as a known value for the BridgeDistribution
option in torrc.
2020-01-15 23:20:27 +00:00
Alexander Færøy
1c8bafcdf9 Lowercase BridgeDistribution value before adding it to the descriptor.
This patch makes sure we lowercase the value of BridgeDistribution
before we add it to the descriptor as `bridge-distribution-request`.

See: https://bugs.torproject.org/32753
2020-01-15 17:22:47 +00:00
Alexander Færøy
026f0c7184 Make BridgeDistribution setting validator case-insensitive.
This patch makes sure that we accept values such as "nOne", "None", and
"AnY" as valid values for BridgeDistribution. We later ensure to
lower-case the values before they are forwarded to the BridgeDB.

See: https://bugs.torproject.org/32753
2020-01-15 17:21:10 +00:00
Alexander Færøy
3f20a69afb Always escape BridgeDistribution value from torrc in descriptors.
When the BridgeDistribution value was added in commit
ebab521525 the check for whether the value
contains '\n' or '\r' was added as a requirement for whether or not the
value should be escaped.

This patch removes this check and makes sure we call `escaped()` on the
value every time before we add it to a descriptor.

See: https://bugs.torproject.org/32753
2020-01-15 17:18:30 +00: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
Nick Mathewson
93894fb770 Merge branch 'ticket22029_attempt_squashed' 2020-01-09 15:27:32 -05:00
Neel Chauhan
d0068be0dd Allow ed25519 keys to be banned in approved-routers 2020-01-09 15:27:26 -05:00
Nick Mathewson
e45810113b Merge branch 'pre_formatter_cleanups_squashed' 2020-01-09 07:32:39 -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
4f02812242 It's 2020. Update the copyright dates with "make update-copyright" 2020-01-08 18:39:17 -05:00
teor
a58cffe195
router: Improve port search function comments 2020-01-08 17:47:08 +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
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
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
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
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
teor
825f52784d
Merge remote-tracking branch 'tor-github/pr/1535' 2019-11-15 12:11:32 +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
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
Nick Mathewson
8cd3e66d93 Use new configuration architecture for crypto options
This is a comparatively simple change.
2019-11-07 07:28:43 -05: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
Nick Mathewson
8933789fef Merge branch 'doxygen_libs' 2019-11-05 08:05:49 -05: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
Nick Mathewson
a33d1dce8a directory-level documentation for feature/* 2019-11-04 17:07:38 -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
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
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
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
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
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
931a5db2a7 Re-run make autostyle. 2019-10-22 09:40:31 -04:00