aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-12-23Fix a buffer overflow in setup_cfg() in src/test/test_voting_flags.cKris Katterjohn
signed_descriptor_digest has a length of DIGEST_LEN but the memset used to fill it used DIGEST256_LEN. Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2018-12-21Merge branch 'maint-0.3.5'Nick Mathewson
2018-12-21Merge branch 'maint-0.3.4' into maint-0.3.5Nick Mathewson
2018-12-21Merge branch 'orconn-tracker_squashed'Nick Mathewson
2018-12-21Add tests for bootstrap trackerTaylor Yu
Part of ticket 27617.
2018-12-21The big bootstrap phase redefinitionTaylor Yu
Redefine the set of bootstrap phases to allow display of finer-grained progress in the early connection stages of connecting to a relay. This includes adding intermediate phases for proxy and PT connections. Also add a separate new phase to indicate obtaining enough directory info to build circuits so we can report that independently of actually initiating an ORCONN to build the first application circuit. Previously, we would claim to be connecting to a relay when we had merely finished obtaining directory info. Part of ticket 27167.
2018-12-21Hook up control_event_bootstrap() to btrack_orconnTaylor Yu
Replace a few invocations of control_event_bootstrap() with calls from the bootstrap tracker subsystem. This mostly leaves behavior unchanged. The actual behavior changes come in the next commit. Part of ticket 27167.
2018-12-21Add a comment about bto_update_best.Taylor Yu
2018-12-21Fix priority on process subsystem level: it uses "net"Nick Mathewson
2018-12-21Merge branch 'ticket28847'Nick Mathewson
2018-12-21Don't initialize the process module manually in tests.Alexander Færøy
It's not longer needed for us to initialize the process module in tests. See: https://bugs.torproject.org/28847
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-21mainloop: Reactivate the linked connection event with a non empty listDavid Goulet
Linked connections aren't woken up by libevent due to I/O but rather artificially so we can, by chunks, empty the spooled object(s). Commit 5719dfb48f87a54aeb5982ff03345303bc058ebb (in 0.3.4.1-alpha) made it that the schedule_active_linked_connections_event would be only called once at startup but this is wrong because then we would never go through again the active linked connections. Fortunately, everytime a new linked connection is created, the event is activated and thus we would go through the active list again. On a busy relay, this issue is mitigated by that but on a slower relays or bridge, a connection could get stuck for a while until a new directory information request would show up. Fixes #28717, #28912
2018-12-20Add bootstrap tracker subsystemTaylor Yu
Add a tracker for bootstrap progress, tracking events related to origin circuit and ORCONN states. This uses the ocirc_event and orconn_event publish-subscribe subsystems. Part of ticket 27167.
2018-12-20Add LD_BTRACK log domain for bootstrap trackerTaylor Yu
Part of ticket 27167.
2018-12-20Add origin circuit event pubsub systemTaylor Yu
Add a publish-subscribe subsystem to publish messages about changes to origin circuits. Functions in circuitbuild.c and circuitlist.c publish messages to this subsystem. Move circuit event constants out of control.h so that subscribers don't have to include all of control.h to take actions based on messages they receive. Part of ticket 27167.
2018-12-20Add ORCONN event pubsub systemTaylor Yu
Add a publish-subscribe subsystem to publish messages about changes to OR connections. connection_or_change_state() in connection_or.c and control_event_or_conn_event() in control.c publish messages to this subsystem via helper functions. Move state constants from connection_or.h to orconn_state.h so that subscribers don't have to include all of connection_or.h to take actions based on changes in OR connection state. Move event constants from control.h for similar reasons. Part of ticket 27167.
2018-12-20Remove unused old_state var in connection_or.cTaylor Yu
connection_or_change_state() saved an old_state to pass to channel_tls_handle_state_change_on_orconn(), which promptly cast it to void. Remove this unused variable and parameter.
2018-12-20Merge remote-tracking branch 'tor-github/pr/609'Nick Mathewson
2018-12-20Escape the PT K/V data before sending it to the logger.Alexander Færøy
See: https://bugs.torproject.org/28846
2018-12-20Merge remote-tracking branch 'tor-github/pr/608'Nick Mathewson
2018-12-20Remove Process initializer/shutdown function from main.c.Alexander Færøy
See: https://bugs.torproject.org/28847
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-20Merge remote-tracking branch 'tor-github/pr/445'Nick Mathewson
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-20Remember to check for whether we actually did exit in tests.Alexander Færøy
See: https://bugs.torproject.org/28179
2018-12-20Add support for STATUS messages from Pluggable Transports.Alexander Færøy
This patch adds support for the new STATUS message that PT's can emit from their standard out. The STATUS message uses the `config_line_t` K/V format that was recently added in Tor. See: https://bugs.torproject.org/28846
2018-12-20Use K/V parser to handle LOG messages for pluggable transports.Alexander Færøy
This patch changes the LOG pluggable transport message to use the recent K/V parser that landed in Tor. This allows PT's to specify the log severity level as well as the message. A mapping between the PT log severity levels and Tor's log serverity level is provided. See: https://bugs.torproject.org/28846
2018-12-19Merge branch 'maint-0.3.5'Nick Mathewson
2018-12-19Merge branch 'ticket28883_035' into maint-0.3.5Nick Mathewson
2018-12-18Merge branch 'ticket28853'Nick Mathewson
2018-12-18Merge branch 'ticket28839_v2_squashed'Nick Mathewson
2018-12-18Avoid a needless decode/re-encode step in assigning onion keysNick Mathewson
Previously we had decoded the asn.1 to get a public key, and then discarded the asn.1 so that we had to re-encode the key to store it in the onion_pkey field of a microdesc_t or routerinfo_t. Now we can just do a tor_memdup() instead, which should be loads faster.
2018-12-18Use a single path for all PEM-like objects in get_next_token()Nick Mathewson
Previously, we would decode the PEM wrapper for keys twice: once in get_next_token, and once later in PEM decode. Now we just do all of the wrapper and base64 stuff in get_next_token, and store the base64-decoded part in the token object for keys and non-keys alike. This change should speed up parsing slightly by letting us skip a bunch of stuff in crypto_pk_read_*from_string(), including the tag detection parts of pem_decode(), and an extra key allocation and deallocation pair. Retaining the base64-decoded part in the token object will allow us to speed up our microdesc parsing, since it is the asn1 portion that we actually want to retain.
2018-12-18Merge branch 'maint-0.3.5'Nick Mathewson
2018-12-18Merge branch 'bug28612_squashed' into maint-0.3.5Nick Mathewson
2018-12-18Call run_tor_main_loop() in ntmain.c, rather than do_main_loop().Nick Mathewson
Fixes bug 28612; bugfix on 0.3.5.3-alpha.
2018-12-18Merge branch 'maint-0.3.5'Nick Mathewson
2018-12-18Merge branch 'ticket28881_035' into maint-0.3.5Nick Mathewson
2018-12-18Always initialize addr in parse_port_config()Nick Mathewson
It was always analyzed before use, but scan-build wasn't able to persuade itself of that. Closes ticket 28881.
2018-12-18Merge remote-tracking branch 'tor-github/pr/595'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-18Bump version to 0.3.5.6-rc-devNick Mathewson