diff options
author | David Goulet <dgoulet@torproject.org> | 2017-09-05 15:52:05 -0400 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-09-08 19:07:00 +0300 |
commit | cd07af60c9e73e16034870ee1d03f729c1f2dd98 (patch) | |
tree | e47840ac1eeb0995f2b0adcd4cc6db75580bb709 /src/test/test_hs_common.c | |
parent | b586de78e37425c3f4b79fb0da32971ed5216401 (diff) | |
download | tor-cd07af60c9e73e16034870ee1d03f729c1f2dd98.tar.gz tor-cd07af60c9e73e16034870ee1d03f729c1f2dd98.zip |
prop224: Expand the overlap period concept to be a full SRV protocol run
Because of #23387, we've realized that there is one scenario that makes
the client unable to reach the service because of a desynch in the time
period used. The scenario is as follows:
+------------------------------------------------------------------+
| |
| 00:00 12:00 00:00 12:00 00:00 12:00 |
| SRV#1 TP#1 SRV#2 TP#2 SRV#3 TP#3 |
| |
| $==========|-----------$===========|-----------$===========| |
| ^ ^ |
| C S |
+------------------------------------------------------------------+
In this scenario the HS has a newer consensus than the client, and the
HS just moved to the next TP but the client is still stuck on the old
one. However, the service is not in any sort of overlap mode so it
doesn't cover the old TP anymore, so the client is unable to fetch a
descriptor.
We've decided to solve this by extending the concept of overlap period
to be permanent so that the service always publishes two descriptors and
aims to cover clients with both older and newer consensuses. See the
spec patch in #23387 for more details.
Diffstat (limited to 'src/test/test_hs_common.c')
-rw-r--r-- | src/test/test_hs_common.c | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/src/test/test_hs_common.c b/src/test/test_hs_common.c index 675c45ea80..ab8b943346 100644 --- a/src/test/test_hs_common.c +++ b/src/test/test_hs_common.c @@ -250,117 +250,6 @@ test_start_time_of_next_time_period(void *arg) ; } -/** Test that our HS overlap period functions work properly. */ -static void -test_desc_overlap_period(void *arg) -{ - (void) arg; - int retval; - time_t now = time(NULL); - networkstatus_t *dummy_consensus = NULL; - - /* First try with a consensus just inside the overlap period */ - dummy_consensus = tor_malloc_zero(sizeof(networkstatus_t)); - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:00:00 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - /* Now increase the valid_after so that it goes to 11:00:00 UTC. Overlap - period is still active. */ - dummy_consensus->valid_after += 3600*11; - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - /* Now increase the valid_after so that it goes to 11:59:59 UTC. Overlap - period is still active. */ - dummy_consensus->valid_after += 3599; - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - /* Now increase the valid_after so that it drifts to noon, and check that - overlap mode is not active anymore. */ - dummy_consensus->valid_after += 1; - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 0); - - /* Check that overlap mode is also inactive at 23:59:59 UTC */ - retval = parse_rfc1123_time("Wed, 13 Apr 2016 23:59:59 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 0); - - done: - tor_free(dummy_consensus); -} - -/* Test the overlap period functions on a testnet with altered voting - * schedule */ -static void -test_desc_overlap_period_testnet(void *arg) -{ - int retval; - time_t now = approx_time(); - networkstatus_t *dummy_consensus = NULL; - or_options_t *options = get_options_mutable(); - - (void) arg; - - /* Set the testnet option and a 10-second voting interval */ - options->TestingTorNetwork = 1; - options->V3AuthVotingInterval = 10; - options->TestingV3AuthInitialVotingInterval = 10; - - dummy_consensus = tor_malloc_zero(sizeof(networkstatus_t)); - - /* A 10-second voting interval means that the lengths of an SRV run and of a - * time period are both 10*24 seconds (4 minutes). The SRV gets published at - * 00:00:00 and the TP starts at 00:02:00 (rotation offset: 2 mins). Those - * two minutes between SRV publish and TP start is the overlap period - * window. Let's test it: */ - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:00:00 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:01:59 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:02:00 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 0); - - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:04:00 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:05:59 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 1); - - retval = parse_rfc1123_time("Wed, 13 Apr 2016 00:06:00 UTC", - &dummy_consensus->valid_after); - tt_int_op(retval, OP_EQ, 0); - retval = hs_overlap_mode_is_active(dummy_consensus, now); - tt_int_op(retval, OP_EQ, 0); - - done: - tor_free(dummy_consensus); -} - static void helper_add_hsdir_to_networkstatus(networkstatus_t *ns, int identity_idx, @@ -860,10 +749,6 @@ struct testcase_t hs_common_tests[] = { NULL, NULL }, { "start_time_of_next_time_period", test_start_time_of_next_time_period, TT_FORK, NULL, NULL }, - { "desc_overlap_period", test_desc_overlap_period, TT_FORK, - NULL, NULL }, - { "desc_overlap_period_testnet", test_desc_overlap_period_testnet, TT_FORK, - NULL, NULL }, { "responsible_hsdirs", test_responsible_hsdirs, TT_FORK, NULL, NULL }, { "desc_reupload_logic", test_desc_reupload_logic, TT_FORK, |