Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DHTBootstrap should always respond to version packets with toxcore version #2354

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions other/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cc_binary(
testonly = 1,
srcs = ["DHT_bootstrap.c"],
deps = [
":bootstrap_node_packets",
"//c-toxcore/testing:misc_tools",
"//c-toxcore/toxcore:DHT",
"//c-toxcore/toxcore:LAN_discovery",
Expand Down
11 changes: 8 additions & 3 deletions other/DHT_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@

#include "../testing/misc_tools.h"

#define DHT_NODE_EXTRA_PACKETS

#ifdef DHT_NODE_EXTRA_PACKETS
#include "./bootstrap_node_packets.h"

#define DHT_VERSION_NUMBER 1
#define DHT_MOTD "This is a test motd"
#ifndef DAEMON_VERSION_NUMBER
#define DAEMON_VERSION_NUMBER (1000000000UL + TOX_VERSION_MAJOR*1000000UL + TOX_VERSION_MINOR*1000UL + TOX_VERSION_PATCH*1UL)
#endif

static const char *motd_str = ""; //Change this to anything within 256 bytes(but 96 bytes maximum prefered)
#endif

#define PORT 33445
Expand Down Expand Up @@ -152,7 +157,7 @@ int main(int argc, char *argv[])
Onion_Announce *onion_a = new_onion_announce(logger, mem, rng, mono_time, dht);

#ifdef DHT_NODE_EXTRA_PACKETS
bootstrap_set_callbacks(dht_get_net(dht), DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD));
bootstrap_set_callbacks(dht_get_net(dht), (uint32_t)DAEMON_VERSION_NUMBER, (const uint8_t *) motd_str, strlen(motd_str)+1);
#endif

if (!(onion && forwarding && onion_a)) {
Expand Down
Loading