Age | Commit message (Collapse) | Author |
|
Closes #40322.
|
|
|
|
Fix a bug introduced in 94b56eaa7597e4a091a5b51d2c9032ea046631e3 which
overwrite the connection message line.
Furthermore, improve how we generate that line by using a smartlist and change
the format so it is clearer of what is being rejected/detected and, if
applicable, which option is disabled thus yielding no stats.
Closes #40308
Signed-off-by: David Goulet <dgoulet@torproject.org>
|
|
Closes #29113
|
|
This change lets us make these tests much shorter and easier to
maintain.
|
|
|
|
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
#
|
|
This will help avoid wide lines in our output.
|
|
This is going to make my script happier; these lines will soon
disappear.
|
|
|
|
Signed-off-by: David Goulet <dgoulet@torproject.org>
|
|
|
|
|
|
|
|
The main.c code is responsible for initialization and shutdown;
the mainloop.c code is responsible for running the main loop of Tor.
Splitting the "generic event loop" part of mainloop.c from the
event-loop-specific part is not done as part of this patch.
|
|
Fun fact: these files used to be called log.[ch] until we ran into
conflicts with systems having a log.h file. But now that we always
include "lib/log/log.h", we should be fine.
|
|
I am very glad to have written this script.
|
|
|
|
|
|
Fewer modules needed this than I had expected.
|
|
or.h should really include only the minimum of stuff from or/*,
common/*, and lib/*.
|
|
|
|
|
|
|
|
I was expecting this to be much worse.
|
|
|
|
We recently merged a circuit cell queue size safeguard. This commit adds the
number of killed circuits that have reached the limit to the DoS heartbeat. It
now looks like this:
[notice] DoS mitigation since startup: 0 circuits killed with too many
cells. 0 circuits rejected, 0 marked addresses. 0 connections closed. 0
single hop clients refused.
Second thing that this patch does. It makes tor always print the DoS
mitigation heartbeat line (for a relay) even though no DoS mitigation have
been enabled. The reason is because we now kill circuits that have too many
cells regardless on if it is enabled or not but also it will give the operator
a chance to learn what is enabled with the heartbeat instead of suddenly
appearing when it is enabled by let say the consensus.
Fixes #25824
Signed-off-by: David Goulet <dgoulet@torproject.org>
|
|
|
|
This patch fixes the operator usage in src/test/*.c to use the symbolic
operators instead of the normal C comparison operators.
This patch was generated using:
./scripts/coccinelle/test-operator-cleanup src/test/*.[ch]
|
|
|
|
In nearly all cases, this is a matter of making sure that we include
orconfig.h before we include any standard c headers.
|
|
This is a big-ish patch, but it's very straightforward. Under this
clang warning, we're not actually allowed to have a global variable
without a previous extern declaration for it. The cases where we
violated this rule fall into three roughly equal groups:
* Stuff that should have been static.
* Stuff that was global but where the extern was local to some
other C file.
* Stuff that was only global when built for the unit tests, that
needed a conditional extern in the headers.
The first two were IMO genuine problems; the last is a wart of how
we build tests.
|
|
Instead of comparing the end of the time string against a constant,
compare it to the output of format_local_iso_time when given the
correct input.
|
|
|
|
|
|
|
|
Closes ticket 15212
|
|
Fixes #15012; bug not in any released Tor
|
|
Also remove the unit test mocks that allowed get_options() to be
NULL; that's an invariant violation for get_options().
|
|
|
|
Part of fix for 13172
|
|
|
|
|
|
|
|
A new set of unit test cases are provided, as well as introducing
an alternative paradigm and macros to support it. Primarily, each test
case is given its own namespace, in order to isolate tests from each
other. We do this by in the usual fashion, by appending module and
submodule names to our symbols. New macros assist by reducing friction
for this and other tasks, like overriding a function in the global
namespace with one in the current namespace, or declaring integer
variables to assist tracking how many times a mock has been called.
A set of tests for a small-scale module has been included in this
commit, in order to highlight how the paradigm can be used. This
suite gives 100% coverage to status.c in test execution.
|