Browse Source

Merge pull request #5997 from mwarning/zerotier

zerotier: update to version 1.2.8
lilik-openwrt-22.03
Hannu Nyman 7 years ago
committed by GitHub
parent
commit
d1d5a186b0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 129 additions and 257 deletions
  1. +11
    -9
      net/zerotier/Makefile
  2. +27
    -0
      net/zerotier/patches/0001-find-miniupnpc.h-in-staging-directory.patch
  3. +0
    -47
      net/zerotier/patches/0001-use-external-libminiupnpc-and-libnatpmp.patch
  4. +0
    -24
      net/zerotier/patches/0002-pin-target-to-linux.patch
  5. +33
    -0
      net/zerotier/patches/0002-remove-pie.patch
  6. +0
    -13
      net/zerotier/patches/0003-gcc48.patch
  7. +33
    -0
      net/zerotier/patches/0003-remove-march-armv5.patch
  8. +0
    -138
      net/zerotier/patches/0004-Revert-Do-not-serve-controller-requests-until-init-i.patch
  9. +25
    -0
      net/zerotier/patches/0004-accept-external-linker-flags.patch
  10. +0
    -26
      net/zerotier/patches/0005-remove-pie.patch

+ 11
- 9
net/zerotier/Makefile View File

@ -6,18 +6,16 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=zerotier PKG_NAME:=zerotier
PKG_VERSION:=1.2.4
PKG_RELEASE:=4
PKG_VERSION:=1.2.8
PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0 PKG_LICENSE:=GPL-3.0
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/zerotier/ZeroTierOne
PKG_SOURCE_SUBDIR:=ZeroTierOne-$(PKG_VERSION)
PKG_SOURCE_VERSION:=fe5257df81c4ec4b5d48f707eb794de0748b7ac0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_MIRROR_HASH:=131436529d26f8eb975a0a8705b489cc22a1139c323755895c1776db579003bc
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_SOURCE_URL:=https://codeload.github.com/zerotier/ZeroTierOne/tar.gz/$(PKG_VERSION)?
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_HASH:=08e2df34550d6bb68e106eaac48babb481160046818b0944ec41f1e158548a47
PKG_BUILD_DIR:=$(BUILD_DIR)/ZeroTierOne-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1 PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
@ -54,6 +52,10 @@ ifeq ($(CONFIG_ZEROTIER_ENABLE_SELFTEST),y)
endif endif
endef endef
# Make binary smaller
TARGET_CFLAGS += -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
define Package/zerotier/install define Package/zerotier/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/zerotier-one $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/zerotier-one $(1)/usr/bin/


+ 27
- 0
net/zerotier/patches/0001-find-miniupnpc.h-in-staging-directory.patch View File

@ -0,0 +1,27 @@
From c578216351a4daa3916265b39b14f7c23ef15c90 Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Mon, 23 Apr 2018 22:12:31 +0200
Subject: [PATCH 1/4] find miniupnpc.h in staging directory
---
make-linux.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/make-linux.mk b/make-linux.mk
index 2e6a8632..0cd955d1 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -22,8 +22,8 @@ ONE_OBJS+=osdep/LinuxEthernetTap.o
# otherwise build into binary as done on Mac and Windows.
ONE_OBJS+=osdep/PortMapper.o
override DEFS+=-DZT_USE_MINIUPNPC
-MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2..*"' /usr/include/miniupnpc/miniupnpc.h && echo 1)
-#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
+MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2..*"' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1)
+#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' $(STAGING_DIR)/usr/include/miniupnpc/miniupnpc.h && echo 1)
ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
override DEFS+=-DZT_USE_SYSTEM_MINIUPNPC
LDLIBS+=-lminiupnpc
--
2.17.0

+ 0
- 47
net/zerotier/patches/0001-use-external-libminiupnpc-and-libnatpmp.patch View File

@ -1,47 +0,0 @@
From 61b69f74fecf3c34c0fd2003897c92790ca5a9f5 Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Thu, 4 May 2017 22:13:55 +0200
Subject: [PATCH 1/2] use external libminiupnpc and libnatpmp
---
make-linux.mk | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/make-linux.mk b/make-linux.mk
index 87d29af..f5b3d8d 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -22,20 +22,20 @@ OBJS+=ext/http-parser/http_parser.o
# otherwise build into binary as done on Mac and Windows.
OBJS+=osdep/PortMapper.o
DEFS+=-DZT_USE_MINIUPNPC
-MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
-ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
+#MINIUPNPC_IS_NEW_ENOUGH=$(shell grep -sqr '.*define.*MINIUPNPC_VERSION.*"2.."' /usr/include/miniupnpc/miniupnpc.h && echo 1)
+#ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
DEFS+=-DZT_USE_SYSTEM_MINIUPNPC
LDLIBS+=-lminiupnpc
-else
- DEFS+=-DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
- OBJS+=ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o
-endif
-ifeq ($(wildcard /usr/include/natpmp.h),)
- OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
-else
+#else
+# DEFS+=-DMINIUPNP_STATICLIB -DMINIUPNPC_SET_SOCKET_TIMEOUT -DMINIUPNPC_GET_SRC_ADDR -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -DOS_STRING=\"Linux\" -DMINIUPNPC_VERSION_STRING=\"2.0\" -DUPNP_VERSION_STRING=\"UPnP/1.1\" -DENABLE_STRNATPMPERR
+# OBJS+=ext/miniupnpc/connecthostport.o ext/miniupnpc/igd_desc_parse.o ext/miniupnpc/minisoap.o ext/miniupnpc/minissdpc.o ext/miniupnpc/miniupnpc.o ext/miniupnpc/miniwget.o ext/miniupnpc/minixml.o ext/miniupnpc/portlistingparse.o ext/miniupnpc/receivedata.o ext/miniupnpc/upnpcommands.o ext/miniupnpc/upnpdev.o ext/miniupnpc/upnperrors.o ext/miniupnpc/upnpreplyparse.o
+#endif
+#ifeq ($(wildcard /usr/include/natpmp.h),)
+# OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
+#else
LDLIBS+=-lnatpmp
DEFS+=-DZT_USE_SYSTEM_NATPMP
-endif
+#endif
ifeq ($(ZT_ENABLE_CLUSTER),1)
DEFS+=-DZT_ENABLE_CLUSTER
--
2.1.4

+ 0
- 24
net/zerotier/patches/0002-pin-target-to-linux.patch View File

@ -1,24 +0,0 @@
From b8a0598002fd08618d20cd1bbfb03559435241a8 Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Thu, 4 May 2017 22:35:58 +0200
Subject: [PATCH 2/2] pin target to linux
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 9511862..d5b0dfc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Common makefile -- loads make rules for each platform
-OSTYPE=$(shell uname -s)
+OSTYPE=Linux
ifeq ($(OSTYPE),Darwin)
include make-mac.mk
--
2.1.4

+ 33
- 0
net/zerotier/patches/0002-remove-pie.patch View File

@ -0,0 +1,33 @@
From 7cfe751128d412a9b780ba5e4cb11908fc71cd3d Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Mon, 30 Apr 2018 16:14:30 +0200
Subject: [PATCH 2/4] remove -pie
fixes relocation "against `a local symbol' can not be used
when making a shared object; recompile with -fPIC" error
---
make-linux.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/make-linux.mk b/make-linux.mk
index 0cd955d1..add1d3ae 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -71,11 +71,11 @@ ifeq ($(ZT_DEBUG),1)
# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
else
- CFLAGS?=-O3 -fstack-protector -fPIE
+ CFLAGS?=-O3 -fstack-protector
override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS)
- CXXFLAGS?=-O3 -fstack-protector -fPIE
+ CXXFLAGS?=-O3 -fstack-protector
override CXXFLAGS+=-Wall -Wno-deprecated -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
- LDFLAGS=-pie -Wl,-z,relro,-z,now
+ LDFLAGS=-Wl,-z,relro,-z,now
STRIP?=strip
STRIP+=--strip-all
endif
--
2.17.0

+ 0
- 13
net/zerotier/patches/0003-gcc48.patch View File

@ -1,13 +0,0 @@
Index: ZeroTierOne-1.2.4/ext/json/json.hpp
===================================================================
--- ZeroTierOne-1.2.4.orig/ext/json/json.hpp
+++ ZeroTierOne-1.2.4/ext/json/json.hpp
@@ -64,7 +64,7 @@ SOFTWARE.
#endif
#elif defined(__GNUC__)
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
- #if GCC_VERSION < 40900
+ #if GCC_VERSION < 40800
#error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
#endif
#endif

+ 33
- 0
net/zerotier/patches/0003-remove-march-armv5.patch View File

@ -0,0 +1,33 @@
From bfb1a652dbf897dc065d2a1414296eb145a2224b Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Mon, 23 Apr 2018 22:31:03 +0200
Subject: [PATCH 3/4] remove -march=armv5
---
make-linux.mk | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/make-linux.mk b/make-linux.mk
index add1d3ae..49e14f70 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -229,12 +229,12 @@ endif
# ARM32 hell -- use conservative CFLAGS
ifeq ($(ZT_ARCHITECTURE),3)
ifeq ($(shell if [ -e /usr/bin/dpkg ]; then dpkg --print-architecture; fi),armel)
- override CFLAGS+=-march=armv5 -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
- override CXXFLAGS+=-march=armv5 -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
+ override CFLAGS+=-mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
+ override CXXFLAGS+=-mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
ZT_USE_ARM32_NEON_ASM_CRYPTO=0
else
- override CFLAGS+=-march=armv5 -mno-unaligned-access -marm
- override CXXFLAGS+=-march=armv5 -mno-unaligned-access -marm
+ override CFLAGS+=-mno-unaligned-access -marm
+ override CXXFLAGS+=-mno-unaligned-access -marm
endif
endif
--
2.17.0

+ 0
- 138
net/zerotier/patches/0004-Revert-Do-not-serve-controller-requests-until-init-i.patch View File

@ -1,138 +0,0 @@
From ab8ececbe70f7c83667d6ebb592fc1df17ad26a4 Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Sat, 20 Jan 2018 21:55:52 +0100
Subject: [PATCH] Revert "Do not serve controller requests until init is done."
This reverts commit f4feccc6265cc480b84c85f897b225714072d4ec.
---
controller/JSONDB.cpp | 20 +++++++-------------
controller/JSONDB.hpp | 15 +++++++--------
2 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/controller/JSONDB.cpp b/controller/JSONDB.cpp
index d3e76fc1..007e0fec 100644
--- a/controller/JSONDB.cpp
+++ b/controller/JSONDB.cpp
@@ -26,8 +26,7 @@ static const nlohmann::json _EMPTY_JSON(nlohmann::json::object());
static const std::map<std::string,std::string> _ZT_JSONDB_GET_HEADERS;
JSONDB::JSONDB(const std::string &basePath) :
- _basePath(basePath),
- _ready(false)
+ _basePath(basePath)
{
if ((_basePath.length() > 7)&&(_basePath.substr(0,7) == "http://")) {
// TODO: this doesn't yet support IPv6 since bracketed address notiation isn't supported.
@@ -50,7 +49,7 @@ JSONDB::JSONDB(const std::string &basePath) :
OSUtils::mkdir(_basePath.c_str());
OSUtils::lockDownFile(_basePath.c_str(),true); // networks might contain auth tokens, etc., so restrict directory permissions
}
- _ready = _reload(_basePath,std::string());
+ _reload(_basePath,std::string());
}
bool JSONDB::writeRaw(const std::string &n,const std::string &obj)
@@ -84,13 +83,9 @@ bool JSONDB::put(const std::string &n,const nlohmann::json &obj)
const nlohmann::json &JSONDB::get(const std::string &n)
{
- while (!_ready) {
- Thread::sleep(250);
- _ready = _reload(_basePath,std::string());
- }
-
if (!_isValidObjectName(n))
return _EMPTY_JSON;
+
std::map<std::string,_E>::iterator e(_db.find(n));
if (e != _db.end())
return e->second.obj;
@@ -138,7 +133,7 @@ void JSONDB::erase(const std::string &n)
_db.erase(n);
}
-bool JSONDB::_reload(const std::string &p,const std::string &b)
+void JSONDB::_reload(const std::string &p,const std::string &b)
{
if (_httpAddr) {
std::string body;
@@ -155,11 +150,11 @@ bool JSONDB::_reload(const std::string &p,const std::string &b)
_db[tmp].obj = i.value();
}
}
- return true;
}
- } catch ( ... ) {} // invalid JSON, so maybe incomplete request
+ } catch ( ... ) {
+ // TODO: report error?
+ }
}
- return false;
} else {
std::vector<std::string> dl(OSUtils::listDirectory(p.c_str(),true));
for(std::vector<std::string>::const_iterator di(dl.begin());di!=dl.end();++di) {
@@ -169,7 +164,6 @@ bool JSONDB::_reload(const std::string &p,const std::string &b)
this->_reload((p + ZT_PATH_SEPARATOR + *di),(b + *di + ZT_PATH_SEPARATOR));
}
}
- return true;
}
}
diff --git a/controller/JSONDB.hpp b/controller/JSONDB.hpp
index beafbaf5..c19112ed 100644
--- a/controller/JSONDB.hpp
+++ b/controller/JSONDB.hpp
@@ -36,7 +36,6 @@
#include "../ext/json/json.hpp"
#include "../osdep/OSUtils.hpp"
#include "../osdep/Http.hpp"
-#include "../osdep/Thread.hpp"
namespace ZeroTier {
@@ -48,6 +47,12 @@ class JSONDB
public:
JSONDB(const std::string &basePath);
+ inline void reload()
+ {
+ _db.clear();
+ _reload(_basePath,std::string());
+ }
+
bool writeRaw(const std::string &n,const std::string &obj);
bool put(const std::string &n,const nlohmann::json &obj);
@@ -74,11 +79,6 @@ public:
template<typename F>
inline void filter(const std::string &prefix,F func)
{
- while (!_ready) {
- Thread::sleep(250);
- _ready = _reload(_basePath,std::string());
- }
-
for(std::map<std::string,_E>::iterator i(_db.lower_bound(prefix));i!=_db.end();) {
if ((i->first.length() >= prefix.length())&&(!memcmp(i->first.data(),prefix.data(),prefix.length()))) {
if (!func(i->first,get(i->first))) {
@@ -94,7 +94,7 @@ public:
inline bool operator!=(const JSONDB &db) const { return (!(*this == db)); }
private:
- bool _reload(const std::string &p,const std::string &b);
+ void _reload(const std::string &p,const std::string &b);
bool _isValidObjectName(const std::string &n);
std::string _genPath(const std::string &n,bool create);
@@ -108,7 +108,6 @@ private:
InetAddress _httpAddr;
std::string _basePath;
std::map<std::string,_E> _db;
- volatile bool _ready;
};
} // namespace ZeroTier
--
2.15.1

+ 25
- 0
net/zerotier/patches/0004-accept-external-linker-flags.patch View File

@ -0,0 +1,25 @@
From a2cf8bf645d25f18cbc2ed7ad4b9a25725811afd Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Wed, 2 May 2018 16:06:46 +0200
Subject: [PATCH 4/4] accept external linker flags
---
make-linux.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make-linux.mk b/make-linux.mk
index 49e14f70..8e766bfb 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -75,7 +75,7 @@ else
override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS)
CXXFLAGS?=-O3 -fstack-protector
override CXXFLAGS+=-Wall -Wno-deprecated -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
- LDFLAGS=-Wl,-z,relro,-z,now
+ LDFLAGS+=-Wl,-z,relro,-z,now
STRIP?=strip
STRIP+=--strip-all
endif
--
2.17.0

+ 0
- 26
net/zerotier/patches/0005-remove-pie.patch View File

@ -1,26 +0,0 @@
From 14a8fe1f7cdef1f1e0c0842f6fedde154cf4ab57 Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Thu, 12 Apr 2018 17:09:16 +0200
Subject: [PATCH 5/5] remove -pie
this prevents immediate segfault on start
---
make-linux.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make-linux.mk b/make-linux.mk
index f5b3d8df..8589e5d6 100644
--- a/make-linux.mk
+++ b/make-linux.mk
@@ -67,7 +67,7 @@ else
override CFLAGS+=-Wall -fPIE -pthread $(INCLUDES) -DNDEBUG $(DEFS)
CXXFLAGS?=-O3 -fstack-protector
override CXXFLAGS+=-Wall -Wno-unused-result -Wreorder -fPIE -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
- override LDFLAGS+=-pie -Wl,-z,relro,-z,now
+ override LDFLAGS+=-Wl,-z,relro,-z,now
STRIP?=strip
STRIP+=--strip-all
endif
--
2.16.3

Loading…
Cancel
Save