aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_rendcache.c
AgeCommit message (Collapse)Author
2020-09-18Merge branch 'maint-0.3.5' into maint-0.4.3David Goulet
2020-09-17Fix underflow in rend_cache/free_all test.Nick Mathewson
We already fixed these in #40099 and #40125. This patch fixes #40126. Bugfix on 0.2.8.1-alpha.
2020-09-17Merge branch 'maint-0.3.5' into maint-0.4.3Nick Mathewson
2020-09-17test: Increment rend cache allocation before freeingDavid Goulet
The rend_cache/entry_free was missing the rend cache allocation increment before freeing the object. Without it, it had an underflow bug: Sep 17 08:40:13.845 [warn] rend_cache_decrement_allocation(): Bug: Underflow in rend_cache_decrement_allocation (on Tor 0.4.5.0-alpha-dev 7eef9ced61e72b1d) Fixes #40125 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-08-13Merge branch 'maint-0.4.2' into maint-0.4.3Nick Mathewson
2020-08-12Fix allocation counting in clean_v2_descs_as_dir test.Nick Mathewson
Without this fix, running this test on its own would fail. Fixes bug 40099. Bugfix on ade5005853c17b3 in 0.2.8.1-alpha.
2020-01-09Fix wide lines from NS() removal fallout.Nick Mathewson
2020-01-09Remove all usage of the NS*() macros in test*.cNick Mathewson
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-09Replace various NS_MODULE/SUBMODULE vals with shorter names.Nick Mathewson
This will help avoid wide lines in our output.
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-02-12test: Fix a warning underflow in rend_cache/cleanDavid Goulet
Because the test is adding entries to the "rend_cache" directly, the rend_cache_increment_allocation() was never called which made the rend_cache_clean() call trigger that underflow warning: rend_cache/clean: [forking] Nov 29 09:55:04.024 [warn] rend_cache_decrement_allocation(): Bug: Underflow in rend_cache_decrement_allocation (on Tor 0.4.0.0-alpha-dev 2240fe63feb9a8cf) The test is still good and valid. Fixes #28660 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-01-16Bump copyright date to 2019Nick Mathewson
2019-01-16Bump copyright date to 2019.Nick Mathewson
2018-11-29test: Fix a warning underflow in rend_cache/cleanDavid Goulet
Because the test is adding entries to the "rend_cache" directly, the rend_cache_increment_allocation() was never called which made the rend_cache_clean() call trigger that underflow warning: rend_cache/clean: [forking] Nov 29 09:55:04.024 [warn] rend_cache_decrement_allocation(): Bug: Underflow in rend_cache_decrement_allocation (on Tor 0.4.0.0-alpha-dev 2240fe63feb9a8cf) The test is still good and valid. Fixes #28660 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-07-05Fix every include path changed in the previous commit (automated)Nick Mathewson
I am very glad to have written this script.
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-15Move extend_info_t into its own header.Nick Mathewson
2018-06-15Extract routerinfo_t into its own header.Nick Mathewson
I was expecting this to be much worse.
2018-06-15Split rend_authorized_client_t and encoded_.._t into their own headersNick Mathewson
2018-06-15Extract rend_intro_point_t into its own header.Nick Mathewson
2018-06-15Extract rend_service_descriptor_t into its own header.Nick Mathewson
2017-12-08Change the free macro convention in the rest of src/or/*.hNick Mathewson
2017-09-12Clear up dead-assignment warnings from scan-buildNick Mathewson
2017-08-24apply ahf's test_assert_null.cocciNick Mathewson
2017-07-07test: Move some test code to test helpers.George Kadianakis
Move code to create connection streams and rend_data structures to test_helpers so that we can use them from the e2e rendezvous circuit unittests.
2017-03-31Remove some now-needless openssl includes from src/test.Nick Mathewson
It would appear that these includes weren't actually used.
2017-03-15Run the copyright update script.Nick Mathewson
2016-12-15Fix a lovely heisenbug in rend_cache/store_v2_desc_as_clientNick Mathewson
Act I. " But that I am forbid To tell the secrets of my prison-house, I could a tale unfold..." Here's the bug: sometimes, rend_cache/store_v2_desc_as_client would say: "Dec 15 08:31:26.147 [warn] rend_cache_store_v2_desc_as_client(): Bug: Couldn't decode base32 [scrubbed] for descriptor id. (on Tor 0.3.0.0-alpha-dev 4098bfa26073551f)" When we merged ade5005853c17b3 back in 0.2.8.1-alpha, we added that test: it mangles the hidden service ID for a hidden service, and ensures that when the descriptor ID doesn't match the descriptor's key, we don't store the descriptor. How did it mangle the descriptor ID? By doing desc_id_base32[0]++; So, if the hidden service ID started with z or 7, we'd wind up with an invalid base32 string, and get the warning. And if it started with any other character, we wouldn't. That there is part 1 of the bug: in 2/32 cases, we'd get a BUG warning. But we wouldn't display it, since warnings weren't shown from the unit tests. Act II. "Our indiscretion sometime serves us well, When our deep plots do pall" Part two: in 0.2.9.3-alpha, for part of #19999, we turned on BUG warnings in the unit tests, so that we'd actually start seeing them. At this point we also began to consider each BUG warning that made it through the unit tests to be an actual bug. So before this point, we wouldn't actually notice anything happening in those 2/32 cases. So, at this point it was a nice random _visible_ bug. Act III. "Our thoughts are ours, their ends none of our own" In acbb60cd6310d30c8cb763, which was part of my prop220 work, I changed how RSA key generation worked in the unit tests. While previously we'd use pre-made RSA keys in some cases, this change made us use a set of pregenerated RSA keys for _all_ 1024 or 2048 keys, and to return them in a rotation when Tor tried to generate a key. And now we had the heisenbug: anything that affected the number of pregenerated keys that we had yielded before reaching rend_cache/store_v2_desc_as_client would make us return a different key, which would give us a different base32 ID, which would make the bug occur, or not. So as we added or removed test cases, the bug might or might not happen. So yeah. Don't mangle a base32 ID like that. Do it this way instead.
2016-11-04Merge branch 'ticket17238_029_02-resquash'Nick Mathewson
Conflicts: src/or/rendclient.c src/or/rendcommon.c src/or/routerparse.c src/test/test_dir.c src/trunnel/ed25519_cert.h
2016-11-04prop224: Directory cache supportDavid Goulet
This implements the proposal 224 directory descriptor cache store and lookup functionalities. Furthermore, it merges the OOM call for the HSDir cache with current protocol v2 and the new upcoming v3. Add hs_cache.{c|h} with store/lookup API. Closes #18572 Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-11-04hs: Refactor rend_data_t for multi version supportDavid Goulet
In order to implement proposal 224, we need the data structure rend_data_t to be able to accomodate versionning that is the current version of hidden service (2) and the new version (3) and future version. For that, we implement a series of accessors and a downcast function to get the v2 data structure. rend_data_t becomes a top level generic place holder. The entire rend_data_t API has been moved to hs_common.{c|h} in order to seperate code that is shared from between HS versions and unshared code (in rendcommon.c). Closes #19024 Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
2016-09-08Simplify log_test_helpers interfaceNick Mathewson
Previously, you needed to store the previous log severity in a local variable, and it wasn't clear if you were allowed to call these functions more than once.
2016-09-08Resolve more BUG warnings in the unit testsNick Mathewson
2016-06-30Fix more naked strdup/malloc/free instancesNick Mathewson
2016-06-20test: Increase offset to rendcache descriptor timeDavid Goulet
Slow system can sometime take more than 10 seconds to reach the test callsite resulting in the unit test failing when using time in the future or in the past. Fixes #19465 Signed-off-by: David Goulet <dgoulet@torproject.org>
2016-06-11Add -Wmissing-variable-declarations, with attendant fixesNick Mathewson
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.
2016-03-11simplify rend_cache_store_status_t back to a booleanRoger Dingledine
it used to be a tri-state, but now it's just a bi-state, so we can take out all the machinery like the enum.
2016-03-11rip out hid_serv_acting_as_directory()Roger Dingledine
When we made HidServDirectoryV2 always 1, we removed the situation where a relay could choose not to be an HSDir. Now simplify the rest of the code to reflect this decision. (We have to remove two apparently unrelated free() calls in the unit tests, since they used to free stuff that we created as a side effect of calling router_get_my_routerinfo(), and now we no longer call that.)
2016-03-11rip out hid_serv_responsible_for_desc_id()Roger Dingledine
This simplifies relay behavior, because the relay offers the hsdir functionality independent of whether the directory authorities have decided this relay is suitable for clients to use yet. Implements ticket 18332.
2016-02-27Update the copyright year.Nick Mathewson
2016-02-05Fix the --disable-asserts-in-tests configure optionSebastian Hahn
2015-12-09Remove unnecessary castingcypherpunks
2015-12-09Fix buffer over-reads in the rendcache testscypherpunks
The hidden service descriptor cache (rendcache) tests use digest maps which expect keys to have a length of DIGEST_LEN. Because the tests use key strings with a length lower than DIGEST_LEN, the internal copy operation reads outside the key strings which leads to buffer over-reads. The issue is resolved by using character arrays with a size of DIGEST_LEN. Patch on ade5005853c17b3ae5923c194680442e0f86db4d.
2015-12-01Avoid relying on malloc internals in test_rend_cache_purge.teor (Tim Wilson-Brown)
Closes ticket 17724. Bug fix on ade5005853c1 and 5e9f2384cf0f, not in any released version of Tor. Patch by "teor".
2015-10-21Fix various coverity-found issuesNick Mathewson
2015-10-21Fix all leaks (and an introduced failure) in the rendcache testsNick Mathewson
2015-10-21Yet more memory leaks in the rendcache testsNick Mathewson
2015-10-21More leaks hereNick Mathewson
2015-10-21Fix a bunch more memory leaks in the tests.Nick Mathewson