Commit Graph

26019 Commits

Author SHA1 Message Date
Nick Mathewson
6069c829f9 Merge branch 'bug19418_029' into maint-0.3.1 2017-08-25 11:38:24 -04:00
Nick Mathewson
0de3147bf1 fix wide lines 2017-08-25 11:34:42 -04:00
Nick Mathewson
82b581f3fc Merge remote-tracking branch 'asn/bug23309_v2' 2017-08-25 11:31:53 -04:00
George Kadianakis
6d48e75685 prop224: Better missing hsdir index logs.
Seems like hsdir index bugs are around to haunt us. Let's improve the
log messages to make debugging easier.
2017-08-25 17:18:05 +03:00
George Kadianakis
ea5af8f442 prop224: When HUPing, move HS state from old to new service.
We used to not copy the state which means that after HUP we would forget
if we are in overlap mode or not. That caused bugs where the service
would enter overlap mode twice, and rotate its descs twice, causing all
sorts of bugs.
2017-08-25 17:18:05 +03:00
George Kadianakis
409ecbec52 prop224: Be more careful to not overwrite descriptors in HUP. 2017-08-25 17:18:05 +03:00
George Kadianakis
17fd2c8a51 prop224: Move function move_descriptors() around.
We want to use some static functions so move it below them.
2017-08-25 17:18:05 +03:00
David Goulet
a9fb97e91a prop224: Don't move intro points but rather descriptors
Apart from the fact that a newly allocated service doesn't have descriptors
thus the move condition can never be true, the service needs the descriptor
signing key to cross-certify the authentication key of each intro point so we
need to move the descriptors between services and not only the intro points.

Fixes #23056

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-25 17:18:05 +03:00
David Goulet
2549b3e923 sandbox: Fix double free when initializing HSv3 filenames
Don't free a reference that has been stolen.

Fixes #23329

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-25 09:28:10 -04:00
George Kadianakis
e07b677bd9 prop224: Move service_desc_hsdirs_changed() and make it static.
That function could be static but needed to be moved to the top.
2017-08-25 14:41:06 +03:00
George Kadianakis
c980be9511 prop224: Refactor descriptor reupload logic.
We refactor the descriptor reupload logic to be similar to the v2 logic
where we update a global 'consider_republishing_rend_descriptors' flag
and then we use that to check for hash ring changes during the global
hidden service callbacks.

This fixes bugs where we would inspect the hash ring immediately as we
receive new dirinfo (e.g. consensus) but before running the hidden
service housekeeping events. That was leaving us in an inconsistent
state wrt hsdir indices and causing bugs all around.
2017-08-25 14:41:06 +03:00
George Kadianakis
8b8e39e04b prop224: Refactor descriptor rotation logic.
The problem was that when we went from overlap mode to non-overlap mode,
we were not wiping the 'desc_next' descriptor and instead we left it on
the service. This meant that all functions that iterated service
descriptors were also inspecting the useless 'desc_next' descriptor that
should have been deleted.

This commit refactors rotate_all_descriptors() so that it rotates
descriptor both when entering overlap mode and also when leaving it.
2017-08-25 14:41:06 +03:00
Nick Mathewson
408ed52e3d Remove the AUTHDIR_NEWDESCS feature: nobody is using it any more
If somebody asks for it, log a warning.

Closes ticket 22377.
2017-08-24 16:53:35 -04:00
Nick Mathewson
f9cd870f50 Merge remote-tracking branch 'dgoulet/bug23319_032_01' 2017-08-24 16:23:57 -04:00
David Goulet
dfaa5c65f9 test: Fix memory leak in hs_descriptor/decode_bad_signature
Fixes #23319

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24 16:21:44 -04:00
Nick Mathewson
cbfc50d485 add another invizbox maintainer to ReleasingTor.md 2017-08-24 16:20:26 -04:00
Nick Mathewson
a007c02df0 Re-run trunnel. Cosmetic changes only. 2017-08-24 16:13:01 -04:00
Nick Mathewson
da75dfc0e5 Merge branch 'ahf_bug22497_redux' 2017-08-24 16:11:43 -04:00
Nick Mathewson
e7c1a6f4f7 Changes file for 22497 2017-08-24 16:11:08 -04:00
Alexander Færøy
77b92c2214 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.
2017-08-24 16:09:41 -04:00
Nick Mathewson
011d94fb11 apply ahf's test_assert_null.cocci 2017-08-24 15:55:27 -04:00
Nick Mathewson
047790a253 apply ahf's test_assert_int.cocci 2017-08-24 15:49:59 -04:00
Nick Mathewson
0b36208fd8 apply ahf's test_assert_zero.cocci 2017-08-24 15:34:34 -04:00
Nick Mathewson
067a4422fe Apply ahf's ceil_div.cocci patch. 2017-08-24 15:33:27 -04:00
Nick Mathewson
e884248118 Fix a needless line-continuation in aes.c
coccinelle was getting confused
2017-08-24 15:32:30 -04:00
Nick Mathewson
1d0f7b7ccd Apply test-operator-cleanup to src/common too. 2017-08-24 15:26:57 -04:00
Alexander Færøy
c4744a01cc 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]
2017-08-24 15:24:34 -04:00
Alexander Færøy
9e1fa95920 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().
2017-08-24 15:22:20 -04:00
Alexander Færøy
7666cd8881 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.
2017-08-24 15:21:43 -04:00
Alexander Færøy
3fd68b249b Add Coccinelle patch for replacing tt_assert(0) with tt_abort(). 2017-08-24 15:21:07 -04:00
Alexander Færøy
25eaf77033 Add Coccinelle patch for detecing places where CEIL_DIV should be used. 2017-08-24 15:20:11 -04:00
Alexander Færøy
7c3e980fb9 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.
2017-08-24 15:19:11 -04:00
Nick Mathewson
91c6bc160b Merge remote-tracking branch 'dgoulet/ticket17242_032_03-squashed' 2017-08-24 15:12:16 -04:00
George Kadianakis
dc0264f659 Silence some spammy log messages. 2017-08-24 13:03:29 -04:00
David Goulet
e546ac6b32 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>
2017-08-24 13:03:29 -04:00
David Goulet
a112562544 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>
2017-08-24 13:03:29 -04:00
David Goulet
1077e9894c 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>
2017-08-24 13:03:29 -04:00
David Goulet
dca105d588 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>
2017-08-24 13:03:29 -04:00
David Goulet
954f663831 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>
2017-08-24 13:03:28 -04:00
David Goulet
5f94c4a0f1 prop224: Refactor how we use connection_ap_handle_onion
Simply directly return its returned value.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24 13:03:28 -04:00
David Goulet
98efb646fc 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>
2017-08-24 13:03:28 -04:00
David Goulet
a16627db1f 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>
2017-08-24 13:03:28 -04:00
David Goulet
7c543412fc 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>
2017-08-24 13:03:28 -04:00
David Goulet
cb462b95b7 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>
2017-08-24 13:03:28 -04:00
David Goulet
61009d40d1 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>
2017-08-24 13:03:28 -04:00
David Goulet
e046e6fb48 prop224: Update OOM counters when storing a client descriptor cache object
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24 13:03:28 -04:00
David Goulet
68887fdc5d 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>
2017-08-24 13:03:28 -04:00
David Goulet
47672ec1c7 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>
2017-08-24 13:03:28 -04:00
David Goulet
520fcdf2f3 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
2017-08-24 13:03:28 -04:00
David Goulet
31da3898e7 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>
2017-08-24 13:03:28 -04:00