summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-12-07Revert accidentally-committed code from 046acf208bc53a3fa7ea9Nick Mathewson
2017-12-06Fix a compiler warningNick Mathewson
2017-12-06Merge remote-tracking branch 'public/monotime_coarse_stamps'Nick Mathewson
2017-12-06Merge remote-tracking branch 'teor/bug24488'Nick Mathewson
2017-12-06Merge branch 'maint-0.3.2'Nick Mathewson
2017-12-06Merge remote-tracking branch 'dgoulet/bug24502_032_01' into maint-0.3.2Nick Mathewson
2017-12-06Merge remote-tracking branch 'teor/bug24489'Nick Mathewson
2017-12-06Merge remote-tracking branch 'dgoulet/bug24502_032_01'Nick Mathewson
2017-12-06test: Add a KIST test for a non opened channelDavid Goulet
This makes sure that a non opened channel is never put back in the channel pending list and that its state is consistent with what we expect that is IDLE. Test the fixes in #24502. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-06Check the return value of hs_parse_address().Alexander Færøy
This patch adds a check for the return value of `hs_parse_address()` in `hs_control_hspost_command()`. Since it should not be possible for `hs_parse_address()` to fail in this context we wrap the error check with the `BUG()` macro. See: https://bugs.torproject.org/24543
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-05add a changes fileNick Mathewson
2017-12-05Update the manpage to describe {Cache,Key}DirectoryNick Mathewson
Also, explain which files should be put in which.
2017-12-05Implement the various get_foodir_*() functions.Nick Mathewson
2017-12-05Create a CacheDirectory and KeyDirectory options.Nick Mathewson
They work the same as DataDirectory, but default slightly different. Tor is not actually updated to use them yet.
2017-12-05Clean up a needlessly complex get_datadir_fname useNick 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-05Extract common code for creating the keys directory.Nick Mathewson
This had somehow gotten duplicated between router.c and routerkeys.c
2017-12-05Use get_datadir_fname() accessor in networkstatus.cNick Mathewson
2017-12-05Extract the code that creates the datadir into a separate function.Nick Mathewson
2017-12-05Merge branch 'dgoulet_ticket20699_033_01'Nick Mathewson
2017-12-05control: Add changes file for HSv3 control portDavid Goulet
Part of #20699. Signed-off-by: David Goulet <dgoulet@torproject.org>
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-05test: Add HS_DESC v3 unit testsDavid Goulet
This introduces the test_hs_control.c file which at this commit contains basic unit test for the HS_DESC event. 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-05hs-v3: Add an handler for the HSPOST commandDavid Goulet
It is not used yet at this commit. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Add a public function to upload a descriptor to an HSDirDavid Goulet
This is groundwork for the HSPOST control port command that needs a way in the HS subsystem to upload a service descriptor to a specific HSDir. To do so, we add a public function that takes a series of parameters including a fully encoded descriptor and initiate a directory request to a specific routerstatut_t object. It is for now not used but should be, in future commit, by the HSPOST command. This commit has no behavior change, only refactoring. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC_CONTENT eventDavid Goulet
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: Support HS_DESC UPLOAD failedDavid Goulet
When failing to upload a descriptor, signal the control port with a FAILED event. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-05hs-v3: Implement HS_DESC UPLOADED eventDavid Goulet
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: Downgrade warning log when an intro circuit has closedDavid Goulet
When an intro circuit has closed, do not warn anymore when we can't find the service. It is possible to hit that condition if the service is removed before the circuits were fully closed. This happens in the case of deleting an ephemeral service. 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-12-05Change our build process to run Cargo from inside the build treeNick Mathewson
Instead of using the cwd to specify the location of Cargo.toml, we use the --manifest-path option to specify its location explicitly. This works around the bug that isis diagnosed on our jenkins builds.
2017-12-05Merge branch 'maint-0.3.2'Nick Mathewson
2017-12-05Tweaks to strings in 24500Nick Mathewson
2017-12-05Make errno error log more useful for getrandom()Fernando Fernandez Mancera
Making errno error log more useful for getrandom() call. Adding if statement to make difference between ENOSYS and other errors. Fixes #24500 Signed-off-by: Fernando Fernandez Mancera <ffernandezmancera@gmail.com>
2017-12-04Merge branch 'ticket24518'Nick Mathewson
2017-12-04sched: Set channel scheduler state to IDLE when not openedDavid Goulet
In the KIST main loop, if the channel happens to be not opened, set its state to IDLE so we can release it properly later on. Prior to this fix, the channel was in PENDING state, removed from the channel pending list and then kept in that state because it is not opened. This bug was introduced in commit dcabf801e52a83e2c3cc23ccc1fa906582a927d6 for which we made the scheduler loop not consider unopened channel. This has no consequences on tor except for an annoying but harmless BUG() warning. Fixes #24502 Signed-off-by: David Goulet <dgoulet@torproject.org>