From 29e31dd60a608bdd9e1c735e395bb19d2f3f274b Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 10 Oct 2017 11:40:14 -0700 Subject: [PATCH] Fixes for Unix-like builds after introduction of Windows code --- Makefile | 11 +++++++---- .../ports/unix/include/{ => arch}/cc.h | 0 .../ports/unix/include/{ => arch}/perf.h | 0 .../ports/unix/include/{ => arch}/sys_arch.h | 0 src/VirtualSocket.cpp | 2 +- src/VirtualTap.hpp | 14 ++++++++++++++ 6 files changed, 22 insertions(+), 5 deletions(-) rename ext/lwip-contrib/ports/unix/include/{ => arch}/cc.h (100%) rename ext/lwip-contrib/ports/unix/include/{ => arch}/perf.h (100%) rename ext/lwip-contrib/ports/unix/include/{ => arch}/sys_arch.h (100%) diff --git a/Makefile b/Makefile index 75f074d..5b97fdd 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ endif OSTYPE=$(shell uname -s | tr '[A-Z]' '[a-z]') BUILD=build/$(OSTYPE) +LWIPCONTRIBDIR=ext/lwip-contrib # Windows ifeq ($(OSTYPE),mingw32_nt-6.2) @@ -44,29 +45,31 @@ CC=gcc CXX=g++ CXXFLAGS+=-Wno-unknown-pragmas -Wno-pointer-arith -Wno-deprecated-declarations -Wno-conversion-null WINDEFS=-lws2_32 -lshlwapi -liphlpapi -static -static-libgcc -static-libstdc++ -CONTRIBDIR=ext/lwip-contrib -LWIPARCH=$(CONTRIBDIR)/ports/win32 -LWIPARCHINCLUDE=$(LWIPARCH)/include +LWIPARCHINCLUDE=$(LWIPCONTRIBDIR)/ports/win32/include endif # Darwin ifeq ($(OSTYPE),darwin) ARTOOL=libtool ARFLAGS=-static +LWIPARCHINCLUDE=$(LWIPCONTRIBDIR)/ports/unix/include endif # Linux ifeq ($(OSTYPE),linux) ARTOOL=ar ARFLAGS=rcs +LWIPARCHINCLUDE=$(LWIPCONTRIBDIR)/ports/unix/include endif # FreeBSD ifeq ($(OSTYPE),freebsd) ARTOOL=ar ARFLAGS=rcs +LWIPARCHINCLUDE=$(LWIPCONTRIBDIR)/ports/unix/include endif # OpenBSD ifeq ($(OSTYPE),openbsd) ARTOOL=ar ARFLAGS=rcs +LWIPARCHINCLUDE=$(LWIPCONTRIBDIR)/ports/unix/include endif ############################################################################## @@ -224,7 +227,7 @@ STACK_DRIVER_DEFS+=-DLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS STACK_DRIVER_DEFS+=-DSTACK_LWIP STACK_DRIVER_FILES:=src/lwIP.cpp LWIPDIR=ext/lwip/src -STACK_INCLUDES+=$(LWIPARCHINCLUDE) -Iext/lwip/src/include/lwip \ +STACK_INCLUDES+=-I$(LWIPARCHINCLUDE) -Iext/lwip/src/include/lwip \ -I$(LWIPDIR)/include \ -I$(LWIPARCH)/include \ -I$(LWIPDIR)/include/ipv4 \ diff --git a/ext/lwip-contrib/ports/unix/include/cc.h b/ext/lwip-contrib/ports/unix/include/arch/cc.h similarity index 100% rename from ext/lwip-contrib/ports/unix/include/cc.h rename to ext/lwip-contrib/ports/unix/include/arch/cc.h diff --git a/ext/lwip-contrib/ports/unix/include/perf.h b/ext/lwip-contrib/ports/unix/include/arch/perf.h similarity index 100% rename from ext/lwip-contrib/ports/unix/include/perf.h rename to ext/lwip-contrib/ports/unix/include/arch/perf.h diff --git a/ext/lwip-contrib/ports/unix/include/sys_arch.h b/ext/lwip-contrib/ports/unix/include/arch/sys_arch.h similarity index 100% rename from ext/lwip-contrib/ports/unix/include/sys_arch.h rename to ext/lwip-contrib/ports/unix/include/arch/sys_arch.h diff --git a/src/VirtualSocket.cpp b/src/VirtualSocket.cpp index 6cc872a..f19edc4 100644 --- a/src/VirtualSocket.cpp +++ b/src/VirtualSocket.cpp @@ -35,7 +35,7 @@ #include -#if defined(__linux__) || #defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) #include #endif diff --git a/src/VirtualTap.hpp b/src/VirtualTap.hpp index 9fc3457..b1e5c30 100644 --- a/src/VirtualTap.hpp +++ b/src/VirtualTap.hpp @@ -119,6 +119,20 @@ namespace ZeroTier { void threadMain() throw(); +#if defined(__MINGW32__) + /* The following is merely to make ZeroTier's OneService happy while building on Windows. + we won't use these in libzt */ + NET_LUID _deviceLuid; + std::string _deviceInstanceId; + + /** + * Returns whether the VirtualTap interface has been initialized + */ + bool isInitialized() const { return _initialized; }; + + inline const NET_LUID &luid() const { return _deviceLuid; } + inline const std::string &instanceId() const { return _deviceInstanceId; } +#endif /** * For moving data onto the ZeroTier virtual wire */