summaryrefslogtreecommitdiff
path: root/src/or/hs_service.c
AgeCommit message (Collapse)Author
2018-07-05Move literally everything out of src/orNick Mathewson
This commit won't build yet -- it just puts everything in a slightly more logical place. The reasoning here is that "src/core" will hold the stuff that every (or nearly every) tor instance will need in order to do onion routing. Other features (including some necessary ones) will live in "src/feature". The "src/app" directory will hold the stuff needed to have Tor be an application you can actually run. This commit DOES NOT refactor the former contents of src/or into a logical set of acyclic libraries, or change any code at all. That will have to come in the future. We will continue to move things around and split them in the future, but I hope this lays a reasonable groundwork for doing so.
2018-07-01Remove system headers from or.hNick Mathewson
2018-07-01Extract or_state_t to its own header.Nick Mathewson
Fewer modules needed this than I had expected.
2018-07-01Minimize headers that include crypto_formats and x25519 stuffNick Mathewson
2018-07-01Remove needless includes from or.hNick Mathewson
or.h should really include only the minimum of stuff from or/*, common/*, and lib/*.
2018-06-21Rectify include paths (automated)Nick Mathewson
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-15Move extend_info_t into its own header.Nick Mathewson
2018-06-15Extract routerstatus_t into its own header.Nick Mathewson
2018-06-15Extract networkstatus_t and ..sr_info_t into their own headersNick Mathewson
2018-06-15Extract node_t into its own header.Nick Mathewson
2018-06-15Extract {or,origin}_circuit_t into their own headersNick Mathewson
2018-06-15Split dir_connection_t into its own headerNick Mathewson
2018-06-15Split entry and edge_connection_t into their own headers.Nick Mathewson
2018-06-02hs-v3: Build onion address before registering ephemeral serviceDavid Goulet
With the work on #25500 (reducing CPU client usage), the HS service main loop callback is enabled as soon as the HS service map changes which happens when registering a new service. Unfortunately, for an ephemeral service, we were building the onion address *after* the registration leading to the "service->onion_address` to be an empty string. This broke the "HS_DESC CREATED" event which had no onion address in it. And also, we were logging an empty onion address for that service. Fixes #25939 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-09Merge branch 'maint-0.3.3'Nick Mathewson
2018-05-09Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-05-09Detect when v3 services get disabled after HUP.George Kadianakis
Remove v3 optimization which made Tor not detect disabling services. This optimization is not so needed because we only call that function after HUP anyway. Fixes bug #25761.
2018-05-03Merge remote-tracking branch 'isis/bug24660_r1'Nick Mathewson
2018-05-02Optimize legacy intro point digest calculation.Neel Chauhan
2018-05-01sr: Rename shared_random_common.{c|h} to shared_random_client.{c|h}David Goulet
No code behavior change. Pars of #25988 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-05-01Merge remote-tracking branch 'dgoulet/ticket25610_034_01-squashed'Nick Mathewson
2018-04-28Make hsdir_index in node_t a hsdir_index_t rather than a pointer.Neel Chauhan
2018-04-27sr: Extract shared SR functionsDavid Goulet
Move most of the shared random functions that are needed outside of the dirauth module. At this commit, because dirvote.c hasn't been refactor, it doesn't compile because some SR functions need a dirvote function. Furthermore, 5 functions haven't been touched yet because they are dirauth only but are in used in other C files than the dirauth module ones. No code behavior change. Only moving code around. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-27mod: Move dirauth specific files to its own moduleDavid Goulet
This is a pretty big commit but it only moves these files to src/or/dirauth: dircollate.c dirvote.c shared_random.c shared_random_state.c dircollate.h dirvote.h shared_random.h shared_random_state.h Then many files are modified to change the include line for those header files that have moved into a new directory. Without using --disable-module-dirauth, everything builds fine. When using the flag to disable the module, tor doesn't build due to linking errors. This will be addressed in the next commit(s). No code behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-27hs: Rescan the main loop event list if the service map changesDavid Goulet
Because ADD_ONION/DEL_ONION can modify the global service map (both for v2 and v3), we need to rescan the event list so we either enable or disable the HS service main loop event. Fixees #25939 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-24Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-24Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-04-23hs: Fix memleak in v3 on SIGHUPDavid Goulet
Fixes #25901 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-06crypto: Refactor (P)RNG functionality into new crypto_rand module.Isis Lovecruft
* ADD new /src/common/crypto_rand.[ch] module. * ADD new /src/common/crypto_util.[ch] module (contains the memwipe() function, since all crypto_* modules need this). * FIXES part of #24658: https://bugs.torproject.org/24658
2018-03-23Merge branch 'maint-0.3.3'Nick Mathewson
2018-03-23Fix windows compilation warnings in hs_service.cNick Mathewson
These were breaking jenkins builds. Bugfix on 5804ccc9070dc54; bug not in any released Tor.
2018-03-20Merge branch 'maint-0.3.3'Nick Mathewson
2018-03-20Merge branch 'bug25306_032_01_squashed_v2' into maint-0.3.3Nick Mathewson
2018-03-20hs-v3: BUG() on missing descriptors during rotationDavid Goulet
Because of #25306 for which we are unable to reproduce nor understand how it is possible, this commit removes the asserts() and BUG() on the missing descriptors instead when rotating them. This allows us to log more data on error but also to let tor recover gracefully instead of dying. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-02-20Remove a bunch of other redundant #includesNick Mathewson
Folks have found two in the past week or so; we may as well fix the others. Found with: \#!/usr/bin/python3 import re def findMulti(fname): includes = set() with open(fname) as f: for line in f: m = re.match(r'^\s*#\s*include\s+["<](\S+)[>"]', line) if m: inc = m.group(1) if inc in includes: print("{}: {}".format(fname, inc)) includes.add(m.group(1)) import sys for fname in sys.argv[1:]: findMulti(fname)
2018-02-07Fix spelling mistakes corresponding to ticket #23650Deepesh Pathak
2018-01-23Add onion service activity information to our heartbeat logs.George Kadianakis
2018-01-03Merge branch 'maint-0.3.2'Nick Mathewson
2018-01-03Fix some shadowed-global warnings.Nick Mathewson
These are all about local variables shadowing global functions. That isn't normally a problem, but at least one compiler we care about seems to treat this as a case of -Wshadow violation, so let's fix it. Fixes bug 24634; bugfix on 0.3.2.1-alpha.
2017-12-12Merge branch 'maint-0.3.2'Nick Mathewson
2017-12-12hs-v3: Don't lookup an intro point while cleaning it upGeorge Kadianakis
Commit e80893e51b0c0320838cbed8c46fd5b0fe608bef made tor call hs_service_intro_circ_has_closed() when we mark for close a circuit. When we cleanup intro points, we iterate over the descriptor's map of intro points and we can possibly mark for close a circuit. This was problematic because we would MAP_DEL_CURRENT() the intro point then free it and finally mark for close the circuit which would lookup the intro point that we just free in the map we are iterating over. This can't be done and leads to a use-after-free because the intro point will be returned successfully due to the fact that we are still in the loop iterating. In other words, MAP_DEL_CURRENT() followed by a digest256map_get() of the same object should never be done in the same loop. Fixes #24595 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-12-11Merge branch 'maint-0.3.2'Nick Mathewson
2017-12-08Merge branch 'macro_free_v2_squashed'Nick Mathewson
2017-12-08Switch to a safer FREE_AND_NULL implementationNick Mathewson
This one only evaluates the input once, so it cannot mess up even if there are side effects.
2017-12-08Change the free macro convention in the rest of src/or/*.hNick Mathewson
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 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>