updated flags

This commit is contained in:
Joseph Henry
2016-06-27 14:15:58 -07:00
parent f2a0a1b579
commit aa9b514c0b
10 changed files with 30 additions and 27 deletions

View File

@@ -9,7 +9,7 @@ This short tutorial will show you how to enable ZeroTier functionality for your
**Step 1: Build the ZeroTier service binaries**
From the ZeroTier source directory, `make netcon` Optionally, if you'd like to see some debug output during execution, use `make sdk ZT_SDK_DEBUG=1`
From the ZeroTier source directory, `make netcon` Optionally, if you'd like to see some debug output during execution, use `make sdk SDK_DEBUG=1`
**Step 2: Build your Docker image**

View File

@@ -1,7 +1,7 @@
ZeroTier Integrations
====
If you want everything built at once, type `make all` and go play outside for a few minutes, we'll copy all of the targets into the `build` directory for you along with specific instructions on how to use each binary.
If you want everything built at once, type `make all` and go play outside for a few minutes, we'll copy all of the targets into the `build` directory for you along with specific instructions on how to use each binary. You can then use `make -s check` to check the build status of each binary target.
*NOTE for Apple platforms: In order to build iOS/OSX Frameworks and Bundles you will need XCode command line tools `xcode-select --install`*

View File

@@ -1376,8 +1376,8 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
OTHER_CFLAGS = (
"-D__UNITY_3D__",
"-DZT_SDK",
"-DZT_SDK_DEBUG",
"-DSDK",
"-DSDK_DEBUG",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1401,8 +1401,8 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
OTHER_CFLAGS = (
"-D__UNITY_3D__",
"-DZT_SDK",
"-DZT_SDK_DEBUG",
"-DSDK",
"-DSDK_DEBUG",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1430,8 +1430,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_CFLAGS = (
"-DZT_SDK_DEBUG",
"-DZT_SDK",
"-DSDK_DEBUG",
"-DSDK",
"-D__IOS__",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-iOS";
@@ -1460,8 +1460,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.3;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_CFLAGS = (
"-DZT_SDK_DEBUG",
"-DZT_SDK",
"-DSDK_DEBUG",
"-DSDK",
"-D__IOS__",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-iOS";
@@ -1491,8 +1491,8 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_CFLAGS = (
"-DZT_SDK",
"-DZT_SDK_DEBUG",
"-DSDK",
"-DSDK_DEBUG",
"-D__XCODE__",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-OSX";
@@ -1519,8 +1519,8 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_CFLAGS = (
"-DZT_SDK",
"-DZT_SDK_DEBUG",
"-DSDK",
"-DSDK_DEBUG",
"-D__XCODE__",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-OSX";
@@ -1541,8 +1541,8 @@
INFOPLIST_FILE = ZeroTierSDK_Unity3D_OSX/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
OTHER_CFLAGS = (
"-DZT_SDK_DEBUG",
"-DZT_SDK",
"-DSDK_DEBUG",
"-DSDK",
"-D__UNITY_3D__",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-OSX";
@@ -1564,8 +1564,8 @@
INFOPLIST_FILE = ZeroTierSDK_Unity3D_OSX/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
OTHER_CFLAGS = (
"-DZT_SDK_DEBUG",
"-DZT_SDK",
"-DSDK_DEBUG",
"-DSDK",
"-D__UNITY_3D__",
);
PRODUCT_BUNDLE_IDENTIFIER = "zerotier.ZeroTierSDK-Unity3D-OSX";

View File

@@ -77,11 +77,11 @@ all: shared_lib check
linux_shared_lib: $(OBJS)
rm -f *.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -DZT_SDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -Izerotierone/osdep -Izerotierone/node -Isrc -o build/zerotier-sdk-service $(OBJS) zerotierone/service/OneService.cpp src/SDK_EthernetTap.cpp src/SDK_Proxy.cpp zerotierone/one.cpp -x c src/SDK_RPC.c $(LDLIBS) -ldl
$(CXX) $(CXXFLAGS) $(LDFLAGS) $(DEFS) -DZT_SDK -DZT_ONE_NO_ROOT_CHECK -Iext/lwip/src/include -Iext/lwip/src/include/ipv4 -Iext/lwip/src/include/ipv6 -Izerotierone/osdep -Izerotierone/node -Isrc -o build/zerotier-sdk-service $(OBJS) zerotierone/service/OneService.cpp src/SDK_EthernetTap.cpp src/SDK_Proxy.cpp zerotierone/one.cpp -x c src/SDK_RPC.c $(LDLIBS) -ldl
# Build liblwip.so which must be placed in ZT home for zerotier-netcon-service to work
make -f make-liblwip.mk
# Use gcc not clang to build standalone intercept library since gcc is typically used for libc and we want to ensure maximal ABI compatibility
cd src ; gcc $(DEFS) -g -O2 -Wall -std=c99 -fPIC -DVERBOSE -D_GNU_SOURCE -DNETCON_INTERCEPT -I. -I../zerotierone/node -nostdlib -shared -o libztintercept.so SDK_Sockets.c SDK_Intercept.c SDK_Debug.c SDK_RPC.c -ldl
cd src ; gcc $(DEFS) -g -O2 -Wall -std=c99 -fPIC -DVERBOSE -D_GNU_SOURCE -DSDK_INTERCEPT -I. -I../zerotierone/node -nostdlib -shared -o libztintercept.so SDK_Sockets.c SDK_Intercept.c SDK_Debug.c SDK_RPC.c -ldl
mkdir -p build/linux_shared_lib
cp src/libztintercept.so build/linux_shared_lib/libztintercept.so
ln -sf zerotier-sdk-service zerotier-cli

View File

@@ -50,14 +50,14 @@
#define MSG_DEBUG 4 // Information which is only useful to someone debugging
#define MSG_DEBUG_EXTRA 5 // If nothing in your world makes sense
#define DEBUG_TO_FILE 1
#define DEBUG_LOGFILE_PATH "/Users/Joseph/code/ztnc_logfile.txt"
void dwr(int level, const char *fmt, ... );
void dwr(int level, const char *fmt, ... )
{
#if defined(ZT_SDK_DEBUG)
fprintf(stderr, "Hello from debug!\n");
#if defined(SDK_DEBUG)
if(level > DEBUG_LEVEL)
return;
int saveerr;
@@ -75,10 +75,10 @@ void dwr(int level, const char *fmt, ... )
#elif defined(__APPLE__)
pid_t tid = pthread_mach_thread_np(pthread_self());
#endif
if(DEBUG_TO_FILE) {
#if defined(SDK_DEBUG_WRITE_LOGFILE)
FILE *file = fopen(DEBUG_LOGFILE_PATH,"a");
vfprintf(file, fmt, ap);
}
#endif
fprintf(stderr, "%s [tid=%7d] ", timestring, tid);
vfprintf(stderr, fmt, ap);
fflush(stderr);

View File

@@ -132,7 +132,7 @@ NetconEthernetTap::NetconEthernetTap(
char sockPath[4096],lwipPath[4096];
rpcCounter = -1;
Utils::snprintf(sockPath,sizeof(sockPath),"%s%snc_%.16llx",homePath,ZT_PATH_SEPARATOR_S,_nwid,ZT_PATH_SEPARATOR_S,(unsigned long long)nwid);
_dev = sockPath; // in netcon mode, set device to be just the network ID
_dev = sockPath; // in SDK mode, set device to be just the network ID
// Start SOCKS5 Proxy server
// For use when traditional syscall hooking isn't available (ex. some APIs on iOS and Android)

View File

@@ -103,7 +103,7 @@ int get_retval(int rpc_sock)
int load_symbols_rpc()
{
#if defined(NETCON_INTERCEPT) || defined(__IOS__) || defined(__UNITY_3D__)
#if defined(SDK_INTERCEPT) || defined(__IOS__) || defined(__UNITY_3D__)
realsocket = dlsym(RTLD_NEXT, "socket");
realconnect = dlsym(RTLD_NEXT, "connect");
if(!realconnect || !realsocket)

View File

@@ -94,6 +94,7 @@ const char *get_netpath() {
void zt_init_rpc(char *nwid)
{
dwr(MSG_DEBUG, "zt_init_rpc\n");
#if defined(__UNITY_3D__)
//char *nw = "565799d8f6e1c11a";
//char *path = "/Users/Joseph/utest2/nc_";
@@ -133,6 +134,8 @@ const char *get_netpath() {
if (!api_netpath) {
api_netpath = getenv("ZT_NC_NETWORK");
set_netpath(api_netpath);
dwr(MSG_DEBUG, "netpath = %s\n", api_netpath);
if(!api_netpath) {
// return 0;
}

View File

@@ -1,4 +1,4 @@
gcc kq_test_client.c ../../kq.c ../../zt_api.c ../../RPC.c -DZT_SDK_DEBUG -DNETCON_INTERCEPT -o kq_test_client
gcc kq_test_client.c ../../kq.c ../../zt_api.c ../../RPC.c -DSDK_DEBUG -DNETCON_INTERCEPT -o kq_test_client
#gcc kq_test_server.c ../../kq.c -o kq_test_server
gcc server.c -o server