diff options
Diffstat (limited to 'other')
-rw-r--r-- | other/DHT_bootstrap.c | 12 | ||||
-rw-r--r-- | other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c | 11 |
2 files changed, 22 insertions, 1 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index af5fae01..c8895e15 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c | |||
@@ -102,9 +102,19 @@ int main(int argc, char *argv[]) | |||
102 | ip_init(&ip, ipv6enabled); | 102 | ip_init(&ip, ipv6enabled); |
103 | 103 | ||
104 | DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT))); | 104 | DHT *dht = new_DHT(new_net_crypto(new_networking(ip, PORT))); |
105 | Onion *onion = new_onion(dht); | ||
106 | Onion_Announce *onion_a = new_onion_announce(dht); | ||
107 | |||
108 | if (!(onion && onion_a)) { | ||
109 | printf("Something failed to initialize.\n"); | ||
110 | exit(1); | ||
111 | } | ||
105 | perror("Initialization"); | 112 | perror("Initialization"); |
106 | 113 | ||
107 | manage_keys(dht); | 114 | manage_keys(dht); |
115 | /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ | ||
116 | memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); | ||
117 | memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); | ||
108 | printf("Public key: "); | 118 | printf("Public key: "); |
109 | uint32_t i; | 119 | uint32_t i; |
110 | 120 | ||
@@ -152,7 +162,7 @@ int main(int argc, char *argv[]) | |||
152 | do_DHT(dht); | 162 | do_DHT(dht); |
153 | 163 | ||
154 | if (is_timeout(last_LANdiscovery, is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL)) { | 164 | if (is_timeout(last_LANdiscovery, is_waiting_for_dht_connection ? 5 : LAN_DISCOVERY_INTERVAL)) { |
155 | send_LANdiscovery(htons(PORT), dht->c); | 165 | send_LANdiscovery(htons(PORT), dht); |
156 | last_LANdiscovery = unix_time(); | 166 | last_LANdiscovery = unix_time(); |
157 | } | 167 | } |
158 | 168 | ||
diff --git a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c index dc519448..e8e06b55 100644 --- a/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c +++ b/other/bootstrap_serverdaemon/DHT_bootstrap_daemon.c | |||
@@ -347,6 +347,13 @@ int main(int argc, char *argv[]) | |||
347 | IP ip; | 347 | IP ip; |
348 | ip_init(&ip, 0); | 348 | ip_init(&ip, 0); |
349 | DHT *dht = new_DHT(new_net_crypto(new_networking(ip, server_conf.port))); | 349 | DHT *dht = new_DHT(new_net_crypto(new_networking(ip, server_conf.port))); |
350 | Onion *onion = new_onion(dht); | ||
351 | Onion_Announce *onion_a = new_onion_announce(dht); | ||
352 | |||
353 | if (!(onion && onion_a)) { | ||
354 | printf("Something failed to initialize.\n"); | ||
355 | exit(1); | ||
356 | } | ||
350 | /* Read the config file */ | 357 | /* Read the config file */ |
351 | printf("PID file: %s\n", server_conf.pid_file); | 358 | printf("PID file: %s\n", server_conf.pid_file); |
352 | printf("Key file: %s\n", server_conf.keys_file); | 359 | printf("Key file: %s\n", server_conf.keys_file); |
@@ -367,6 +374,10 @@ int main(int argc, char *argv[]) | |||
367 | manage_keys(dht, server_conf.keys_file); | 374 | manage_keys(dht, server_conf.keys_file); |
368 | errno = tmperr; | 375 | errno = tmperr; |
369 | 376 | ||
377 | /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ | ||
378 | memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); | ||
379 | memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); | ||
380 | |||
370 | /* Public key */ | 381 | /* Public key */ |
371 | int i; | 382 | int i; |
372 | printf("\nPublic Key: "); | 383 | printf("\nPublic Key: "); |