zerotier: add initial package

Signed-off-by: Moritz Warning <moritzwarning@web.de>
This commit is contained in:
Moritz Warning
2017-01-04 18:26:21 +01:00
parent 6dee23a0f6
commit 23983d7a66
8 changed files with 329 additions and 0 deletions
@@ -0,0 +1,44 @@
From 830250759cd4c14ca2ae5ddf24f0a0427f258622 Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@gmail.com>
Date: Tue, 26 Jul 2016 16:36:20 -0700
Subject: [PATCH 1/2] Fix for running under MUSL libc (e.g. Alpine Linux)
---
osdep/Thread.hpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/osdep/Thread.hpp b/osdep/Thread.hpp
index 7fb38d8..4f90dc0 100644
--- a/osdep/Thread.hpp
+++ b/osdep/Thread.hpp
@@ -125,6 +125,10 @@ public:
throw()
{
memset(&_tid,0,sizeof(_tid));
+ pthread_attr_init(&_tattr);
+#ifdef __LINUX__
+ pthread_attr_setstacksize(&_tattr,8388608); // for MUSL libc and others, has no effect in normal glibc environments
+#endif
_started = false;
}
@@ -157,7 +161,7 @@ public:
{
Thread t;
t._started = true;
- if (pthread_create(&t._tid,(const pthread_attr_t *)0,&___zt_threadMain<C>,instance))
+ if (pthread_create(&t._tid,&t._tattr,&___zt_threadMain<C>,instance))
throw std::runtime_error("pthread_create() failed, unable to create thread");
return t;
}
@@ -184,6 +188,7 @@ public:
private:
pthread_t _tid;
+ pthread_attr_t _tattr;
volatile bool _started;
};
--
2.9.0
+36
View File
@@ -0,0 +1,36 @@
From 333bbabc6dfad0553fb63d560ab6442a50cc9e52 Mon Sep 17 00:00:00 2001
From: Moritz Warning <moritzwarning@web.de>
Date: Fri, 22 Jul 2016 23:27:31 +0200
Subject: [PATCH 2/2] fix build
---
make-linux.mk | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
Index: ZeroTierOne-1.1.14/make-linux.mk
===================================================================
--- ZeroTierOne-1.1.14.orig/make-linux.mk
+++ ZeroTierOne-1.1.14/make-linux.mk
@@ -39,19 +39,19 @@ include objects.mk
# On Linux we auto-detect the presence of some libraries and if present we
# link against the system version. This works with our package build images.
-ifeq ($(wildcard /usr/include/lz4.h),)
+ifeq ($(wildcard $(STAGING_DIR)/usr/include/lz4.h),)
OBJS+=ext/lz4/lz4.o
else
LDLIBS+=-llz4
DEFS+=-DZT_USE_SYSTEM_LZ4
endif
-ifeq ($(wildcard /usr/include/http_parser.h),)
+ifeq ($(wildcard $(STAGING_DIR)/usr/include/http_parser.h),)
OBJS+=ext/http-parser/http_parser.o
else
LDLIBS+=-lhttp_parser
DEFS+=-DZT_USE_SYSTEM_HTTP_PARSER
endif
-ifeq ($(wildcard /usr/include/json-parser/json.h),)
+ifeq ($(wildcard $(STAGING_DIR)/usr/include/json-parser/json.h),)
OBJS+=ext/json-parser/json.o
else
LDLIBS+=-ljsonparser
@@ -0,0 +1,27 @@
From 21f4958bd48cae59b478b1b3445e00fa4fb18991 Mon Sep 17 00:00:00 2001
From: muebau <muebau@gmail.com>
Date: Fri, 5 Aug 2016 19:22:45 +0200
Subject: [PATCH] OpenWRT workaround to avoid seg faults
---
service/OneService.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 13820f5..9ba3238 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -862,8 +862,8 @@ public:
}
// Start two background threads to handle expensive ops out of line
- Thread::start(_node);
- Thread::start(_node);
+ //Thread::start(_node);
+ //Thread::start(_node);
_nextBackgroundTaskDeadline = 0;
uint64_t clockShouldBe = OSUtils::now();
--
2.7.4
@@ -0,0 +1,35 @@
Index: ZeroTierOne-1.1.14/make-linux.mk
===================================================================
--- ZeroTierOne-1.1.14.orig/make-linux.mk
+++ ZeroTierOne-1.1.14/make-linux.mk
@@ -64,7 +64,7 @@ ifeq ($(ZT_USE_MINIUPNPC),1)
DEFS+=-DZT_USE_MINIUPNPC
# Auto-detect libminiupnpc at least v2.0
- 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)
ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1)
DEFS+=-DZT_USE_SYSTEM_MINIUPNPC
LDLIBS+=-lminiupnpc
@@ -74,7 +74,7 @@ ifeq ($(ZT_USE_MINIUPNPC),1)
endif
# Auto-detect libnatpmp
- ifeq ($(wildcard /usr/include/natpmp.h),)
+ ifeq ($(wildcard $(STAGING_DIR)/usr/include/natpmp.h),)
OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o
else
LDLIBS+=-lnatpmp
Index: ZeroTierOne-1.1.14/osdep/PortMapper.cpp
===================================================================
--- ZeroTierOne-1.1.14.orig/osdep/PortMapper.cpp
+++ ZeroTierOne-1.1.14/osdep/PortMapper.cpp
@@ -180,7 +180,7 @@ public:
struct IGDdatas data;
int upnpError = 0;
- UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,2,&upnpError);
+ UPNPDev *devlist = upnpDiscoverAll(5000,(const char *)0,(const char *)0,0,0,&upnpError);
if (devlist) {
#ifdef ZT_PORTMAPPER_TRACE