summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-08-24apply ahf's test_assert_zero.cocciNick Mathewson
2017-08-24Apply ahf's ceil_div.cocci patch.Nick Mathewson
2017-08-24Fix a needless line-continuation in aes.cNick Mathewson
coccinelle was getting confused
2017-08-24Apply test-operator-cleanup to src/common too.Nick Mathewson
2017-08-24Fix operator usage in src/test/*.cAlexander Færøy
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-24Add Coccinelle patch for replacing NULL/non-NULL tt_assert().Alexander Færøy
This patch replaces tt_assert() checks for NULL/non-NULL values with tt_ptr_op().
2017-08-24Add Coccinelle patch for replacing tt_assert() usage on integer types.Alexander Færøy
This patch replaces tt_assert() comparison of integers and unsigned integers with their respective tt_int_op or tt_uint_op counterpart.
2017-08-24Add Coccinelle patch for replacing tt_assert(0) with tt_abort().Alexander Færøy
2017-08-24Add Coccinelle patch for detecing places where CEIL_DIV should be used.Alexander Færøy
2017-08-24Add script for cleaning op operator usage in test files.Alexander Færøy
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-24Merge remote-tracking branch 'dgoulet/ticket17242_032_03-squashed'Nick Mathewson
2017-08-24Silence some spammy log messages.George Kadianakis
2017-08-24circuit: Consider v3 hidden service circuit in circuit_expire_building()David Goulet
For a ready v3 rendezvous circuit, consider it so we don't expire. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24hs: Update intro circuit timestamp when re-extendingDavid Goulet
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-24circuit: Avoid needless log info in circuit_get_best()David Goulet
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-24prop224: Register RP circuit when it opensDavid Goulet
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-24prop224: Try to recover from a bad intro circuitDavid Goulet
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-24prop224: Refactor how we use connection_ap_handle_onionDavid Goulet
Simply directly return its returned value. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24hs: Remove unused rend_client_rendezvous_acked()David Goulet
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-24prop224: Add a function to find an intro point by legacy IDDavid Goulet
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-24prop224: Add a function to clear INTRO dataDavid Goulet
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-24prop224: Rename hs_desc_encode_lspec()David Goulet
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-24hs: Stub link_specifier_t in hs_descriptor.hDavid Goulet
Avoid including a huge trunnel interface everytime we include hs_descriptor.h Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Update OOM counters when storing a client descriptor cache objectDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Update OOM counters when freeing a client descriptor cache objectDavid Goulet
When we free a client descriptor cache object, tell the OOM handler. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Check decoded descriptor matches the expected blinded keyDavid Goulet
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-24test: Fix broken HS upload descriptor testDavid Goulet
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-24prop224: Add directory_request_fetch_set_hs_ident()David Goulet
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-24prop224: Implement hs_client_any_intro_points_usable()David Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-08-24prop224: Use the intro point state cacheDavid Goulet
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>
2017-08-24prop224: Add a client intro point state cacheDavid Goulet
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>
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>