aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcache.c
AgeCommit message (Collapse)Author
2017-12-08Switch to a safer FREE_AND_NULL implementationNick Mathewson
This one only evaluates the input once, so it cannot mess up even if there are side effects.
2017-12-08Change the free macro convention in the rest of src/or/*.hNick Mathewson
2017-08-30prop224: Purge client state on NEWNYMDavid Goulet
Closes #23355 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-19prop224: Refactor parse_extended_hostname() to parse v3 addrs.George Kadianakis
We need this func so that we recognize SOCKS conns to v3 addresses. - Also rename rend_valid_service_id() to rend_valid_v2_service_id() - Also move parse_extended_hostname() tests to their own unittest, and add a v3 address to the test as well. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-03-15Run the copyright update script.Nick Mathewson
2016-12-19Merge branch 'maint-0.2.9'Nick Mathewson
2016-12-19Merge branch 'maint-0.2.8' into maint-0.2.9Nick Mathewson
2016-12-19Merge branch 'bug21018_024' into maint-0.2.8Nick Mathewson
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-06-12typo/comment/log fixes i found in my sandbox from montrealRoger Dingledine
2016-03-26Do not treat "DOCDOC" as doxygen.Nick Mathewson
2016-03-16Bridges now refuse "rendezvous2" publish attemptsRoger Dingledine
Suggested during review of ticket 18332.
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-03-11moving hid_serv_get_responsible_directories and hid_serv_acting_as_directory ↵Hassan Alsibyani
from routerlist.c to rendcommon.c
2016-02-27Update the copyright year.Nick Mathewson
2015-12-09Mention the expected length of the digestscypherpunks
Some functions that use digest maps did not mention that the digests are expected to have DIGEST_LEN bytes. This lead to buffer over-reads in the past.
2015-10-21Merge remote-tracking branch 'origin/maint-0.2.7'Nick Mathewson
2015-10-21Whoops; infinite recursionNick Mathewson
2015-10-21Merge remote-tracking branch 'origin/maint-0.2.7'Nick Mathewson
2015-10-21Yet more memory leaks in the rendcache testsNick Mathewson
2015-10-21Fix memory leak in rend_cache_failure_entry_free()Nick Mathewson
Bug 17402.
2015-10-21Merge remote-tracking branch 'origin/maint-0.2.7'Nick Mathewson
2015-10-21Fix an (unreachable) memory leak in rendcache.cNick Mathewson
The 0.2.8 unit tests provoke this leak, though I don't think it can happen IRL.
2015-10-21Merge remote-tracking branch 'origin/maint-0.2.7'Nick Mathewson
2015-10-21Fix a bunch more memory leaks in the tests.Nick Mathewson
2015-10-21Fix a use-after-free in validate_intro_point_failure. Bug 17401. Found w ↵Nick Mathewson
valgrind
2015-10-06Merge remote-tracking branch 'twstrike/rendcache_tests'Nick Mathewson
Conflicts: src/test/include.am src/test/rend_test_helpers.c src/test/rend_test_helpers.h
2015-10-02Merge remote-tracking branch 'donncha/feature14846_4'Nick Mathewson
2015-09-15Add tests for the rend cacheOla Bini
2015-09-11Add a rend cache failure info dup functionDavid Goulet
When validating a new descriptor against our rend cache failure, we were added the failure entry to the new cache entry without duplicating. It was then freed just after the validation ending up in a very bad memory state that was making tor abort(). To fix this, a dup function has been added and used just before adding the failure entry. Fixes #17041 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-09-08Separate lookup function for service rend cacheDonncha O'Cearbhaill
Performing lookups in both the client and service side descriptor caches from the same rend_cache_lookup_entry() function increases the risk of accidental API misuse. I'm separating the lookup functions to keep the caches distinct.
2015-09-08Rename rend_cache_service to rend_cache_local_service for clarityDonncha O'Cearbhaill
2015-09-08Clean old descriptors from the service-side rend cacheDonncha O'Cearbhaill
Parameterize the rend_cache_clean() function to allow it clean old rendezvous descriptors from the service-side cache as well as the client descriptor cache.
2015-09-08Require explict specification of cache typeDonncha O'Cearbhaill
2015-09-08Clean up service-side descriptor cache and fix potential double-free.Donncha O'Cearbhaill
Entries in the service-side descriptor cache are now cleaned when rend_cache_free_all() is called. The call to tor_free(intro_content) in rend_cache_store_v2_desc_as_service() is moved to prevent a potential double-free when a service has a descriptor with a newer timestamp already in it's service-side descriptor cache.
2015-09-08Specify descriptor cache type in rend_cache_lookup_entry()Donncha O'Cearbhaill
Adds an Enum which represents the different types of rendezvous descriptor caches. This argument is passed in each call to rend_cache_lookup_entry() to specify lookup in the client-side or service-side descriptor caches.
2015-08-25Create a service-side descriptor cacheDonncha O'Cearbhaill
Adds a service descriptor cache which is indexed by service ID. This descriptor cache is used to store service descriptors generated by a local rendevous service. The service-side cach can be queried by calling rend_cache_lookup_entry() with the 'service' argument set to 1.
2015-08-25Fix typoDonncha O'Cearbhaill
2015-08-21Fix a bunch of check-spaces complaintsSebastian Hahn
2015-08-11Expire after 5 minutes rend cache failure entriesDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-08-11Add created timestamp to a rend cache failure entryDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-08-11Use an enum for INTRO_POINT_FAILURE_*David Goulet
Safer, wiser, stronger! Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-08-11Purge client HS failure cache on NEWNYMDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-08-11Add rend failure cacheDavid Goulet
When fetching a descriptor, we know test every introduction points in it against our rend failure cache to know if we keep it or not. For this to work, now everytime an introduction points is discareded (ex: receiving a NACK), we note it down in our introduction cache. See rendcache.c for a detailed explanation of the cache's behavior. Fixes #16389 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-07-16Fix most check-spaces issuesNick Mathewson
2015-06-18Move cache objects and functions to rendcache.{c|h}David Goulet
Every functions and objects that are used for hidden service descriptor caches are moved to rendcache.{c|h}. This commit does NOT change anything, just moving code around. Fixes #16399 Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-06-18Add rendcache.{c|h}David Goulet
For now, rend_cache_entry_t has been moved from or.h to rendcache.h and those files have been added to the build system. In the next commit, these will contain hidden service descriptor cache ABI and API for both client and directory side. The goal is to consolidate the descriptor caches in one location to ease development, maintenance, review and improve documentation for each cache behavior and algorithm. Signed-off-by: David Goulet <dgoulet@ev0ke.net>