Signed-off-by: Moritz Warning <moritzwarning@web.de>lilik-openwrt-22.03
@ -1,44 +0,0 @@ | |||
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 | |||
@ -0,0 +1,28 @@ | |||
From 4fd495fca8417a8fd4405951d1eee80f345eaf9b Mon Sep 17 00:00:00 2001 | |||
From: Moritz Warning <moritzwarning@web.de> | |||
Date: Sun, 19 Mar 2017 01:13:14 +0100 | |||
Subject: [PATCH 1/2] prevent D_FORTIFY_SOURCE from being defined twice | |||
--- | |||
make-linux.mk | 3 ++- | |||
1 file changed, 2 insertions(+), 1 deletion(-) | |||
diff --git a/make-linux.mk b/make-linux.mk | |||
index 7c77f58f..508d8c42 100644 | |||
--- a/make-linux.mk | |||
+++ b/make-linux.mk | |||
@@ -8,9 +8,10 @@ ifeq ($(origin CXX),default) | |||
endif | |||
INCLUDES?= | |||
-DEFS?=-D_FORTIFY_SOURCE=2 | |||
+DEFS?= | |||
LDLIBS?= | |||
DESTDIR?= | |||
+ZT_ENABLE_PORTMAPPING?=0 | |||
include objects.mk | |||
-- | |||
2.12.0 | |||
@ -1,51 +0,0 @@ | |||
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(-) | |||
--- a/make-linux.mk | |||
+++ b/make-linux.mk | |||
@@ -39,24 +39,24 @@ 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),) | |||
+#else | |||
+# LDLIBS+=-llz4 | |||
+# DEFS+=-DZT_USE_SYSTEM_LZ4 | |||
+#endif | |||
+#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),) | |||
+#else | |||
+# LDLIBS+=-lhttp_parser | |||
+# DEFS+=-DZT_USE_SYSTEM_HTTP_PARSER | |||
+#endif | |||
+#ifeq ($(wildcard $(STAGING_DIR)/usr/include/json-parser/json.h),) | |||
OBJS+=ext/json-parser/json.o | |||
-else | |||
- LDLIBS+=-ljsonparser | |||
- DEFS+=-DZT_USE_SYSTEM_JSON_PARSER | |||
-endif | |||
+#else | |||
+# LDLIBS+=-ljsonparser | |||
+# DEFS+=-DZT_USE_SYSTEM_JSON_PARSER | |||
+#endif | |||
ifeq ($(ZT_USE_MINIUPNPC),1) | |||
OBJS+=osdep/PortMapper.o |
@ -0,0 +1,56 @@ | |||
From b8390696d81f66109560d12046bb63b9704e07f3 Mon Sep 17 00:00:00 2001 | |||
From: Moritz Warning <moritzwarning@web.de> | |||
Date: Sun, 19 Mar 2017 01:14:10 +0100 | |||
Subject: [PATCH 2/2] make natpmp/miniupnpc configurable | |||
also include staging_dir variable in the search paths | |||
--- | |||
make-linux.mk | 32 ++++++++++++++++++-------------- | |||
1 file changed, 18 insertions(+), 14 deletions(-) | |||
diff --git a/make-linux.mk b/make-linux.mk | |||
index 508d8c42..36060857 100644 | |||
--- a/make-linux.mk | |||
+++ b/make-linux.mk | |||
@@ -22,20 +22,24 @@ OBJS+=ext/http-parser/http_parser.o | |||
# Auto-detect miniupnpc and nat-pmp as well and use system libs if present, | |||
# 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) | |||
- 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 | |||
- LDLIBS+=-lnatpmp | |||
- DEFS+=-DZT_USE_SYSTEM_NATPMP | |||
+ | |||
+ifeq ($(ZT_ENABLE_PORTMAPPING),1) | |||
+ DEFS+=-DZT_USE_MINIUPNPC | |||
+ 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 | |||
+ 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 $(STAGING_DIR)/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) | |||
-- | |||
2.12.0 | |||
@ -1,27 +0,0 @@ | |||
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 | |||
@ -1,32 +0,0 @@ | |||
--- a/make-linux.mk | |||
+++ b/make-linux.mk | |||
@@ -64,7 +64,8 @@ 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) | |||
+ MINIUPNPC_IS_NEW_ENOUGH=1 | |||
ifeq ($(MINIUPNPC_IS_NEW_ENOUGH),1) | |||
DEFS+=-DZT_USE_SYSTEM_MINIUPNPC | |||
LDLIBS+=-lminiupnpc | |||
@@ -74,7 +75,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 | |||
--- a/osdep/PortMapper.cpp | |||
+++ b/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 |