diff --git a/net/zerotier/Makefile b/net/zerotier/Makefile index 50a270a87e..4413da2df0 100644 --- a/net/zerotier/Makefile +++ b/net/zerotier/Makefile @@ -6,16 +6,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=zerotier -PKG_VERSION:=1.2.12 -PKG_RELEASE:=3 +PKG_VERSION:=1.4.6 +PKG_RELEASE:=1 -PKG_LICENSE:=GPL-3.0 - -PKG_SOURCE_URL:=https://codeload.github.com/zerotier/ZeroTierOne/tar.gz/$(PKG_VERSION)? PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=212799bfaeb5e7dff20f2cd83f15742c8e13b8e9535606cfb85abcfb5fb6fed4 +PKG_SOURCE_URL:=https://codeload.github.com/zerotier/ZeroTierOne/tar.gz/$(PKG_VERSION)? +PKG_HASH:=d1a0eeb03acfa446f67adf5901902d17de14b4648c21e160024acf476e3d4fba PKG_BUILD_DIR:=$(BUILD_DIR)/ZeroTierOne-$(PKG_VERSION) +PKG_MAINTAINER:=Moritz Warning +PKG_LICENSE:=BSL 1.1 +PKG_LICENSE_FILES:=LICENSE.txt PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk @@ -27,7 +28,6 @@ define Package/zerotier TITLE:=Create flat virtual Ethernet networks of almost unlimited size URL:=https://www.zerotier.com SUBMENU:=VPN - MAINTAINER:=Moritz Warning endef define Package/zerotier/description @@ -54,7 +54,15 @@ endef # Make binary smaller TARGET_CFLAGS += -ffunction-sections -fdata-sections -TARGET_LDFLAGS += -Wl,--gc-sections +TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed + +ifdef CONFIG_USE_UCLIBC + TARGET_CFLAGS += -D'valloc(a)=aligned_alloc(getpagesize(),a)' +endif + +define Package/zerotier/conffiles +/etc/config/zerotier +endef define Package/zerotier/install $(INSTALL_DIR) $(1)/usr/bin diff --git a/net/zerotier/files/etc/config/zerotier b/net/zerotier/files/etc/config/zerotier index 1a016ebcfb..f342f851b5 100644 --- a/net/zerotier/files/etc/config/zerotier +++ b/net/zerotier/files/etc/config/zerotier @@ -7,6 +7,9 @@ config zerotier sample_config #option port '9993' + # path to the local.conf + #option local_conf '/etc/zerotier.conf' + # Generate secret on first start option secret '' diff --git a/net/zerotier/files/etc/init.d/zerotier b/net/zerotier/files/etc/init.d/zerotier index ba6b427fa7..c308b4246e 100755 --- a/net/zerotier/files/etc/init.d/zerotier +++ b/net/zerotier/files/etc/init.d/zerotier @@ -14,7 +14,7 @@ section_enabled() { start_instance() { local cfg="$1" - local port secret config_path path + local port secret config_path local_conf path local args="" if ! section_enabled "$cfg"; then @@ -25,6 +25,7 @@ start_instance() { config_get config_path $cfg 'config_path' config_get port $cfg 'port' config_get secret $cfg 'secret' + config_get local_conf $cfg 'local_conf' path=${CONFIG_PATH}_$cfg @@ -38,6 +39,9 @@ start_instance() { return fi + # ensure that the symlink target exists + mkdir -p $(dirname $path) + ln -s $config_path $path fi @@ -71,6 +75,10 @@ start_instance() { rm -f $path/identity.public fi + if [ -f "$local_conf" ]; then + ln -s "$local_conf" $path/local.conf + fi + add_join() { # an (empty) config file will cause ZT to join a network touch $path/networks.d/$1.conf diff --git a/net/zerotier/patches/0001-find-miniupnpc.h-in-staging-directory.patch b/net/zerotier/patches/0001-find-miniupnpc.h-in-staging-directory.patch index 5ea4d697ee..7aa9c7ead3 100644 --- a/net/zerotier/patches/0001-find-miniupnpc.h-in-staging-directory.patch +++ b/net/zerotier/patches/0001-find-miniupnpc.h-in-staging-directory.patch @@ -1,4 +1,4 @@ -From c578216351a4daa3916265b39b14f7c23ef15c90 Mon Sep 17 00:00:00 2001 +From 14454285d7ef5b9cd134c86059933036c1aa2fef Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Mon, 23 Apr 2018 22:12:31 +0200 Subject: [PATCH 1/4] find miniupnpc.h in staging directory @@ -8,10 +8,10 @@ Subject: [PATCH 1/4] find miniupnpc.h in staging directory 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-linux.mk b/make-linux.mk -index 2e6a8632..0cd955d1 100644 +index b81c7aeb..a547125d 100644 --- a/make-linux.mk +++ b/make-linux.mk -@@ -22,8 +22,8 @@ ONE_OBJS+=osdep/LinuxEthernetTap.o +@@ -29,8 +29,8 @@ TIMESTAMP=$(shell date +"%Y%m%d%H%M") # otherwise build into binary as done on Mac and Windows. ONE_OBJS+=osdep/PortMapper.o override DEFS+=-DZT_USE_MINIUPNPC @@ -23,5 +23,5 @@ index 2e6a8632..0cd955d1 100644 override DEFS+=-DZT_USE_SYSTEM_MINIUPNPC LDLIBS+=-lminiupnpc -- -2.17.0 +2.22.0 diff --git a/net/zerotier/patches/0002-remove-pie.patch b/net/zerotier/patches/0002-remove-pie.patch index 849cb20f91..8f90d8f0a2 100644 --- a/net/zerotier/patches/0002-remove-pie.patch +++ b/net/zerotier/patches/0002-remove-pie.patch @@ -1,4 +1,4 @@ -From 7cfe751128d412a9b780ba5e4cb11908fc71cd3d Mon Sep 17 00:00:00 2001 +From 68fe97ef6b05e3709cd4b67c7681dcfc63bfaf80 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Mon, 30 Apr 2018 16:14:30 +0200 Subject: [PATCH 2/4] remove -pie @@ -10,10 +10,10 @@ when making a shared object; recompile with -fPIC" error 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/make-linux.mk b/make-linux.mk -index 0cd955d1..add1d3ae 100644 +index a547125d..13244741 100644 --- a/make-linux.mk +++ b/make-linux.mk -@@ -63,11 +63,11 @@ ifeq ($(ZT_DEBUG),1) +@@ -77,11 +77,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 @@ -29,5 +29,5 @@ index 0cd955d1..add1d3ae 100644 STRIP+=--strip-all endif -- -2.17.0 +2.22.0 diff --git a/net/zerotier/patches/0003-remove-arm32-conservative-CFLAGS.patch b/net/zerotier/patches/0003-remove-arm32-conservative-CFLAGS.patch index ea74d0d8cb..f2189b97f1 100644 --- a/net/zerotier/patches/0003-remove-arm32-conservative-CFLAGS.patch +++ b/net/zerotier/patches/0003-remove-arm32-conservative-CFLAGS.patch @@ -1,6 +1,17 @@ +From a856855ab97e0775a08e1571a4ad26c264cb13f4 Mon Sep 17 00:00:00 2001 +From: Moritz Warning +Date: Sun, 4 Aug 2019 03:56:37 +0200 +Subject: [PATCH 3/4] remove arm32 conservative CFLAGS + +--- + make-linux.mk | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/make-linux.mk b/make-linux.mk +index 13244741..fd164dfa 100644 --- a/make-linux.mk +++ b/make-linux.mk -@@ -231,7 +231,7 @@ ifeq ($(ZT_OFFICIAL),1) +@@ -262,7 +262,7 @@ ifeq ($(ZT_OFFICIAL),1) endif # ARM32 hell -- use conservative CFLAGS @@ -9,3 +20,6 @@ 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 +-- +2.22.0 + diff --git a/net/zerotier/patches/0004-accept-external-linker-flags.patch b/net/zerotier/patches/0004-accept-external-linker-flags.patch index d50143a612..a28f4d8266 100644 --- a/net/zerotier/patches/0004-accept-external-linker-flags.patch +++ b/net/zerotier/patches/0004-accept-external-linker-flags.patch @@ -1,4 +1,4 @@ -From a2cf8bf645d25f18cbc2ed7ad4b9a25725811afd Mon Sep 17 00:00:00 2001 +From 5169e5328525af28f6b7de087ece10a9bc0a2282 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Wed, 2 May 2018 16:06:46 +0200 Subject: [PATCH 4/4] accept external linker flags @@ -8,10 +8,10 @@ Subject: [PATCH 4/4] accept external linker flags 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-linux.mk b/make-linux.mk -index 49e14f70..8e766bfb 100644 +index fd164dfa..29ff8813 100644 --- a/make-linux.mk +++ b/make-linux.mk -@@ -67,7 +67,7 @@ else +@@ -81,7 +81,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) @@ -21,5 +21,5 @@ index 49e14f70..8e766bfb 100644 STRIP+=--strip-all endif -- -2.17.0 +2.22.0 diff --git a/net/zerotier/patches/0005-link-natpmp.patch b/net/zerotier/patches/0005-link-natpmp.patch new file mode 100644 index 0000000000..d1c820947a --- /dev/null +++ b/net/zerotier/patches/0005-link-natpmp.patch @@ -0,0 +1,11 @@ +--- a/make-linux.mk ++++ b/make-linux.mk +@@ -38,7 +38,7 @@ else + override 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 + ONE_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),) ++ifeq ($(wildcard $(STAGING_DIR)/usr/include/natpmp.h),) + ONE_OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o + else + LDLIBS+=-lnatpmp