Browse Source

Build fixes.

Adam Ierymenko 10 năm trước cách đây
mục cha
commit
afea153a0b

+ 6 - 0
make-linux.mk

@@ -31,6 +31,12 @@ ifeq ($(MACHINE),x86)
 	DEFS+=-DZT_SALSA20_SSE 
 	DEFS+=-DZT_SALSA20_SSE 
 endif
 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
 # "make official" is a shortcut for this
 ifeq ($(ZT_OFFICIAL_RELEASE),1)
 ifeq ($(ZT_OFFICIAL_RELEASE),1)
 	ZT_AUTO_UPDATE=1
 	ZT_AUTO_UPDATE=1

+ 9 - 5
node/IncomingPacket.cpp

@@ -714,15 +714,17 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
 {
 {
 	try {
 	try {
 		uint64_t nwid = at<uint64_t>(ZT_PROTO_VERB_NETWORK_CONFIG_REQUEST_IDX_NETWORK_ID);
 		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) {
 		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);
 			RR->netconfMaster->doNetworkConfigRequest(_remoteAddress,packetId(),source(),nwid,metaData,haveTimestamp);
 		} else {
 		} else {
+#endif
 			Packet outp(source(),RR->identity.address(),Packet::VERB_ERROR);
 			Packet outp(source(),RR->identity.address(),Packet::VERB_ERROR);
 			outp.append((unsigned char)Packet::VERB_NETWORK_CONFIG_REQUEST);
 			outp.append((unsigned char)Packet::VERB_NETWORK_CONFIG_REQUEST);
 			outp.append(packetId());
 			outp.append(packetId());
@@ -730,7 +732,9 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons
 			outp.append(nwid);
 			outp.append(nwid);
 			outp.armor(peer->key(),true);
 			outp.armor(peer->key(),true);
 			_fromSock->send(_remoteAddress,outp.data(),outp.size());
 			_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());
 		peer->received(RR,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_CONFIG_REQUEST,0,Packet::VERB_NOP,Utils::now());
 	} catch (std::exception &exc) {
 	} catch (std::exception &exc) {

+ 0 - 2
node/NetworkConfigMaster.hpp

@@ -30,8 +30,6 @@
 
 
 #include "Constants.hpp"
 #include "Constants.hpp"
 
 
-#define ZT_ENABLE_NETCONF_MASTER
-
 #ifdef ZT_ENABLE_NETCONF_MASTER
 #ifdef ZT_ENABLE_NETCONF_MASTER
 
 
 #include <stdint.h>
 #include <stdint.h>

+ 2 - 0
node/Node.cpp

@@ -108,7 +108,9 @@ struct _NodeImpl
 		delete renv.mc;            renv.mc = (Multicaster *)0;
 		delete renv.mc;            renv.mc = (Multicaster *)0;
 		delete renv.antiRec;       renv.antiRec = (AntiRecursion *)0;
 		delete renv.antiRec;       renv.antiRec = (AntiRecursion *)0;
 		delete renv.sw;            renv.sw = (Switch *)0;                // order matters less from here down
 		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;
 		delete renv.netconfMaster; renv.netconfMaster = (NetworkConfigMaster *)0;
+#endif
 		delete renv.http;          renv.http = (HttpClient *)0;
 		delete renv.http;          renv.http = (HttpClient *)0;
 		delete renv.prng;          renv.prng = (CMWC4096 *)0;
 		delete renv.prng;          renv.prng = (CMWC4096 *)0;
 		delete renv.log;           renv.log = (Logger *)0;               // but stop logging last of all
 		delete renv.log;           renv.log = (Logger *)0;               // but stop logging last of all