Browse Source

Merge branch 'edge' of http://10.6.6.2/zerotier/ZeroTierOne into edge

Adam Ierymenko 7 years ago
parent
commit
b601041b5b
3 changed files with 19 additions and 1 deletions
  1. 5 0
      make-linux.mk
  2. 6 1
      make-mac.mk
  3. 8 0
      service/OneService.cpp

+ 5 - 0
make-linux.mk

@@ -88,6 +88,11 @@ ifeq ($(ZT_USE_TEST_TAP),1)
 	override DEFS+=-DZT_USE_TEST_TAP
 	override DEFS+=-DZT_USE_TEST_TAP
 endif
 endif
 
 
+ifeq ($(ZT_VAULT_SUPPORT),1)
+	override DEFS+=-DZT_VAULT_SUPPORT=1
+	override LDLIBS+=-lcurl
+endif
+
 # Uncomment for gprof profile build
 # Uncomment for gprof profile build
 #CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
 #CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
 #CXXFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
 #CXXFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)

+ 6 - 1
make-mac.mk

@@ -63,6 +63,11 @@ ifeq ($(ZT_TRACE),1)
 	DEFS+=-DZT_TRACE
 	DEFS+=-DZT_TRACE
 endif
 endif
 
 
+ifeq ($(ZT_VAULT_SUPPORT),1)
+	DEFS+=-DZT_VAULT_SUPPORT=1
+	LIBS+=-lcurl
+endif
+
 CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++ 
 CXXFLAGS=$(CFLAGS) -std=c++11 -stdlib=libc++ 
 
 
 all: one macui
 all: one macui
@@ -70,7 +75,7 @@ all: one macui
 ext/x64-salsa2012-asm/salsa2012.o:
 ext/x64-salsa2012-asm/salsa2012.o:
 	$(CC) $(CFLAGS) -c ext/x64-salsa2012-asm/salsa2012.s -o ext/x64-salsa2012-asm/salsa2012.o
 	$(CC) $(CFLAGS) -c ext/x64-salsa2012-asm/salsa2012.s -o ext/x64-salsa2012-asm/salsa2012.o
 
 
-one:	$(CORE_OBJS) $(ONE_OBJS) one.o
+one:	$(CORE_OBJS) $(ONE_OBJS) one.o 
 	$(CXX) $(CXXFLAGS) -o zerotier-one $(CORE_OBJS) $(ONE_OBJS) one.o $(LIBS)
 	$(CXX) $(CXXFLAGS) -o zerotier-one $(CORE_OBJS) $(ONE_OBJS) one.o $(LIBS)
 	$(STRIP) zerotier-one
 	$(STRIP) zerotier-one
 	ln -sf zerotier-one zerotier-idtool
 	ln -sf zerotier-one zerotier-idtool

+ 8 - 0
service/OneService.cpp

@@ -531,10 +531,12 @@ public:
 #ifdef ZT_USE_MINIUPNPC
 #ifdef ZT_USE_MINIUPNPC
 		,_portMapper((PortMapper *)0)
 		,_portMapper((PortMapper *)0)
 #endif
 #endif
+#ifdef ZT_VAULT_SUPPORT
 		,_vaultEnabled(false)
 		,_vaultEnabled(false)
 		,_vaultURL()
 		,_vaultURL()
 		,_vaultToken()
 		,_vaultToken()
 		,_vaultPath("cubbyhole/zerotier")
 		,_vaultPath("cubbyhole/zerotier")
+#endif
 		,_run(true)
 		,_run(true)
 	{
 	{
 		_ports[0] = 0;
 		_ports[0] = 0;
@@ -551,6 +553,10 @@ public:
 		_binder.closeAll(_phy);
 		_binder.closeAll(_phy);
 		_phy.close(_localControlSocket4);
 		_phy.close(_localControlSocket4);
 		_phy.close(_localControlSocket6);
 		_phy.close(_localControlSocket6);
+#if ZT_VAULT_SUPPORT
+		curl_global_cleanup();
+#endif
+
 #ifdef ZT_USE_MINIUPNPC
 #ifdef ZT_USE_MINIUPNPC
 		delete _portMapper;
 		delete _portMapper;
 #endif
 #endif
@@ -1541,6 +1547,7 @@ public:
 			}
 			}
 		}
 		}
 
 
+#if ZT_VAULT_SUPPORT
 		json &vault = settings["vault"];
 		json &vault = settings["vault"];
 		if (vault.is_object()) {
 		if (vault.is_object()) {
 			const std::string url(OSUtils::jsonString(vault["vaultURL"], "").c_str());
 			const std::string url(OSUtils::jsonString(vault["vaultURL"], "").c_str());
@@ -1579,6 +1586,7 @@ public:
 		if (!_vaultURL.empty() && !_vaultToken.empty()) {
 		if (!_vaultURL.empty() && !_vaultToken.empty()) {
 			_vaultEnabled = true;
 			_vaultEnabled = true;
 		}
 		}
+#endif
 	}
 	}
 
 
 	// Checks if a managed IP or route target is allowed
 	// Checks if a managed IP or route target is allowed