commit aaa31290431ea2cd1d1e8498dbe271eb53d2389d Merge: 738a8c6 36e201d Author: Nick Mathewson nickm@torproject.org Date: Fri Jul 1 15:29:05 2016 -0400
Merge remote-tracking branch 'dgoulet/ticket16943_029_05-squashed'
Trivial Conflicts: src/or/or.h src/or/routerparse.c
changes/bug16943 | 8 + doc/tor.1.txt | 6 + src/common/util.c | 21 + src/common/util.h | 2 + src/or/config.c | 1 + src/or/directory.c | 5 + src/or/dirvote.c | 187 ++++-- src/or/dirvote.h | 45 +- src/or/include.am | 4 + src/or/main.c | 13 + src/or/networkstatus.c | 18 +- src/or/networkstatus.h | 4 +- src/or/or.h | 21 + src/or/routerlist.c | 4 +- src/or/routerlist.h | 3 +- src/or/routerparse.c | 158 +++++ src/or/shared_random.c | 1354 +++++++++++++++++++++++++++++++++++++++++ src/or/shared_random.h | 166 +++++ src/or/shared_random_state.c | 1353 ++++++++++++++++++++++++++++++++++++++++ src/or/shared_random_state.h | 146 +++++ src/test/include.am | 1 + src/test/sr_srv_calc_ref.py | 71 +++ src/test/test.c | 1 + src/test/test.h | 1 + src/test/test_dir.c | 87 ++- src/test/test_routerlist.c | 17 + src/test/test_shared_random.c | 1261 ++++++++++++++++++++++++++++++++++++++ 27 files changed, 4889 insertions(+), 69 deletions(-)
diff --cc src/or/networkstatus.c index 5415c30,cf395f9..0dfb8af --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@@ -1216,56 -1189,10 +1226,56 @@@ consensus_is_waiting_for_certs(void ? 1 : 0; }
+/** Look up the currently active (depending on bootstrap status) download + * status for this consensus flavor and return a pointer to it. + */ +MOCK_IMPL(download_status_t *, +networkstatus_get_dl_status_by_flavor,(consensus_flavor_t flavor)) +{ + download_status_t *dl = NULL; + const int we_are_bootstrapping = + networkstatus_consensus_is_bootstrapping(time(NULL)); + + if ((int)flavor <= N_CONSENSUS_FLAVORS) { + dl = &((we_are_bootstrapping ? + consensus_bootstrap_dl_status : consensus_dl_status)[flavor]); + } + + return dl; +} + +/** Look up the bootstrap download status for this consensus flavor + * and return a pointer to it. */ +MOCK_IMPL(download_status_t *, +networkstatus_get_dl_status_by_flavor_bootstrap,(consensus_flavor_t flavor)) +{ + download_status_t *dl = NULL; + + if ((int)flavor <= N_CONSENSUS_FLAVORS) { + dl = &(consensus_bootstrap_dl_status[flavor]); + } + + return dl; +} + +/** Look up the running (non-bootstrap) download status for this consensus + * flavor and return a pointer to it. */ +MOCK_IMPL(download_status_t *, +networkstatus_get_dl_status_by_flavor_running,(consensus_flavor_t flavor)) +{ + download_status_t *dl = NULL; + + if ((int)flavor <= N_CONSENSUS_FLAVORS) { + dl = &(consensus_dl_status[flavor]); + } + + return dl; +} + /** Return the most recent consensus that we have downloaded, or NULL if we * don't have one. */ - networkstatus_t * - networkstatus_get_latest_consensus(void) + MOCK_IMPL(networkstatus_t *, + networkstatus_get_latest_consensus,(void)) { return current_consensus; } diff --cc src/or/or.h index a1a0810,1b7f1a8..ed799b9 --- a/src/or/or.h +++ b/src/or/or.h @@@ -4499,10 -4496,11 +4514,16 @@@ typedef struct /** Autobool: Do we try to retain capabilities if we can? */ int KeepBindCapabilities;
+ /** Maximum total size of unparseable descriptors to log during the + * lifetime of this Tor process. + */ + uint64_t MaxUnparseableDescSizeToLog; ++ + /** Bool (default: 1): Switch for the shared random protocol. Only + * relevant to a directory authority. If off, the authority won't + * participate in the protocol. If on (default), a flag is added to the + * vote indicating participation. */ + int AuthDirSharedRandomness; } or_options_t;
/** Persistent state for an onion router, as saved to disk. */ diff --cc src/or/routerparse.c index d257910,88cfbdc..0f9b9f7 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@@ -28,7 -28,7 +28,8 @@@ #include "routerparse.h" #include "entrynodes.h" #include "torcert.h" +#include "sandbox.h" + #include "shared_random.h"
#undef log #include <math.h>