diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 479e97a6..ebb0ab78 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c @@ -109,6 +109,7 @@ int main(int argc, char *argv[]) printf("Something failed to initialize.\n"); exit(1); } + perror("Initialization"); manage_keys(dht); diff --git a/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c b/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c index 3c6d7b4e..5fbe83fa 100644 --- a/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c +++ b/other/bootstrap_serverdaemon/tox_dht_bootstrap_server_daemon.c @@ -283,7 +283,7 @@ int try_connect(DHT *dht, int port, int enable_lan_discovery) do_DHT(dht); if (enable_lan_discovery) { - send_LANdiscovery(htons_port, dht->c); + send_LANdiscovery(htons_port, dht); } networking_poll(dht->c->lossless_udp->net); @@ -358,12 +358,19 @@ int main(int argc, char *argv[]) ip_init(&ip, enable_ipv6); DHT *dht = new_DHT(new_net_crypto(new_networking(ip, port))); + Onion *onion = new_onion(dht); + Onion_Announce *onion_a = new_onion_announce(dht); if (dht == NULL) { syslog(LOG_ERR, "Couldn't initialize Tox DHT instance. Exiting.\n"); return 1; } + if (!(onion && onion_a)) { + syslog(LOG_ERR, "Couldn't initialize Tox onion stuff. Exiting.\n"); + return 1; + } + if (enable_lan_discovery) { LANdiscovery_init(dht); } @@ -375,6 +382,10 @@ int main(int argc, char *argv[]) return 1; } + /* We want our DHT public key to be the same as our internal one since this is a bootstrap server */ + memcpy(dht->self_public_key, dht->c->self_public_key, crypto_box_PUBLICKEYBYTES); + memcpy(dht->self_secret_key, dht->c->self_secret_key, crypto_box_SECRETKEYBYTES); + if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { syslog(LOG_DEBUG, "List of bootstrap servers read successfully\n"); } else { @@ -446,11 +457,11 @@ int main(int argc, char *argv[]) do_DHT(dht); if (enable_lan_discovery && is_timeout(last_LANdiscovery, LAN_DISCOVERY_INTERVAL)) { - send_LANdiscovery(htons_port, dht->c); + send_LANdiscovery(htons_port, dht); last_LANdiscovery = unix_time(); } - networking_poll(dht->c->lossless_udp->net); + networking_poll(dht->net); sleep; } diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 32928fd9..cfdd7254 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -509,7 +509,7 @@ static int handle_dht_fakeid(void *object, IP_Port source, uint8_t *source_pubke if ((uint32_t)len != length - (DATA_IN_RESPONSE_MIN_SIZE + crypto_box_NONCEBYTES)) return 1; - + if (memcpy(source_pubkey, packet, crypto_box_PUBLICKEYBYTES) != 0) return 1;