aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-08-24prop224: Move and refactor rend_client_reextend_intro_circuit()David Goulet
This moves it to hs_client.c so it can be used by both system (legacy and prop224). For now, only the legacy system uses it. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24hs: Update the IP failure cache only if legacyDavid Goulet
Don't assert() on rend_data when closing circuits to report an IP failure. The prop224 code doesn't have yet the support for this. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Use the client-side circuitmap in hs_client.cGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Add client-side rend circuit support to HS circuitmapGeorge Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24hs: Only note a connection attempt with a valid rend_dataDavid Goulet
For now, prop224 doesn't have a mechanism to note down connection attempts so we only do it for legacy system using rend_data. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Handle RENDEZVOUS2 cellDavid Goulet
The client can now handle RENDEZVOUS2 cell when they arrive. This consolidate both hidden service version in one function. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Parse RENDEZVOUS2 cellDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24trunnel: Add RENDEZVOUS2 cell definitionDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Handle INTRODUCE_ACK cellDavid Goulet
The client is now able to handle an INTRODUCE_ACK cell and do the appropriate actions. An intro point failure cache is missing and a way to close all intro point that were launched in parallel. Some notes are in the comment for that. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Parse INTRODUCE_ACK cellDavid Goulet
Add a function to parse an INTRODUCE_ACK cell in hs_cell.c. Furthermore, add an enum that lists all possible expected status code. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Make client send INTRODUCE1 cellDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Client function to pick intro pointDavid Goulet
From an edge connection object, add a function that randomly pick an introduction point for the requested service. This follows the code design of rend_client_get_random_intro() and returns an extend_info_t object ready to be used to extend to. At this commit, it is not used yet. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Client callback when descriptor has arrivedDavid Goulet
When a descriptor fetch has completed and it has been successfully stored in the client cache, this callback will take appropriate actions to attach streams and/or launch neede circuits to connect to the service. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Handle client RENDEZVOUS_ESTABLISHED cellDavid Goulet
Client now handles a RENDEZVOUS_ESTABLISHED cell when it arrives on the rendezvous circuit. This new function applies for both the legacy system and prop224. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Build ESTABLISH_RENDEZVOUS cell and logicDavid Goulet
Add a function to build the cell. Add a the logic to send the cell when the rendezvous circuit opens. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Client has opened circuit logicDavid Goulet
Make a single entry point for the entire HS subsystem when a client circuit opens (every HS version). Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Build INTRODUCE1 cell and send logicDavid Goulet
Add a function in hs_cell.{c|h} for a client to build an INTRODUCE1 cell using an object that contains all the needed keys to do so. Add an entry point in hs_client.c that allows a tor client to send an INTRODUCE1 cell on a given introduction circuit. It includes the building of the cell, sending it and the setup of the rendezvous circuit with the circuit identifier. The entry point function is still unused at this commit. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Make lspecs to extend info publicDavid Goulet
The hs circuit file had this function that takes a list of link specifiers and return a newly allocated extend info object. Make it public so the client side can also use it to be able to extend to introduction point. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Helper function to assert on invalid client intro circuitDavid Goulet
Put all the possible assert() we can do on a client introduction circuit in one helper function to make sure it is valid and usable. It is disabled for now so gcc doesn't complain that we have a unused function. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24hs: Move link specifier encoding to a functionDavid Goulet
This commit only moves code into a function. The client code will need a way to take a bunch of descriptor link specifier object and encode them into link specifiers objects. Make this a public function so it can be used outside of hs_descriptor.c. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24conn: Add a function to return a list of connection by stateDavid Goulet
This will be useful to the hidden service subsystem that needs to go over all connections of a certain state to attach them to a hidden service circuit. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24test: Add tests for fetching descs and handling SOCKS conns.George Kadianakis
- Add tests that ensure that SOCKS requests for v2/v3 addresses get intercepted and handled. - Add test that stores and lookups an HS descriptor in the client-side cache. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24hs: Fix comment of the get max size descriptor functionDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Rename hs_client_note_connection_attempt_succeeded()David Goulet
This is a static function so don't polute the hs_client_ namespace. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Add the dir purpose HAS_FETCHEDDavid Goulet
Once a descriptor has been successfully downloaded from an HSDir, we flag the directory connection to "has fetched descriptor" so the connection subsystem doesn't trigger a new fetch on success. Same has DIR_PURPOSE_HAS_FETCHED_RENDDESC_V2 but for prop224. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Add client code to handle fetched HS descriptors.George Kadianakis
This code handles received HS descriptors by storing them in the client-side HS cache. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Introduce v2/v3 HS desc fetch retry functionality.George Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Connect to v3 services in connection_ap_handle_onion().George Kadianakis
Recognize and handle v3 addresses. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Add code that launches v3 HS desc fetches.George Kadianakis
Entry point is hs_client_refetch_v3_renddesc(). Will be used in subsequent commits. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Refactor pick_hsdir() to be used by both v2 and v3.George Kadianakis
Also refactor rendclient.c to use the new hs_pick_hdsir() func. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Refactor rendclient.c to use the new hsdir_req code.George Kadianakis
- Also add tests for the hidserv_req subsystem. - Introduce purge_v2_hidserv_req() wrapper to simplify v2 code. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Fix hidserv request code to work for both v2 and v3.George Kadianakis
See documentation of `last_hid_serv_requests_` for how it works. strmaps are cool! Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Move some rendclient.c code to hs_common.cGeorge Kadianakis
Specifically move the pick_hsdir() function and all the HSDir request tracking code. We plan to use all that code both for v2 and v3. This commit only moves code. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Add client-side HS descriptor cache.George Kadianakis
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-19prop224: Decouple the HS part of connection_ap_handshake_rewrite_and_attach().George Kadianakis
We will need to edit this function, and it's already pretty huge. Let's make it a bit smaller. This commit moves code, fixes a 80 char line and add two lines at the start to make it compile. Trivial change. Signed-off-by: David Goulet <dgoulet@torproject.org>
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-19prop224: Recompute all HSDir indices when we enter overlap mode.George Kadianakis
When we enter overlap mode we start using the next hsdir index of relays. However, we only compute the next hsdir index of relays when we receive a consensus or their descriptor. This means that there is a window of time between entering the overlap period and fetching the consensus where relays have their next hsdir index uninitialized. This patch fixes this by recomputing all hsdir indices when we first enter the overlap period.
2017-08-19prop224: Improve descriptor reupload logic.George Kadianakis
We want to reupload our descriptor if its set of responsible HSDirs changed to minimize reachability issues. This patch adds a callback everytime we get new dirinfo which checks if the hash ring changed and reuploads descriptor if needed.
2017-08-19test: Improve get_responsible_hsdirs test.George Kadianakis
2017-08-19prop224: Only upload descriptor if we have good hash ring and SRV.George Kadianakis
Make sure we have a live consensus (for SRV) and enough descriptors (for hash ring). Also fix unittests that broke.
2017-08-19prop224: Improve our checks for unset HSDir index.George Kadianakis
We used to not check next hsdir index.
2017-08-19sr: Log voting schedule at debug levelDavid Goulet
Because the HS subsystem calls it every second, change the log level to debug so it doesn't spam the info log. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-11Make Windows happy for time_t printf formatDavid Goulet
Our Windows compiler treats "time_t" as long long int but Linux likes it long int so cast those to make Windows happy. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-11test: Fix typing issues found by clangDavid Goulet
Partially fix #23224. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-11test: Fix memory leak in test_hs_common.cDavid Goulet
Partially fixes #23223 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-11test: Fix hs common test for WindowsDavid Goulet
Use the PATH_SEPARATOR for a path comparaison so it works with Windows as well. Partially fix #23223 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-11Merge branch 'ticket23220'Nick Mathewson
2017-08-11Raise MIN_DL_PER_REQUEST to 32Nick Mathewson
This change should improve overhead for downloading small numbers of descriptors and microdescriptors by improving compression performance and lowering directory request overhead. Closes ticket 23220.
2017-08-11Merge branch 'bug18982'Nick Mathewson
2017-08-11Add # to "hop N" messages to disambiguate from old messages.Nick Mathewson