teor
dce1f63d44
fs: Clarify an ambiguous comment about string/pointer equality
2019-10-30 16:15:43 +10:00
George Kadianakis
4413b98190
Merge branch 'tor-github/pr/1456'
2019-10-29 21:29:13 +08:00
teor
30705e8294
app/config: Fix a comment typo in config.c
...
The options validation is now a callback.
Bugfix on 31241; not in any released version of tor.
2019-10-29 12:40:20 +10:00
David Goulet
ceca6e7c35
ewma: Implement unit tests
...
At this commit, 93.9% of line coverage and 95.5% of function coverage.
Closes #32196
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
48781c32ca
ewma: Move private struct into header private section
...
Facilitate testing.
Part of #32196 .
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
bbcded554a
test: Implement unit tests for circuitmux.c
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
dba249bc73
test: Add fakecircs.{h|c} helper
...
Fake circuits are created everywhere in the unit tests. This is an attempt at
centralizing a "fake circuit creation" API like fakechans.c does for channel.
This commit introduces fakecircs.c and changes test_relay.c and
test_circpadding.c which were using roughly the same code.
This will allow easier OR circuit creation for the future tests in
test_circuitmux.c
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
a41ec84914
test: Implement cmux allocate unit test
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
d2e51aca7d
test: Remove circuitmux/destroy_cell_queue code duplication
...
This also rename a function to improve code clarity.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
839bc4814e
test: Add testcase setup object for test_cmux
...
Also remove a scheduler_init() from a test and MOCK the appropriate function
so the test can pass.
This is done in order to minimize initialization functions in the unit test
and try to only go through the testcase setup object.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
7678022e85
cmux: Move circuitmux_s object into header in private section
...
Step needed in order to access members of the object for unit tests.
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
David Goulet
4c95022658
core: Add missing include in destroy_cell_queue_st.h
...
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-10-28 13:17:11 -04:00
teor
bf16efeb07
nodelist: fix a comment typo in routerset.h
2019-10-28 23:44:08 +10:00
David Goulet
b98631d280
Merge branch 'tor-github/pr/1476'
2019-10-28 08:47:57 -04:00
Nick Mathewson
25d66a3391
add missing docs in crypto_digest*
2019-10-28 08:27:42 -04:00
José M. Guisado
42ba3997d6
Check memunit parsing for overflow in confparse
...
Before, when parsing memunits, if overflow occured it failed silently.
Use nowrap u64 math to detect overflow, compare to INT64_MAX and if
greater tell user and fail accordingly.
15000000.5 TB fails double check as it a greater floating number than
(double)INT64_MAX
8388608.1 TB passes double check because it falls in the same value as
(double)INT64_MAX (which is 2^63), but will fail the int check because
(uint64_t)d, which is 2^63, is strictly greater than 2^63-1 (INT64_MAX).
Fixes #30920
Signed-off-by: José M. Guisado <guigom@riseup.net>
2019-10-28 11:38:41 +01:00
José M. Guisado
f237529fff
Add nowrap u64 multiplication function
...
Follows #30920
Signed-off-by: José M. Guisado <guigom@riseup.net>
2019-10-27 10:27:54 +01:00
JeremyRand
b69e85cc3d
Bug 19859: Add unit test for formatting
2019-10-27 05:14:26 +00:00
JeremyRand
56ee42e1c9
Bug 19859: Add HTTPCONNECT client protocol
2019-10-27 05:14:21 +00:00
JeremyRand
23819d3a66
Bug 19859: Set arg to const
2019-10-27 03:06:19 +00:00
JeremyRand
0c4e3b6b50
Bug 19859: Consolidate flag fields into ISO_FIELDS
2019-10-27 01:54:11 +00:00
JeremyRand
2734968e40
Bug 19859: Add stream isolation data to STREAM event
2019-10-27 01:32:21 +00:00
Nick Mathewson
f751cc020f
Documentation cleanup in confmacros.h
2019-10-26 17:24:22 -04:00
Nick Mathewson
b314b68d61
Fix doxygen HTML warnings in src/feature.
2019-10-26 12:07:09 -04: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
30c6ab5150
doxygen: add @file declarations for src/app
...
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:41:43 -04:00
Nick Mathewson
5f299feb82
doxygen: add @file declarations for src/core/crypto
...
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:39:17 -04:00
Nick Mathewson
ff7a70ca09
doxygen: add @file declarations for src/core/or
...
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:37:25 -04:00
Nick Mathewson
943fd734f9
doxygen: add @file declarations for src/core/mainloop
...
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
2019-10-26 11:26:06 -04:00
Nick Mathewson
4d4a3eeeb1
doxygen: add @file declarations for src/core/proto
...
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
These declarations also turned up a doxygen warning for
proto_socks.c; I fixed that too.
2019-10-26 11:21:25 -04:00
Nick Mathewson
39d09ea081
doxygen: add @file declarations for src/lib
...
If a file doesn't use the file command (either \file or @file),
Doxygen won't try to process it.
These declarations also turned up a doxygen warning for
crypto_ope.c; I fixed that too.
2019-10-26 11:13:29 -04:00
Nick Mathewson
16dffa523e
Rename confparse.[ch] identifiers to confmgt.[ch] identifiers.
...
This is an automated commit, generated by this command:
./scripts/maint/rename_c_identifier.py \
confparse.h confmgt.h \
confparse.c confmgt.c \
CONFPARSE_PRIVATE CONFMGT_PRIVATE \
TOR_CONFPARSE_H TOR_CONFMGT_H
2019-10-26 10:09:03 -04:00
Nick Mathewson
2402d95715
Rename confparse.[ch] to confmgt.[ch]
...
This will break compilation until includes etc are fixed.
2019-10-26 10:07:14 -04:00
Nick Mathewson
407fb0c35c
Move config_format_t and allied definitions into conftypes.h
...
Since these are needed by every module that is _configurable_, they
belong in lib/conf, not lib/confmgt.
2019-10-26 10:05:03 -04:00
Nick Mathewson
e7993dc046
Merge branch 'ticket31241_v3'
2019-10-25 08:10:39 -04:00
Nick Mathewson
63f2a310cb
config,state: check magic in all callbacks.
2019-10-25 08:09:05 -04:00
Nick Mathewson
aa6b4b62db
confparse: Add a function to check the magic of a toplevel object.
2019-10-25 08:08:43 -04:00
teor
0ae530c8f6
test: Use SEVERITY_MASK_IDX() to find the LOG_* mask indexes
...
In the unit tests.
Fixes a regression to bug 31334; bug not in any released version of tor.
2019-10-25 17:23:46 +10:00
teor
60aa6dac34
Merge remote-tracking branch 'tor-github/pr/1467'
2019-10-25 17:17:39 +10:00
teor
a91f52a443
Merge branch 'maint-0.4.2'
2019-10-25 10:38:22 +10:00
Nick Mathewson
620e40bcfc
test_options: add a test for options_trial_assign()
...
This function is used by controllers to set options. I refactored
it a bit when refactoring options validation, so it needs to get
tested.
2019-10-24 20:38:02 -04:00
Nick Mathewson
06475f30e9
tests: set DataDirectory_option as well as DataDirectory.
...
options_validate_cb() derives DataDirectory (which we use) from
DataDirectory_option (which the user sets). I want to add a test
that will call options_validate_cb(), but it will fail unless it
derives the same value.
2019-10-24 20:38:02 -04:00
Nick Mathewson
4d53bbeafb
config: make options_act*() mockable.
...
I'll need this for testing options_trial_assign().
2019-10-24 20:38:02 -04:00
teor
c8aa3cc17d
Merge remote-tracking branch 'tor-github/pr/1466' into maint-0.4.2
2019-10-25 10:38:01 +10:00
Nick Mathewson
f796bf3aa5
Extend confmgr tests to handle validation callbacks.
2019-10-24 20:37:53 -04:00
Nick Mathewson
d17aa09308
config.c: Turn options_transition_allowed() into a proper callback
2019-10-24 20:30:32 -04:00
Nick Mathewson
bd891f517f
config.c: extract validate, check-transition, and set into a function
...
This eliminates duplicated code. The options_validate() function
itself is now tests-only.
2019-10-24 20:30:32 -04:00
Nick Mathewson
e0ae137df5
Write a new set of config validation callbacks.
...
Unlike legacy_validate_fn_t, these callbacks have separation of
duties, into:
* early normalization and computation.
* validation
* transition checking
* late normalization and computation
Only the first and last steps get mutable objects. Only the
transition-checking step gets to see the previous values of this
object.
2019-10-24 20:30:32 -04:00
Nick Mathewson
dc6d7f072d
Make foo_validate() functions call config_validate().
...
The former foo_validate() functions are now toplevel
legacy_validate_fn callbacks. The new foo_validate() functions now
call them.
This change lets us remove the old shared_random disk state
validation callback entirely.
2019-10-24 20:30:32 -04:00
Nick Mathewson
0cb4238537
Add a config_validate() function to invoke verify callbacks.
...
As we turn our monolithic configuration objects into suites of
smaller module-specific configuration objects, we will want each one
to be able to provide its own verification callbacks. That means
that instead of invoking these verification callbacks directly, we will
want to call them via the configuration manager object.
2019-10-24 20:30:32 -04:00