summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-05-04Do not BUG on missing sha3-as-signed fieldNick Mathewson
This can happen if you've been running an earlier alpha on your relay. Instead, just ignore the entry.
2017-05-04Update the consdiff directory code based on #22143 fixesNick Mathewson
These are mostly just identifier renames, except for one place in routerparse.c where we switch to using a correct hash.
2017-05-04Turn DEFAULT_IF_MODIFIED_SINCE_DELAY into a constNick Mathewson
2017-05-04Request (and try to use) consensus diffs.Nick Mathewson
2017-05-04Generate X-Or-Diff-From-Consensus headers correctly.Nick Mathewson
2017-05-04Remove excess indentation from previous commit.Nick Mathewson
Review this with 'diff -b' to confirm
2017-05-04Extract the consensus-only part of directory_get_from_dirserverNick Mathewson
Right now it just sets an if-modified-since header, but it's about to get even bigger. This patch avoids changing indentation; the next patch will be whitespace fixes.
2017-05-04New function to add additional headers to a directory requestNick Mathewson
2017-05-04Store the sha3 of a networkstatus as part of the networkstatus_tNick Mathewson
Also store it in the cached_dir_t.
2017-05-04Serve consensus diffs on request.Nick Mathewson
2017-05-04Support writing Content-Encoding headers other than deflateNick Mathewson
Right now this only sends "deflate" or "identity", but there's more to come.
2017-05-04Remove old unused indentation from handle_get_current_consensusNick Mathewson
This commit removes a pair of meaningless braces, and changes whitespace only.
2017-05-04Add consensus_cache_entry spooling support to spooled_resource_tNick Mathewson
2017-05-04Merge branch 'ticket22143_squashed'Nick Mathewson
2017-05-04Add a test for $ with non-delete commands.Nick Mathewson
2017-05-04Remove some unused digests from test_consdiffmgr.cNick Mathewson
These were unused before I started working on #22143 -- I just found them while I was lookinging for digests to update.
2017-05-04bug#22143/prop#140: in consdiffmgr, store and use digest-as-signedNick Mathewson
We need to index diffs by the digest-as-signed of their source consensus, so that we can find them even from consensuses whose signatures are encoded differently.
2017-05-04bug#22143/prop#140: Use <n>,$d commands in diffs to remove signaturesNick Mathewson
In this patch I add support for "delete through end of file" in our ed diff handler, and generate our diffs so that they remove everything after in the consensus after the signatures begin.
2017-05-03Fix additional leaks in #22103 testsTaylor Yu
test_options_validate_impl() incorrectly executed subsequent phases of config parsing and validation after an expected error. This caused msg to leak when those later phases (which would likely produce errors as well) overwrote it.
2017-05-03bug#22143/prop#140: identify input diffs by their digest-as-signedNick Mathewson
See may 3 changes to prop140 for more background.
2017-05-03Merge remote-tracking branch 'argonblue/bug22103_fixtest'Nick Mathewson
2017-05-03control: Fix NULL pointer access in HS desc eventDavid Goulet
This was introduced 90562fc23a7ce61f3660b507d9991a27af2eae37 adding a code path where we pass a NULL pointer for the HSDir fingerprint to the control event subsystem. The HS desc failed function wasn't handling properly that pointer for a NULL value. Two unit tests are also added in this commit to make sure we handle properly the case of a NULL hsdir fingerprint and a NULL content as well. Fixes #22138 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-05-03Fix memory management for #22103 testsTaylor Yu
Code movement in the commit introducings tests for #22103 uncovered a latent memory management bug. Refactor the log message checking from test_options_checkmsgs() into a helper test_options_checklog(). This avoids a memory leak (and possible double-free) in a test failure condition. Don't reuse variables (especially pointers to allocated memory!) for multiple unrelated purposes. Fixes CID 1405778.
2017-05-02Merge branch 'refactor_dir_client_handler'Nick Mathewson
2017-05-02Merge branch 'teor_connection-with-client-v2_squashed'Nick Mathewson
2017-05-02Accurately identify client connections by their lack of peer authenticationteor
This means that we bail out earlier if asked to extend to a client. Follow-up to 21407. Fixes bug 21406; bugfix on 0.2.4.23.
2017-05-02Add tests for #22103Taylor Yu
Also factor out the error message comparisions from test_options_validate_impl() into a separate function so it can check for error messages in different phases of config parsing.
2017-05-02Delete useless checks in confparse.cTaylor Yu
config_parse_interval() and config_parse_msec_interval() were checking whether the variable "ok" (a pointer to an int) was null, rather than derefencing it. Both functions are static, and all existing callers pass a valid pointer to those static functions. The callers do check the variables (also confusingly named "ok") whose addresses they pass as the "ok" arguments, so even if the pointer check were corrected to be a dereference, it would be redundant. Fixes #22103.
2017-05-02Reindent the just-extracted directory response handler functionsNick Mathewson
2017-05-02Break connection_dir_client_reached_eof() into smaller functionsNick Mathewson
This was a >630-line function, which doesn't make anybody happy. It was also mostly composed of a bunch of if-statements that handled different directory responses differently depending on the original purpose of the directory connection. The logical refactoring here is to move the body of each switch statement into a separate handler function, and to invoke those functions from a separate switch statement. This commit leaves whitespace mostly untouched, for ease of review. I'll reindent in the next commit.
2017-05-02Remove special-casing for NO_METHOD in consdiffmgr.cNick Mathewson
2017-05-02Merge branch 'compress_none_v2_squashed'Nick Mathewson
2017-05-02Add unit tests for the NO_METHOD compressorNick Mathewson
These required some special-casing, since some of the assumption about real compression algorithms don't actually hold for the identity transform. Specifically, we had assumed: - compression functions typically change the lengths of their inputs. - decompression functions can detect truncated inputs - compression functions have detectable headers None of those is true for the identity transformation.
2017-05-02Treat the identity transformation as another kind of compression.Nick Mathewson
This will allow us to treat NO_METHOD as a real compression method, and to simplify code that currently does if (compressing) { compress } else { copy }
2017-05-01Merge branch 'dgoulet_bug22042_031_01_squashed'Nick Mathewson
2017-05-01control: Fix comment of control_event_hs_descriptor_contentDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-05-01hs: Trigger control event when client can't pick HSDirDavid Goulet
Inform the control port with an HS_DESC failed event when the client is unable to pick an HSDir. It's followed by an empty HS_DESC_CONTENT event. In order to achieve that, some control port code had to be modified to accept a NULL HSDir identity digest. This commit also adds a trigger of a failed event when we are unable to base64-decode the descriptor cookie. Fixes #22042 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-05-01Rename x-lzma to x-tor-lzmaNick Mathewson
We shouldn't call it lzma, because we are imposing a limit on the memory needed for decoding.
2017-05-01Merge remote-tracking branch 'ahf/bugs/21665'Nick Mathewson
2017-04-28Fix a brazen memleak in consdiffmgr_add_consensus()Nick Mathewson
2017-04-28Increase MALLOC_MP_LIM to 16MBNick Mathewson
Increase the maximum allowed size passed to mprotect(PROT_WRITE) from 1MB to 16MB. This was necessary with the glibc allocator in order to allow worker threads to allocate more memory -- which in turn is necessary because of our new use of worker threads for compression. Closes ticket #22096. Found while working on #21648.
2017-04-27Merge branches 'consdiffmgr_orig_squashed' and 'actually_compute_diffs_squashed'Nick Mathewson
2017-04-27Pre-compress consensus diffs with supported consensus methods.Nick Mathewson
2017-04-27Store archived consensuses compressed on disk.Nick Mathewson
I'm just using gzip compression now, for performance.
2017-04-27Functionality to ensure there is space to add files to cache.Nick Mathewson
2017-04-27New force-delete option on consensus_cache_delete_pending()Nick Mathewson
If we're out of file space in the storage directory, we'll need to get rid of old files fast.
2017-04-27Lower the file limit in consdiffmgr, to support seccomp2Nick Mathewson
2017-04-27Pass incoming consensus documents to the consdiffmgr codeNick Mathewson
2017-04-27Fix use-after-free bug in storage_dir sandbox code.Nick Mathewson
2017-04-27Clean the consdiffmgr cache and launch new diffs as needed.Nick Mathewson