]> git.ipfire.org Git - thirdparty/tor.git/log
thirdparty/tor.git
8 years agoRe-run trunnel. Cosmetic changes only.
Nick Mathewson [Thu, 24 Aug 2017 20:13:01 +0000 (16:13 -0400)] 
Re-run trunnel. Cosmetic changes only.

8 years agoMerge branch 'ahf_bug22497_redux'
Nick Mathewson [Thu, 24 Aug 2017 20:11:43 +0000 (16:11 -0400)] 
Merge branch 'ahf_bug22497_redux'

8 years agoChanges file for 22497
Nick Mathewson [Thu, 24 Aug 2017 20:11:08 +0000 (16:11 -0400)] 
Changes file for 22497

8 years agoEnsure that `make check-spaces` is happy.
Alexander Færøy [Mon, 5 Jun 2017 14:38:20 +0000 (14:38 +0000)] 
Ensure that `make check-spaces` is happy.

The `test-operator-cleanup` patch, and related coccinelle patches,
don't do any checks for line length. This patch fixes the line
length issues caused by the previous commits.

8 years agoapply ahf's test_assert_null.cocci
Nick Mathewson [Thu, 24 Aug 2017 19:55:27 +0000 (15:55 -0400)] 
apply ahf's test_assert_null.cocci

8 years agoapply ahf's test_assert_int.cocci
Nick Mathewson [Thu, 24 Aug 2017 19:49:59 +0000 (15:49 -0400)] 
apply ahf's test_assert_int.cocci

8 years agoapply ahf's test_assert_zero.cocci
Nick Mathewson [Thu, 24 Aug 2017 19:34:34 +0000 (15:34 -0400)] 
apply ahf's test_assert_zero.cocci

8 years agoApply ahf's ceil_div.cocci patch.
Nick Mathewson [Thu, 24 Aug 2017 19:33:27 +0000 (15:33 -0400)] 
Apply ahf's ceil_div.cocci patch.

8 years agoFix a needless line-continuation in aes.c
Nick Mathewson [Thu, 24 Aug 2017 19:32:30 +0000 (15:32 -0400)] 
Fix a needless line-continuation in aes.c

coccinelle was getting confused

8 years agoApply test-operator-cleanup to src/common too.
Nick Mathewson [Thu, 24 Aug 2017 19:26:57 +0000 (15:26 -0400)] 
Apply test-operator-cleanup to src/common too.

8 years agoFix operator usage in src/test/*.c
Alexander Færøy [Mon, 5 Jun 2017 14:23:02 +0000 (14:23 +0000)] 
Fix operator usage in src/test/*.c

This patch fixes the operator usage in src/test/*.c to use the symbolic
operators instead of the normal C comparison operators.

This patch was generated using:

    ./scripts/coccinelle/test-operator-cleanup src/test/*.[ch]

8 years agoAdd Coccinelle patch for replacing NULL/non-NULL tt_assert().
Alexander Færøy [Mon, 5 Jun 2017 15:54:21 +0000 (15:54 +0000)] 
Add Coccinelle patch for replacing NULL/non-NULL tt_assert().

This patch replaces tt_assert() checks for NULL/non-NULL values with
tt_ptr_op().

8 years agoAdd Coccinelle patch for replacing tt_assert() usage on integer types.
Alexander Færøy [Mon, 5 Jun 2017 15:22:11 +0000 (15:22 +0000)] 
Add Coccinelle patch for replacing tt_assert() usage on integer types.

This patch replaces tt_assert() comparison of integers and unsigned
integers with their respective tt_int_op or tt_uint_op counterpart.

8 years agoAdd Coccinelle patch for replacing tt_assert(0) with tt_abort().
Alexander Færøy [Mon, 5 Jun 2017 15:19:46 +0000 (15:19 +0000)] 
Add Coccinelle patch for replacing tt_assert(0) with tt_abort().

8 years agoAdd Coccinelle patch for detecing places where CEIL_DIV should be used.
Alexander Færøy [Mon, 5 Jun 2017 14:45:53 +0000 (14:45 +0000)] 
Add Coccinelle patch for detecing places where CEIL_DIV should be used.

8 years agoAdd script for cleaning op operator usage in test files.
Alexander Færøy [Mon, 5 Jun 2017 14:20:39 +0000 (14:20 +0000)] 
Add script for cleaning op operator usage in test files.

This patch adds a script written by Nick for bug #13172 to clean up the
usage of ==, !=, <, >, <=, and >= by replacing them with their symbolic
OP_* counterpart. This will ensure that a tool like Coccinelle doesn't
get confused and silently ignore large blocks of code.

8 years agoMerge remote-tracking branch 'dgoulet/ticket17242_032_03-squashed'
Nick Mathewson [Thu, 24 Aug 2017 19:12:16 +0000 (15:12 -0400)] 
Merge remote-tracking branch 'dgoulet/ticket17242_032_03-squashed'

8 years agoSilence some spammy log messages.
George Kadianakis [Thu, 24 Aug 2017 16:09:25 +0000 (19:09 +0300)] 
Silence some spammy log messages.

8 years agocircuit: Consider v3 hidden service circuit in circuit_expire_building()
David Goulet [Thu, 24 Aug 2017 13:31:30 +0000 (09:31 -0400)] 
circuit: Consider v3 hidden service circuit in circuit_expire_building()

For a ready v3 rendezvous circuit, consider it so we don't expire.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Update intro circuit timestamp when re-extending
David Goulet [Thu, 24 Aug 2017 13:12:57 +0000 (09:12 -0400)] 
hs: Update intro circuit timestamp when re-extending

A client can re-extend up to 3 intro points on the same circuit. This happens
when we get NACKed by the intro point for which we choose a new intro and
re-extend the circuit to it.

That process can be arbitrarly long so reset the dirty timestamp of the
circuit everytime we choose to re-extend so we get a bit more time to actually
do our introduction.

This is a client circuit so it is short live once opened thus giving us a bit
more time to complete the introduction is ok.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agocircuit: Avoid needless log info in circuit_get_best()
David Goulet [Thu, 24 Aug 2017 13:00:18 +0000 (09:00 -0400)] 
circuit: Avoid needless log info in circuit_get_best()

When looking for an introduction circuit in circuit_get_best(), we log an info
message if we are about to launch a new intro circuit in parallel. However,
the condition was considering marked for close circuit leading to the function
triggering the log info even though there is actually no valid intro circuit.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Register RP circuit when it opens
David Goulet [Thu, 24 Aug 2017 12:49:24 +0000 (08:49 -0400)] 
prop224: Register RP circuit when it opens

Only register the RP circuit when it opens and not when we send the INTRODUCE1
cell else, when re-extending to a new IP, we would register the same RP
circuit with the same cookie twice leading to the circuit being closed.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Try to recover from a bad intro circuit
David Goulet [Wed, 23 Aug 2017 15:15:25 +0000 (11:15 -0400)] 
prop224: Try to recover from a bad intro circuit

Changed the assert_intro_circ_ok() to an almost non fatal function so tor can
recover properly. We keep the anonymity assert because if that is not right,
we have much deeper problems and client should stop sending bytes to the
network immediately.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Refactor how we use connection_ap_handle_onion
David Goulet [Wed, 23 Aug 2017 14:48:48 +0000 (10:48 -0400)] 
prop224: Refactor how we use connection_ap_handle_onion

Simply directly return its returned value.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Remove unused rend_client_rendezvous_acked()
David Goulet [Tue, 22 Aug 2017 19:03:19 +0000 (15:03 -0400)] 
hs: Remove unused rend_client_rendezvous_acked()

This function has been replaced by hs_client_receive_rendezvous_acked(() doing
the same exact thing for both v2 and v3 service.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a function to find an intro point by legacy ID
David Goulet [Tue, 22 Aug 2017 18:51:27 +0000 (14:51 -0400)] 
prop224: Add a function to find an intro point by legacy ID

The client needs to find the right intro point object from the circuit
identity digest it is opened to. This new function does that.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a function to clear INTRO data
David Goulet [Tue, 22 Aug 2017 18:37:33 +0000 (14:37 -0400)] 
prop224: Add a function to clear INTRO data

New function named hs_cell_introduce1_data_clear() is introduced to clear off
an hs_cell_introduce1_data_t object.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Rename hs_desc_encode_lspec()
David Goulet [Tue, 22 Aug 2017 18:12:49 +0000 (14:12 -0400)] 
prop224: Rename hs_desc_encode_lspec()

Give it a name that shows the transition from a descriptor link spec to a
trunnel link spec.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Stub link_specifier_t in hs_descriptor.h
David Goulet [Tue, 22 Aug 2017 18:10:30 +0000 (14:10 -0400)] 
hs: Stub link_specifier_t in hs_descriptor.h

Avoid including a huge trunnel interface everytime we include hs_descriptor.h

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Update OOM counters when storing a client descriptor cache object
David Goulet [Tue, 22 Aug 2017 15:30:11 +0000 (11:30 -0400)] 
prop224: Update OOM counters when storing a client descriptor cache object

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Update OOM counters when freeing a client descriptor cache object
David Goulet [Tue, 22 Aug 2017 15:27:47 +0000 (11:27 -0400)] 
prop224: Update OOM counters when freeing a client descriptor cache object

When we free a client descriptor cache object, tell the OOM handler.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Check decoded descriptor matches the expected blinded key
David Goulet [Tue, 22 Aug 2017 13:02:23 +0000 (09:02 -0400)] 
prop224: Check decoded descriptor matches the expected blinded key

When a client decodes a descriptor, make sure it matches the expected blinded
key which is derived from the hidden service identity key.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Fix broken HS upload descriptor test
David Goulet [Fri, 11 Aug 2017 19:41:23 +0000 (15:41 -0400)] 
test: Fix broken HS upload descriptor test

We can't trigger a valid upload because it would require us to MOCK a long
list of functions ultimately not really testing the upload because we aren't
on a running network.

Signed-off-by: David Goulet <dgoulet@torproject.org>
Conflicts:
src/test/test_hs_service.c

8 years agoprop224: Add directory_request_fetch_set_hs_ident()
David Goulet [Wed, 9 Aug 2017 15:45:29 +0000 (11:45 -0400)] 
prop224: Add directory_request_fetch_set_hs_ident()

Needed by the client when fetching a descriptor. This function checks the
directory purpose and hard assert if it is not for fetching.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Implement hs_client_any_intro_points_usable()
David Goulet [Thu, 27 Jul 2017 21:15:19 +0000 (17:15 -0400)] 
prop224: Implement hs_client_any_intro_points_usable()

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Use the intro point state cache
David Goulet [Thu, 27 Jul 2017 21:06:42 +0000 (17:06 -0400)] 
prop224: Use the intro point state cache

This commit makes the client use the intro point state cache. It notes down
when we get a NACK from the intro point and then uses that cache to decide if
it should either close the circuits or re-extend to a new intro point.

This also introduces a very useful function that checks if an intro point is
usable that is query the state cache and checks a series of requirement.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add a client intro point state cache
David Goulet [Thu, 27 Jul 2017 19:51:32 +0000 (15:51 -0400)] 
prop224: Add a client intro point state cache

This cache keeps track of the state of intro points which is needed when we
have failures when using them. It is similar to the failure cache of the
legacy system.

At this commit, it is unused but initialized, cleanup and freed.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Move and refactor rend_client_reextend_intro_circuit()
David Goulet [Thu, 27 Jul 2017 16:37:52 +0000 (12:37 -0400)] 
prop224: Move and refactor rend_client_reextend_intro_circuit()

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>
8 years agohs: Update the IP failure cache only if legacy
David Goulet [Tue, 25 Jul 2017 15:37:55 +0000 (11:37 -0400)] 
hs: Update the IP failure cache only if legacy

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>
8 years agoprop224: Use the client-side circuitmap in hs_client.c
George Kadianakis [Tue, 25 Jul 2017 09:17:20 +0000 (12:17 +0300)] 
prop224: Use the client-side circuitmap in hs_client.c

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add client-side rend circuit support to HS circuitmap
George Kadianakis [Tue, 25 Jul 2017 09:05:02 +0000 (12:05 +0300)] 
prop224: Add client-side rend circuit support to HS circuitmap

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agohs: Only note a connection attempt with a valid rend_data
David Goulet [Tue, 25 Jul 2017 14:31:44 +0000 (10:31 -0400)] 
hs: Only note a connection attempt with a valid rend_data

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>
8 years agoprop224: Handle RENDEZVOUS2 cell
David Goulet [Tue, 25 Jul 2017 14:14:00 +0000 (10:14 -0400)] 
prop224: Handle RENDEZVOUS2 cell

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>
8 years agoprop224: Parse RENDEZVOUS2 cell
David Goulet [Sun, 23 Jul 2017 17:01:00 +0000 (13:01 -0400)] 
prop224: Parse RENDEZVOUS2 cell

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotrunnel: Add RENDEZVOUS2 cell definition
David Goulet [Sun, 23 Jul 2017 19:04:59 +0000 (15:04 -0400)] 
trunnel: Add RENDEZVOUS2 cell definition

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Handle INTRODUCE_ACK cell
David Goulet [Fri, 21 Jul 2017 21:48:18 +0000 (17:48 -0400)] 
prop224: Handle INTRODUCE_ACK cell

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>
8 years agoprop224: Parse INTRODUCE_ACK cell
David Goulet [Fri, 21 Jul 2017 21:06:04 +0000 (17:06 -0400)] 
prop224: Parse INTRODUCE_ACK cell

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>
8 years agoprop224: Make client send INTRODUCE1 cell
David Goulet [Fri, 21 Jul 2017 20:31:27 +0000 (16:31 -0400)] 
prop224: Make client send INTRODUCE1 cell

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Client function to pick intro point
David Goulet [Fri, 21 Jul 2017 19:19:32 +0000 (15:19 -0400)] 
prop224: Client function to pick intro point

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>
8 years agoprop224: Client callback when descriptor has arrived
David Goulet [Fri, 21 Jul 2017 18:32:47 +0000 (14:32 -0400)] 
prop224: Client callback when descriptor has arrived

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>
8 years agoprop224: Handle client RENDEZVOUS_ESTABLISHED cell
David Goulet [Fri, 21 Jul 2017 18:20:37 +0000 (14:20 -0400)] 
prop224: Handle client RENDEZVOUS_ESTABLISHED cell

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>
8 years agoprop224: Build ESTABLISH_RENDEZVOUS cell and logic
David Goulet [Fri, 21 Jul 2017 17:57:10 +0000 (13:57 -0400)] 
prop224: Build ESTABLISH_RENDEZVOUS cell and logic

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>
8 years agoprop224: Client has opened circuit logic
David Goulet [Fri, 21 Jul 2017 17:56:10 +0000 (13:56 -0400)] 
prop224: Client has opened circuit logic

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>
8 years agoprop224: Build INTRODUCE1 cell and send logic
David Goulet [Fri, 14 Jul 2017 14:16:48 +0000 (10:16 -0400)] 
prop224: Build INTRODUCE1 cell and send logic

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>
8 years agoprop224: Make lspecs to extend info public
David Goulet [Tue, 18 Jul 2017 19:17:37 +0000 (15:17 -0400)] 
prop224: Make lspecs to extend info public

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>
8 years agoprop224: Helper function to assert on invalid client intro circuit
David Goulet [Thu, 29 Jun 2017 17:29:23 +0000 (13:29 -0400)] 
prop224: Helper function to assert on invalid client intro circuit

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>
8 years agohs: Move link specifier encoding to a function
David Goulet [Tue, 18 Jul 2017 17:56:19 +0000 (13:56 -0400)] 
hs: Move link specifier encoding to a function

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>
8 years agoconn: Add a function to return a list of connection by state
David Goulet [Tue, 18 Jul 2017 15:41:41 +0000 (11:41 -0400)] 
conn: Add a function to return a list of connection by state

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>
8 years agotest: Add tests for fetching descs and handling SOCKS conns.
George Kadianakis [Thu, 1 Jun 2017 11:35:39 +0000 (14:35 +0300)] 
test: Add tests for fetching descs and handling SOCKS conns.

- 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>
8 years agohs: Fix comment of the get max size descriptor function
David Goulet [Tue, 27 Jun 2017 13:28:15 +0000 (09:28 -0400)] 
hs: Fix comment of the get max size descriptor function

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Rename hs_client_note_connection_attempt_succeeded()
David Goulet [Wed, 28 Jun 2017 18:20:28 +0000 (14:20 -0400)] 
prop224: Rename hs_client_note_connection_attempt_succeeded()

This is a static function so don't polute the hs_client_ namespace.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add the dir purpose HAS_FETCHED
David Goulet [Tue, 27 Jun 2017 13:46:16 +0000 (09:46 -0400)] 
prop224: Add the dir purpose HAS_FETCHED

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>
8 years agoprop224: Add client code to handle fetched HS descriptors.
George Kadianakis [Thu, 1 Jun 2017 11:25:46 +0000 (14:25 +0300)] 
prop224: Add client code to handle fetched HS descriptors.

This code handles received HS descriptors by storing them in the
client-side HS cache.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Introduce v2/v3 HS desc fetch retry functionality.
George Kadianakis [Thu, 1 Jun 2017 11:22:17 +0000 (14:22 +0300)] 
prop224: Introduce v2/v3 HS desc fetch retry functionality.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Connect to v3 services in connection_ap_handle_onion().
George Kadianakis [Thu, 1 Jun 2017 11:17:49 +0000 (14:17 +0300)] 
prop224: Connect to v3 services in connection_ap_handle_onion().

Recognize and handle v3 addresses.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Add code that launches v3 HS desc fetches.
George Kadianakis [Thu, 1 Jun 2017 11:12:33 +0000 (14:12 +0300)] 
prop224: Add code that launches v3 HS desc fetches.

Entry point is hs_client_refetch_v3_renddesc().

Will be used in subsequent commits.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Refactor pick_hsdir() to be used by both v2 and v3.
George Kadianakis [Thu, 1 Jun 2017 11:07:53 +0000 (14:07 +0300)] 
prop224: Refactor pick_hsdir() to be used by both v2 and v3.

Also refactor rendclient.c to use the new hs_pick_hdsir() func.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Refactor rendclient.c to use the new hsdir_req code.
George Kadianakis [Thu, 1 Jun 2017 11:01:48 +0000 (14:01 +0300)] 
prop224: Refactor rendclient.c to use the new hsdir_req code.

- 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>
8 years agoprop224: Fix hidserv request code to work for both v2 and v3.
George Kadianakis [Thu, 1 Jun 2017 10:56:43 +0000 (13:56 +0300)] 
prop224: Fix hidserv request code to work for both v2 and v3.

See documentation of `last_hid_serv_requests_` for how it works. strmaps are
cool!

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoprop224: Move some rendclient.c code to hs_common.c
George Kadianakis [Thu, 1 Jun 2017 10:48:03 +0000 (13:48 +0300)] 
prop224: Move some rendclient.c code to hs_common.c

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>
8 years agoprop224: Add client-side HS descriptor cache.
George Kadianakis [Thu, 1 Jun 2017 10:37:11 +0000 (13:37 +0300)] 
prop224: Add client-side HS descriptor cache.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agoMerge branch 'bug23106_032'
Nick Mathewson [Thu, 24 Aug 2017 13:45:03 +0000 (09:45 -0400)] 
Merge branch 'bug23106_032'

8 years agoMerge branch 'bug19281_025'
Nick Mathewson [Thu, 24 Aug 2017 13:27:26 +0000 (09:27 -0400)] 
Merge branch 'bug19281_025'

8 years agoMerge branch 'feature22976_squashed'
Nick Mathewson [Thu, 24 Aug 2017 13:23:43 +0000 (09:23 -0400)] 
Merge branch 'feature22976_squashed'

8 years agoAlso disable spawning on Sandbox.
Nick Mathewson [Wed, 9 Aug 2017 14:56:57 +0000 (10:56 -0400)] 
Also disable spawning on Sandbox.

This isn't a functional change, but it makes our logic more clear,
and catches bugs earlier.

8 years agoMerge branch 'bug22779_031'
Nick Mathewson [Thu, 24 Aug 2017 13:18:39 +0000 (09:18 -0400)] 
Merge branch 'bug22779_031'

8 years agoMerge branch 'bug22677'
Nick Mathewson [Thu, 24 Aug 2017 13:18:03 +0000 (09:18 -0400)] 
Merge branch 'bug22677'

8 years agoadd parenthesis to make cast work right.
Nick Mathewson [Wed, 23 Aug 2017 17:12:58 +0000 (13:12 -0400)] 
add parenthesis to make cast work right.

8 years agoAdd test_hs_descriptor.inc to include.am to unbreak distcheck.
Nick Mathewson [Wed, 23 Aug 2017 17:08:59 +0000 (13:08 -0400)] 
Add test_hs_descriptor.inc to include.am to unbreak distcheck.

8 years ago22839: Build tor with rust enabled on win
Ties Stuij [Thu, 10 Aug 2017 08:08:41 +0000 (01:08 -0700)] 
22839: Build tor with rust enabled on win

- make tor_util static library name configurable
- fix Rust libary dependency order for Windows

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Mon, 21 Aug 2017 19:08:17 +0000 (15:08 -0400)] 
Merge branch 'maint-0.3.1'

8 years agoMerge branch 'bug23291_028' into maint-0.3.1
Nick Mathewson [Mon, 21 Aug 2017 19:06:39 +0000 (15:06 -0400)] 
Merge branch 'bug23291_028' into maint-0.3.1

8 years agochanges file for bug 23291
Nick Mathewson [Mon, 21 Aug 2017 19:04:35 +0000 (15:04 -0400)] 
changes file for bug 23291

8 years ago22839: fix check_heap_buffer buffer size in test-memwipe
Ties Stuij [Sun, 13 Aug 2017 15:55:45 +0000 (17:55 +0200)] 
22839: fix check_heap_buffer buffer size in test-memwipe

8 years agoMerge branch 'maint-0.3.1'
Nick Mathewson [Mon, 21 Aug 2017 18:20:38 +0000 (14:20 -0400)] 
Merge branch 'maint-0.3.1'

8 years agowhitespace fixes
Nick Mathewson [Mon, 21 Aug 2017 18:18:41 +0000 (14:18 -0400)] 
whitespace fixes

8 years agoFix triggerable BUG() when decoding hsv3 descriptors.
George Kadianakis [Thu, 17 Aug 2017 20:13:15 +0000 (23:13 +0300)] 
Fix triggerable BUG() when decoding hsv3 descriptors.

Also improve the unittest to make sure it catches the right error.

8 years agoAdd unittest for #23233.
George Kadianakis [Thu, 17 Aug 2017 20:12:59 +0000 (23:12 +0300)] 
Add unittest for #23233.

This will fail currently since the bug is not fixed yet.

8 years agoprop224: Decouple the HS part of connection_ap_handshake_rewrite_and_attach().
George Kadianakis [Thu, 1 Jun 2017 10:24:28 +0000 (13:24 +0300)] 
prop224: Decouple the HS part of connection_ap_handshake_rewrite_and_attach().

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>
8 years agoprop224: Refactor parse_extended_hostname() to parse v3 addrs.
George Kadianakis [Thu, 1 Jun 2017 10:21:03 +0000 (13:21 +0300)] 
prop224: Refactor parse_extended_hostname() to parse v3 addrs.

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>
8 years agoprop224: Recompute all HSDir indices when we enter overlap mode.
George Kadianakis [Sat, 19 Aug 2017 13:00:58 +0000 (16:00 +0300)] 
prop224: Recompute all HSDir indices when we enter overlap mode.

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.

8 years agoprop224: Improve descriptor reupload logic.
George Kadianakis [Sat, 19 Aug 2017 13:26:46 +0000 (16:26 +0300)] 
prop224: Improve descriptor reupload logic.

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.

8 years agotest: Improve get_responsible_hsdirs test.
George Kadianakis [Sun, 13 Aug 2017 20:25:08 +0000 (23:25 +0300)] 
test: Improve get_responsible_hsdirs test.

8 years agoprop224: Only upload descriptor if we have good hash ring and SRV.
George Kadianakis [Sun, 13 Aug 2017 17:16:21 +0000 (20:16 +0300)] 
prop224: Only upload descriptor if we have good hash ring and SRV.

Make sure we have a live consensus (for SRV) and enough descriptors (for
hash ring).

Also fix unittests that broke.

8 years agoprop224: Improve our checks for unset HSDir index.
George Kadianakis [Sat, 12 Aug 2017 10:05:25 +0000 (13:05 +0300)] 
prop224: Improve our checks for unset HSDir index.

We used to not check next hsdir index.

8 years agosr: Log voting schedule at debug level
David Goulet [Wed, 9 Aug 2017 15:25:53 +0000 (11:25 -0400)] 
sr: Log voting schedule at debug level

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>
8 years agoMake Windows happy for time_t printf format
David Goulet [Fri, 11 Aug 2017 19:08:45 +0000 (15:08 -0400)] 
Make Windows happy for time_t printf format

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>
8 years agotest: Fix typing issues found by clang
David Goulet [Fri, 11 Aug 2017 18:59:28 +0000 (14:59 -0400)] 
test: Fix typing issues found by clang

Partially fix #23224.

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Fix memory leak in test_hs_common.c
David Goulet [Fri, 11 Aug 2017 18:46:27 +0000 (14:46 -0400)] 
test: Fix memory leak in test_hs_common.c

Partially fixes #23223

Signed-off-by: David Goulet <dgoulet@torproject.org>
8 years agotest: Fix hs common test for Windows
David Goulet [Fri, 11 Aug 2017 18:42:20 +0000 (14:42 -0400)] 
test: Fix hs common test for Windows

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>