summaryrefslogtreecommitdiff
path: root/src/or/control.c
AgeCommit message (Collapse)Author
2018-02-07Fix spelling mistakes corresponding to ticket #23650Deepesh Pathak
2017-12-08Merge branch 'macro_free_v2_squashed'Nick Mathewson
2017-12-08Convert remaining function (mostly static) to new free styleNick Mathewson
2017-12-05Initialize pk so that older gcc versions don't freak out.Nick Mathewson
2017-12-05Merge branch 'more_directories_squashed'Nick Mathewson
2017-12-05New accessors for keydir/cachedir accessNick Mathewson
This patch is a result of auditing all of our uses of get_datadir_fname() and its kin, and dividing them into cache vs keys vs other data. The new get_keydir_fname() and get_cachedir_fname() functions don't actually do anything new yet.
2017-12-05control: Improve ADD_ONION helper function commentsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: Don't use void pointer for ADD_ONION secret keyDavid Goulet
Make this a bit more safe with at least type checking of the pointers depending on the version. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: HSPOST command support for v3David Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: Don't check if Server is an HSDir for HSPOSTDavid Goulet
This is removed for two reasons. First, HSDir accepts descriptor even though they don't think they are in fact an HSDir. This is to avoid consensus desync between client/service and directories. Second, our malicious HSDir scanner uses the HSPOST command to post on all relays in order to test them before they could become HSDir. We had to remove that check from the tor code that the scanner uses. Thus, this check should not be enforced by the control port for the above use cases. It is also a bit more complex with v3 support for which not all HSDir support it so basically irrelevant check. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: Support HS v3 for CIRC and CIRC_MINOR eventDavid Goulet
"REND_QUERY=" can now output a v3 address. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC UPLOAD eventDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC CREATED eventDavid Goulet
This makes the REPLICA= field optional for the control port event. A v2 service will always pass it and v3 is ignored. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC RECEIVED eventDavid Goulet
Adds a v3 specific function to handle a received event. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC FAILED eventDavid Goulet
A new v3 specific function has been added named control_event_hsv3_descriptor_failed(). The HS v3 subsystem now uses it. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC REQUESTED eventDavid Goulet
This changes the control_event_hs_descriptor_requested() call to add the hsdir index optional value. v2 passes NULL all the time. This commit creates hs_control.{c|h} that contains wrappers for the HS subsystem to interact with the control port subsystem. The descriptor REQUESTED event is implemented following proposal 284 extension for v3. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: Rename two HS v2 specific functionsDavid Goulet
Make control_event_hs_descriptor_received() and control_event_hs_descriptor_failed() v2 specific because they take a rend_data_t object and v3 will need to pass a different object. No behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: Refactor control_event_hs_descriptor_receive_endDavid Goulet
First, rename and make that function static because it is internal to control.c and called by two HS_DESC events. Second, make it take more basic parameters and thus not a rend_data_t object so we can still use the function for v3 HS that doesn't use that object. Third, move the descriptor ID lookup to the two specific events (yes little code duplication there) because they get a rend_data_t object which won't be the case for v3. Finally, through this refactoring, change the pointer check to BUG() and change some parameter names to reflect what they really are. No behavior change at this commit. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05control: Refactor HS_DESC events functions to not be v2 specificDavid Goulet
This is a naming refactor mostly _except_ for a the events' function that take a rend_data_t which will require much more refactoring. No behavior change at this commit, cleanup and renaming stuff to not be only v2 specific. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Add ephemeral service supportDavid Goulet
The functions are now used by the ADD_ONION/DEL_ONION control port command as well. This commits makes them fully functionnal with hidden service v3. Part of #20699 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-20hs: Rename rend_service_add_ephemeral_status_tDavid Goulet
Move it to hs_common.h and rename it "hs_service_add_ephemeral_status_t". It will be shared between v2 and v3 services. Part of #20699 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-20control: Support HSv3 interface for ADD_ONIONDavid Goulet
At this commit, the key handling and generation is supported for a v3 service (ED25519-V3). However, the service creation is not yet implemented. This only adds the interface and code to deal with the new ED25519-V3 key type. Tests have been updated for RSA key type but nothing yet for ED25519-v3. Part of #20699 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-20control: Implement GETINFO hs/service/desc/id/<ADDR> for HSv3David Goulet
Part of #20699 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-20control: Implement GETINFO hs/client/desc/id/<ADDR> for HSv3David Goulet
Part of #20699 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-14Merge branch 'maint-0.3.2'Nick Mathewson
2017-11-10control: Fix wrong Action on failure to upload an HS descriptorDavid Goulet
On failure to upload, the HS_DESC event would report "UPLOAD_FAILED" as the Action but it should have reported "FAILED" according to the spec. Fixes #24230 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-01Merge remote-tracking branch 'public/owning_control_fd'Nick Mathewson
2017-10-20Return instead of exiting in options_init_from_torrc()Nick Mathewson
2017-10-19Comment-only change: annotate exit() calls.Nick Mathewson
Sometimes when we call exit(), it's because the process is completely hopeless: openssl has a broken AES-CTR implementation, or the clock is in the 1960s, or something like that. But sometimes, we should return cleanly from tor_main() instead, so that embedders can keep embedding us and start another Tor process. I've gone through all the exit() and _exit() calls to annotate them with "exit ok" or "XXXX bad exit" -- the next step will be to fix the bad exit()s. First step towards 23848.
2017-10-18Add __OwningControllerFD to allow controllers without controlportsNick Mathewson
This feature should help programs that want to launch and manage a Tor process, as well as programs that want to launch and manage a Tor instance in a separate thread. Right now, they have to open a controlport, and then connect to it, with attendant authentication issues. This feature allows them to just start with an authenticated connection. Bug 23900.
2017-09-15Replace accumulated C ;;s with ;sNick Mathewson
I don't know where these came from.
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-15Merge remote-tracking branch 'dgoulet/ticket19254_032_01'Nick Mathewson
2017-09-15Make control port download status next attempts consistentteor
Make download status next attempts reported over the control port consistent with the time used by tor. This issue only occurs if a download status has not been reset before it is queried over the control port. Fixes 23525, not in any released version of tor.
2017-09-14Refactor control_event_bootstrap_problemTaylor Yu
Change the contract of control_event_bootstrap_problem() to be more general and to take a connection_t. New function control_event_bootstrap_prob_or() has the specific or_connection_t funcionality previously used.
2017-09-08Merge branch 'ed25519_lookup'Nick Mathewson
2017-09-08Merge branch 'maint-0.3.1'Nick Mathewson
2017-09-08Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-09-08Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-09-08Merge branch 'ticket22377'Nick Mathewson
2017-09-07Fix crashes on empty +HSPOST and +POSTDESCRIPTOR commandsNick Mathewson
Fixes bug 22644; bugfix on 0.2.7.1-alpha and 0.2.0.1-alpha respectively.
2017-09-05Repair buffer API so everything starts with buf_.Nick Mathewson
Our convention is that functions which manipulate a type T should be named T_foo. But the buffer functions were super old, and followed all kinds of conventions. Now they're uniform. Here's the perl I used to do this: \#!/usr/bin/perl -w -i -p s/read_to_buf\(/buf_read_from_socket\(/; s/flush_buf\(/buf_flush_to_socket\(/; s/read_to_buf_tls\(/buf_read_from_tls\(/; s/flush_buf_tls\(/buf_flush_to_tls\(/; s/write_to_buf\(/buf_add\(/; s/write_to_buf_compress\(/buf_add_compress\(/; s/move_buf_to_buf\(/buf_move_to_buf\(/; s/peek_from_buf\(/buf_peek\(/; s/fetch_from_buf\(/buf_get_bytes\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/buf_remove_from_front\(/buf_drain\(/; s/peek_buf_startswith\(/buf_peek_startswith\(/; s/assert_buf_ok\(/buf_assert_ok\(/;
2017-09-05Move protocol-specific functions out of buffers.cNick Mathewson
This commit does not change the implementation of any function: it only moves code and adds new includes as necessary. Part of #23149.
2017-08-24Remove the AUTHDIR_NEWDESCS feature: nobody is using it any moreNick Mathewson
If somebody asks for it, log a warning. Closes ticket 22377.
2017-08-24Merge remote-tracking branch 'dgoulet/ticket17242_032_03-squashed'Nick Mathewson
2017-08-24Merge branch 'bug19281_025'Nick Mathewson
2017-08-22Refactor node lookup APIs to take flagsNick Mathewson
Right now there's a single warn_if_unnamed flag for router_get_consensus_status_by_nickname() and node_get_by_nickname(), that is nearly always 1. I've turned it into an 'unsigned' bitfield, and inverted its sense. I've added the flags argument to node_get_by_hex_id() too, though it does nothing there right now. I've removed the router_get_consensus_status_by_nickname() function, since it was only used in once place. This patch changes the warning behavior of GETINFO ns/name/<name>, since all other name lookups from the controller currently warn. Later I'm going to add more flags, for ed25519 support.
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-08-09Make write_escaped_data more robust to large inputs.Nick Mathewson
The old implementation would fail with super-long inputs. We never gave it any, but still, it's nicer to dtrt here. Reported by Guido Vranken. Fixes bug 19281.
2017-07-05Make the strings from #1667 static.Nick Mathewson