torproject / tor Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ticket25610 034 01 #58
Closed
Closed
Conversation
Make our build system support a disable dirauth module option. It can only be disabled explicitly with: $ ./configure --disable-module-dirauth If *not* specified that is enabled, an automake conditional variable is set to true and a defined value for the C code: AM_CONDITIONAL: BUILD_MODULE_DIRAUTH AC_DEFINE: HAVE_MODULE_DIRAUTH=1 This introduces the dirauth/ module directory in src/or/ for which .c files are only compiled if the BUILD_MODULE_DIRAUTH is set. All the header files are compiled in regardless of the support so we can use the alternative entry point functions of the dirauth subsystem. Signed-off-by: David Goulet <dgoulet@torproject.org>
Don't access the AuthoritativeDir options directly. We do this so we can move authdir_mode() to the dirauth module. Signed-off-by: David Goulet <dgoulet@torproject.org>
Many functions become static to the C file or exposed to the tests within the PRIVATE define of dirvote.h. This commit moves a function to the top. No code behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
Signed-off-by: David Goulet <dgoulet@torproject.org>
Remove useless include. Clearly identify functions that are used by other part of Tor, functions that are only used by the dirauth subsystem and functions that are exposed for unit tests. This will help us in the dirauth modularization effort. Signed-off-by: David Goulet <dgoulet@torproject.org>
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>
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>
Add static inline dirauth public functions used outside of the dirauth module so they can be seen by the tor code but simply do nothing. Signed-off-by: David Goulet <dgoulet@torproject.org>
No code behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
In order to follow the public namespace of dirvote. Signed-off-by: David Goulet <dgoulet@torproject.org>
Renamed to follow the file namespace. Signed-off-by: David Goulet <dgoulet@torproject.org>
From dirvote.c to networkstatus.c where it makes more sense both in terms of namespace and subsystem responsability. This removes one less dependency on the dirauth module. Signed-off-by: David Goulet <dgoulet@torproject.org>
When parsing a vote in routerparse.c, only dirauth extract the commits from the vote so move all this code into dirvote.c so we can make it specific to the dirauth module. If the dirauth module is disabled, the commit parsing does nothing. Signed-off-by: David Goulet <dgoulet@torproject.org>
In order to make sr_commit_free() only used by the dirauth module, this commits moves the commits free from a vote object into the dirvote.c file which is now only for the module. The function does nothing if the module is disabled. Signed-off-by: David Goulet <dgoulet@torproject.org>
In order to further isolate the dirauth code into its module, this moves the handling of the directory request GET /tor/status-vote/* into the module. Signed-off-by: David Goulet <dgoulet@torproject.org>
Both functions are used for directory request but they can only be used if the running tor instance is a directory authority. For this reason, make those symbols visible but hard assert() if they are called when the module is disabled. This would mean we failed to safeguard the entry point into the module. Signed-off-by: David Goulet <dgoulet@torproject.org>
This code is only for dirauth so this commit moves it into the module in dirvote.c. No code behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
Pull Request Test Coverage Report for Build 579
|
ahf
reviewed
Apr 25, 2018
| { | ||
| (void) options; | ||
| (void) now; | ||
| return; |
Let's kill these before landing. Only return when there is a value to return.
| (void) status_out; | ||
| /* If the dirauth module is disabled, this should NEVER be called else we | ||
| * failed to safeguard the dirauth module. */ | ||
| tor_assert(0); |
Well there is a backtrace with a tor_assert() but the main point for me was also to stop the whole thing in that case. It should really NEVER happen.
| src/or/statefile.h \ | ||
| src/or/status.h \ | ||
| src/or/torcert.h \ | ||
| src/or/tor_api_internal.h | ||
|
|
||
| # We add the headers of the modules even though they are disabled so we can | ||
| # properly compiled the entry points replacedment. |
I think replacedment is a typo here. Maybe 'stub functions' are better?
| @@ -79,7 +79,14 @@ src_test_AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \ | |||
| # This seems to matter nowhere but on Windows, but I assure you that it | |||
| # matters a lot there, and is quite hard to debug if you forget to do it. | |||
|
|
|||
| DIRAUTH_MOD = \ | |||
| src/or/dirauth/dircollate.c \ | |||
Yeah that commit doesn't work and will disappear. Sorry about this, it got forgotten :(
| src_test_test_SOURCES = \ | ||
| $DIRAUTH_MOD \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
No description provided.
The text was updated successfully, but these errors were encountered: