Commit Graph

25386 Commits

Author SHA1 Message Date
teor
0b82b5ee42
Merge remote-tracking branch 'tor-github/pr/1671' 2020-01-20 15:40:42 +10:00
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
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
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
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
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
Nick Mathewson
5e70c27e85 Merge remote-tracking branch 'tor-github/pr/1657' 2020-01-15 13:10:14 -05: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
Nick Mathewson
08bbb6b8d9 Merge branch 'ticket32892_043_01_squashed' 2020-01-14 13:31:20 -05:00
David Goulet
59dac38ebe chan: Remove dead var cell handler from channel_t
The variable lenght cells are handled directly by
channel_tls_handle_var_cell() from an OR connection reading its inbuf. The
channel var cell handler (agnostic) was never used.

Closes #32892

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-14 13:31:08 -05:00
Nick Mathewson
165a92e33f Replace an assertion with a check-and-log
We hit this assertion with bug 32868, but I'm stymied figuring out
how we wound up with a routerstatus like this.  This patch is a
diagnostic to attempt to figure out what is going on, and to avoid a
crash in the meantime.
2020-01-14 13:16:39 -05:00
Nick Mathewson
c948db4252 Merge remote-tracking branch 'tor-github/pr/1636' 2020-01-14 12:46:14 -05:00
Nick Mathewson
c2dc94d8eb Merge branch 'ticket32883' 2020-01-14 12:42:41 -05:00
Nick Mathewson
dec11793ba Merge branch 'ticket32825_squashed' 2020-01-14 12:42:19 -05:00
Nick Mathewson
ac7d6f3c05 Rename UTIL_TEST_NO_WIN to reflect intent
Now that these tests are skipped on windows _and_ android, we should
name the macro that skips them after the functionality that the
tests depend on.

Closes last part of 32825.
2020-01-14 12:42:13 -05:00
Nick Mathewson
75741c6b3a Merge remote-tracking branch 'tor-github/pr/1659' 2020-01-14 12:40:07 -05:00
Neel Chauhan
8d288eb3a7 Deprecate the ClientAutoIPv6ORPort option 2020-01-13 14:55:16 -08: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
David Goulet
bbe90e3ec1 hs-v2: Always check rend_cache validity before using it
When looking up an entry in the rend_cache, stop asserting that it exists but
rather confirm it exists and if not, return that no entry was found.

The reason for that is because the hs_circ_cleanup_on_free() function (which
can end up looking at the rend_cache) can be called from the
circuit_free_all() function that is called _after_ the rend cache is cleaned
up in tor_free_all().

We could fix the free all ordering but then it will just hide a future bug.
Instead, handle a missing rend_cache as a valid use case as in while we are in
the cleanup process.

As Tor becomes more modular, it is getting more and more difficult to ensure
subsystem callstack ordering thus this fix aims at making the HSv2 subsystem
more robust at being called while tor is pretty much in any kind of state.

Fixes #32847.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-01-13 09:25:26 -05:00
Nick Mathewson
5888db4967 Merge branch 'disable_ns_macro' 2020-01-09 16:02:41 -05:00
Nick Mathewson
93894fb770 Merge branch 'ticket22029_attempt_squashed' 2020-01-09 15:27:32 -05:00
Neel Chauhan
9129de7017 Add dirserv_load_fingerprint_file() test 2020-01-09 15:27:26 -05:00
Neel Chauhan
d0068be0dd Allow ed25519 keys to be banned in approved-routers 2020-01-09 15:27:26 -05:00
Nick Mathewson
e28e41dd78 Fix wide lines from NS() removal fallout. 2020-01-09 11:43:49 -05:00
Nick Mathewson
42c6fc851e Remove NS*() macros from test.h.
We never used them very much, and although they had potential to
clarify some of our tests, they also made some of the logic harder
for people to follow.  Clang-format can't make head or tail of them,
so the time has come to say goodbye to them.
2020-01-09 11:09:31 -05:00
Nick Mathewson
23c77f79fd Remove all usage of the NS*() macros in test*.c
This is an automatically generated commit, made with the following
kludgey perl script. It results in a number of wide lines, which
I'll clean up in a subsequent commit.

#/usr/bin/perl -w -i
$mod = "NS_MODULE";
$submod = "NS_SUBMODULE";
$last_was_empty = 0;

while (<>) {

    s/\bASPECT\(\s*(\w+)\s*,\s*(\w+)\s*\)/$1_$2/;

    if (/# *define +NS_MODULE +(\w+)/) {
        $mod = $1;
        next;
    } elsif (/# *define +NS_SUBMODULE +(\w+)/) {
        $submod = $1;
        next;
    }

    next if (/#undef NS_(SUB)?MODULE/);

    s/NS\(\s*test_main\s*\)/test_${mod}_${submod}/;
    s/NS\(\s*(\w+)\s*\)/${mod}_${submod}_$1/g;
    s/NS_FULL\(\\s*(\w+)\s*,\s*(\w+),\s*(\w+)\s*\)/$1_$2_$3/;
    s/^(\s*)NS_MOCK\(\s*(\w+)\s*\)/$1MOCK($2,\n$1     ${mod}_${submod}_$2)/;
    s/NS_UNMOCK\(\s*(\w+)\s*\)/UNMOCK($1)/;
    s/TEST_CASE\(\s*(\w+)\s*\)/{ "$1", test_${mod}_$1, TT_FORK, NULL, NULL }/;
    s/TEST_CASE_ASPECT\(\s*(\w+)\s*,\s*(\w+)\s*\)/{ "$1_$2", test_${mod}_$1_$2, TT_FORK, NULL, NULL }/;
    s/NS_DECL\(\s*([^,]+)\s*,\s*([^,]+)\s*,\s*(\(.*)\);/static $1 ${mod}_${submod}_$2$3;\nATTR_UNUSED static int ${mod}_${submod}_$2_called = 0;/;
    s/\bCALLED\(\s*(\w+)\s*\)/${mod}_${submod}_$1_called/;

    if (/^$/) {
        print if (! $last_was_empty);
        $last_was_empty = 1;
    } else {
        $last_was_empty = 0;
        print;
    }

    if (eof) {
        $mod = "NS_MODULE";
        $submod = "NS_SUBMODULE";
        $last_was_empty = 0;
    }
}

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Thu Jan 9 10:26:10 2020 -0500
#
# On branch disable_ns_macro
# Changes to be committed:
#	modified:   src/test/test_accounting.c
#	modified:   src/test/test_compat_libevent.c
#	modified:   src/test/test_dir.c
#	modified:   src/test/test_dir_handle_get.c
#	modified:   src/test/test_dns.c
#	modified:   src/test/test_options.c
#	modified:   src/test/test_procmon.c
#	modified:   src/test/test_rendcache.c
#	modified:   src/test/test_router.c
#	modified:   src/test/test_routerset.c
#	modified:   src/test/test_status.c
#	modified:   src/test/test_tortls.c
#	modified:   src/test/test_tortls_openssl.c
#	modified:   src/test/test_util_format.c
#	modified:   src/test/test_util_process.c
#
# Untracked files:
#	experiments/
#	locate_options.sh
#	un_ns.pl
#

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Thu Jan 9 10:26:10 2020 -0500
#
# On branch disable_ns_macro
# Changes to be committed:
#	modified:   src/test/test_accounting.c
#	modified:   src/test/test_compat_libevent.c
#	modified:   src/test/test_dir.c
#	modified:   src/test/test_dir_handle_get.c
#	modified:   src/test/test_dns.c
#	modified:   src/test/test_options.c
#	modified:   src/test/test_procmon.c
#	modified:   src/test/test_rendcache.c
#	modified:   src/test/test_router.c
#	modified:   src/test/test_routerset.c
#	modified:   src/test/test_status.c
#	modified:   src/test/test_tortls.c
#	modified:   src/test/test_tortls_openssl.c
#	modified:   src/test/test_util_format.c
#	modified:   src/test/test_util_process.c
#
# Untracked files:
#	experiments/
#	locate_options.sh
#	un_ns.pl
#
2020-01-09 11:09:22 -05:00
Nick Mathewson
c9855f23c1 Replace various NS_MODULE/SUBMODULE vals with shorter names.
This will help avoid wide lines in our output.
2020-01-09 11:08:18 -05:00
Nick Mathewson
e2fcfc6e52 Put all NS_DECL invocations on single lines.
This is going to make my script happier; these lines will soon
disappear.
2020-01-09 10:06:35 -05:00
Nick Mathewson
1ffba2f121 Always define NS_MODULE and NS_SUBMODULE when NS is used.
When these macros aren't defined, the expansions of the NS macros
can get particularly ugly.
2020-01-09 09:56:41 -05:00