Commit Graph

33368 Commits

Author SHA1 Message Date
Nick Mathewson
7e9ee3a58d Add a test with many non-default options. 2019-09-14 19:00:41 -04:00
Nick Mathewson
617679df42 Add a few error test cases 2019-09-14 19:00:41 -04:00
Nick Mathewson
80e858e3e6 Add an integration test for %include. 2019-09-14 19:00:41 -04:00
Nick Mathewson
28025698a1 test_parseconf: run each test from inside its directory.
We need this to test includes and relative paths.
2019-09-14 19:00:41 -04:00
Nick Mathewson
98ab3817a8 Add a changes file for ticket 31637. 2019-09-14 19:00:41 -04:00
Nick Mathewson
850a00dc07 Add test for +Option, /Option, and Option
Here we use these directives to replace, extend, or clear values in
torrc.defaults and in torrc.
2019-09-14 19:00:41 -04:00
Nick Mathewson
2f7be9620b Move our first 3 example conf_examples to named directories
I'm not planning to use "example" as the name for all of them, but
these first three _are_ simple examples.
2019-09-14 19:00:41 -04:00
Nick Mathewson
7c7e8402b5 Add a test script to try parsing and encoding Tor configurations
This script takes a set of example torrcs and command-lines from
src/test/conf_examples.  If a success is expected, it runs "tor
--dump-config" and compares the result with the one we expect.  If a
failure is expected, it runs "tor --verify-config" and greps for the
error we expect.
2019-09-14 19:00:41 -04:00
Nick Mathewson
bfc5f09979 Detect overflow or underflow on double config values.
Any floating point value too positive or negative to distinguish
from +/-Inf, or too small to distinguish from +/-0, is an
over/underflow.
2019-09-13 18:26:16 -04:00
David Goulet
286b129b09 Merge branch 'tor-github/pr/1319' 2019-09-12 13:53:59 -04:00
David Goulet
c39c9ce26b Merge branch 'tor-github/pr/1285' 2019-09-12 13:47:09 -04:00
George Kadianakis
028733e8b6 Merge branch 'tor-github/pr/1303' 2019-09-12 18:09:35 +03:00
George Kadianakis
3aaa4d416b Merge branch 'tor-github/pr/1299' 2019-09-12 18:08:00 +03:00
Nick Mathewson
c3b1a25d46 Workaround for GCC "note" about "variable tracking size limit"
GCC complains that we are using too many variables here, probably
because of the sheer number of locals used for our tinytest macros.
Eventually we should fix that (see 30968), but this commit just
makes the "note" go away by splitting the test function into two.
2019-09-12 18:07:47 +03:00
Nick Mathewson
261ec900db Remove variable declarations from macros in test_addr_parse()
Instead, put them in the function itself.

This is an attempt to fix the gcc warning about the "variable
tracking size limit exceeded".
2019-09-12 18:07:47 +03:00
Nick Mathewson
34bab120df Ticket 31687: fix for tor_isinf() as well
tor_isinf() was new in 0.4.0, and also needs to look at the
same rules as clamp_double_to_i64()
2019-09-12 09:53:13 -04:00
Nick Mathewson
0327f9a075 Merge branch 'ticket31687_035' into ticket31687_040 2019-09-12 09:51:04 -04:00
Nick Mathewson
87944cecfc Merge remote-tracking branch 'tor-github/pr/1300' 2019-09-12 08:50:09 -04:00
Nick Mathewson
c7cbe64463 Changes file for ticket31626 (confparse.[ch] move) 2019-09-11 10:25:27 -04:00
Nick Mathewson
ae6e60281c Update include.am files to refer to new location of confparse.[ch]
Tests should now pass again.
2019-09-11 10:22:01 -04:00
Nick Mathewson
a90d1918af Update #includes to point to confparse.h in its new location.
This commit was automatically generated by running
scripts/maint/rectify_include_paths.py .
2019-09-11 10:17:20 -04:00
Nick Mathewson
87ca9e4d2a Move confparse.[ch] into src/lib/confmgt/
This commit only does code movement, and does not clean up after
itself.  As such, it will break compilation.  I'm separating it for
ease of review.
2019-09-11 10:16:10 -04:00
Nick Mathewson
bf8c3164b6 Add new entries to lib/confmgt ".may_include" file
confparse.[ch] will need these; checkIncludes confirms that we have
not introduced a cycle.
2019-09-11 10:13:57 -04:00
David Goulet
41261c3b5c Merge branch 'tor-github/pr/1296' 2019-09-11 09:42:31 -04:00
Nick Mathewson
478141e617 Document inconsistent usage of config_var_is_listable()
See also ticket 31654.
2019-09-11 09:42:19 -04:00
Nick Mathewson
e61bfd0bfd Extract common list of flags to use for obsolete variables. 2019-09-11 09:42:19 -04:00
Nick Mathewson
fe5033d3b0 Clarify documentation on config_var_is_listable()
Here we make it clear we're only looking at listable variable names,
not at whether the variables themselves are gettable.

Also, remove an extraneous h.

(This commit is not a fixup, because of rebase conflicts.)
2019-09-11 09:42:19 -04:00
Nick Mathewson
14f48cb083 Add test_cmdline.sh to distribution. 2019-09-11 09:42:19 -04:00
Nick Mathewson
7a8ea0d3c3 integration test for --list-torrc-options
(This option tests our existing behavior, not necessarily the most
sensible behavior.)
2019-09-11 09:42:19 -04:00
Nick Mathewson
5ffe6ec0e3 Test: Make sure NOLIST options are not listed. 2019-09-11 09:42:19 -04:00
Nick Mathewson
d545fe1992 Changes file for 31625 (config flag refactor) 2019-09-11 09:42:19 -04:00
Nick Mathewson
bbd40e690e Revise documentation on CFLG_* flags 2019-09-11 09:42:19 -04:00
Nick Mathewson
0d6d96396c Remove all CVFLAG_* usage. 2019-09-11 09:42:19 -04:00
Nick Mathewson
5ca5d196ac Remove all VTFLAG_* usage. 2019-09-11 09:42:19 -04:00
Nick Mathewson
9b571d4729 confparse, conftypes: Replace flags with their new names.
The old names remain as #defines that cause variables to get one or
more flags.

Now every flag-testing function in confparse.c tests exactly one flag.
2019-09-11 09:42:19 -04:00
Nick Mathewson
1b3b6d9f2d Replace low-level {var_type,struct_var}_is_*() with flag inspection
Since the flags are now stored with compatible numbering, we can
just OR them together and see whether the flag we want is in the
result.

(Net code removal!)
2019-09-11 09:42:19 -04:00
Nick Mathewson
4b92f4c83a Re-number VTFLAG_* values so they don't conflict with CVFLAG_* 2019-09-11 09:42:19 -04:00
Nick Mathewson
c650ab8061 Move VTFLAG_* declarations to conftypes.h 2019-09-11 09:42:19 -04:00
Nick Mathewson
03e4183043 typed_var: Make flags into an unsigned OR of bits.
Using a bitfield here will enable us to unify the var_type_def_t flags
with the config_var_t flags.

(This commit does not yet do that unification, and does not yet
rename or refactor any flags.  It only changes booleans into bits.)
2019-09-11 09:42:19 -04:00
Nick Mathewson
4f6b592691 struct_var: refactor struct_var_is*() functions to delegate
Previously they checked the individual flags inside var_type_def_t;
now they call the appropriate var_type_is_*() functions.

(These functions will be removed entirely by the end of this branch.)
2019-09-11 09:42:19 -04:00
Nick Mathewson
7171ce2a2a config: make config_var_is_dumpable static. 2019-09-11 09:42:19 -04:00
Nick Mathewson
8d685aee7c config: rename "contained" to "derived", and explain it better.
Don't use "derived" directly, but check its implications for listing
and copying.
2019-09-11 09:42:19 -04:00
Nick Mathewson
668e3a7709 config: Introduce the concept of an "ungettable" variable.
We had though to make all obsolete and invisible variables
ungettable, so that GETCONF would reject them.  But it turns out
that this isn't the current behavior of GETCONF with those
variables.  So for now, I'm leaving the current behavior unchanged.
(See ticket 31647 for a proposal to change the behavior.)
2019-09-11 09:42:19 -04:00
Nick Mathewson
3bf38ffff5 Document config_var_is_dumpable and config_var_is_settable. 2019-09-11 09:42:19 -04:00
David Goulet
049705fc1c Merge branch 'tor-github/pr/1311' 2019-09-11 09:36:28 -04:00
George Kadianakis
3b32f2508c Merge branch 'tor-github/pr/1307' 2019-09-11 16:19:21 +03:00
Nick Mathewson
0891a31ad3 madvise: tolerate EINVAL and ENOSYS when minherit fails
These errors can occur if we are built on a system with support for
madvise(MADV_NOFORK) but then we are run on a system whose kernel
does not support that flag.

If the error is something that we don't tolerate at all, we now log
it before crashing.

Fixes bug 31696.  I am calling this a bugfix on 0.4.1.1-alpha, where
we actually started using the map_anon code.

This is similar to, but not the same as, the fix for #31570.
2019-09-11 09:13:50 -04:00
Nick Mathewson
e7565855c0 Merge branch 'ticket31578' into ticket31578_merged 2019-09-11 08:59:29 -04:00
Nick Mathewson
9d60495903 Use strtod, not atof, for parsing doubles in the configuration.
This lets us detect erroneous doubles, which previously we could not
do.

Fixes bug 31475; bugfix on commit 00a9e3732e, a.k.a svn:r136.
2019-09-10 19:01:32 -04:00
Nick Mathewson
97f7efa9e3 pf: when extracting an IPv6 address, make sure we got an IPv6 address
Our code assumes that when we're configured to get IPv6 addresses
out of a TRANS_PF transparent proxy connection, we actually will.
But we didn't check that, and so FreeBSD started warning us about a
potential NULL pointer dereference.

Fixes part of bug 31687; bugfix on 0.2.3.4-alpha when this code was
added.
2019-09-10 11:07:25 -04:00