Skip to content

Commit 06d949a

Browse files
Tha14iphydf
authored andcommitted
fix: always respond to version packets with toxcore version
1 parent 8099d82 commit 06d949a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

other/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cc_binary(
1616
testonly = 1,
1717
srcs = ["DHT_bootstrap.c"],
1818
deps = [
19+
":bootstrap_node_packets",
1920
"//c-toxcore/testing:misc_tools",
2021
"//c-toxcore/toxcore:DHT",
2122
"//c-toxcore/toxcore:LAN_discovery",

other/DHT_bootstrap.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@
3131

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

34+
#define DHT_NODE_EXTRA_PACKETS
35+
3436
#ifdef DHT_NODE_EXTRA_PACKETS
3537
#include "./bootstrap_node_packets.h"
3638

37-
#define DHT_VERSION_NUMBER 1
38-
#define DHT_MOTD "This is a test motd"
39+
#ifndef DAEMON_VERSION_NUMBER
40+
#define DAEMON_VERSION_NUMBER (1000000000UL + TOX_VERSION_MAJOR*1000000UL + TOX_VERSION_MINOR*1000UL + TOX_VERSION_PATCH*1UL)
41+
#endif
42+
43+
static const char *motd_str = ""; //Change this to anything within 256 bytes(but 96 bytes maximum prefered)
3944
#endif
4045

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

154159
#ifdef DHT_NODE_EXTRA_PACKETS
155-
bootstrap_set_callbacks(dht_get_net(dht), DHT_VERSION_NUMBER, DHT_MOTD, sizeof(DHT_MOTD));
160+
bootstrap_set_callbacks(dht_get_net(dht), (uint32_t)DAEMON_VERSION_NUMBER, (const uint8_t *) motd_str, strlen(motd_str)+1);
156161
#endif
157162

158163
if (!(onion && forwarding && onion_a)) {

0 commit comments

Comments
 (0)