summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--make-linux.mk6
-rw-r--r--node/IncomingPacket.cpp14
-rw-r--r--node/NetworkConfigMaster.hpp2
-rw-r--r--node/Node.cpp2
4 files changed, 17 insertions, 7 deletions
diff --git a/make-linux.mk b/make-linux.mk
index 2033e35c..931120a4 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -31,6 +31,12 @@ ifeq ($(MACHINE),x86)
DEFS+=-DZT_SALSA20_SSE
endif
+# Build with ZT_ENABLE_NETCONF_MASTER=1 to build with NetworkConfigMaster enabled
+ifeq ($(ZT_ENABLE_NETCONF_MASTER),1)
+ DEFS+=-DZT_ENABLE_NETCONF_MASTER
+ LIBS+=-lhiredis
+endif
+
# "make official" is a shortcut for this
ifeq ($(ZT_OFFICIAL_RELEASE),1)
ZT_AUTO_UPDATE=1
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp
index ded83d67..f5379458 100644
--- a/node/IncomingPacket.cpp
+++ b/node/IncomingPacket.cpp
@@ -714,15 +714,17 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
{
try {
uint64_t nwid = at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_NETWORK_ID);
- unsigned int metaDataLength = at<uint16_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN);
- Dictionary metaData((const char *)field(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT,metaDataLength),metaDataLength);
- uint64_t haveTimestamp = 0;
- if ((ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength + 8) <= size())
- haveTimestamp = at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength);
+#ifdef ZT_ENABLE_NETCONF_MASTER
if (RR->netconfMaster) {
+ unsigned int metaDataLength = at<uint16_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT_LEN);
+ Dictionary metaData((const char *)field(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT,metaDataLength),metaDataLength);
+ uint64_t haveTimestamp = 0;
+ if ((ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength + 8) <= size())
+ haveTimestamp = at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_DICT + metaDataLength);
RR->netconfMaster->doNetworkConfigRequest(_remoteAddress,packetId(),source(),nwid,metaData,haveTimestamp);
} else {
+#endif
Packet outp(source(),RR->identity.address(),Packet::VERB_ERROR);
outp.append((unsigned char)Packet::VERB_NETWORK_CONFIG_REQUEST);
outp.append(packetId());
@@ -730,7 +732,9 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
outp.append(nwid);
outp.armor(peer->key(),true);
_fromSock->send(_remoteAddress,outp.data(),outp.size());
+#ifdef ZT_ENABLE_NETCONF_MASTER
}
+#endif
peer->received(RR,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_CONFIG_REQUEST,0,Packet::VERB_NOP,Utils::now());
} catch (std::exception &exc) {
diff --git a/node/NetworkConfigMaster.hpp b/node/NetworkConfigMaster.hpp
index 70391882..25d5bb1c 100644
--- a/node/NetworkConfigMaster.hpp
+++ b/node/NetworkConfigMaster.hpp
@@ -30,8 +30,6 @@
#include "Constants.hpp"
-#define ZT_ENABLE_NETCONF_MASTER
-
#ifdef ZT_ENABLE_NETCONF_MASTER
#include <stdint.h>
diff --git a/node/Node.cpp b/node/Node.cpp
index 291af590..d65e4e39 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -108,7 +108,9 @@ struct _NodeImpl
delete renv.mc; renv.mc = (Multicaster *)0;
delete renv.antiRec; renv.antiRec = (AntiRecursion *)0;
delete renv.sw; renv.sw = (Switch *)0; // order matters less from here down
+#ifdef ZT_ENABLE_NETCONF_MASTER
delete renv.netconfMaster; renv.netconfMaster = (NetworkConfigMaster *)0;
+#endif
delete renv.http; renv.http = (HttpClient *)0;
delete renv.prng; renv.prng = (CMWC4096 *)0;
delete renv.log; renv.log = (Logger *)0; // but stop logging last of all