aboutsummaryrefslogtreecommitdiff
path: root/src/lib
AgeCommit message (Collapse)Author
2019-01-16Bump copyright date to 2019Nick Mathewson
2019-01-14Merge remote-tracking branch 'asn-github/adaptive_padding-final'Nick Mathewson
2019-01-14Merge remote-tracking branch 'teor/bug29015'Nick Mathewson
2019-01-11Actually close the stdout pipe on error in process_unix_execKris Katterjohn
When cleaning up after an error in process_unix_exec, the stdin pipe was being double closed instead of closing both the stdin and stdout pipes. This occurred in two places. Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-01-11Include the beginnings of a FAQ about which timer to use.Nick Mathewson
2019-01-11Add some more type checking.Taylor R Campbell
NOTE: This commit breaks the build, because there was a mistake in an earlier change of exactly the sort that this is meant to detect! I'm leaving it broken for illustration.
2019-01-11Use the distribution abstraction as an abstraction.Taylor R Campbell
2019-01-11Move ceil call back into the geometric sampler.Taylor R Campbell
Test exactly what the geometric sampler returns, because that's what the downstream callers of it are going to use. While here, also assert that the geometric sampler returns a positive integer. (Our geometric distribution is the one suported on {1, 2, 3, ...} that returns the number of trials before the first success, not the one supported on {0, 1, 2, ...} that returns the number of failures before the first success.)
2019-01-10Rename crypto_rand_uint32() -> crypto_rand_u32()George Kadianakis
See https://github.com/torproject/tor/pull/624#discussion_r246453777
2019-01-09Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-09Merge remote-tracking branch 'tor-github/pr/636' into maint-0.3.5Nick Mathewson
2019-01-09Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-09Fix (and make consistent) the use of OpenBSD preprocessor macro testsKris Katterjohn
Prior to this commit, the testsuite was failing on OpenBSD. After this commit the testsuite runs fine on OpenBSD. It was previously decided to test for the OpenBSD macro (rather than __OpenBSD__, etc.) because OpenBSD forks seem to have the former macro defined. sys/param.h must be included for the OpenBSD macro definition; however, many files tested for the OpenBSD macro without having this header included. This commit includes sys/param.h in the files where the OpenBSD macro is used (and sys/param.h is not already included), and it also changes some instances of the __OpenBSD__ macro to OpenBSD. See commit 27df23abb675ffeb198bf0c1cc85c4baed77a988 which changed everything to use OpenBSD instead of __OpenBSD__ or OPENBSD. See also tickets #6982 and #20980 (the latter ticket is where it was decided to use the OpenBSD macro). Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-01-09Merge branch 'ticket28856_v2'Nick Mathewson
2019-01-08lib/net: improve the docs for tor_{ersatz_,}socketpair()teor
Add some details about IP family support, and point to tor_socketpair() from tor_ersatz_socketpair(). Closes ticket 29015.
2019-01-07Fix tor_ersatz_socketpair on IPv6-only systemsKris Katterjohn
In get_local_listener used by tor_ersatz_socketpair, the address family used when binding the IPv6 socket was AF_INET instead of AF_INET6. Fixes bug 28995; bugfix on 0.3.5.1-alpha. Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-01-03Add a #ifdef HAVE_UNISTD_H check to buffers.cNick Mathewson
Reported on tor-dev by Gisle Vanem. Bug not in any released Tor (The suggested patch used _MSC_VER, but that's not how we do stuff with autoconf. With autoconf, you detect the feature you want, rather than trying to list all the systems that do or do not have it.)
2019-01-03Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-03Merge branch 'ticket28851_035_squashed' into maint-0.3.5Nick Mathewson
2019-01-03Stop re-checking our hardcoded dh parameters on every startupNick Mathewson
Closes ticket 28851.
2019-01-03Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-03Merge remote-tracking branch 'public/ticket28838_035' into maint-0.3.5Nick Mathewson
2019-01-03Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-03Merge branch 'maint-0.3.4' into maint-0.3.5Nick Mathewson
2019-01-02Merge branch 'maint-0.3.5'Nick Mathewson
2019-01-02Add an errno.h include to freespace.c to fix bug 28974.Nick Mathewson
2019-01-02Concentrate all TOR_USEC_PER_SEC definitions in a single header file.George Kadianakis
Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
2019-01-02Implement and test probability distributions used by WTF-PAD.George Kadianakis
This project introduces the prob_distr.c subsystem which implements all the probability distributions that WTF-PAD needs. It also adds unittests for all of them. Code and tests courtesy of Riastradh. Co-authored-by: Taylor R Campbell <campbell+tor@mumble.net> Co-authored-by: Mike Perry <mikeperry-git@torproject.org>
2019-01-02Circuit padding tests.George Kadianakis
Co-authored-by: George Kadianakis <desnacked@riseup.net>
2019-01-02Provide a smartlist reverse-order traversal.Mike Perry
We need this for padding negotiation so that we can have later machine revisions supercede earlier ones. Co-authored-by: George Kadianakis <desnacked@riseup.net>
2018-12-21Merge branch 'orconn-tracker_squashed'Nick Mathewson
2018-12-21Fix priority on process subsystem level: it uses "net"Nick Mathewson
2018-12-21Merge branch 'ticket28847'Nick Mathewson
2018-12-21Fix typo in time_sys.h.Alexander Færøy
2018-12-21Use the subsystem list to initialize and shutdown process module.Alexander Færøy
This patch makes the process module use the subsystem list for initializing and shutting down. See: https://bugs.torproject.org/28847
2018-12-20Add LD_BTRACK log domain for bootstrap trackerTaylor Yu
Part of ticket 27167.
2018-12-20Merge remote-tracking branch 'tor-github/pr/608'Nick Mathewson
2018-12-20Forward declare smartlist_t in process.hAlexander Færøy
This allows other libraries to include process.h without including the smartlist_t headers first. See: https://bugs.torproject.org/28847
2018-12-20No need to log ordinary EOF conditions as LOG_WARN.Alexander Færøy
Let's not use log_warn() when a pipe is closed under what should be considered normal conditions. See: https://bugs.torproject.org/28179
2018-12-20Make example CancelIoEx() code use CancelIo().Alexander Færøy
This patch changes the CancelIoEx() example code to use CancelIo(), which is available for older versions of Windows too. I still think the kernel handles this nicely by sending broken pipes if either side closes the pipe while I/O operations are pending. See: https://bugs.torproject.org/28179
2018-12-20Handle ERROR_BROKEN_PIPE in completion routines.Alexander Færøy
Handle `ERROR_BROKEN_PIPE` from ReadFileEx() and WriteFileEx() in process_win32_stdin_write_done() and process_win32_handle_read_completion() instead of in the early handler. This most importantmly makes sure that `reached_eof` is set to true when these errors appears. See: https://bugs.torproject.org/28179
2018-12-20Remember to set `reached_eof` when our handles are reporting errors.Alexander Færøy
This patch adds some missing calls to set `reached_eof` of our handles when various error conditions happens or when we close our handle (which happens at `process_terminate()`. See: https://bugs.torproject.org/28179
2018-12-20Handle errors even after success from ReadFileEx() and WriteFileEx().Alexander Færøy
This patch adds some additional error checking after calls to ReadFileEx() and WriteFileEx(). I have not managed to get this code to reach the branch where `error_code` is NOT `ERROR_SUCCESS`, but MSDN says one should check for this condition so we do so just to be safe. See: https://bugs.torproject.org/28179
2018-12-20Delay checking process for termination until both stdout and stderr are closed.Alexander Færøy
This patch makes us delay checking for whether we have an exit code value (via GetExitCodeProcess()) until both stdout and stderr have been closed by the operating system either by the process itself or by process cleanup after termination. See: https://bugs.torproject.org/28179
2018-12-20Remember to close the child process' ends of the pipes.Alexander Færøy
This prevents us from leaking the HANDLE for stdout, stderr, and stdin. See: https://bugs.torproject.org/28179
2018-12-18Merge branch 'ticket28839_v2_squashed'Nick Mathewson
2018-12-18Avoid breaking the event loop prematurely.Alexander Færøy
This patch makes sure that we terminate the event loop from the event loop timer instead of directly in the process' exit handler. This allows us to run the event loop an additional time to ensure that the SleepEx() call on Windows is called and the data from stdout/stderr is delivered to us. Additionally we ensure that we don't try to read or write data from a Unix process that have been terminated in the main loop, since its file descriptors are closed at that time. See: https://bugs.torproject.org/28179
2018-12-17lib/process may include lib/buf.Nick Mathewson
2018-12-17Update location of buffers.hNick Mathewson
2018-12-17Merge branch 'ticket28179_squashed' into ticket28179_squashed_mergedNick Mathewson