summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2017-03-28Merge branch 'spooling_squashed'Nick Mathewson
2017-03-28Add nonfatal asserts for return val of dirserv_flushed_someNick Mathewson
2017-03-28Improve documentation for connection_dirserv_flushed_some.Nick Mathewson
2017-03-28Refactor the directory spool implementationNick Mathewson
The old implementation had duplicated code in a bunch of places, and it interspersed spool-management with resource management. The new implementation should make it easier to add new resource types and maintain the spooling code. Closing ticket 21651.
2017-03-27Merge remote-tracking branch 'origin/maint-0.3.0'Nick Mathewson
2017-03-27Fix max sampled size logic when in bridge mode.George Kadianakis
When calculating max sampled size, Tor would only count the number of bridges in torrc, without considering that our state file might already have sampled bridges in it. This caused problems when people swap bridges, since the following error would trigger: [warn] Not expanding the guard sample any further; just hit the maximum sample threshold of 1
2017-03-27Storagedir test fix: save strings in binary mode to preserve lengthNick Mathewson
2017-03-27Merge remote-tracking branch 'ahf/bugs/21757'Nick Mathewson
2017-03-27Merge remote-tracking branch 'jigsaw52/fix_leak_21788'Nick Mathewson
2017-03-27Check and cast st_size to size_t in storagedir codeNick Mathewson
This prevents an i386 compilation warning and fixes bug 21828. Bug not in any released Tor.
2017-03-26Merge remote-tracking branch 'origin/maint-0.3.0'Nick Mathewson
2017-03-26Tweak test_entrynodes commentNick Mathewson
2017-03-23Use update_approx_time() to run a test 100 days in the past.Nick Mathewson
Fixes bug21799.
2017-03-20Fix very small memory leak #21788Daniel Pinto
Leak caused by clean_up_backtrace_handler not being called on shutdown.
2017-03-17Merge branch 'ahf_bugs_21641_squashed'Nick Mathewson
2017-03-17Check onion key consensus parameters every hour.Alexander Færøy
This patch changes the way we decide when to check for whether it's time to rotate and/or expiry our onion keys. Due to proposal #274 we can now have the keys rotate at different frequencies than before and we thus do the check once an hour when our Tor daemon is running in server mode. This should allow us to quickly notice if the network consensus parameter have changed while we are running instead of having to wait until the current parameters timeout value have passed. See: See: https://bugs.torproject.org/21641
2017-03-17Add periodic timer for expiring old onion keys.Alexander Færøy
This patch adds a new timer that is executed when it is time to expire our current set of old onion keys. Because of proposal #274 this can no longer be assumed to be at the same time we rotate our onion keys since they will be updated less frequently. See: https://bugs.torproject.org/21641
2017-03-17Add API to query the current onion key grace period.Alexander Færøy
This patch adds an API to get the current grace period, in days, defined as the consensus parameter "onion-key-grace-period-days". As per proposal #274 the values for "onion-key-grace-period-days" is a default value of 7 days, a minimum value of 1 day, and a maximum value defined by other consensus parameter "onion-key-rotation-days" also defined in days. See: https://bugs.torproject.org/21641
2017-03-17Make MIN_ONION_KEY_LIFETIME a consensus parameter defined value.Alexander Færøy
This patch turns `MIN_ONION_KEY_LIFETIME` into a new function `get_onion_key_lifetime()` which gets its value from a network consensus parameter named "onion-key-rotation-days". This allows us to tune the value at a later point in time with no code modifications. We also bump the default onion key lifetime from 7 to 28 days as per proposal #274. See: https://bugs.torproject.org/21641
2017-03-17Split strings at newline in tor_get_lines_from_handle().Alexander Færøy
This patch fixes a regression described in bug #21757 that first appeared after commit 6e78ede73f which was an attempt to fix bug #21654. When switching from buffered I/O to direct file descriptor I/O our output strings from get_string_from_pipe() might contain newline characters (\n). In this patch we modify tor_get_lines_from_handle() to ensure that the function splits the newly read string at the newline character and thus might return multiple lines from a single call to get_string_from_pipe(). Additionally, we add a test case to test_util_string_from_pipe() to ensure that get_string_from_pipe() correctly returns multiple lines in a single call. See: https://bugs.torproject.org/21757 See: https://bugs.torproject.org/21654
2017-03-16Generate src/test/fuzz/include.am from a scriptNick Mathewson
It was very error-prone to maintain this by hand.
2017-03-16Merge branch 'storagedir_squashed'Nick Mathewson
2017-03-16Define a "storagedir" abstraction to hold numerous similar filesNick Mathewson
We could use one of these for holding "junk" descriptors and unparseable things -- but we'll _need_ it for having cached consensuses and diffs between them.
2017-03-16Now, resolve a new 64-bit warning in compat_threads.cNick Mathewson
2017-03-16consdiff: Fix 32-bit compilation.Nick Mathewson
Thanks, jenkins!
2017-03-16Merge branch 'prop140_21643_diff_only_squashed'Nick Mathewson
2017-03-16Switch ed-command parsing to use tor_parse_long.Nick Mathewson
2017-03-16Consdiff: extract router ID hash iteration functionsNick Mathewson
There was a frequent block of code that did "find the next router line, see if we've hit the end of the list, get the ID hash from the line, and enforce well-ordering." Per Ahf's review, I'm extracting it to its own function.
2017-03-16Make CONSENSUS_LINE_MAX_LEN a real defineNick Mathewson
2017-03-16Remove a couple of {\n\n instancesNick Mathewson
2017-03-16Use a better for X outside of base64_compare_table.Nick Mathewson
2017-03-16Reindent a few labels.Nick Mathewson
2017-03-16Avoid all needless memory copies when computing consensus diffs.Nick Mathewson
Previously, we operated on smartlists of NUL-terminated strings, which required us to copy both inputs to produce the NUL-terminated strings. Then we copied parts of _those_ inputs to produce an output smartlist of NUL-terminated strings. And finally, we concatenated everything into a final resulting string. This implementation, instead, uses a pointer-and-extent pattern to represent each line as a pointer into the original inputs and a length. These line objects are then added by reference into the output. No actual bytes are copied from the original strings until we finally concatenate the final result together. Bookkeeping structures and newly allocated strings (like ed commands) are allocated inside a memarea, to avoid needless mallocs or complicated should-I-free-this-or-not bookkeeping. In my measurements, this improves CPU performance by something like 18%. The memory savings should be much, much higher.
2017-03-16Swap memory allocation strategy for lists of lines for diffsNick Mathewson
Now we use a single allocation block for all the lines, rather than calling strdup on them one at a time. This should help performance a tiny bit.
2017-03-16Fill in the missing documentation on the new functionsNick Mathewson
2017-03-16Prop140: Fix a crash bug.Nick Mathewson
Found while fuzzing: this could occur if we tried to copy a nonexistent "line 0" while applying a diff.
2017-03-16Add fuzzers for consensus diff backend codeNick Mathewson
This takes two fuzzers: one which generates a diff and makes sure it works, and one which applies a diff. So far, they won't crash, but there's a bug in my string-manipulation code someplace that I'm having to work around, related to the case where you have a blank line at the end of a file, or where you diff a file with itself.
2017-03-16Make consensus diff sha3 operations mockable.Nick Mathewson
(We'll want this for fuzzing)
2017-03-16String-based API for consensus diffs.Nick Mathewson
Also, add very strict split/join functions, and totally forbid nonempty files that end with somethig besides a newline. This change is necessary to ensure that diff/apply are actually reliable inverse operations.
2017-03-16Fix an abstraction violation.Nick Mathewson
Don't alias the insides of smartlist_t; that way lies madness.
2017-03-16Use "const" in consdiff.[ch]Nick Mathewson
2017-03-16prop140: Use sha3-256, not sha2-256Nick Mathewson
This is a protocol update from recent prop140 changes. Also, per #21673, we need to check the entire document, including signatures.
2017-03-16Add a couple more cases to reach 100% coverage.Nick Mathewson
2017-03-16Cover two more failing cases with unit testsNick Mathewson
2017-03-16Fix an unreachable memory leak.Nick Mathewson
Also add a missing newline.
2017-03-16Remove digest[12]_hexNick Mathewson
2017-03-16Tweak&test log messages on apply_diffNick Mathewson
2017-03-16Fixes when applying diffs: Allow 2-line diffs, fix bogus freeNick Mathewson
The 2-line diff changs is needed to make the unit tests actually test the cases that they thought they were testing. The bogus free was found while testing those cases
2017-03-16Mark some warnings as bugs, and as (hopefully) unreachable.Nick Mathewson
2017-03-16Check for expected warnings in apply_ed_diffNick Mathewson