diff --git a/make-linux.mk b/make-linux.mk index b6fe0d2..b9c91be 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -168,6 +168,10 @@ INCLUDES+=-Iext/lwip/src/include/lwip \ -Iext endif +ifeq ($(NO_STACK),1) +CXXFLAGS+=-DNO_STACK +endif + all: ############################################################################## diff --git a/make-mac.mk b/make-mac.mk index 9bb4bfb..7f444ce 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -164,6 +164,10 @@ INCLUDES+=-Iext/lwip/src/include/lwip \ -Iext endif +ifeq ($(NO_STACK),1) +CXXFLAGS+=-DNO_STACK +endif + all: ############################################################################## diff --git a/src/Connection.hpp b/src/Connection.hpp index e76df1d..cc462d7 100644 --- a/src/Connection.hpp +++ b/src/Connection.hpp @@ -32,15 +32,12 @@ #include #include -// picoTCP #if defined(STACK_PICO) - #include "pico_socket.h" +#include "pico_socket.h" #endif -// ZT #include "Phy.hpp" -// SDK #include "libzt.h" #include "SocketTap.hpp" #include "RingBuffer.hpp" @@ -82,7 +79,6 @@ namespace ZeroTier { std::time_t closure_ts; Connection() { - TXbuf = new RingBuffer(ZT_TCP_TX_BUF_SZ); RXbuf = new RingBuffer(ZT_TCP_RX_BUF_SZ); @@ -96,27 +92,12 @@ namespace ZeroTier { } sdk_fd = fdpair[0]; app_fd = fdpair[1]; - //DEBUG_ERROR("sdk_fd = %d, app_fd = %d", sdk_fd, app_fd); - -/* - if(ZT_SOCK_BEHAVIOR_LINGER) { - struct linger so_linger; - so_linger.l_onoff = true; - so_linger.l_linger = ZT_SOCK_BEHAVIOR_LINGER_TIME; - if(setsockopt(app_fd, SOL_SOCKET, SO_LINGER, &so_linger, sizeof so_linger) < 0) { - DEBUG_ERROR("error setsockopt (%d)", errno); - } - } -*/ - } - ~Connection() - { - // DEBUG_INFO("~Connection() this = %p", this); } + ~Connection() { } }; /* - * A helper object for passing SocketTaps and Connections through the stack + * A helper object for passing SocketTap(s) and Connection(s) through the stack */ struct ConnectionPair { diff --git a/src/README.md b/src/README.md deleted file mode 100644 index 67d098f..0000000 --- a/src/README.md +++ /dev/null @@ -1,2 +0,0 @@ -src -====== \ No newline at end of file diff --git a/src/Utilities.cpp b/src/Utilities.cpp index fc8fe21..1a0a14a 100644 --- a/src/Utilities.cpp +++ b/src/Utilities.cpp @@ -24,21 +24,4 @@ * of your own application. */ -#include -#include -#include -#include -#include -#include -#include - -/* -void zt_dump_stacktrace(int sig) { - void *array[16]; - size_t size; - size = backtrace(array, 16); - fprintf(stderr, "Error: signal %d:\n", sig); - backtrace_symbols_fd(array, size, STDERR_FILENO); - exit(1); -} -*/ +// Intentionally left blank diff --git a/src/Utilities.hpp b/src/Utilities.hpp index 124aea6..f9e89d0 100644 --- a/src/Utilities.hpp +++ b/src/Utilities.hpp @@ -27,11 +27,6 @@ #ifndef UTILITIES_HPP #define UTILITIES_HPP -/* - * Print a stacktrace - */ -// void zt_dump_stacktrace(int sig); - #if defined(STACK_LWIP) && defined(LIBZT_IPV4) #include "lwip/ip_addr.h" @@ -53,6 +48,6 @@ inline ip_addr_t convert_ip(struct sockaddr_in * addr) return conn_addr; } -#endif +#endif // STACK_LWIP && LIBZT_IPV4 -#endif \ No newline at end of file +#endif // UTILITIES_HPP \ No newline at end of file diff --git a/src/lwIP.cpp b/src/lwIP.cpp index a9b1c64..8e107ac 100644 --- a/src/lwIP.cpp +++ b/src/lwIP.cpp @@ -29,8 +29,8 @@ #include "libzt.h" #include "SocketTap.hpp" #include "Utilities.hpp" - #include "lwIP.hpp" + #include "netif/ethernet.h" #include "lwip/etharp.h" diff --git a/src/picoTCP.cpp b/src/picoTCP.cpp index c336529..043e762 100644 --- a/src/picoTCP.cpp +++ b/src/picoTCP.cpp @@ -26,7 +26,6 @@ #include -// picoTCP #include "pico_eth.h" #include "pico_stack.h" #include "pico_ipv4.h" @@ -37,14 +36,12 @@ #include "pico_device.h" #include "pico_ipv6.h" -// SDK #include "libzt.h" #include "Utilities.hpp" #include "SocketTap.hpp" #include "picoTCP.hpp" #include "RingBuffer.hpp" -// ZT #include "Utils.hpp" #include "OSUtils.hpp" #include "Mutex.hpp" diff --git a/test/generate_test_env.sh b/test/generate_test_env.sh index bd50121..6146303 100755 --- a/test/generate_test_env.sh +++ b/test/generate_test_env.sh @@ -1,15 +1,20 @@ #!/bin/bash # create dirs to house the identities/config -mkdir -p test_identities -mkdir test_identities/alice -mkdir test_identities/bob +mkdir alice +mkdir bob +mkdir ted +mkdir carol # generate identities -zerotier-one test_identities/alice -d -echo $! >> "test_identities/zto.alice" -zerotier-one test_identities/bob -d -echo $! >> "test_identities/zto.bob" +zerotier-one alice -d +echo $! >> "zto.alice" +zerotier-one bob -d +echo $! >> "zto.bob" +zerotier-one ted -d +echo $! >> "zto.ted" +zerotier-one carol -d +echo $! >> "zto.carol" # should be done by now sleep(30) @@ -17,7 +22,11 @@ sleep(30) # kill daemons echo "killing daemons" -pid=$(cat test_identities/alice/zto.alice) +pid=$(cat alice/zto.alice) kill -9 $pid -pid=$(cat test_identities/bob/zto.bob) +pid=$(cat bob/zto.bob) +kill -9 $pid +pid=$(cat ted/zto.ted) +kill -9 $pid +pid=$(cat carol/zto.carol) kill -9 $pid \ No newline at end of file