Commit Graph

34775 Commits

Author SHA1 Message Date
Nick Mathewson
5086b16055 Merge remote-tracking branch 'tor-github/pr/1529' 2020-01-17 08:49:56 -05:00
Nick Mathewson
c8b6392b4e Initialize publish/subscribe code when running as an NT service.
Fixes bug 32778; bugfix on 0.4.1.1-alpha.
2020-01-17 08:41:52 -05:00
Nick Mathewson
eef021e12d Revert "Use tor_api.h entry points in ntmain.c."
This reverts commit dca2629480.
2020-01-17 08:39:56 -05:00
Nick Mathewson
d7a22160f5 Revert "Restore feature where nt-services detect non-"run_tor" modes."
This reverts commit 5c240db0bf.
2020-01-17 08:39:49 -05:00
Nick Mathewson
7f03ba06d8 Merge branch 'ticket32806' 2020-01-17 08:37:33 -05:00
Nick Mathewson
6d2b9c9631 Remove some dead checks
The only code that could set these options to be negative was in the
unit tests.
2020-01-17 08:31:22 -05:00
Nick Mathewson
648e1afc33 fix a stray asterisk in a comment 2020-01-17 08:25:09 -05:00
Nick Mathewson
abd9ae48ac Merge branch 'ticket32487_squashed_and_merged' 2020-01-17 07:50:50 -05:00
Nick Mathewson
01fdc3240f Merge branch 'ticket32695_squashed' 2020-01-16 16:42:01 -05:00
Nick Mathewson
ceacda44f1 Remove functions that checked for pre-ipv6 consensus.
We no longer need or need to test:
  * node_awaiting_ipv6()
  * networkstatus_consensus_has_ipv6().
2020-01-16 16:41:53 -05:00
Nick Mathewson
8d94bcbf8c Remove routerstatus_format_entry() consensus_method argument as unused 2020-01-16 16:41:53 -05:00
Nick Mathewson
441a048a3a Remove support for now-obsolete consensus methods before 28.
Closes ticket 32695.
2020-01-16 16:41:53 -05:00
Nick Mathewson
60a0d7d1e8 expose routerstatus_has_changed to unit tests. 2020-01-16 12:14:12 -05:00
Victor Nepveu
594e5ce635 Refactor routerstatus_has_changed function
- Check all fields that might change in a routerstatus
- Document the refactoring

Signed-off-by: Victor Nepveu <victor.nepveu@imt-atlantique.net>
2020-01-16 10:39:15 -05:00
Nick Mathewson
17c63ff9f6 Merge remote-tracking branch 'tor-github/pr/1663' 2020-01-16 10:24:39 -05:00
Nick Mathewson
3c89622e39 Merge branch 'ticket32487_squashed' into ticket32487_squashed_and_merged
Resolved conflicts in src/core/include.am
2020-01-16 07:57:37 -05:00
Nick Mathewson
efb301c86c Document why dircache is not included in --list-modules 2020-01-16 07:48:17 -05:00
Nick Mathewson
a623a49777 Add have_module_dircache(). 2020-01-16 07:48:17 -05:00
Nick Mathewson
5cff1ce84b Turn several functions from stubs into macros
This may help the compiler eliminate deadcode.
2020-01-16 07:48:17 -05:00
Nick Mathewson
6ba4b5e5da Rename dirclient_modes.h identifiers to start with dirclient_
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        directory_must_use_begindir dirclient_must_use_begindir \
        directory_fetches_from_authorities dirclient_fetches_from_authorities \
        directory_fetches_dir_info_early dirclient_fetches_dir_info_early \
        directory_fetches_dir_info_later dirclient_fetches_dir_info_later \
        directory_too_idle_to_fetch_descriptors dirclient_too_idle_to_fetch_descriptors
2020-01-16 07:48:17 -05:00
Nick Mathewson
8d1f31190e Move directory_must_use_begindir() to dirclient_modes.[ch] 2020-01-16 07:48:17 -05:00
Nick Mathewson
773bcf5629 Move dirclient-related functions out of dirserv, and reenable them
I had incorrectly identified these functions as dircache-only, when
in fact they apply to everyone who acts a directory client.
2020-01-16 07:48:17 -05:00
Nick Mathewson
a1bc471dd4 Add a changes file for disabling the dircache code. 2020-01-16 07:48:17 -05:00
Nick Mathewson
8a0c739467 Disable feature/dircache files when dircache module is disabled.
To make Tor still work, we define a minimal dircache_stub.c file
that defines the entry points to the module that can actually be
seen by the compiler when we're building with dircache and relay
disabled.
2020-01-16 07:48:17 -05:00
Nick Mathewson
6e12a8f047 Use dir_conn_clear_spool() in connection.c.
This is cleaner than iterating over the spool.
2020-01-16 07:48:17 -05:00
Nick Mathewson
fe8156dbc2 Move dirserv_get_routerdescs() to control_getinfo.c
This function had some XXX comments indicating (correctly) that it
was not actually used by the dirserver code, and that only the
controller still used it.
2020-01-16 07:48:17 -05:00
Nick Mathewson
4cf15ee015 Move dir_split_resource_into_spoolable() to dircache module.
Only directory caches actually need to spool things.
2020-01-16 07:48:17 -05:00
Nick Mathewson
888a0be0b9 Define a "dircache" module.
For now, this module is enabled whenever the relay module is
enabled, and disabled whenever the relay module is disabled.  Though
they are logically separate, the use cases for running one without
the other are rare enough that we don't really want to support
compiling them independently.
2020-01-16 07:48:17 -05:00
teor
4025cbada6
Merge branch 'maint-0.4.2' 2020-01-16 10:00:55 +10:00
teor
48187248d3
Merge branch 'maint-0.4.1' into maint-0.4.2 2020-01-16 10:00:47 +10:00
teor
fb541ffca3
Merge branch 'maint-0.4.0' into maint-0.4.1 2020-01-16 10:00:40 +10:00
teor
026f068bb3
Merge branch 'maint-0.3.5' into maint-0.4.0 2020-01-16 10:00:32 +10:00
teor
19954cffd7
Merge remote-tracking branch 'tor-github/pr/1513' into maint-0.3.5 2020-01-16 09:57:27 +10: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
teor
eb336e23a6
add_c_file: Rename variables based on the type of path
* fname for generic file paths
* tor_fname for paths relative to the top-level tor directory
* src_fname for paths relative to tor's src directory

With prefixes as required to disambiguate different paths of the same
type.

Part of 32962.
2020-01-16 09:27:57 +10:00
teor
b828588499
add_c_file: Simplify some usage of srcdir_file()
Part of 32962.
2020-01-16 09:26:08 +10:00
teor
3d50efcf98
add_c_file: Document the paths used by each part of the script
Most paths are relative to the top-level tor directory, but the
paths in the C and H files are relative to tor's src directory.

Part of 32962.
2020-01-16 09:26:04 +10:00
teor
207d2625ed
add_c_file: Improve path handling and canonicalisation
* distinguish between paths relative to the top-level tor directory,
  and paths relative to tor's src directory
* canonicalise paths before using them
* check that the script is run from the top-level tor directory
* check that the file is being created in tor's src directory

Part of 32962.
2020-01-16 09:25:58 +10:00
Nick Mathewson
4f45ad1394
add_c_file: tolerate ./ in filenames. 2020-01-16 09:23:54 +10:00
Nick Mathewson
ef1744e2c9
add_c_file: handle adding to the end of a list correctly.
Fixes bug 32962.
2020-01-16 09:23:49 +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
Nick Mathewson
5e70c27e85 Merge remote-tracking branch 'tor-github/pr/1657' 2020-01-15 13:10:14 -05: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
77246dc0d8 Tell static analyzer that having ntservice functions not exist is ok
When we made these functions exist unconditionally (as macros on
non-windows platforms), we started to get a dead-code warning on
Coverity.  We now use a macro to tell coverity not to worry about
this particular dead-code instance.
2020-01-15 10:30:03 -05:00
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
teor
d430b5a074
Merge remote-tracking branch 'tor-github/pr/1634'
"Ours" merge, because ticket 32883 replaces this code with calls
to tor_run_main(). (Which then calls the pubsub functions.)

Therefore, this PR is obsolete in master, but it still needs to be
merged, to avoid conflicts during any future backport.
2020-01-15 22:31:10 +10:00