From b36a213d476d280da89360e6e93397b81c1373a2 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Mon, 11 Sep 2017 16:59:52 -0700 Subject: [PATCH] Added LIBZT_SANITIZE option, removed APIFILES from lwIP build --- FAQ.md | 10 +++++++++- make-liblwip.mk | 3 ++- make-linux.mk | 9 ++++----- make-mac.mk | 8 ++++---- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/FAQ.md b/FAQ.md index 034f616..03b2dca 100644 --- a/FAQ.md +++ b/FAQ.md @@ -11,4 +11,12 @@ In rare circumstances it can take a substantial amount of time for a libzt insta ### How do I get debug output? -In order of relevance, enable the following: For `libzt`-specific debug output which basically includes the POSIX socket emulation layer and network stack *drivers*, enable `LIBZT_DEBUG=1`. For situations where you suspect that the problem might lie within the network stack itself, enable `NS_DEBUG=1`. You should also check out `include/libzt.h` for additional fine-grained debug options for each network stack. If you think that your problem is with the ZeroTier protocol itself, enable `ZT_DEBUG=1`. This will output what's happening in the ZeroTier core. Note, you can enable all of these at once if you're brave. +In order of relevance, enable the following: For `libzt`-specific debug output which basically includes the POSIX socket emulation layer and network stack *drivers*, enable `LIBZT_DEBUG=1`. For situations where you suspect that the problem might lie within the network stack itself, enable `NS_DEBUG=1`. You should also check out `include/libzt.h` for additional fine-grained debug options for each network stack. If you think that your problem is with the ZeroTier protocol itself, enable `ZT_DEBUG=1`. This will output what's happening in the ZeroTier core. Note, you can enable all of these at once if you're brave. Additionally, you can use the `LIBZT_SANITIZE=1` flag to build against the [AddressSanitization]() library. + +### Versioning + +Each version of libzt will include a specific (and unrelated) version of the ZeroTier core, and network stacks. For instance: Version 1.1.5 of libzt might include version 1.2.5 of ZeroTier, there is no connection between these versioning schemes. Additionally, an update to libzt doesn't necessarily translate to an update to the ZeroTier core. + +### How do I run unit tests? + +See: [TESTING.md](TESTING.md) \ No newline at end of file diff --git a/make-liblwip.mk b/make-liblwip.mk index a841b35..f8ccc02 100644 --- a/make-liblwip.mk +++ b/make-liblwip.mk @@ -99,7 +99,8 @@ SIXLOWPAN=$(LWIPDIR)/netif/lowpan6.c \ # ARCHFILES: Architecture specific files. ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)tapif.c $(LWIPARCH)/netif/list.c $(LWIPARCH)/netif/tcpdump.c) # LWIPFILES: All the above. -LWIPFILES=$(COREFILES) $(APIFILES) $(NETIFFILES) $(ARCHFILES) +LWIPFILES=$(COREFILES) $(NETIFFILES) $(ARCHFILES) +#$(APIFILES) ifeq ($(LIBZT_IPV4),1) LWIPFILES+=$(CORE4FILES) diff --git a/make-linux.mk b/make-linux.mk index 28c14f6..2846448 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -70,8 +70,8 @@ endif CXXFLAGS=$(CFLAGS) -Wno-format -fno-rtti -std=c++11 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" # Build against address sanitization library for advanced debugging (clang) -ifeq ($(ZT_SANITIZE),1) - CXXFLAGS+=-x c++ -O -g -fsanitize=address -DASAN_OPTIONS=symbolize=1 -DASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) +ifeq ($(LIBZT_SANITIZE),1) + SANFLAGS+=-x c++ -O -g -fsanitize=address -DASAN_OPTIONS=symbolize=1 -DASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) endif INCLUDES+= -Iext \ @@ -207,7 +207,6 @@ picotcp: cd $(STACK_DIR); make lib ARCH=shared IPV4=1 IPV6=1 lwip: - echo $(STACK_FLAGSs) make -f make-liblwip.mk liblwip.a $(STACK_FLAGS) ############################################################################## @@ -269,10 +268,10 @@ ztproxy: @$(CXX) $(CXXFLAGS) $(UNIT_TEST_INCLUDES) examples/ztproxy/ztproxy.cpp -o $(BUILD)/ztproxy $< $(UNIT_TEST_LIBS) -ldl @./check.sh $(BUILD)/ztproxy selftest: - @$(CXX) $(CXXFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__SELFTEST__ -o $(BUILD)/selftest $(UNIT_TEST_LIBS) + @$(CXX) $(CXXFLAGS) $(SANFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__SELFTEST__ -o $(BUILD)/selftest $(UNIT_TEST_LIBS) @./check.sh $(BUILD)/selftest nativetest: - @$(CXX) $(CXXFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__NATIVETEST__ -o $(BUILD)/nativetest + @$(CXX) -v $(CXXFLAGS) $(SANFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__NATIVETEST__ -o $(BUILD)/nativetest @./check.sh $(BUILD)/nativetest diff --git a/make-mac.mk b/make-mac.mk index 8ed29eb..5ea8ce6 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -71,8 +71,8 @@ endif CXXFLAGS=$(CFLAGS) -Wno-format -fno-rtti -std=c++11 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" # Build against address sanitization library for advanced debugging (clang) -ifeq ($(ZT_SANITIZE),1) - CXXFLAGS+=-x c++ -O -g -fsanitize=address -DASAN_OPTIONS=symbolize=1 -DASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) +ifeq ($(LIBZT_SANITIZE),1) + SANFLAGS+=-x c++ -O -g -fsanitize=address -DASAN_OPTIONS=symbolize=1 -DASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer) endif INCLUDES+= -Iext \ @@ -281,10 +281,10 @@ ztproxy: @$(CXX) $(CXXFLAGS) $(UNIT_TEST_INCLUDES) examples/ztproxy/ztproxy.cpp -o $(BUILD)/ztproxy $< $(UNIT_TEST_LIBS) -ldl @./check.sh $(BUILD)/ztproxy selftest: - @$(CXX) $(CXXFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__SELFTEST__ -o $(BUILD)/selftest $(UNIT_TEST_LIBS) + @$(CXX) $(CXXFLAGS) $(SANFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__SELFTEST__ -o $(BUILD)/selftest $(UNIT_TEST_LIBS) @./check.sh $(BUILD)/selftest nativetest: - @$(CXX) $(CXXFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__NATIVETEST__ -o $(BUILD)/nativetest + @$(CXX) $(CXXFLAGS) $(SANFLAGS) $(UNIT_TEST_INCLUDES) $(INCLUDES) test/selftest.cpp -D__NATIVETEST__ -o $(BUILD)/nativetest @./check.sh $(BUILD)/nativetest ##############################################################################