summaryrefslogtreecommitdiff
path: root/auto_tests/dht_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests/dht_test.c')
-rw-r--r--auto_tests/dht_test.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c
index 5a4f8005..3125454a 100644
--- a/auto_tests/dht_test.c
+++ b/auto_tests/dht_test.c
@@ -25,6 +25,22 @@ static bool enable_broken_tests = false;
25 memcpy(&x,swap_temp,sizeof(x)); \ 25 memcpy(&x,swap_temp,sizeof(x)); \
26 } while(0) 26 } while(0)
27 27
28#ifndef USE_IPV6
29#define USE_IPV6 1
30#endif
31
32static inline IP get_loopback()
33{
34 IP ip;
35#if USE_IPV6
36 ip.family = TOX_AF_INET6;
37 ip.ip6 = get_ip6_loopback();
38#else
39 ip.family = TOX_AF_INET;
40 ip.ip4 = get_ip4_loopback();
41#endif
42 return ip;
43}
28 44
29static void mark_bad(IPPTsPng *ipptp) 45static void mark_bad(IPPTsPng *ipptp)
30{ 46{
@@ -615,8 +631,7 @@ loop_top:
615 631
616 for (i = 0; i < NUM_DHT; ++i) { 632 for (i = 0; i < NUM_DHT; ++i) {
617 IP_Port ip_port; 633 IP_Port ip_port;
618 ip_init(&ip_port.ip, 1); 634 ip_port.ip = get_loopback();
619 ip_port.ip.ip6.uint8[15] = 1;
620 ip_port.port = net_htons(DHT_DEFAULT_PORT + i); 635 ip_port.port = net_htons(DHT_DEFAULT_PORT + i);
621 DHT_bootstrap(dhts[(i - 1) % NUM_DHT], ip_port, dhts[i]->self_public_key); 636 DHT_bootstrap(dhts[(i - 1) % NUM_DHT], ip_port, dhts[i]->self_public_key);
622 } 637 }