summaryrefslogtreecommitdiff
path: root/src/test/test_dir.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-03 09:29:31 -0500
committerNick Mathewson <nickm@torproject.org>2015-12-18 13:14:10 -0500
commit54406f78b84103ed7fd4610a89dda9d37f0f033e (patch)
treed0cc2e9012cdc47e48f6c097c44b2305898709d9 /src/test/test_dir.c
parent6a5528356f41cd71a8cad2c7b66dcd24d177d07b (diff)
downloadtor-54406f78b84103ed7fd4610a89dda9d37f0f033e.tar.gz
tor-54406f78b84103ed7fd4610a89dda9d37f0f033e.zip
Change dataflow on generating 'dir-cache' flag.
Convention is that router_dump_router_to_string() should look at its input "router", which should be generated by router_build_fresh_descirptor().
Diffstat (limited to 'src/test/test_dir.c')
-rw-r--r--src/test/test_dir.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 97a9200bdb..cf95df5100 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -111,6 +111,7 @@ test_dir_formats(void *arg)
r1->cache_info.published_on = 0;
r1->or_port = 9000;
r1->dir_port = 9003;
+ r1->supports_tunnelled_dir_requests = 1;
tor_addr_parse(&r1->ipv6_addr, "1:2:3:4::");
r1->ipv6_orport = 9999;
r1->onion_pkey = crypto_pk_dup_key(pk1);
@@ -155,6 +156,7 @@ test_dir_formats(void *arg)
r2->cache_info.published_on = 5;
r2->or_port = 9005;
r2->dir_port = 0;
+ r2->supports_tunnelled_dir_requests = 1;
r2->onion_pkey = crypto_pk_dup_key(pk2);
curve25519_keypair_t r2_onion_keypair;
curve25519_keypair_generate(&r2_onion_keypair, 0);
@@ -176,12 +178,9 @@ test_dir_formats(void *arg)
options->ContactInfo = tor_strdup("Magri White "
"<magri@elsewhere.example.com>");
- options->ORPort_set = options->DirPort_set = options->AssumeReachable = 1;
buf = router_dump_router_to_string(r1, pk2, NULL, NULL, NULL);
tor_free(options->ContactInfo);
- /* Reset for later */
- options->ORPort_set = options->DirPort_set = options->AssumeReachable = 0;
tt_assert(buf);
strlcpy(buf2, "router Magri 192.168.0.1 9000 0 9003\n"
@@ -301,8 +300,6 @@ test_dir_formats(void *arg)
strlcat(buf2, "tunnelled-dir-server\n", sizeof(buf2));
strlcat(buf2, "router-sig-ed25519 ", sizeof(buf2));
- options->ORPort_set = 1;
-
buf = router_dump_router_to_string(r2, pk1, pk2, &r2_onion_keypair, &kp2);
tt_assert(buf);
buf[strlen(buf2)] = '\0'; /* Don't compare the sig; it's never the same
@@ -314,7 +311,6 @@ test_dir_formats(void *arg)
buf = router_dump_router_to_string(r2, pk1, NULL, NULL, NULL);
/* Reset for later */
- options->ORPort_set = 0;
cp = buf;
rp2 = router_parse_entry_from_string((const char*)cp,NULL,1,0,NULL,NULL);
tt_assert(rp2);