diff options
author | George Kadianakis <desnacked@riseup.net> | 2015-01-29 14:54:47 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-02-18 09:09:32 -0500 |
commit | 5ee48d47a73691001746541e15b3dc5a89fa37eb (patch) | |
tree | fd0f616cba64e66b9597b337ff039232e4a8c8de /src/or/config.c | |
parent | a3de2dfde6a92c0fe7ca755aa7bc1aa046c463a8 (diff) | |
download | tor-5ee48d47a73691001746541e15b3dc5a89fa37eb.tar.gz tor-5ee48d47a73691001746541e15b3dc5a89fa37eb.zip |
Parse Guardfraction file and apply results to routerstatuses.
Parse the file just before voting and apply its information to the
provided vote_routerstatus_t. This follows the same logic as when
dirauths parse bwauth files.
Diffstat (limited to 'src/or/config.c')
-rw-r--r-- | src/or/config.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c index 568baec703..6349445bc1 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -428,6 +428,7 @@ static config_var_t option_vars_[] = { V(V3AuthNIntervalsValid, UINT, "3"), V(V3AuthUseLegacyKey, BOOL, "0"), V(V3BandwidthsFile, FILENAME, NULL), + V(GuardfractionFile, FILENAME, NULL), VAR("VersioningAuthoritativeDirectory",BOOL,VersioningAuthoritativeDir, "0"), V(VirtualAddrNetworkIPv4, STRING, "127.192.0.0/10"), V(VirtualAddrNetworkIPv6, STRING, "[FE80::]/10"), @@ -2787,6 +2788,17 @@ options_validate(or_options_t *old_options, or_options_t *options, if (options->V3BandwidthsFile && !old_options) { dirserv_read_measured_bandwidths(options->V3BandwidthsFile, NULL); } + /* same for guardfraction file */ + if (options->GuardfractionFile && !old_options) { + file_status_t fs = file_status(options->GuardfractionFile); + if (fs == FN_EMPTY) { + REJECT("GuardfractionFile set but it's an empty file? Failing"); + } else if (fs != FN_FILE) { + REJECT("GuardfractionFile set but not a file? Failing"); + } + + dirserv_read_guardfraction_file(options->GuardfractionFile, NULL); + } } if (options->AuthoritativeDir && !options->DirPort_set) |