From e171384c19bb0c0dfe0368e4f249dd6a30d33748 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sun, 29 Oct 2023 13:48:07 +0200 Subject: [PATCH 01/36] Append noexecstack to linker flags instead of assembler flags * Better compatibility with LLVM toolchain where clang -c doesn't support the flag, but the linker does. LLD already defaults to noexecstack, but adding it in the linker phase will avoid errors about unsupported options. Signed-off-by: Alfred Wingate --- make-linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-linux.mk b/make-linux.mk index 48d44a048..273fc7656 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -358,7 +358,7 @@ override CFLAGS+=-fPIC -fPIE override CXXFLAGS+=-fPIC -fPIE # Non-executable stack -override ASFLAGS+=--noexecstack +override LDFLAGS+=-Wl,-z,noexecstack .PHONY: all all: one From 5533b8245082e88b7b116be04756340279e98246 Mon Sep 17 00:00:00 2001 From: ChrisCarini <6374067+ChrisCarini@users.noreply.github.com> Date: Fri, 3 Nov 2023 18:11:51 -0700 Subject: [PATCH 02/36] Add ARM architectures to Synology DSM7 --- pkg/synology/dsm7-docker/README.md | 5 +++++ pkg/synology/dsm7-docker/build.sh | 22 ++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pkg/synology/dsm7-docker/README.md b/pkg/synology/dsm7-docker/README.md index 14bacde76..99cd979cf 100644 --- a/pkg/synology/dsm7-docker/README.md +++ b/pkg/synology/dsm7-docker/README.md @@ -1,3 +1,8 @@ ## Docker image for Synology's DSM7 Documentation: [docs.zerotier.com/devices/synology](https://docs.zerotier.com/devices/synology) + +### Build & Push changes to DockerHub +```shell +./build.sh build +``` diff --git a/pkg/synology/dsm7-docker/build.sh b/pkg/synology/dsm7-docker/build.sh index acec5e0c9..1706ac686 100755 --- a/pkg/synology/dsm7-docker/build.sh +++ b/pkg/synology/dsm7-docker/build.sh @@ -3,19 +3,17 @@ ZTO_VER=$(git describe --tags $(git rev-list --tags --max-count=1)) ZTO_COMMIT=$(git rev-parse HEAD) -build() -{ - sudo docker build --load --rm -t zerotier-synology . --build-arg ZTO_COMMIT=${ZTO_COMMIT} --build-arg ZTO_VER=${ZTO_VER} - LATEST_DOCKER_IMAGE_HASH=$(sudo docker images -q zerotier-synology) - sudo docker tag ${LATEST_DOCKER_IMAGE_HASH} zerotier/zerotier-synology:${ZTO_VER} - sudo docker tag ${LATEST_DOCKER_IMAGE_HASH} zerotier/zerotier-synology:latest -} - -push() -{ +build() { sudo docker login --username=${DOCKERHUB_USERNAME} - sudo docker push zerotier/zerotier-synology:${ZTO_VER} - sudo docker push zerotier/zerotier-synology:latest + + sudo docker buildx build \ + --push \ + --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \ + --tag zerotier/zerotier-synology:${ZTO_VER} \ + --tag zerotier/zerotier-synology:latest \ + --build-arg ZTO_COMMIT=${ZTO_COMMIT} \ + --build-arg ZTO_VER=${ZTO_VER} \ + . } "$@" From 1aa31e04140f7d937182d7398f6c8893223d8eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20El=20Amri?= Date: Tue, 14 Nov 2023 21:57:53 +0100 Subject: [PATCH 03/36] Fix how MAC addresses are handled by the rules parser It wasn't ignoring separator characters such as the colon and hyphen. The rules compiler automatically add a colon to separate bytes, which is not compatible with how they are parsed. --- controller/EmbeddedNetworkController.cpp | 4 ++-- node/Utils.hpp | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index a01b68a9d..898dfa06b 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -315,12 +315,12 @@ static bool _parseRule(json &r,ZT_VirtualNetworkRule &rule) return true; } else if (t == "MATCH_MAC_SOURCE") { rule.t |= ZT_NETWORK_RULE_MATCH_MAC_SOURCE; - const std::string mac(OSUtils::jsonString(r["mac"],"0")); + const std::string mac(Utils::cleanMac(OSUtils::jsonString(r["mac"],"0"))); Utils::unhex(mac.c_str(),(unsigned int)mac.length(),rule.v.mac,6); return true; } else if (t == "MATCH_MAC_DEST") { rule.t |= ZT_NETWORK_RULE_MATCH_MAC_DEST; - const std::string mac(OSUtils::jsonString(r["mac"],"0")); + const std::string mac(Utils::cleanMac(OSUtils::jsonString(r["mac"],"0"))); Utils::unhex(mac.c_str(),(unsigned int)mac.length(),rule.v.mac,6); return true; } else if (t == "MATCH_IPV4_SOURCE") { diff --git a/node/Utils.hpp b/node/Utils.hpp index d13674c1f..a4c3ac8ff 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #if defined(__FreeBSD__) #include @@ -849,6 +850,19 @@ public: * Hexadecimal characters 0-f */ static const char HEXCHARS[16]; + + /* + * Remove `-` and `:` from a MAC address (in-place). + * + * @param mac The MAC address + */ + static inline void cleanMac(std::string& mac) + { + auto start = mac.begin(); + auto end = mac.end(); + auto new_end = std::remove_if(start, end, [](char c) { return c == 45 || c == 58; }); + mac.erase(new_end, end); + } }; } // namespace ZeroTier From 683d332abcc7a31ced0586871888fcabcec95256 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Fri, 23 Feb 2024 09:57:39 -0800 Subject: [PATCH 04/36] Add multi-core concurrent packet processing --- osdep/BSDEthernetTap.cpp | 120 +++++++++++------ osdep/BSDEthernetTap.hpp | 4 + osdep/EthernetTap.cpp | 15 ++- osdep/EthernetTap.hpp | 1 + osdep/LinuxEthernetTap.cpp | 241 ++++++++++++++++++++--------------- osdep/LinuxEthernetTap.hpp | 8 +- osdep/MacEthernetTap.cpp | 22 +++- osdep/MacEthernetTap.hpp | 4 + osdep/MacEthernetTapAgent.c | 2 +- osdep/MacKextEthernetTap.cpp | 6 +- osdep/MacKextEthernetTap.hpp | 4 + service/OneService.cpp | 163 +++++++++++++++++++---- 12 files changed, 400 insertions(+), 190 deletions(-) diff --git a/osdep/BSDEthernetTap.cpp b/osdep/BSDEthernetTap.cpp index b2e1a8760..9d378b770 100644 --- a/osdep/BSDEthernetTap.cpp +++ b/osdep/BSDEthernetTap.cpp @@ -39,7 +39,9 @@ #include #include #include +#include +#include #include #include #include @@ -53,6 +55,7 @@ #include "BSDEthernetTap.hpp" #define ZT_BASE32_CHARS "0123456789abcdefghijklmnopqrstuv" +#define ZT_TAP_BUF_SIZE (1024 * 16) // ff:ff:ff:ff:ff:ff with no ADI static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0); @@ -61,6 +64,7 @@ namespace ZeroTier { BSDEthernetTap::BSDEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -69,6 +73,7 @@ BSDEthernetTap::BSDEthernetTap( void (*handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int), void *arg) : _handler(handler), + _concurrency(concurrency), _arg(arg), _nwid(nwid), _mtu(mtu), @@ -195,11 +200,9 @@ BSDEthernetTap::BSDEthernetTap( BSDEthernetTap::~BSDEthernetTap() { ::write(_shutdownSignalPipe[1],"\0",1); // causes thread to exit - Thread::join(_thread); ::close(_fd); ::close(_shutdownSignalPipe[0]); ::close(_shutdownSignalPipe[1]); - long cpid = (long)vfork(); if (cpid == 0) { #ifdef ZT_TRACE @@ -211,6 +214,10 @@ BSDEthernetTap::~BSDEthernetTap() int exitcode = -1; ::waitpid(cpid,&exitcode,0); } + Thread::join(_thread); + for (std::thread &t : _rxThreads) { + t.join(); + } } void BSDEthernetTap::setEnabled(bool en) @@ -418,53 +425,84 @@ void BSDEthernetTap::setMtu(unsigned int mtu) void BSDEthernetTap::threadMain() throw() { - fd_set readfds,nullfds; - MAC to,from; - int n,nfds,r; - char getBuf[ZT_MAX_MTU + 64]; + bool _enablePinning = false; + char* envvar = std::getenv("ZT_CPU_PINNING"); + if (envvar) { + int tmp = atoi(envvar); + if (tmp > 0) { + _enablePinning = true; + } + } // Wait for a moment after startup -- wait for Network to finish // constructing itself. Thread::sleep(500); - FD_ZERO(&readfds); - FD_ZERO(&nullfds); - nfds = (int)std::max(_shutdownSignalPipe[0],_fd) + 1; + for (unsigned int i = 0; i < _concurrency; ++i) { + _rxThreads.push_back(std::thread([this, i, _enablePinning] { - r = 0; - for(;;) { - FD_SET(_shutdownSignalPipe[0],&readfds); - FD_SET(_fd,&readfds); - select(nfds,&readfds,&nullfds,&nullfds,(struct timeval *)0); - - if (FD_ISSET(_shutdownSignalPipe[0],&readfds)) // writes to shutdown pipe terminate thread - break; - - if (FD_ISSET(_fd,&readfds)) { - n = (int)::read(_fd,getBuf + r,sizeof(getBuf) - r); - if (n < 0) { - if ((errno != EINTR)&&(errno != ETIMEDOUT)) - break; - } else { - // Some tap drivers like to send the ethernet frame and the - // payload in two chunks, so handle that by accumulating - // data until we have at least a frame. - r += n; - if (r > 14) { - if (r > ((int)_mtu + 14)) // sanity check for weird TAP behavior on some platforms - r = _mtu + 14; - - if (_enabled) { - to.setTo(getBuf,6); - from.setTo(getBuf + 6,6); - unsigned int etherType = ntohs(((const uint16_t *)getBuf)[6]); - _handler(_arg,(void *)0,_nwid,from,to,etherType,0,(const void *)(getBuf + 14),r - 14); - } - - r = 0; + if (_enablePinning) { + int pinCore = i % _concurrency; + fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); + pthread_t self = pthread_self(); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(pinCore, &cpuset); + //int rc = sched_setaffinity(self, sizeof(cpu_set_t), &cpuset); + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); + if (rc != 0) + { + fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + exit(1); } } - } + + uint8_t b[ZT_TAP_BUF_SIZE]; + MAC to, from; + fd_set readfds, nullfds; + int n, nfds, r; + + FD_ZERO(&readfds); + FD_ZERO(&nullfds); + nfds = (int)std::max(_shutdownSignalPipe[0],_fd) + 1; + + r = 0; + + for(;;) { + FD_SET(_shutdownSignalPipe[0],&readfds); + FD_SET(_fd,&readfds); + select(nfds,&readfds,&nullfds,&nullfds,(struct timeval *)0); + + if (FD_ISSET(_shutdownSignalPipe[0],&readfds)) // writes to shutdown pipe terminate thread + break; + + if (FD_ISSET(_fd,&readfds)) { + n = (int)::read(_fd,b + r,sizeof(b) - r); + if (n < 0) { + if ((errno != EINTR)&&(errno != ETIMEDOUT)) + break; + } else { + // Some tap drivers like to send the ethernet frame and the + // payload in two chunks, so handle that by accumulating + // data until we have at least a frame. + r += n; + if (r > 14) { + if (r > ((int)_mtu + 14)) // sanity check for weird TAP behavior on some platforms + r = _mtu + 14; + + if (_enabled) { + to.setTo(b,6); + from.setTo(b + 6,6); + unsigned int etherType = ntohs(((const uint16_t *)b)[6]); + _handler(_arg,(void *)0,_nwid,from,to,etherType,0,(const void *)(b + 14),r - 14); + } + + r = 0; + } + } + } + } + })); } } diff --git a/osdep/BSDEthernetTap.hpp b/osdep/BSDEthernetTap.hpp index fc4e4908e..ecf6caf9b 100644 --- a/osdep/BSDEthernetTap.hpp +++ b/osdep/BSDEthernetTap.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "../node/Constants.hpp" #include "../node/MulticastGroup.hpp" @@ -34,6 +35,7 @@ class BSDEthernetTap : public EthernetTap public: BSDEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -62,6 +64,7 @@ public: private: void (*_handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int); void *_arg; + unsigned int _concurrency; uint64_t _nwid; Thread _thread; std::string _dev; @@ -73,6 +76,7 @@ private: volatile bool _enabled; mutable std::vector _ifaddrs; mutable uint64_t _lastIfAddrsUpdate; + std::vector _rxThreads; }; } // namespace ZeroTier diff --git a/osdep/EthernetTap.cpp b/osdep/EthernetTap.cpp index 445a5fe43..d6c7bd7b2 100644 --- a/osdep/EthernetTap.cpp +++ b/osdep/EthernetTap.cpp @@ -58,6 +58,7 @@ namespace ZeroTier { std::shared_ptr EthernetTap::newInstance( const char *tapDeviceType, // OS-specific, NULL for default const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -83,16 +84,16 @@ std::shared_ptr EthernetTap::newInstance( // The "feth" virtual Ethernet device type appeared in Darwin 17.x.x. Older versions // (Sierra and earlier) must use the a kernel extension. if (strtol(osrelease,(char **)0,10) < 17) { - return std::shared_ptr(new MacKextEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new MacKextEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); } else { - return std::shared_ptr(new MacEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new MacEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); } } } #endif // __APPLE__ #ifdef __LINUX__ - return std::shared_ptr(new LinuxEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new LinuxEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __LINUX__ #ifdef __WINDOWS__ @@ -126,19 +127,19 @@ std::shared_ptr EthernetTap::newInstance( _comInit = true; } } - return std::shared_ptr(new WindowsEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new WindowsEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __WINDOWS__ #ifdef __FreeBSD__ - return std::shared_ptr(new BSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new BSDEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __FreeBSD__ #ifdef __NetBSD__ - return std::shared_ptr(new NetBSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new NetBSDEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __NetBSD__ #ifdef __OpenBSD__ - return std::shared_ptr(new BSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new BSDEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __OpenBSD__ #endif // ZT_SDK? diff --git a/osdep/EthernetTap.hpp b/osdep/EthernetTap.hpp index 893e70c34..c5e82470c 100644 --- a/osdep/EthernetTap.hpp +++ b/osdep/EthernetTap.hpp @@ -33,6 +33,7 @@ public: static std::shared_ptr newInstance( const char *tapDeviceType, // OS-specific, NULL for default const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index a888db9d9..4919dbd69 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -60,7 +60,7 @@ #define IFNAMSIZ 16 #endif -#define ZT_TAP_BUF_SIZE 16384 +#define ZT_TAP_BUF_SIZE (1024 * 16) // ff:ff:ff:ff:ff:ff with no ADI static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0); @@ -68,7 +68,7 @@ static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC namespace ZeroTier { // determine if we're running a really old linux kernel. -// Kernels in the 2.6.x series don't behave the same when bringing up +// Kernels in the 2.6.x series don't behave the same when bringing up // the tap devices. // // Returns true if the kernel major version is < 3 @@ -111,6 +111,7 @@ static void _base32_5_to_8(const uint8_t *in,char *out) LinuxEthernetTap::LinuxEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -127,6 +128,7 @@ LinuxEthernetTap::LinuxEthernetTap( _fd(0), _enabled(true), _run(true), + _concurrency(concurrency), _lastIfAddrsUpdate(0) { static std::mutex s_tapCreateLock; @@ -220,135 +222,164 @@ LinuxEthernetTap::LinuxEthernetTap( (void)::pipe(_shutdownSignalPipe); - _tapReaderThread = std::thread([this]{ - uint8_t b[ZT_TAP_BUF_SIZE]; - fd_set readfds,nullfds; - int n,nfds,r; - std::vector buffers; - struct ifreq ifr; - - memset(&ifr,0,sizeof(ifr)); - strcpy(ifr.ifr_name,_dev.c_str()); - - const int sock = socket(AF_INET,SOCK_DGRAM,0); - if (sock <= 0) - return; - - if (ioctl(sock,SIOCGIFFLAGS,(void *)&ifr) < 0) { - ::close(sock); - printf("WARNING: ioctl() failed setting up Linux tap device (bring interface up)\n"); - return; + bool _enablePinning = false; + char* envvar = std::getenv("ZT_CPU_PINNING"); + if (envvar) { + int tmp = atoi(envvar); + if (tmp > 0) { + _enablePinning = true; } + } - ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER; - _mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data,6); - if (ioctl(sock,SIOCSIFHWADDR,(void *)&ifr) < 0) { - ::close(sock); - printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n"); - return; - } + for (unsigned int i = 0; i < _concurrency; ++i) { + _rxThreads.push_back(std::thread([this, i, _enablePinning] { - usleep(100000); + if (_enablePinning) { + int pinCore = i % _concurrency; + fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); + pthread_t self = pthread_self(); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(pinCore, &cpuset); + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); + if (rc != 0) + { + fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + exit(1); + } + } + + uint8_t b[ZT_TAP_BUF_SIZE]; + fd_set readfds, nullfds; + int n, nfds, r; + if (i == 0) { + struct ifreq ifr; + memset(&ifr, 0, sizeof(ifr)); + strcpy(ifr.ifr_name, _dev.c_str()); + + const int sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock <= 0) + return; + + if (ioctl(sock, SIOCGIFFLAGS, (void*)&ifr) < 0) { + ::close(sock); + printf("WARNING: ioctl() failed setting up Linux tap device (bring interface up)\n"); + return; + } + + ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER; + _mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data, 6); + if (ioctl(sock, SIOCSIFHWADDR, (void*)&ifr) < 0) { + ::close(sock); + printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n"); + return; + } + + usleep(100000); + + if (isOldLinuxKernel()) { + ifr.ifr_ifru.ifru_mtu = (int)_mtu; + if (ioctl(sock, SIOCSIFMTU, (void*)&ifr) < 0) { + ::close(sock); + printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n"); + return; + } + + usleep(100000); + } + + ifr.ifr_flags |= IFF_MULTICAST; + ifr.ifr_flags |= IFF_UP; + if (ioctl(sock, SIOCSIFFLAGS, (void*)&ifr) < 0) { + ::close(sock); + printf("WARNING: ioctl() failed setting up Linux tap device (bring interface up)\n"); + return; + } + + usleep(100000); + + if (! isOldLinuxKernel()) { + ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER; + _mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data, 6); + if (ioctl(sock, SIOCSIFHWADDR, (void*)&ifr) < 0) { + ::close(sock); + printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n"); + return; + } + + ifr.ifr_ifru.ifru_mtu = (int)_mtu; + if (ioctl(sock, SIOCSIFMTU, (void*)&ifr) < 0) { + ::close(sock); + printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n"); + return; + } + } + + fcntl(_fd, F_SETFL, O_NONBLOCK); - if (isOldLinuxKernel()) { - ifr.ifr_ifru.ifru_mtu = (int)_mtu; - if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) { ::close(sock); - printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n"); + } + + if (! _run) { return; } - usleep(100000); - } - + FD_ZERO(&readfds); + FD_ZERO(&nullfds); + nfds = (int)std::max(_shutdownSignalPipe[0], _fd) + 1; - ifr.ifr_flags |= IFF_MULTICAST; - ifr.ifr_flags |= IFF_UP; - if (ioctl(sock,SIOCSIFFLAGS,(void *)&ifr) < 0) { - ::close(sock); - printf("WARNING: ioctl() failed setting up Linux tap device (bring interface up)\n"); - return; - } + r = 0; + for (;;) { + FD_SET(_shutdownSignalPipe[0], &readfds); + FD_SET(_fd, &readfds); + select(nfds, &readfds, &nullfds, &nullfds, (struct timeval*)0); - usleep(100000); + if (FD_ISSET(_shutdownSignalPipe[0], &readfds)) { + break; + } + if (FD_ISSET(_fd, &readfds)) { + for (;;) { + // read until there are no more packets, then return to outer select() loop + n = (int)::read(_fd, b + r, ZT_TAP_BUF_SIZE - r); + if (n > 0) { + // Some tap drivers like to send the ethernet frame and the + // payload in two chunks, so handle that by accumulating + // data until we have at least a frame. + r += n; + if (r > 14) { + if (r > ((int)_mtu + 14)) // sanity check for weird TAP behavior on some platforms + r = _mtu + 14; - if (!isOldLinuxKernel()) { - ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER; - _mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data,6); - if (ioctl(sock,SIOCSIFHWADDR,(void *)&ifr) < 0) { - ::close(sock); - printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n"); - return; - } + if (_enabled) { + MAC to(b, 6), from(b + 6, 6); + unsigned int etherType = Utils::ntoh(((const uint16_t*)b)[6]); + _handler(_arg, nullptr, _nwid, from, to, etherType, 0, (const void*)(b + 14), (unsigned int)(r - 14)); + } - ifr.ifr_ifru.ifru_mtu = (int)_mtu; - if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) { - ::close(sock); - printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n"); - return; - } - } - - fcntl(_fd,F_SETFL,O_NONBLOCK); - - ::close(sock); - - if (!_run) - return; - - FD_ZERO(&readfds); - FD_ZERO(&nullfds); - nfds = (int)std::max(_shutdownSignalPipe[0],_fd) + 1; - - r = 0; - for(;;) { - FD_SET(_shutdownSignalPipe[0],&readfds); - FD_SET(_fd,&readfds); - select(nfds,&readfds,&nullfds,&nullfds,(struct timeval *)0); - - if (FD_ISSET(_shutdownSignalPipe[0],&readfds)) - break; - - if (FD_ISSET(_fd,&readfds)) { - for(;;) { // read until there are no more packets, then return to outer select() loop - n = (int)::read(_fd,b + r,ZT_TAP_BUF_SIZE - r); - if (n > 0) { - // Some tap drivers like to send the ethernet frame and the - // payload in two chunks, so handle that by accumulating - // data until we have at least a frame. - r += n; - if (r > 14) { - if (r > ((int)_mtu + 14)) // sanity check for weird TAP behavior on some platforms - r = _mtu + 14; - - if (_enabled) { - //_tapq.post(std::pair(buf,r)); - //buf = nullptr; - MAC to(b, 6),from(b + 6, 6); - unsigned int etherType = Utils::ntoh(((const uint16_t *)b)[6]); - _handler(_arg, nullptr, _nwid, from, to, etherType, 0, (const void *)(b + 14),(unsigned int)(r - 14)); + r = 0; } - - r = 0; } - } else { - r = 0; - break; + else { + r = 0; + break; + } } } } - } - }); + })); + } } LinuxEthernetTap::~LinuxEthernetTap() { _run = false; (void)::write(_shutdownSignalPipe[1],"\0",1); - _tapReaderThread.join(); ::close(_fd); ::close(_shutdownSignalPipe[0]); ::close(_shutdownSignalPipe[1]); + for (std::thread &t : _rxThreads) { + t.join(); + } } void LinuxEthernetTap::setEnabled(bool en) diff --git a/osdep/LinuxEthernetTap.hpp b/osdep/LinuxEthernetTap.hpp index 424a6d37e..b694b277c 100644 --- a/osdep/LinuxEthernetTap.hpp +++ b/osdep/LinuxEthernetTap.hpp @@ -26,6 +26,7 @@ #include #include "../node/MulticastGroup.hpp" #include "EthernetTap.hpp" +#include "BlockingQueue.hpp" namespace ZeroTier { @@ -34,6 +35,7 @@ class LinuxEthernetTap : public EthernetTap public: LinuxEthernetTap( const char *homePath, + unsigned int _concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -57,9 +59,6 @@ public: virtual void setMtu(unsigned int mtu); virtual void setDns(const char *domain, const std::vector &servers) {} - - - private: void (*_handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int); void *_arg; @@ -69,13 +68,14 @@ private: std::string _dev; std::vector _multicastGroups; unsigned int _mtu; + unsigned int _concurrency; int _fd; int _shutdownSignalPipe[2]; std::atomic_bool _enabled; std::atomic_bool _run; - std::thread _tapReaderThread; mutable std::vector _ifaddrs; mutable uint64_t _lastIfAddrsUpdate; + std::vector _rxThreads; }; } // namespace ZeroTier diff --git a/osdep/MacEthernetTap.cpp b/osdep/MacEthernetTap.cpp index 37f27f87a..8d15b3b20 100644 --- a/osdep/MacEthernetTap.cpp +++ b/osdep/MacEthernetTap.cpp @@ -69,6 +69,7 @@ static bool fethMaxMtuAdjusted = false; MacEthernetTap::MacEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -77,6 +78,7 @@ MacEthernetTap::MacEthernetTap( void (*handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *data,unsigned int len), void *arg) : _handler(handler), + _concurrency(concurrency), _arg(arg), _nwid(nwid), _homePath(homePath), @@ -286,6 +288,9 @@ MacEthernetTap::~MacEthernetTap() } Thread::join(_thread); + for (std::thread &t : _rxThreads) { + t.join(); + } } void MacEthernetTap::setEnabled(bool en) { _enabled = en; } @@ -474,17 +479,25 @@ void MacEthernetTap::setMtu(unsigned int mtu) void MacEthernetTap::threadMain() throw() { + Thread::sleep(250); + + for (unsigned int i = 0; i < _concurrency; ++i) { + _rxThreads.push_back(std::thread([this, i] { + + fprintf(stderr, "starting thread %d\n", i); + char agentReadBuf[ZT_MACETHERNETTAP_AGENT_READ_BUF_SIZE]; char agentStderrBuf[256]; fd_set readfds,nullfds; MAC to,from; - Thread::sleep(250); - const int nfds = std::max(std::max(_shutdownSignalPipe[0],_agentStdout),_agentStderr) + 1; long agentReadPtr = 0; - fcntl(_agentStdout,F_SETFL,fcntl(_agentStdout,F_GETFL)|O_NONBLOCK); - fcntl(_agentStderr,F_SETFL,fcntl(_agentStderr,F_GETFL)|O_NONBLOCK); + + if (i == 0) { + fcntl(_agentStdout,F_SETFL,fcntl(_agentStdout,F_GETFL)|O_NONBLOCK); + fcntl(_agentStderr,F_SETFL,fcntl(_agentStderr,F_GETFL)|O_NONBLOCK); + } FD_ZERO(&readfds); FD_ZERO(&nullfds); @@ -533,6 +546,7 @@ void MacEthernetTap::threadMain() */ } } + }));} ::close(_agentStdin); ::close(_agentStdout); diff --git a/osdep/MacEthernetTap.hpp b/osdep/MacEthernetTap.hpp index 8ba378022..0bb78a79f 100644 --- a/osdep/MacEthernetTap.hpp +++ b/osdep/MacEthernetTap.hpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace ZeroTier { @@ -36,6 +37,7 @@ class MacEthernetTap : public EthernetTap public: MacEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -67,6 +69,7 @@ private: uint64_t _nwid; Thread _thread; std::string _homePath; + unsigned int _concurrency; std::string _dev; std::vector _multicastGroups; Mutex _putLock; @@ -79,6 +82,7 @@ private: volatile bool _enabled; mutable std::vector _ifaddrs; mutable uint64_t _lastIfAddrsUpdate; + std::vector _rxThreads; }; diff --git a/osdep/MacEthernetTapAgent.c b/osdep/MacEthernetTapAgent.c index ca75ed054..6a0dbaf85 100644 --- a/osdep/MacEthernetTapAgent.c +++ b/osdep/MacEthernetTapAgent.c @@ -32,7 +32,7 @@ * All this stuff is basically undocumented. A lot of tracing through * the Darwin/XNU kernel source was required to figure out how to make * this actually work. - * + * * We hope to develop a DriverKit-based driver in the near-mid future to * replace this weird hack, but it works for now through Big Sur in our * testing. diff --git a/osdep/MacKextEthernetTap.cpp b/osdep/MacKextEthernetTap.cpp index fce0c121d..7ac0dac25 100644 --- a/osdep/MacKextEthernetTap.cpp +++ b/osdep/MacKextEthernetTap.cpp @@ -306,6 +306,7 @@ static Mutex globalTapCreateLock; MacKextEthernetTap::MacKextEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -317,6 +318,7 @@ MacKextEthernetTap::MacKextEthernetTap( _arg(arg), _nwid(nwid), _homePath(homePath), + _concurrency(concurrency), _mtu(mtu), _metric(metric), _fd(0), @@ -447,7 +449,9 @@ MacKextEthernetTap::~MacKextEthernetTap() ::write(_shutdownSignalPipe[1],"\0",1); // causes thread to exit Thread::join(_thread); - + for (std::thread &t : _rxThreads) { + t.join(); + } ::close(_fd); ::close(_shutdownSignalPipe[0]); ::close(_shutdownSignalPipe[1]); diff --git a/osdep/MacKextEthernetTap.hpp b/osdep/MacKextEthernetTap.hpp index 4c61c2843..6d8539874 100644 --- a/osdep/MacKextEthernetTap.hpp +++ b/osdep/MacKextEthernetTap.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "../node/Constants.hpp" #include "../node/MAC.hpp" @@ -36,6 +37,7 @@ class MacKextEthernetTap : public EthernetTap public: MacKextEthernetTap( const char *homePath, + unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -70,11 +72,13 @@ private: std::string _homePath; std::string _dev; std::vector _multicastGroups; + unsigned int _concurrency; unsigned int _mtu; unsigned int _metric; int _fd; int _shutdownSignalPipe[2]; volatile bool _enabled; + std::vector _rxThreads; }; } // namespace ZeroTier diff --git a/service/OneService.cpp b/service/OneService.cpp index fcebe4677..9d737a413 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -16,7 +16,6 @@ #include #include #include - #include #include #include @@ -26,6 +25,11 @@ #include #include +#ifdef __FreeBSD__ +#include +#include +#endif + #include "../version.h" #include "../include/ZeroTierOne.h" @@ -758,7 +762,7 @@ struct TcpConnection Mutex writeq_m; }; -struct OneServiceIncomingPacket +struct PacketRecord { uint64_t now; int64_t sock; @@ -785,14 +789,20 @@ public: SoftwareUpdater *_updater; bool _updateAutoApply; - httplib::Server _controlPlane; + httplib::Server _controlPlane; httplib::Server _controlPlaneV6; - std::thread _serverThread; + std::thread _serverThread; std::thread _serverThreadV6; bool _serverThreadRunning; bool _serverThreadRunningV6; - bool _allowTcpFallbackRelay; + unsigned int _rxThreadCount; + BlockingQueue _rxPacketQueue; + std::vector _rxPacketVector; + std::vector _rxPacketThreads; + Mutex _rxPacketVector_m,_rxPacketThreads_m; + + bool _allowTcpFallbackRelay; bool _forceTcpRelay; bool _allowSecondaryPort; @@ -842,8 +852,6 @@ public: // Deadline for the next background task service function volatile int64_t _nextBackgroundTaskDeadline; - - std::map _nets; Mutex _nets_m; @@ -890,9 +898,9 @@ public: ,_node((Node *)0) ,_updater((SoftwareUpdater *)0) ,_updateAutoApply(false) - ,_controlPlane() + ,_controlPlane() ,_controlPlaneV6() - ,_serverThread() + ,_serverThread() ,_serverThreadV6() ,_serverThreadRunning(false) ,_serverThreadRunningV6(false) @@ -926,9 +934,79 @@ public: _ports[1] = 0; _ports[2] = 0; - prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr); - prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5)); - prometheus::simpleapi::saver.set_out_file(_homePath + ZT_PATH_SEPARATOR + "metrics.prom"); + bool _enablePinning = false; + char* pinningVar = std::getenv("ZT_CPU_PINNING"); + if (pinningVar) { + int tmp = atoi(pinningVar); + if (tmp > 0) { + _enablePinning = true; + } + } + char* concurrencyVar = std::getenv("ZT_PACKET_PROCESSING_CONCURRENCY"); + if (concurrencyVar) { + int tmp = atoi(concurrencyVar); + if (tmp > 0) { + _rxThreadCount = tmp; + } + else { + _rxThreadCount = std::thread::hardware_concurrency(); + } + } + else { + _rxThreadCount = std::thread::hardware_concurrency(); + } + for (unsigned int i = 0; i < _rxThreadCount; ++i) { + _rxPacketThreads.push_back(std::thread([this, i]() { + +#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ + int pinCore = i % _rxThreadCount; + fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); + pthread_t self = pthread_self(); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(pinCore, &cpuset); +#endif +#ifdef __LINUX__ + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); +#elif __FreeBSD__ + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); +#endif +#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ + if (rc != 0) + { + fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + exit(1); + } +#endif + PacketRecord* packet = nullptr; + for (;;) { + if (! _rxPacketQueue.get(packet)) { + break; + } + if (! packet) { + break; + } + const ZT_ResultCode err = _node->processWirePacket(nullptr, packet->now, packet->sock, &(packet->from), packet->data, packet->size, &_nextBackgroundTaskDeadline); + { + Mutex::Lock l(_rxPacketVector_m); + _rxPacketVector.push_back(packet); + } + if (ZT_ResultCode_isFatal(err)) { + char tmp[256]; + OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = tmp; + this->terminate(); + break; + } + } + })); + } + + prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr); + prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5)); + prometheus::simpleapi::saver.set_out_file(_homePath + ZT_PATH_SEPARATOR + "metrics.prom"); #if ZT_VAULT_SUPPORT curl_global_init(CURL_GLOBAL_DEFAULT); @@ -940,20 +1018,34 @@ public: #ifdef __WINDOWS__ WinFWHelper::removeICMPRules(); #endif + + _rxPacketQueue.stop(); + _rxPacketThreads_m.lock(); + for(auto t=_rxPacketThreads.begin();t!=_rxPacketThreads.end();++t) { + t->join(); + } + _rxPacketThreads_m.unlock(); _binder.closeAll(_phy); #if ZT_VAULT_SUPPORT curl_global_cleanup(); #endif - _controlPlane.stop(); + _controlPlane.stop(); if (_serverThreadRunning) { - _serverThread.join(); + _serverThread.join(); } _controlPlaneV6.stop(); if (_serverThreadRunningV6) { _serverThreadV6.join(); } + _rxPacketVector_m.lock(); + while (!_rxPacketVector.empty()) { + delete _rxPacketVector.back(); + _rxPacketVector.pop_back(); + } + _rxPacketVector_m.unlock(); + #ifdef ZT_USE_MINIUPNPC delete _portMapper; @@ -1270,6 +1362,9 @@ public: const unsigned long delay = (dl > now) ? (unsigned long)(dl - now) : 500; clockShouldBe = now + (int64_t)delay; _phy.poll(delay); + + + } } catch (std::exception &e) { Mutex::Lock _l(_termReason_m); @@ -2756,25 +2851,37 @@ public: // Handlers for Node and Phy<> callbacks // ========================================================================= - inline void phyOnDatagram(PhySocket *sock,void **uptr,const struct sockaddr *localAddr,const struct sockaddr *from,void *data,unsigned long len) + + + + inline void phyOnDatagram(PhySocket* sock, void** uptr, const struct sockaddr* localAddr, const struct sockaddr* from, void* data, unsigned long len) { if (_forceTcpRelay) { return; } - Metrics::udp_recv += len; + Metrics::udp_recv += len; const uint64_t now = OSUtils::now(); - if ((len >= 16)&&(reinterpret_cast(from)->ipScope() == InetAddress::IP_SCOPE_GLOBAL)) { + if ((len >= 16) && (reinterpret_cast(from)->ipScope() == InetAddress::IP_SCOPE_GLOBAL)) { _lastDirectReceiveFromGlobal = now; - } - const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); - if (ZT_ResultCode_isFatal(rc)) { - char tmp[256]; - OSUtils::ztsnprintf(tmp,sizeof(tmp),"fatal error code from processWirePacket: %d",(int)rc); - Mutex::Lock _l(_termReason_m); - _termReason = ONE_UNRECOVERABLE_ERROR; - _fatalErrorMessage = tmp; - this->terminate(); } + + PacketRecord* packet; + _rxPacketVector_m.lock(); + if (_rxPacketVector.empty()) { + packet = new PacketRecord; + } + else { + packet = _rxPacketVector.back(); + _rxPacketVector.pop_back(); + } + _rxPacketVector_m.unlock(); + + packet->sock = reinterpret_cast(sock); + packet->now = now; + memcpy(&(packet->from), from, sizeof(struct sockaddr_storage)); + packet->size = (unsigned int)len; + memcpy(packet->data, data, len); + _rxPacketQueue.postLimit(packet, 256 * _rxThreadCount); } inline void phyOnTcpConnect(PhySocket *sock,void **uptr,bool success) @@ -2996,6 +3103,7 @@ public: n.setTap(EthernetTap::newInstance( nullptr, _homePath.c_str(), + _rxThreadCount, MAC(nwc->mac), nwc->mtu, (unsigned int)ZT_IF_METRIC, @@ -3509,8 +3617,9 @@ public: inline void nodeVirtualNetworkFrameFunction(uint64_t nwid,void **nuptr,uint64_t sourceMac,uint64_t destMac,unsigned int etherType,unsigned int vlanId,const void *data,unsigned int len) { NetworkState *n = reinterpret_cast(*nuptr); - if ((!n)||(!n->tap())) + if ((!n)||(!n->tap())) { return; + } n->tap()->put(MAC(sourceMac),MAC(destMac),etherType,data,len); } From b9d0cf9c894752ecfb74c9f8942eff6b77a90f4a Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 5 Mar 2024 12:14:12 -0800 Subject: [PATCH 05/36] Don't pass result of void function to string constructor --- controller/EmbeddedNetworkController.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index 0aa56d59e..98a9fbd94 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -315,12 +315,14 @@ static bool _parseRule(json &r,ZT_VirtualNetworkRule &rule) return true; } else if (t == "MATCH_MAC_SOURCE") { rule.t |= ZT_NETWORK_RULE_MATCH_MAC_SOURCE; - const std::string mac(Utils::cleanMac(OSUtils::jsonString(r["mac"],"0"))); + std::string mac(OSUtils::jsonString(r["mac"],"0")); + Utils::cleanMac(mac); Utils::unhex(mac.c_str(),(unsigned int)mac.length(),rule.v.mac,6); return true; } else if (t == "MATCH_MAC_DEST") { rule.t |= ZT_NETWORK_RULE_MATCH_MAC_DEST; - const std::string mac(Utils::cleanMac(OSUtils::jsonString(r["mac"],"0"))); + std::string mac(OSUtils::jsonString(r["mac"],"0")); + Utils::cleanMac(mac); Utils::unhex(mac.c_str(),(unsigned int)mac.length(),rule.v.mac,6); return true; } else if (t == "MATCH_IPV4_SOURCE") { From 280cc77e23157611b082fa8e78c31a4d22dc3568 Mon Sep 17 00:00:00 2001 From: Federico Pellegrin Date: Mon, 25 Mar 2024 05:06:22 +0100 Subject: [PATCH 06/36] Update README.md minimal compilers Update the minimal compilers in documentation. As `std=c++17` is used the minimal got quite bumped from last update. For gcc 7.x would seem possibly enough, but some of the dependencies (eg. libpqxx) need 8.x at least, so setting that as documented minimum. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42eecdda0..e881ce810 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ To build on Mac and Linux just type `make`. On FreeBSD and OpenBSD `gmake` (GNU - Xcode command line tools for macOS 10.13 or newer are required. - Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*. - **Linux** - - The minimum compiler versions required are GCC/G++ 4.9.3 or CLANG/CLANG++ 3.4.2. (Install `clang` on CentOS 7 as G++ is too old.) + - The minimum compiler versions required are GCC/G++ 8.x or CLANG/CLANG++ 5.x. - Linux makefiles automatically detect and prefer clang/clang++ if present as it produces smaller and slightly faster binaries in most cases. You can override by supplying CC and CXX variables on the make command line. - Rust for x86_64 and ARM64 targets *if SSO is enabled in the build*. - **Windows** From 9de2b90528d1fe7efe963acca3313defd1eb5662 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Wed, 27 Mar 2024 14:40:38 -0700 Subject: [PATCH 07/36] fix rebuild for x64 --- rustybits/zeroidc.vcxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rustybits/zeroidc.vcxproj b/rustybits/zeroidc.vcxproj index b31ed0ee4..833437238 100644 --- a/rustybits/zeroidc.vcxproj +++ b/rustybits/zeroidc.vcxproj @@ -91,7 +91,7 @@ cargo clean - cargo clean & cargo build --release --target=x86_64-pc-windows-msvc + cargo clean & cargo build -p zeroidc --release --target=x86_64-pc-windows-msvc NDEBUG;$(NMakePreprocessorDefinitions) From 28cf1423c93d036205397e9ee5d4ef982127a43c Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Thu, 9 May 2024 09:35:54 -0700 Subject: [PATCH 08/36] also install x64 rust in github action --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b983a4bcf..82d0207af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,13 +43,20 @@ jobs: # git config --global core.eol lf - name: checkout uses: actions/checkout@v3 - - name: Install Rust + - name: Install Rust aarch64 uses: actions-rs/toolchain@v1 with: toolchain: stable target: aarch64-apple-darwin override: true components: rustfmt, clippy + - name: Install Rust x86_64 + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-apple-darwin + override: true + components: rustfmt, clippy - name: Set up cargo cache uses: Swatinem/rust-cache@v2 continue-on-error: false From e915d109530a34370af948a04cac91b2f049c486 Mon Sep 17 00:00:00 2001 From: Sean OMeara Date: Thu, 9 May 2024 18:57:48 +0200 Subject: [PATCH 09/36] cargo update rustybits (#2286) --- rustybits/Cargo.lock | 543 +++++++++++++++++++++---------------------- 1 file changed, 263 insertions(+), 280 deletions(-) diff --git a/rustybits/Cargo.lock b/rustybits/Cargo.lock index 1b01a0df3..d8a2f5f40 100644 --- a/rustybits/Cargo.lock +++ b/rustybits/Cargo.lock @@ -31,18 +31,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-tzdata" @@ -70,15 +70,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" [[package]] name = "async-stream" @@ -99,18 +99,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "async-trait" -version = "0.1.78" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" @@ -188,9 +188,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -219,6 +219,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -248,9 +254,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.4" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" @@ -260,9 +266,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cbindgen" @@ -285,9 +291,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.90" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" [[package]] name = "cfg-if" @@ -297,9 +303,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -307,7 +313,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -433,7 +439,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -457,7 +463,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -468,7 +474,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -478,7 +484,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -486,9 +492,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "pem-rfc7468", @@ -523,7 +529,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -533,7 +539,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -613,9 +619,9 @@ dependencies = [ [[package]] name = "either" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "elliptic-curve" @@ -640,43 +646,43 @@ dependencies = [ [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] [[package]] name = "enum-iterator" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600536cfe9e2da0820aa498e570f6b2b9223eec3ce2f835c8ae4861304fa4794" +checksum = "c280b9e6b3ae19e152d8e31cf47f18389781e119d4013a2a2bb0180e5facc635" dependencies = [ "enum-iterator-derive", ] [[package]] name = "enum-iterator-derive" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03cdc46ec28bd728e67540c528013c6a10eb69a02eb31078a1bda695438cbfb8" +checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "enum_dispatch" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -696,9 +702,9 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -706,9 +712,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "ff" @@ -722,9 +728,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" +checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" [[package]] name = "fixedbitset" @@ -824,7 +830,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -887,9 +893,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -937,9 +943,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -947,7 +953,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -962,9 +968,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -981,9 +987,9 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -1024,15 +1030,6 @@ dependencies = [ "digest", ] -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "0.2.12" @@ -1168,12 +1165,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] @@ -1207,15 +1204,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -1227,9 +1215,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" @@ -1265,9 +1253,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.153" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libm" @@ -1283,9 +1271,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1303,7 +1291,7 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -1323,9 +1311,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "mime" @@ -1377,14 +1365,14 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "multimap" -version = "0.8.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "native-tls" @@ -1460,9 +1448,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -1471,9 +1459,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -1579,7 +1567,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -1590,9 +1578,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.101" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -1656,9 +1644,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -1666,15 +1654,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -1694,12 +1682,12 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.5", + "indexmap 2.2.6", ] [[package]] @@ -1719,14 +1707,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1763,9 +1751,9 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "portable-atomic" @@ -1813,12 +1801,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.16" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -1832,18 +1820,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" dependencies = [ "unicode-ident", ] [[package]] name = "prometheus" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" +checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" dependencies = [ "cfg-if", "fnv", @@ -1856,9 +1844,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", "prost-derive", @@ -1866,13 +1854,13 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes", - "heck 0.4.1", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.12.1", "log", "multimap", "once_cell", @@ -1881,38 +1869,37 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.53", + "syn 2.0.61", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "9554e3ab233f0a932403704f1a1d08c30d5ccd931adfdfa1e8b5a19b52c1d55a" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ "prost", ] [[package]] name = "prost-wkt" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d8ef9c3f0f1dab910d2b7e2c24a8e4322e122eba6d7a1921eeebcebbc046c40" +checksum = "5fb7ec2850c138ebaa7ab682503b5d08c3cb330343e9c94776612928b6ddb53f" dependencies = [ "chrono", "inventory", @@ -1925,11 +1912,11 @@ dependencies = [ [[package]] name = "prost-wkt-build" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b31cae9a54ca84fee1504740a82eebf2479532905e106f63ca0c3bc8d780321" +checksum = "598b7365952c2ed4e32902de0533653aafbe5ae3da436e8e2335c7d375a1cef3" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "prost", "prost-build", "prost-types", @@ -1938,9 +1925,9 @@ dependencies = [ [[package]] name = "prost-wkt-types" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435be4a8704091b4c5fb1d79799de7f2dbff53af05edf29385237f8cf7ab37ee" +checksum = "1a8eadc2381640a49c1fbfb9f4a857794b4e5bf5a2cbc2d858cfdb74f64dcd22" dependencies = [ "chrono", "prost", @@ -1962,9 +1949,9 @@ checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] name = "quanta" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" dependencies = [ "crossbeam-utils", "libc", @@ -1977,9 +1964,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -2016,32 +2003,32 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "11.0.1" +version = "11.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d86a7c4638d42c44551f4791a20e687dbb4c3de1f33c43dd71e355cd429def1" +checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" dependencies = [ "bitflags 2.5.0", ] [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", "regex-automata 0.4.6", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -2061,7 +2048,7 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.3", ] [[package]] @@ -2072,15 +2059,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.26" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", "bytes", @@ -2172,9 +2159,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" @@ -2188,7 +2175,7 @@ dependencies = [ [[package]] name = "rustfsm" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "rustfsm_procmacro", "rustfsm_trait", @@ -2197,25 +2184,25 @@ dependencies = [ [[package]] name = "rustfsm_procmacro" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "derive_more", "proc-macro2", "quote", "rustfsm_trait", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "rustfsm_trait" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -2226,9 +2213,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.2" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", "ring", @@ -2245,7 +2232,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.1", + "rustls-pemfile 2.1.2", "rustls-pki-types", "schannel", "security-framework", @@ -2262,25 +2249,25 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f48172685e6ff52a556baa527774f61fcaa884f59daf3375c62a3f1cd2549dab" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.3.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.102.2" +version = "0.102.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" +checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" dependencies = [ "ring", "rustls-pki-types", @@ -2289,15 +2276,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" @@ -2330,11 +2317,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "core-foundation", "core-foundation-sys", "libc", @@ -2343,9 +2330,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -2353,15 +2340,15 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] @@ -2378,20 +2365,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -2431,15 +2418,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.7.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -2449,14 +2436,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.7.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -2481,9 +2468,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -2524,9 +2511,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smeeclient" @@ -2544,9 +2531,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -2614,9 +2601,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -2665,16 +2652,18 @@ dependencies = [ [[package]] name = "temporal-client" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "anyhow", "async-trait", "backoff", + "base64 0.21.7", "derive_builder", "derive_more", "futures", "futures-retry", "http", + "hyper", "once_cell", "opentelemetry", "parking_lot", @@ -2694,7 +2683,7 @@ dependencies = [ [[package]] name = "temporal-sdk" version = "0.1.0-alpha.1" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "anyhow", "async-trait", @@ -2722,7 +2711,7 @@ dependencies = [ [[package]] name = "temporal-sdk-core" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "anyhow", "async-trait", @@ -2772,7 +2761,7 @@ dependencies = [ [[package]] name = "temporal-sdk-core-api" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "async-trait", "derive_builder", @@ -2790,7 +2779,7 @@ dependencies = [ [[package]] name = "temporal-sdk-core-protos" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#4840a9c570fa3388e190e20f01f61065d0b7e965" +source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" dependencies = [ "anyhow", "base64 0.21.7", @@ -2825,22 +2814,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -2855,9 +2844,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -2876,9 +2865,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", @@ -2901,9 +2890,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -2936,7 +2925,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -2973,16 +2962,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -3014,7 +3002,7 @@ dependencies = [ "pin-project", "prost", "rustls-native-certs", - "rustls-pemfile 2.1.1", + "rustls-pemfile 2.1.2", "rustls-pki-types", "tokio", "tokio-rustls", @@ -3035,7 +3023,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -3090,7 +3078,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -3166,7 +3154,7 @@ checksum = "ac73887f47b9312552aa90ef477927ff014d63d1920ca8037c6c1951eab64bb1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] @@ -3198,9 +3186,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "untrusted" @@ -3295,7 +3283,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", "wasm-bindgen-shared", ] @@ -3329,7 +3317,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3350,18 +3338,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi" version = "0.3.9" @@ -3390,7 +3366,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -3408,7 +3384,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -3428,17 +3404,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -3449,9 +3426,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -3461,9 +3438,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -3473,9 +3450,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -3485,9 +3468,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -3497,9 +3480,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -3509,9 +3492,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -3521,9 +3504,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winreg" @@ -3537,22 +3520,22 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.53", + "syn 2.0.61", ] [[package]] From 9ec6c2901cefa58cc246108564440dbf66cad178 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Sun, 29 Oct 2023 14:11:13 +0200 Subject: [PATCH 10/36] Respect user LDFLAGS * Respect user LDFLAGS instead of replacing them. Signed-off-by: Alfred Wingate --- make-linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make-linux.mk b/make-linux.mk index bfa416aa0..97ff6215e 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -71,7 +71,7 @@ else override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS) CXXFLAGS?=-O3 -fstack-protector override CXXFLAGS+=-Wall -Wno-deprecated -std=c++17 -pthread $(INCLUDES) -DNDEBUG $(DEFS) - LDFLAGS=-pie -Wl,-z,relro,-z,now + LDFLAGS?=-pie -Wl,-z,relro,-z,now ZT_CARGO_FLAGS=--release endif From dca77cb0d2dc7dd9403ab32a6338703e23645c0f Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Tue, 21 May 2024 12:09:14 -0400 Subject: [PATCH 11/36] expand GETENV macro that needs to be modified --- java/jni/com_zerotierone_sdk_Node.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/java/jni/com_zerotierone_sdk_Node.cpp b/java/jni/com_zerotierone_sdk_Node.cpp index 36d722c7d..260e523cf 100644 --- a/java/jni/com_zerotierone_sdk_Node.cpp +++ b/java/jni/com_zerotierone_sdk_Node.cpp @@ -194,7 +194,13 @@ namespace { assert(ref); assert(ref->node == node); JNIEnv *env; - GETENV(env, ref->jvm); + + jint getEnvRet; + assert(ref->jvm); + if ((getEnvRet = ref->jvm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6)) != JNI_OK) { + LOGE("Error calling GetEnv: %d", getEnvRet); + assert(false && "Error calling GetEnv"); + } if (env->ExceptionCheck()) { LOGE("Unhandled pending exception"); From e32fecd16deeab0df65e4aad15ef3e096e35c5a9 Mon Sep 17 00:00:00 2001 From: Brenton Bostick Date: Tue, 21 May 2024 12:10:00 -0400 Subject: [PATCH 12/36] Thread might actually be detached, so need to handle that --- java/jni/com_zerotierone_sdk_Node.cpp | 52 ++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/java/jni/com_zerotierone_sdk_Node.cpp b/java/jni/com_zerotierone_sdk_Node.cpp index 260e523cf..ba1627856 100644 --- a/java/jni/com_zerotierone_sdk_Node.cpp +++ b/java/jni/com_zerotierone_sdk_Node.cpp @@ -111,6 +111,44 @@ namespace { bool finishInitializing(); }; + // + // RAII construct for calling AttachCurrentThread and DetachCurrent automatically + // + struct ScopedJNIThreadAttacher { + + JavaVM *jvm; + JNIEnv **env_p; + jint getEnvRet; + + ScopedJNIThreadAttacher(JavaVM *jvmIn, JNIEnv **env_pIn, jint getEnvRetIn) : + jvm(jvmIn), + env_p(env_pIn), + getEnvRet(getEnvRetIn) { + + if (getEnvRet != JNI_EDETACHED) { + return; + } + + jint attachCurrentThreadRet; + if ((attachCurrentThreadRet = jvm->AttachCurrentThread(env_p, NULL)) != JNI_OK) { + LOGE("Error calling AttachCurrentThread: %d", attachCurrentThreadRet); + assert(false && "Error calling AttachCurrentThread"); + } + } + + ~ScopedJNIThreadAttacher() { + + if (getEnvRet != JNI_EDETACHED) { + return; + } + + jint detachCurrentThreadRet; + if ((detachCurrentThreadRet = jvm->DetachCurrentThread()) != JNI_OK) { + LOGE("Error calling DetachCurrentThread: %d", detachCurrentThreadRet); + assert(false && "Error calling DetachCurrentThread"); + } + } + }; /* * This must return 0 on success. It can return any OS-dependent error code @@ -197,11 +235,23 @@ namespace { jint getEnvRet; assert(ref->jvm); - if ((getEnvRet = ref->jvm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6)) != JNI_OK) { + getEnvRet = ref->jvm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6); + + if (!(getEnvRet == JNI_OK || getEnvRet == JNI_EDETACHED)) { LOGE("Error calling GetEnv: %d", getEnvRet); assert(false && "Error calling GetEnv"); } + // + // Thread might actually be detached. + // + // e.g: + // https://github.com/zerotier/ZeroTierOne/blob/91e7ce87f09ac1cfdeaf6ff22c3cedcd93574c86/node/Switch.cpp#L519 + // + // Make sure to attach if needed + // + ScopedJNIThreadAttacher attacher{ref->jvm, &env, getEnvRet}; + if (env->ExceptionCheck()) { LOGE("Unhandled pending exception"); return; From f79af92599454b9ecd2dce126b254290da9de353 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 17 Jun 2024 11:02:13 -0400 Subject: [PATCH 13/36] Add Rust tcp-proxy base, add .clangd --- .clangd | 2 + .gitignore | 1 + tcp-proxy/Cargo.lock | 390 +++++++++++++++++++++ tcp-proxy/Cargo.toml | 15 + tcp-proxy/{ => old}/Makefile | 0 tcp-proxy/{ => old}/README.md | 0 tcp-proxy/{ => old}/tcp-proxy.cpp | 0 tcp-proxy/{ => old}/zerotier-proxy.service | 0 tcp-proxy/src/main.rs | 0 9 files changed, 408 insertions(+) create mode 100644 .clangd create mode 100644 tcp-proxy/Cargo.lock create mode 100644 tcp-proxy/Cargo.toml rename tcp-proxy/{ => old}/Makefile (100%) rename tcp-proxy/{ => old}/README.md (100%) rename tcp-proxy/{ => old}/tcp-proxy.cpp (100%) rename tcp-proxy/{ => old}/zerotier-proxy.service (100%) create mode 100644 tcp-proxy/src/main.rs diff --git a/.clangd b/.clangd new file mode 100644 index 000000000..c7a47fe97 --- /dev/null +++ b/.clangd @@ -0,0 +1,2 @@ +CompileFlags: + Add: [-std=c++17] diff --git a/.gitignore b/.gitignore index fd2f7a9a1..ba8b4afca 100755 --- a/.gitignore +++ b/.gitignore @@ -124,6 +124,7 @@ attic/world/mkworld workspace/ workspace2/ zeroidc/target/ +tcp-proxy/target #snapcraft specifics /parts/ diff --git a/tcp-proxy/Cargo.lock b/tcp-proxy/Cargo.lock new file mode 100644 index 000000000..bd726117d --- /dev/null +++ b/tcp-proxy/Cargo.lock @@ -0,0 +1,390 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "backtrace" +version = "0.3.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + +[[package]] +name = "io-uring" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595a0399f411a508feb2ec1e970a4a30c249351e30208960d58298de8660b0e5" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "object" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" +dependencies = [ + "memchr", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "tcp-proxy" +version = "0.0.1" +dependencies = [ + "socket2 0.5.7", + "tokio", + "tokio-uring", +] + +[[package]] +name = "tokio" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +dependencies = [ + "backtrace", + "libc", + "mio", + "pin-project-lite", + "socket2 0.5.7", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-uring" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "748482e3e13584a34664a710168ad5068e8cb1d968aa4ffa887e83ca6dd27967" +dependencies = [ + "futures-util", + "io-uring", + "libc", + "slab", + "socket2 0.4.10", + "tokio", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/tcp-proxy/Cargo.toml b/tcp-proxy/Cargo.toml new file mode 100644 index 000000000..b791923ad --- /dev/null +++ b/tcp-proxy/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "tcp-proxy" +version = "0.0.1" +edition = "2021" +license = "MPL-2.0" +authors = ["ZeroTier, Inc. "] + +[features] + +[dependencies] +socket2 = "^0" +tokio-uring = "0.5.0" +tokio = "^1.2" + +[dev-dependencies] diff --git a/tcp-proxy/Makefile b/tcp-proxy/old/Makefile similarity index 100% rename from tcp-proxy/Makefile rename to tcp-proxy/old/Makefile diff --git a/tcp-proxy/README.md b/tcp-proxy/old/README.md similarity index 100% rename from tcp-proxy/README.md rename to tcp-proxy/old/README.md diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/old/tcp-proxy.cpp similarity index 100% rename from tcp-proxy/tcp-proxy.cpp rename to tcp-proxy/old/tcp-proxy.cpp diff --git a/tcp-proxy/zerotier-proxy.service b/tcp-proxy/old/zerotier-proxy.service similarity index 100% rename from tcp-proxy/zerotier-proxy.service rename to tcp-proxy/old/zerotier-proxy.service diff --git a/tcp-proxy/src/main.rs b/tcp-proxy/src/main.rs new file mode 100644 index 000000000..e69de29bb From ad60d708e1bd4880f341b2622ed808eab038bb9c Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 17 Jun 2024 16:32:53 -0700 Subject: [PATCH 14/36] fix log line --- controller/PostgreSQL.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index abfdbd31d..010df3b9d 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -1180,7 +1180,7 @@ void PostgreSQL::_membersWatcher_Redis() { _memberChanged(oldConfig,newConfig,(this->_ready >= 2)); } } catch (...) { - fprintf(stderr, "json parse error in networkWatcher_Redis\n"); + fprintf(stderr, "json parse error in _membersWatcher_Redis: %s\n", a.second.c_str()); } } if (_rc->clusterMode) { @@ -1269,8 +1269,8 @@ void PostgreSQL::_networksWatcher_Redis() { if (oldConfig.is_object()||newConfig.is_object()) { _networkChanged(oldConfig,newConfig,(this->_ready >= 2)); } - } catch (...) { - fprintf(stderr, "json parse error in networkWatcher_Redis\n"); + } catch (std::exception &e) { + fprintf(stderr, "json parse error in networkWatcher_Redis: what: %s json: %s\n", e.what(), a.second.c_str()); } } if (_rc->clusterMode) { From 9d57ccd7b145071c662e57d5b7a27c14f5d0f636 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 17 Jun 2024 16:35:08 -0700 Subject: [PATCH 15/36] deauth all members upon network delete --- controller/DB.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/controller/DB.cpp b/controller/DB.cpp index fe2973990..2c354ae7f 100644 --- a/controller/DB.cpp +++ b/controller/DB.cpp @@ -382,6 +382,24 @@ void DB::_networkChanged(nlohmann::json &old,nlohmann::json &networkConfig,bool const std::string ids = old["id"]; const uint64_t networkId = Utils::hexStrToU64(ids.c_str()); if (networkId) { + try { + // deauth all members on the network + nlohmann::json network; + std::vector members; + this->get(networkId, network, members); + for(auto i=members.begin();i!=members.end();++i) { + const std::string nodeID = (*i)["id"]; + const uint64_t memberId = Utils::hexStrToU64(nodeID.c_str()); + std::unique_lock ll(_changeListeners_l); + for(auto j=_changeListeners.begin();j!=_changeListeners.end();++j) { + (*j)->onNetworkMemberDeauthorize(this,networkId,memberId); + } + } + } catch (std::exception &e) { + std::cerr << "Error deauthorizing members on network delete: " << e.what() << std::endl; + } + + // delete the network std::unique_lock l(_networks_l); _networks.erase(networkId); } From f9c6ee0181acb1b77605d9a4e4106ac79aaacca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 21 Jun 2024 13:18:42 +0200 Subject: [PATCH 16/36] macos: use more portable pwd instead of PWD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In nixpkgs we use coreutils and do not have PWD available. This change have any downsides on normal macOS systems, but helps nixpkgs packaging a bit. Signed-off-by: Jörg Thalheim --- make-mac.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-mac.mk b/make-mac.mk index 018fb8325..7af200adc 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -1,8 +1,8 @@ CC=clang CXX=clang++ -TOPDIR=$(shell PWD) +TOPDIR=$(shell pwd) -INCLUDES=-I$(shell PWD)/rustybits/target -isystem $(TOPDIR)/ext -I$(TOPDIR)/ext/prometheus-cpp-lite-1.0/core/include -I$(TOPDIR)/ext-prometheus-cpp-lite-1.0/3rdparty/http-client-lite/include -I$(TOPDIR)/ext/prometheus-cpp-lite-1.0/simpleapi/include +INCLUDES=-I$(shell pwd)/rustybits/target -isystem $(TOPDIR)/ext -I$(TOPDIR)/ext/prometheus-cpp-lite-1.0/core/include -I$(TOPDIR)/ext-prometheus-cpp-lite-1.0/3rdparty/http-client-lite/include -I$(TOPDIR)/ext/prometheus-cpp-lite-1.0/simpleapi/include DEFS= LIBS= ARCH_FLAGS=-arch x86_64 -arch arm64 From 8caede300c609843b7f207eeb1298cb1e852332b Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 24 Jun 2024 18:02:58 -0400 Subject: [PATCH 17/36] Add OS_ARCH to network config metadata. --- node/Constants.hpp | 64 +++++++++ node/Network.cpp | 1 + node/NetworkConfig.hpp | 4 +- tcp-proxy/Cargo.lock | 154 +++++++++------------ tcp-proxy/Cargo.toml | 15 ++- tcp-proxy/src/main.rs | 296 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 440 insertions(+), 94 deletions(-) diff --git a/node/Constants.hpp b/node/Constants.hpp index e310cc947..7c80910f6 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -202,6 +202,70 @@ #define ZT_PACKED_STRUCT(D) D __attribute__((packed)) #endif +#if defined(_WIN32) +#define ZT_PLATFORM_NAME "windows" // Windows +#elif defined(_WIN64) +#define ZT_PLATFORM_NAME "windows" // Windows +#elif defined(__CYGWIN__) +#define ZT_PLATFORM_NAME "windows" // Windows (Cygwin POSIX under Microsoft Window) +#elif defined(__ANDROID__) +#define ZT_PLATFORM_NAME "android" // Android (implies Linux, so it must come first) +#elif defined(__linux__) +#define ZT_PLATFORM_NAME "linux" // Debian, Ubuntu, Gentoo, Fedora, openSUSE, RedHat, Centos and other +#elif defined(__unix__) || !defined(__APPLE__) && defined(__MACH__) +#include +#if defined(BSD) +#define ZT_PLATFORM_NAME "bsd" // FreeBSD, NetBSD, OpenBSD, DragonFly BSD +#endif +#elif defined(__hpux) +#define ZT_PLATFORM_NAME "hp-ux" // HP-UX +#elif defined(_AIX) +#define ZT_PLATFORM_NAME "aix" // IBM AIX +#elif defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin) +#include +#if TARGET_IPHONE_SIMULATOR == 1 +#define ZT_PLATFORM_NAME "ios" // Apple iOS +#elif TARGET_OS_IPHONE == 1 +#define ZT_PLATFORM_NAME "ios" // Apple iOS +#elif TARGET_OS_MAC == 1 +#define ZT_PLATFORM_NAME "macos" // Apple OSX +#endif +#elif defined(__sun) && defined(__SVR4) +#define ZT_PLATFORM_NAME "solaris" // Oracle Solaris, Open Indiana +#else +#define ZT_PLATFORM_NAME "unknown" +#endif +#ifndef ZT_PLATFORM_NAME +#define ZT_PLATFORM_NAME "unknown" +#endif + +#if defined(__amd64) || defined(__amd64__) || defined(__x86_64) || defined(__x86_64__) || defined(__AMD64) || defined(__AMD64__) || defined(_M_X64) || defined(_M_AMD64) +#define ZT_ARCH_NAME "x86_64" +#elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(_X86_) || defined(_M_IX86) || defined(__X86__) || defined(__I86__) || defined(_M_I86) +#define ZT_ARCH_NAME "x86" +#elif defined(__aarch64__) || defined(__AARCH64EL__) || defined(_M_ARM64) +#define ZT_ARCH_NAME "arm64" +#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_ARM) || defined(_M_ARM) || defined(_M_ARMT) || defined(__arm) || defined(__thumb__) +#define ZT_ARCH_NAME "arm" +#elif defined(__loongarch__) || defined(_LOONGARCH_ARCH) +#define ZT_ARCH_NAME "loongarch" +#elif defined(__mips__) || defined(__MIPS__) +#define ZT_ARCH_NAME "mips" +#elif defined(__riscv) || defined(__riscv_xlen) +#define ZT_ARCH_NAME "riscv" +#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__ppc__) || defined(__ppc64__) || defined (_M_PPC) +#define ZT_ARCH_NAME "powerpc" +#elif defined(__s390__) || defined(__s390x__) || defined(__zarch__) +#define ZT_ARCH_NAME "s390" +#else +#define ZT_ARCH_NAME "unknown" +#endif +#ifndef ZT_ARCH_NAME +#define ZT_ARCH_NAME "unknown" +#endif + +#define ZT_TARGET_NAME (ZT_PLATFORM_NAME "/" ZT_ARCH_NAME) + /** * Length of a ZeroTier address in bytes */ diff --git a/node/Network.cpp b/node/Network.cpp index 2e03b2482..1643487fe 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -1313,6 +1313,7 @@ void Network::requestConfiguration(void *tPtr) rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_MAX_NETWORK_TAGS,(uint64_t)ZT_MAX_NETWORK_TAGS); rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_FLAGS,(uint64_t)0); rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_RULES_ENGINE_REV,(uint64_t)ZT_RULES_ENGINE_REVISION); + rmd.add(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_OS_ARCH,ZT_TARGET_NAME); RR->t->networkConfigRequestSent(tPtr,*this,ctrl); diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp index 416bbfd78..65e4c8365 100644 --- a/node/NetworkConfig.hpp +++ b/node/NetworkConfig.hpp @@ -105,6 +105,8 @@ namespace ZeroTier { // Network config version #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_VERSION "v" +// Network config version +#define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_OS_ARCH "o" // Protocol version (see Packet.hpp) #define ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_PROTOCOL_VERSION "pv" // Software vendor @@ -687,7 +689,7 @@ public: /** * Time current authentication expires or 0 if external authentication is disabled - * + * * Not used if authVersion >= 1 */ uint64_t authenticationExpiryTime; diff --git a/tcp-proxy/Cargo.lock b/tcp-proxy/Cargo.lock index bd726117d..89cd3d2e6 100644 --- a/tcp-proxy/Cargo.lock +++ b/tcp-proxy/Cargo.lock @@ -17,12 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - [[package]] name = "backtrace" version = "0.3.73" @@ -39,10 +33,10 @@ dependencies = [ ] [[package]] -name = "bitflags" -version = "1.3.2" +name = "bytes" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" @@ -56,31 +50,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "gimli" version = "0.29.0" @@ -88,14 +57,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] -name = "io-uring" -version = "0.6.4" +name = "hermit-abi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595a0399f411a508feb2ec1e970a4a30c249351e30208960d58298de8660b0e5" -dependencies = [ - "bitflags", - "libc", -] +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "libc" @@ -129,6 +94,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + [[package]] name = "object" version = "0.36.0" @@ -145,10 +120,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] -name = "pin-utils" -version = "0.1.0" +name = "proc-macro2" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] [[package]] name = "rustc-demangle" @@ -157,22 +144,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] -name = "slab" -version = "0.4.9" +name = "signal-hook-registry" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "socket2" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", - "winapi", ] [[package]] @@ -185,13 +162,23 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "tcp-proxy" version = "0.0.1" dependencies = [ - "socket2 0.5.7", + "socket2", "tokio", - "tokio-uring", ] [[package]] @@ -201,55 +188,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", + "bytes", "libc", "mio", + "num_cpus", "pin-project-lite", - "socket2 0.5.7", + "signal-hook-registry", + "socket2", + "tokio-macros", "windows-sys 0.48.0", ] [[package]] -name = "tokio-uring" -version = "0.5.0" +name = "tokio-macros" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748482e3e13584a34664a710168ad5068e8cb1d968aa4ffa887e83ca6dd27967" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ - "futures-util", - "io-uring", - "libc", - "slab", - "socket2 0.4.10", - "tokio", + "proc-macro2", + "quote", + "syn", ] +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-sys" version = "0.48.0" diff --git a/tcp-proxy/Cargo.toml b/tcp-proxy/Cargo.toml index b791923ad..4bd57c762 100644 --- a/tcp-proxy/Cargo.toml +++ b/tcp-proxy/Cargo.toml @@ -9,7 +9,18 @@ authors = ["ZeroTier, Inc. "] [dependencies] socket2 = "^0" -tokio-uring = "0.5.0" -tokio = "^1.2" +#tokio-uring = "0.5.0" +tokio = { version = "^1", default-features = false, features = [ + "fs", + "io-util", + "io-std", + "net", + "rt", + "signal", + "sync", + "time", + "macros", + "rt-multi-thread", +] } [dev-dependencies] diff --git a/tcp-proxy/src/main.rs b/tcp-proxy/src/main.rs index e69de29bb..1475608d3 100644 --- a/tcp-proxy/src/main.rs +++ b/tcp-proxy/src/main.rs @@ -0,0 +1,296 @@ +use std::{ + net::{Ipv6Addr, SocketAddrV6}, + time::Duration, +}; + +use tokio::net::TcpListener; + +const ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS: Duration = Duration::from_secs(300); +const ZT_TCP_PROXY_TCP_PORT: u16 = 443; + +#[tokio::main] +async fn main() { + let listener = + socket2::Socket::new(socket2::Domain::IPV6, socket2::Type::STREAM, None).unwrap(); + listener.set_only_v6(false).expect("error setting V6ONLY"); + let _ = listener.set_linger(None); + listener + .bind(&SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, ZT_TCP_PROXY_TCP_PORT, 0, 0).into()) + .expect("error binding to port"); + listener.listen(1024).expect("error listening"); + let listener = TcpListener::from_std(listener.into()).unwrap(); + + loop { + if let Ok((stream, from_address)) = listener.accept().await { + tokio::task::spawn(async move { + // + }); + } + } +} + +/* +use std::collections::HashMap; +use std::net::{IpAddr, Ipv4Addr, SocketAddr}; +use std::sync::Arc; +use std::time::{Duration, Instant}; + +use tokio::io::AsyncReadExt; +use tokio::net::{TcpListener, TcpStream, UdpSocket}; +use tokio::sync::Mutex; + +const ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS: u64 = 300; +const ZT_TCP_PROXY_TCP_PORT: u16 = 443; + +struct Client { + tcp_read_buf: Vec, + tcp_write_buf: Vec, + tcp_write_ptr: usize, + tcp_read_ptr: usize, + tcp: TcpStream, + udp: Arc, + last_activity: Instant, + new_version: bool, +} + +struct TcpProxyService { + udp_port_counter: Arc>, + clients: Arc>>, +} + +impl TcpProxyService { + async fn get_unused_udp(&self) -> Option> { + for _ in 0..65535 { + let mut port = self.udp_port_counter.lock().await; + *port += 1; + if *port > 0xfffe { + *port = 1024; + } + let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), *port); + match UdpSocket::bind(addr).await { + Ok(udp) => return Some(Arc::new(udp)), + Err(_) => continue, + } + } + None + } + + async fn handle_udp(&self, addr: SocketAddr, data: &[u8]) { + if data.len() < 16 || data.len() >= 2048 { + return; + } + + let mut clients = self.clients.lock().await; + if let Some(client) = clients.get_mut(&addr) { + client.last_activity = Instant::now(); + + let mlen = if client.new_version { + data.len() + 7 + } else { + data.len() + }; + + if client.tcp_write_ptr + 5 + mlen <= client.tcp_write_buf.len() { + client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + 5] + .copy_from_slice(&[0x17, 0x03, 0x03, (mlen >> 8) as u8, mlen as u8]); + client.tcp_write_ptr += 5; + + if client.new_version { + client.tcp_write_buf[client.tcp_write_ptr] = 4; // IPv4 + client.tcp_write_ptr += 1; + if let IpAddr::V4(ip) = addr.ip() { + client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + 4] + .copy_from_slice(&ip.octets()); + client.tcp_write_ptr += 4; + } + client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + 2] + .copy_from_slice(&addr.port().to_be_bytes()); + client.tcp_write_ptr += 2; + } + + client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + data.len()] + .copy_from_slice(data); + client.tcp_write_ptr += data.len(); + + if let Err(e) = client.tcp.writable().await { + eprintln!("Error waiting for TCP stream to be writable: {}", e); + } + } + + println!( + "<< UDP {}:{} -> {:#016x}", + addr.ip(), + addr.port(), + client as *const _ as usize + ); + } + } + + async fn handle_tcp(&self, mut stream: TcpStream, addr: SocketAddr) { + let udp = match self.get_unused_udp().await { + Some(udp) => udp, + None => { + println!("** TCP rejected, no more UDP ports to assign"); + return; + } + }; + + let mut client = Client { + tcp_read_buf: vec![0; 131072], + tcp_write_buf: vec![0; 131072], + tcp_write_ptr: 0, + tcp_read_ptr: 0, + tcp: stream.clone(), + udp: udp.clone(), + last_activity: Instant::now(), + new_version: false, + }; + + let mut clients = self.clients.lock().await; + clients.insert(addr, client); + drop(clients); + + println!( + "<< TCP from {} -> {:#016x}", + addr, &client as *const _ as usize + ); + + let mut buf = [0; 4096]; + loop { + match stream.read(&mut buf).await { + Ok(0) => break, + Ok(n) => { + let mut clients = self.clients.lock().await; + if let Some(client) = clients.get_mut(&addr) { + client.last_activity = Instant::now(); + + client.tcp_read_buf[client.tcp_read_ptr..client.tcp_read_ptr + n] + .copy_from_slice(&buf[..n]); + client.tcp_read_ptr += n; + + while client.tcp_read_ptr >= 5 { + let mlen = (client.tcp_read_buf[3] as usize) << 8 + | client.tcp_read_buf[4] as usize; + if client.tcp_read_ptr >= mlen + 5 { + if mlen == 4 { + client.new_version = true; + println!("<< TCP {:#016x} HELLO", client as *const _ as usize); + } else if mlen >= 7 { + let payload = &client.tcp_read_buf[5..mlen + 5]; + let mut payload_len = mlen; + + let mut dest = + SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0); + if client.new_version { + if payload[0] == 4 { + let ip = Ipv4Addr::new( + payload[1], payload[2], payload[3], payload[4], + ); + let port = u16::from_be_bytes([payload[5], payload[6]]); + dest = SocketAddr::new(IpAddr::V4(ip), port); + payload_len -= 7; + } + } else { + dest = SocketAddr::new( + IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), + 9993, + ); + } + + if dest.port() > 1024 && payload_len >= 16 { + if let Err(e) = + udp.send_to(&payload[7..payload_len + 7], dest).await + { + eprintln!("Error sending UDP packet: {}", e); + } + println!( + ">> TCP {:#016x} to {}:{}", + client as *const _ as usize, + dest.ip(), + dest.port() + ); + } + } + + client.tcp_read_ptr -= mlen + 5; + client.tcp_read_buf.copy_within(mlen + 5.., 0); + } else { + break; + } + } + } + } + Err(e) => { + eprintln!("Error reading from TCP stream: {}", e); + break; + } + } + } + + let mut clients = self.clients.lock().await; + clients.remove(&addr); + println!("** TCP {:#016x} closed", &client as *const _ as usize); + } + + async fn housekeeping(&self) { + let now = Instant::now(); + let mut clients = self.clients.lock().await; + let mut to_close = Vec::new(); + + for (addr, client) in clients.iter() { + if now.duration_since(client.last_activity) + >= Duration::from_secs(ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS) + { + to_close.push(*addr); + } + } + + for addr in to_close { + clients.remove(&addr); + } + } + + async fn run(&self) { + let listener = TcpListener::bind(SocketAddr::new( + IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), + ZT_TCP_PROXY_TCP_PORT, + )) + .await + .expect("Failed to bind TCP listener"); + + println!( + "TCP proxy server listening on {}", + listener.local_addr().unwrap() + ); + + let udp = UdpSocket::bind("0.0.0.0:0") + .await + .expect("Failed to bind UDP socket"); + + let mut buf = [0u8; 2048]; + loop { + tokio::select! { + Ok((stream, addr)) = listener.accept() => { + tokio::spawn(self.handle_tcp(stream, addr)); + } + Ok((len, addr)) = udp.recv_from(&mut buf) => { + self.handle_udp(addr, &buf[..len]).await; + } + _ = tokio::time::sleep(Duration::from_secs(120)) => { + self.housekeeping().await; + } + } + } + } +} + +#[tokio::main] +async fn main() { + let service = TcpProxyService { + udp_port_counter: Arc::new(Mutex::new(1023)), + clients: Arc::new(Mutex::new(HashMap::new())), + }; + + service.run().await; +} +*/ From e2840b0eb8aaa3c428d99a248bfb91879f7164c8 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 24 Jun 2024 18:54:05 -0400 Subject: [PATCH 18/36] undo stuff from other branch --- tcp-proxy/Cargo.lock | 362 --------------------- tcp-proxy/Cargo.toml | 26 -- tcp-proxy/{old => }/Makefile | 0 tcp-proxy/{old => }/README.md | 0 tcp-proxy/src/main.rs | 296 ----------------- tcp-proxy/{old => }/tcp-proxy.cpp | 0 tcp-proxy/{old => }/zerotier-proxy.service | 0 7 files changed, 684 deletions(-) delete mode 100644 tcp-proxy/Cargo.lock delete mode 100644 tcp-proxy/Cargo.toml rename tcp-proxy/{old => }/Makefile (100%) rename tcp-proxy/{old => }/README.md (100%) delete mode 100644 tcp-proxy/src/main.rs rename tcp-proxy/{old => }/tcp-proxy.cpp (100%) rename tcp-proxy/{old => }/zerotier-proxy.service (100%) diff --git a/tcp-proxy/Cargo.lock b/tcp-proxy/Cargo.lock deleted file mode 100644 index 89cd3d2e6..000000000 --- a/tcp-proxy/Cargo.lock +++ /dev/null @@ -1,362 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "backtrace" -version = "0.3.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - -[[package]] -name = "cc" -version = "1.0.99" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "memchr" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" - -[[package]] -name = "miniz_oxide" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.48.0", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" -dependencies = [ - "memchr", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "proc-macro2" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "syn" -version = "2.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tcp-proxy" -version = "0.0.1" -dependencies = [ - "socket2", - "tokio", -] - -[[package]] -name = "tokio" -version = "1.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/tcp-proxy/Cargo.toml b/tcp-proxy/Cargo.toml deleted file mode 100644 index 4bd57c762..000000000 --- a/tcp-proxy/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "tcp-proxy" -version = "0.0.1" -edition = "2021" -license = "MPL-2.0" -authors = ["ZeroTier, Inc. "] - -[features] - -[dependencies] -socket2 = "^0" -#tokio-uring = "0.5.0" -tokio = { version = "^1", default-features = false, features = [ - "fs", - "io-util", - "io-std", - "net", - "rt", - "signal", - "sync", - "time", - "macros", - "rt-multi-thread", -] } - -[dev-dependencies] diff --git a/tcp-proxy/old/Makefile b/tcp-proxy/Makefile similarity index 100% rename from tcp-proxy/old/Makefile rename to tcp-proxy/Makefile diff --git a/tcp-proxy/old/README.md b/tcp-proxy/README.md similarity index 100% rename from tcp-proxy/old/README.md rename to tcp-proxy/README.md diff --git a/tcp-proxy/src/main.rs b/tcp-proxy/src/main.rs deleted file mode 100644 index 1475608d3..000000000 --- a/tcp-proxy/src/main.rs +++ /dev/null @@ -1,296 +0,0 @@ -use std::{ - net::{Ipv6Addr, SocketAddrV6}, - time::Duration, -}; - -use tokio::net::TcpListener; - -const ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS: Duration = Duration::from_secs(300); -const ZT_TCP_PROXY_TCP_PORT: u16 = 443; - -#[tokio::main] -async fn main() { - let listener = - socket2::Socket::new(socket2::Domain::IPV6, socket2::Type::STREAM, None).unwrap(); - listener.set_only_v6(false).expect("error setting V6ONLY"); - let _ = listener.set_linger(None); - listener - .bind(&SocketAddrV6::new(Ipv6Addr::UNSPECIFIED, ZT_TCP_PROXY_TCP_PORT, 0, 0).into()) - .expect("error binding to port"); - listener.listen(1024).expect("error listening"); - let listener = TcpListener::from_std(listener.into()).unwrap(); - - loop { - if let Ok((stream, from_address)) = listener.accept().await { - tokio::task::spawn(async move { - // - }); - } - } -} - -/* -use std::collections::HashMap; -use std::net::{IpAddr, Ipv4Addr, SocketAddr}; -use std::sync::Arc; -use std::time::{Duration, Instant}; - -use tokio::io::AsyncReadExt; -use tokio::net::{TcpListener, TcpStream, UdpSocket}; -use tokio::sync::Mutex; - -const ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS: u64 = 300; -const ZT_TCP_PROXY_TCP_PORT: u16 = 443; - -struct Client { - tcp_read_buf: Vec, - tcp_write_buf: Vec, - tcp_write_ptr: usize, - tcp_read_ptr: usize, - tcp: TcpStream, - udp: Arc, - last_activity: Instant, - new_version: bool, -} - -struct TcpProxyService { - udp_port_counter: Arc>, - clients: Arc>>, -} - -impl TcpProxyService { - async fn get_unused_udp(&self) -> Option> { - for _ in 0..65535 { - let mut port = self.udp_port_counter.lock().await; - *port += 1; - if *port > 0xfffe { - *port = 1024; - } - let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), *port); - match UdpSocket::bind(addr).await { - Ok(udp) => return Some(Arc::new(udp)), - Err(_) => continue, - } - } - None - } - - async fn handle_udp(&self, addr: SocketAddr, data: &[u8]) { - if data.len() < 16 || data.len() >= 2048 { - return; - } - - let mut clients = self.clients.lock().await; - if let Some(client) = clients.get_mut(&addr) { - client.last_activity = Instant::now(); - - let mlen = if client.new_version { - data.len() + 7 - } else { - data.len() - }; - - if client.tcp_write_ptr + 5 + mlen <= client.tcp_write_buf.len() { - client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + 5] - .copy_from_slice(&[0x17, 0x03, 0x03, (mlen >> 8) as u8, mlen as u8]); - client.tcp_write_ptr += 5; - - if client.new_version { - client.tcp_write_buf[client.tcp_write_ptr] = 4; // IPv4 - client.tcp_write_ptr += 1; - if let IpAddr::V4(ip) = addr.ip() { - client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + 4] - .copy_from_slice(&ip.octets()); - client.tcp_write_ptr += 4; - } - client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + 2] - .copy_from_slice(&addr.port().to_be_bytes()); - client.tcp_write_ptr += 2; - } - - client.tcp_write_buf[client.tcp_write_ptr..client.tcp_write_ptr + data.len()] - .copy_from_slice(data); - client.tcp_write_ptr += data.len(); - - if let Err(e) = client.tcp.writable().await { - eprintln!("Error waiting for TCP stream to be writable: {}", e); - } - } - - println!( - "<< UDP {}:{} -> {:#016x}", - addr.ip(), - addr.port(), - client as *const _ as usize - ); - } - } - - async fn handle_tcp(&self, mut stream: TcpStream, addr: SocketAddr) { - let udp = match self.get_unused_udp().await { - Some(udp) => udp, - None => { - println!("** TCP rejected, no more UDP ports to assign"); - return; - } - }; - - let mut client = Client { - tcp_read_buf: vec![0; 131072], - tcp_write_buf: vec![0; 131072], - tcp_write_ptr: 0, - tcp_read_ptr: 0, - tcp: stream.clone(), - udp: udp.clone(), - last_activity: Instant::now(), - new_version: false, - }; - - let mut clients = self.clients.lock().await; - clients.insert(addr, client); - drop(clients); - - println!( - "<< TCP from {} -> {:#016x}", - addr, &client as *const _ as usize - ); - - let mut buf = [0; 4096]; - loop { - match stream.read(&mut buf).await { - Ok(0) => break, - Ok(n) => { - let mut clients = self.clients.lock().await; - if let Some(client) = clients.get_mut(&addr) { - client.last_activity = Instant::now(); - - client.tcp_read_buf[client.tcp_read_ptr..client.tcp_read_ptr + n] - .copy_from_slice(&buf[..n]); - client.tcp_read_ptr += n; - - while client.tcp_read_ptr >= 5 { - let mlen = (client.tcp_read_buf[3] as usize) << 8 - | client.tcp_read_buf[4] as usize; - if client.tcp_read_ptr >= mlen + 5 { - if mlen == 4 { - client.new_version = true; - println!("<< TCP {:#016x} HELLO", client as *const _ as usize); - } else if mlen >= 7 { - let payload = &client.tcp_read_buf[5..mlen + 5]; - let mut payload_len = mlen; - - let mut dest = - SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 0); - if client.new_version { - if payload[0] == 4 { - let ip = Ipv4Addr::new( - payload[1], payload[2], payload[3], payload[4], - ); - let port = u16::from_be_bytes([payload[5], payload[6]]); - dest = SocketAddr::new(IpAddr::V4(ip), port); - payload_len -= 7; - } - } else { - dest = SocketAddr::new( - IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), - 9993, - ); - } - - if dest.port() > 1024 && payload_len >= 16 { - if let Err(e) = - udp.send_to(&payload[7..payload_len + 7], dest).await - { - eprintln!("Error sending UDP packet: {}", e); - } - println!( - ">> TCP {:#016x} to {}:{}", - client as *const _ as usize, - dest.ip(), - dest.port() - ); - } - } - - client.tcp_read_ptr -= mlen + 5; - client.tcp_read_buf.copy_within(mlen + 5.., 0); - } else { - break; - } - } - } - } - Err(e) => { - eprintln!("Error reading from TCP stream: {}", e); - break; - } - } - } - - let mut clients = self.clients.lock().await; - clients.remove(&addr); - println!("** TCP {:#016x} closed", &client as *const _ as usize); - } - - async fn housekeeping(&self) { - let now = Instant::now(); - let mut clients = self.clients.lock().await; - let mut to_close = Vec::new(); - - for (addr, client) in clients.iter() { - if now.duration_since(client.last_activity) - >= Duration::from_secs(ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS) - { - to_close.push(*addr); - } - } - - for addr in to_close { - clients.remove(&addr); - } - } - - async fn run(&self) { - let listener = TcpListener::bind(SocketAddr::new( - IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), - ZT_TCP_PROXY_TCP_PORT, - )) - .await - .expect("Failed to bind TCP listener"); - - println!( - "TCP proxy server listening on {}", - listener.local_addr().unwrap() - ); - - let udp = UdpSocket::bind("0.0.0.0:0") - .await - .expect("Failed to bind UDP socket"); - - let mut buf = [0u8; 2048]; - loop { - tokio::select! { - Ok((stream, addr)) = listener.accept() => { - tokio::spawn(self.handle_tcp(stream, addr)); - } - Ok((len, addr)) = udp.recv_from(&mut buf) => { - self.handle_udp(addr, &buf[..len]).await; - } - _ = tokio::time::sleep(Duration::from_secs(120)) => { - self.housekeeping().await; - } - } - } - } -} - -#[tokio::main] -async fn main() { - let service = TcpProxyService { - udp_port_counter: Arc::new(Mutex::new(1023)), - clients: Arc::new(Mutex::new(HashMap::new())), - }; - - service.run().await; -} -*/ diff --git a/tcp-proxy/old/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp similarity index 100% rename from tcp-proxy/old/tcp-proxy.cpp rename to tcp-proxy/tcp-proxy.cpp diff --git a/tcp-proxy/old/zerotier-proxy.service b/tcp-proxy/zerotier-proxy.service similarity index 100% rename from tcp-proxy/old/zerotier-proxy.service rename to tcp-proxy/zerotier-proxy.service From 64634c916c0c8494929b0f0f3a6eec5414199c88 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 3 Jul 2024 08:49:07 -0700 Subject: [PATCH 19/36] Fix build for macOS, tune to prevent packet re-ordering --- osdep/EthernetTap.cpp | 4 +- osdep/LinuxEthernetTap.cpp | 2 +- osdep/MacEthernetTap.cpp | 22 +---- osdep/MacEthernetTap.hpp | 4 - osdep/MacKextEthernetTap.cpp | 2 - osdep/MacKextEthernetTap.hpp | 2 - service/OneService.cpp | 162 ++++++++++++++++++++--------------- 7 files changed, 102 insertions(+), 96 deletions(-) diff --git a/osdep/EthernetTap.cpp b/osdep/EthernetTap.cpp index d6c7bd7b2..95ce54b0a 100644 --- a/osdep/EthernetTap.cpp +++ b/osdep/EthernetTap.cpp @@ -84,9 +84,9 @@ std::shared_ptr EthernetTap::newInstance( // The "feth" virtual Ethernet device type appeared in Darwin 17.x.x. Older versions // (Sierra and earlier) must use the a kernel extension. if (strtol(osrelease,(char **)0,10) < 17) { - return std::shared_ptr(new MacKextEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new MacKextEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); } else { - return std::shared_ptr(new MacEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new MacEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); } } } diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index 4919dbd69..81ebedc11 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -223,7 +223,7 @@ LinuxEthernetTap::LinuxEthernetTap( (void)::pipe(_shutdownSignalPipe); bool _enablePinning = false; - char* envvar = std::getenv("ZT_CPU_PINNING"); + char* envvar = std::getenv("ZT_CORE_PINNING"); if (envvar) { int tmp = atoi(envvar); if (tmp > 0) { diff --git a/osdep/MacEthernetTap.cpp b/osdep/MacEthernetTap.cpp index 8d15b3b20..37f27f87a 100644 --- a/osdep/MacEthernetTap.cpp +++ b/osdep/MacEthernetTap.cpp @@ -69,7 +69,6 @@ static bool fethMaxMtuAdjusted = false; MacEthernetTap::MacEthernetTap( const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -78,7 +77,6 @@ MacEthernetTap::MacEthernetTap( void (*handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *data,unsigned int len), void *arg) : _handler(handler), - _concurrency(concurrency), _arg(arg), _nwid(nwid), _homePath(homePath), @@ -288,9 +286,6 @@ MacEthernetTap::~MacEthernetTap() } Thread::join(_thread); - for (std::thread &t : _rxThreads) { - t.join(); - } } void MacEthernetTap::setEnabled(bool en) { _enabled = en; } @@ -479,25 +474,17 @@ void MacEthernetTap::setMtu(unsigned int mtu) void MacEthernetTap::threadMain() throw() { - Thread::sleep(250); - - for (unsigned int i = 0; i < _concurrency; ++i) { - _rxThreads.push_back(std::thread([this, i] { - - fprintf(stderr, "starting thread %d\n", i); - char agentReadBuf[ZT_MACETHERNETTAP_AGENT_READ_BUF_SIZE]; char agentStderrBuf[256]; fd_set readfds,nullfds; MAC to,from; + Thread::sleep(250); + const int nfds = std::max(std::max(_shutdownSignalPipe[0],_agentStdout),_agentStderr) + 1; long agentReadPtr = 0; - - if (i == 0) { - fcntl(_agentStdout,F_SETFL,fcntl(_agentStdout,F_GETFL)|O_NONBLOCK); - fcntl(_agentStderr,F_SETFL,fcntl(_agentStderr,F_GETFL)|O_NONBLOCK); - } + fcntl(_agentStdout,F_SETFL,fcntl(_agentStdout,F_GETFL)|O_NONBLOCK); + fcntl(_agentStderr,F_SETFL,fcntl(_agentStderr,F_GETFL)|O_NONBLOCK); FD_ZERO(&readfds); FD_ZERO(&nullfds); @@ -546,7 +533,6 @@ void MacEthernetTap::threadMain() */ } } - }));} ::close(_agentStdin); ::close(_agentStdout); diff --git a/osdep/MacEthernetTap.hpp b/osdep/MacEthernetTap.hpp index 0bb78a79f..8ba378022 100644 --- a/osdep/MacEthernetTap.hpp +++ b/osdep/MacEthernetTap.hpp @@ -28,7 +28,6 @@ #include #include #include -#include namespace ZeroTier { @@ -37,7 +36,6 @@ class MacEthernetTap : public EthernetTap public: MacEthernetTap( const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -69,7 +67,6 @@ private: uint64_t _nwid; Thread _thread; std::string _homePath; - unsigned int _concurrency; std::string _dev; std::vector _multicastGroups; Mutex _putLock; @@ -82,7 +79,6 @@ private: volatile bool _enabled; mutable std::vector _ifaddrs; mutable uint64_t _lastIfAddrsUpdate; - std::vector _rxThreads; }; diff --git a/osdep/MacKextEthernetTap.cpp b/osdep/MacKextEthernetTap.cpp index 7ac0dac25..69e97050d 100644 --- a/osdep/MacKextEthernetTap.cpp +++ b/osdep/MacKextEthernetTap.cpp @@ -306,7 +306,6 @@ static Mutex globalTapCreateLock; MacKextEthernetTap::MacKextEthernetTap( const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -318,7 +317,6 @@ MacKextEthernetTap::MacKextEthernetTap( _arg(arg), _nwid(nwid), _homePath(homePath), - _concurrency(concurrency), _mtu(mtu), _metric(metric), _fd(0), diff --git a/osdep/MacKextEthernetTap.hpp b/osdep/MacKextEthernetTap.hpp index 6d8539874..a0cc1b81a 100644 --- a/osdep/MacKextEthernetTap.hpp +++ b/osdep/MacKextEthernetTap.hpp @@ -37,7 +37,6 @@ class MacKextEthernetTap : public EthernetTap public: MacKextEthernetTap( const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -72,7 +71,6 @@ private: std::string _homePath; std::string _dev; std::vector _multicastGroups; - unsigned int _concurrency; unsigned int _mtu; unsigned int _metric; int _fd; diff --git a/service/OneService.cpp b/service/OneService.cpp index 9d737a413..0287276bc 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -801,6 +801,7 @@ public: std::vector _rxPacketVector; std::vector _rxPacketThreads; Mutex _rxPacketVector_m,_rxPacketThreads_m; + bool _enableMulticore; bool _allowTcpFallbackRelay; bool _forceTcpRelay; @@ -934,74 +935,87 @@ public: _ports[1] = 0; _ports[2] = 0; - bool _enablePinning = false; - char* pinningVar = std::getenv("ZT_CPU_PINNING"); - if (pinningVar) { - int tmp = atoi(pinningVar); + _enableMulticore = false; + char* multicoreVar = std::getenv("ZT_ENABLE_MULTICORE"); + if (multicoreVar) { + int tmp = atoi(multicoreVar); if (tmp > 0) { - _enablePinning = true; + _enableMulticore = true; } } - char* concurrencyVar = std::getenv("ZT_PACKET_PROCESSING_CONCURRENCY"); - if (concurrencyVar) { - int tmp = atoi(concurrencyVar); - if (tmp > 0) { - _rxThreadCount = tmp; + if (_enableMulticore) { + bool _enablePinning = false; + char* pinningVar = std::getenv("ZT_CORE_PINNING"); + if (pinningVar) { + int tmp = atoi(pinningVar); + if (tmp > 0) { + _enablePinning = true; + } + } + char* concurrencyVar = std::getenv("ZT_CONCURRENCY"); + if (concurrencyVar) { + int tmp = atoi(concurrencyVar); + if (tmp > 0) { + _rxThreadCount = tmp; + } + else { + _rxThreadCount = std::thread::hardware_concurrency() >= 4 ? 2 : 1; + } } else { - _rxThreadCount = std::thread::hardware_concurrency(); + _rxThreadCount = std::thread::hardware_concurrency() >= 4 ? 2 : 1; } - } - else { - _rxThreadCount = std::thread::hardware_concurrency(); - } - for (unsigned int i = 0; i < _rxThreadCount; ++i) { - _rxPacketThreads.push_back(std::thread([this, i]() { + fprintf(stderr, "using %d rx threads\n", _rxThreadCount); + for (unsigned int i = 0; i < _rxThreadCount; ++i) { + _rxPacketThreads.push_back(std::thread([this, i, _enablePinning]() { + if (_enablePinning) { #if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ - int pinCore = i % _rxThreadCount; - fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); - pthread_t self = pthread_self(); - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(pinCore, &cpuset); + int pinCore = i % _rxThreadCount; + fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); + pthread_t self = pthread_self(); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(pinCore, &cpuset); #endif #ifdef __LINUX__ - int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); #elif __FreeBSD__ - int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); #endif #if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ - if (rc != 0) - { - fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); - exit(1); - } -#endif - PacketRecord* packet = nullptr; - for (;;) { - if (! _rxPacketQueue.get(packet)) { - break; - } - if (! packet) { - break; - } - const ZT_ResultCode err = _node->processWirePacket(nullptr, packet->now, packet->sock, &(packet->from), packet->data, packet->size, &_nextBackgroundTaskDeadline); + if (rc != 0) { - Mutex::Lock l(_rxPacketVector_m); - _rxPacketVector.push_back(packet); - } - if (ZT_ResultCode_isFatal(err)) { - char tmp[256]; - OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); - Mutex::Lock _l(_termReason_m); - _termReason = ONE_UNRECOVERABLE_ERROR; - _fatalErrorMessage = tmp; - this->terminate(); - break; + fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + exit(1); } +#endif } - })); + PacketRecord* packet = nullptr; + for (;;) { + if (! _rxPacketQueue.get(packet)) { + break; + } + if (! packet) { + break; + } + const ZT_ResultCode err = _node->processWirePacket(nullptr, packet->now, packet->sock, &(packet->from), packet->data, packet->size, &_nextBackgroundTaskDeadline); + { + Mutex::Lock l(_rxPacketVector_m); + _rxPacketVector.push_back(packet); + } + if (ZT_ResultCode_isFatal(err)) { + char tmp[256]; + OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = tmp; + this->terminate(); + break; + } + } + })); + } } prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr); @@ -2865,25 +2879,39 @@ public: _lastDirectReceiveFromGlobal = now; } - PacketRecord* packet; - _rxPacketVector_m.lock(); - if (_rxPacketVector.empty()) { - packet = new PacketRecord; + if (_enableMulticore) { + PacketRecord* packet; + _rxPacketVector_m.lock(); + if (_rxPacketVector.empty()) { + packet = new PacketRecord; + } + else { + packet = _rxPacketVector.back(); + _rxPacketVector.pop_back(); + } + _rxPacketVector_m.unlock(); + + packet->sock = reinterpret_cast(sock); + packet->now = now; + memcpy(&(packet->from), from, sizeof(struct sockaddr_storage)); + packet->size = (unsigned int)len; + memcpy(packet->data, data, len); + _rxPacketQueue.postLimit(packet, 256 * _rxThreadCount); } else { - packet = _rxPacketVector.back(); - _rxPacketVector.pop_back(); + const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); + if (ZT_ResultCode_isFatal(rc)) { + char tmp[256]; + OSUtils::ztsnprintf(tmp,sizeof(tmp),"fatal error code from processWirePacket: %d",(int)rc); + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = tmp; + this->terminate(); + } } - _rxPacketVector_m.unlock(); - - packet->sock = reinterpret_cast(sock); - packet->now = now; - memcpy(&(packet->from), from, sizeof(struct sockaddr_storage)); - packet->size = (unsigned int)len; - memcpy(packet->data, data, len); - _rxPacketQueue.postLimit(packet, 256 * _rxThreadCount); } + inline void phyOnTcpConnect(PhySocket *sock,void **uptr,bool success) { if (!success) { @@ -3103,7 +3131,7 @@ public: n.setTap(EthernetTap::newInstance( nullptr, _homePath.c_str(), - _rxThreadCount, + _enableMulticore ? _rxThreadCount : 1, MAC(nwc->mac), nwc->mtu, (unsigned int)ZT_IF_METRIC, From 508527f7cdcf622b51cedab86d95be79a82d9a37 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Mon, 8 Jul 2024 14:08:54 -0700 Subject: [PATCH 20/36] break up redis tx inserts into smaller chunks --- controller/PostgreSQL.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index 010df3b9d..e4a31ba28 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -780,11 +780,25 @@ void PostgreSQL::initializeNetworks() fprintf(stderr, "adding networks to redis...\n"); if (_rc->clusterMode) { auto tx = _cluster->transaction(_myAddressStr, true, false); - tx.sadd(setKey, networkSet.begin(), networkSet.end()); + uint64_t count = 0; + for (std::string nwid : networkSet) { + tx.sadd(setKey, nwid); + if (++count % 30000 == 0) { + tx.exec(); + tx = _cluster->transaction(_myAddressStr, true, false); + } + } tx.exec(); } else { auto tx = _redis->transaction(true, false); - tx.sadd(setKey, networkSet.begin(), networkSet.end()); + uint64_t count = 0; + for (std::string nwid : networkSet) { + tx.sadd(setKey, nwid); + if (++count % 30000 == 0) { + tx.exec(); + tx = _redis->transaction(true, false); + } + } tx.exec(); } fprintf(stderr, "done.\n"); @@ -1005,14 +1019,24 @@ void PostgreSQL::initializeMembers() fprintf(stderr, "Load member data into redis...\n"); if (_rc->clusterMode) { auto tx = _cluster->transaction(_myAddressStr, true, false); + uint64_t count = 0; for (auto it : networkMembers) { tx.sadd(it.first, it.second); + if (++count % 30000 == 0) { + tx.exec(); + tx = _cluster->transaction(_myAddressStr, true, false); + } } tx.exec(); } else { auto tx = _redis->transaction(true, false); + uint64_t count = 0; for (auto it : networkMembers) { tx.sadd(it.first, it.second); + if (++count % 30000 == 0) { + tx.exec(); + tx = _redis->transaction(true, false); + } } tx.exec(); } From 36adae3d8211f165b77cfc644bb60fede3f9034d Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Sun, 18 Aug 2024 15:07:18 -0700 Subject: [PATCH 21/36] Add packet multiplexer --- node/IncomingPacket.cpp | 13 ++-- node/Node.cpp | 14 +++- node/Node.hpp | 2 +- node/PacketMultiplexer.cpp | 125 ++++++++++++++++++++++++++++++++++++ node/PacketMultiplexer.hpp | 62 ++++++++++++++++++ node/RuntimeEnvironment.hpp | 2 + node/Switch.cpp | 2 +- objects.mk | 3 +- osdep/EthernetTap.cpp | 5 +- osdep/EthernetTap.hpp | 1 - osdep/LinuxEthernetTap.cpp | 23 +++++-- osdep/LinuxEthernetTap.hpp | 2 - service/OneService.cpp | 4 +- 13 files changed, 236 insertions(+), 22 deletions(-) create mode 100644 node/PacketMultiplexer.cpp create mode 100644 node/PacketMultiplexer.hpp diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index a5dd77017..e34d4b048 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -38,6 +38,7 @@ #include "Path.hpp" #include "Bond.hpp" #include "Metrics.hpp" +#include "PacketMultiplexer.hpp" namespace ZeroTier { @@ -793,7 +794,7 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar { Metrics::pkt_frame_in++; int32_t _flowId = ZT_QOS_NO_FLOW; - if (peer->flowHashingSupported()) { + //if (peer->flowHashingSupported()) { if (size() > ZT_PROTO_VERB_EXT_FRAME_IDX_PAYLOAD) { const unsigned int etherType = at(ZT_PROTO_VERB_FRAME_IDX_ETHERTYPE); const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; @@ -855,7 +856,9 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar } } } - } + //} + + //fprintf(stderr, "IncomingPacket::_doFRAME: flowId=%d\n", _flowId); const uint64_t nwid = at(ZT_PROTO_VERB_FRAME_IDX_NETWORK_ID); const SharedPtr network(RR->node->network(nwid)); @@ -869,7 +872,8 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; const uint8_t *const frameData = reinterpret_cast(data()) + ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; if (network->filterIncomingPacket(tPtr,peer,RR->identity.address(),sourceMac,network->mac(),frameData,frameLen,etherType,0) > 0) { - RR->node->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen); + //RR->node->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen); + RR->pm->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen, _flowId); } } } else { @@ -942,7 +946,8 @@ bool IncomingPacket::_doEXT_FRAME(const RuntimeEnvironment *RR,void *tPtr,const } // fall through -- 2 means accept regardless of bridging checks or other restrictions case 2: - RR->node->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen); + //RR->node->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen); + RR->pm->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen, flowId); break; } } diff --git a/node/Node.cpp b/node/Node.cpp index 4913d1a4c..f2ad40fe0 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -35,6 +35,7 @@ #include "Network.hpp" #include "Trace.hpp" #include "Metrics.hpp" +#include "PacketMultiplexer.hpp" // FIXME: remove this suppression and actually fix warnings #ifdef __GNUC__ @@ -119,9 +120,10 @@ Node::Node(void *uptr,void *tptr,const struct ZT_Node_Callbacks *callbacks,int64 const unsigned long mcs = sizeof(Multicaster) + (((sizeof(Multicaster) & 0xf) != 0) ? (16 - (sizeof(Multicaster) & 0xf)) : 0); const unsigned long topologys = sizeof(Topology) + (((sizeof(Topology) & 0xf) != 0) ? (16 - (sizeof(Topology) & 0xf)) : 0); const unsigned long sas = sizeof(SelfAwareness) + (((sizeof(SelfAwareness) & 0xf) != 0) ? (16 - (sizeof(SelfAwareness) & 0xf)) : 0); - const unsigned long bc = sizeof(Bond) + (((sizeof(Bond) & 0xf) != 0) ? (16 - (sizeof(Bond) & 0xf)) : 0); + const unsigned long bcs = sizeof(Bond) + (((sizeof(Bond) & 0xf) != 0) ? (16 - (sizeof(Bond) & 0xf)) : 0); + const unsigned long pms = sizeof(PacketMultiplexer) + (((sizeof(PacketMultiplexer) & 0xf) != 0) ? (16 - (sizeof(PacketMultiplexer) & 0xf)) : 0); - m = reinterpret_cast(::malloc(16 + ts + sws + mcs + topologys + sas + bc)); + m = reinterpret_cast(::malloc(16 + ts + sws + mcs + topologys + sas + bcs + pms)); if (!m) { throw std::bad_alloc(); } @@ -141,6 +143,8 @@ Node::Node(void *uptr,void *tptr,const struct ZT_Node_Callbacks *callbacks,int64 RR->sa = new (m) SelfAwareness(RR); m += sas; RR->bc = new (m) Bond(RR); + m += bcs; + RR->pm = new (m) PacketMultiplexer(RR); } catch ( ... ) { if (RR->sa) { RR->sa->~SelfAwareness(); @@ -160,6 +164,9 @@ Node::Node(void *uptr,void *tptr,const struct ZT_Node_Callbacks *callbacks,int64 if (RR->bc) { RR->bc->~Bond(); } + if (RR->pm) { + RR->pm->~PacketMultiplexer(); + } ::free(m); throw; } @@ -191,6 +198,9 @@ Node::~Node() if (RR->bc) { RR->bc->~Bond(); } + if (RR->pm) { + RR->pm->~PacketMultiplexer(); + } ::free(RR->rtmem); } diff --git a/node/Node.hpp b/node/Node.hpp index 1f74b8340..1c789a0b0 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -283,7 +283,7 @@ public: return _lowBandwidthMode; } -private: +public: RuntimeEnvironment _RR; RuntimeEnvironment *RR; void *_uPtr; // _uptr (lower case) is reserved in Visual Studio :P diff --git a/node/PacketMultiplexer.cpp b/node/PacketMultiplexer.cpp new file mode 100644 index 000000000..6f559c4b8 --- /dev/null +++ b/node/PacketMultiplexer.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c)2013-2021 ZeroTier, Inc. + * + * Use of this software is governed by the Business Source License included + * in the LICENSE.TXT file in the project's root directory. + * + * Change Date: 2026-01-01 + * + * On the date above, in accordance with the Business Source License, use + * of this software will be governed by version 2.0 of the Apache License. + */ +/****/ + +#include "PacketMultiplexer.hpp" + +#include "Node.hpp" +#include "RuntimeEnvironment.hpp" + +#include +#include + +namespace ZeroTier { + +void PacketMultiplexer::putFrame(void* tPtr, uint64_t nwid, void** nuptr, const MAC& source, const MAC& dest, unsigned int etherType, unsigned int vlanId, const void* data, unsigned int len, unsigned int flowId) +{ + PacketRecord* packet; + _rxPacketVector_m.lock(); + if (_rxPacketVector.empty()) { + packet = new PacketRecord; + } + else { + packet = _rxPacketVector.back(); + _rxPacketVector.pop_back(); + } + _rxPacketVector_m.unlock(); + + packet->tPtr = tPtr; + packet->nwid = nwid; + packet->nuptr = nuptr; + packet->source = source.toInt(); + packet->dest = dest.toInt(); + packet->etherType = etherType; + packet->vlanId = vlanId; + packet->len = len; + packet->flowId = flowId; + memcpy(packet->data, data, len); + + int bucket = flowId % _concurrency; + //fprintf(stderr, "bucket=%d\n", bucket); + _rxPacketQueues[bucket]->postLimit(packet, 2048); +} + +PacketMultiplexer::PacketMultiplexer(const RuntimeEnvironment* renv) +{ + RR = renv; + bool _enablePinning = false; + char* pinningVar = std::getenv("ZT_CPU_PINNING"); + if (pinningVar) { + int tmp = atoi(pinningVar); + if (tmp > 0) { + _enablePinning = true; + } + } + + _concurrency = 1; + char* concurrencyVar = std::getenv("ZT_PACKET_PROCESSING_CONCURRENCY"); + if (concurrencyVar) { + int tmp = atoi(concurrencyVar); + if (tmp > 0) { + _concurrency = tmp; + } + else { + _concurrency = std::max((unsigned int)1, std::thread::hardware_concurrency() / 2); + } + } + else { + _concurrency = std::max((unsigned int)1, std::thread::hardware_concurrency() / 2); + } + + for (unsigned int i = 0; i < _concurrency; ++i) { + fprintf(stderr, "reserved queue for thread %d\n", i); + _rxPacketQueues.push_back(new BlockingQueue()); + } + + // Each thread picks from its own queue to feed into the core + for (unsigned int i = 0; i < _concurrency; ++i) { + _rxThreads.push_back(std::thread([this, i, _enablePinning]() { + fprintf(stderr, "created post-decode packet ingestion thread %d\n", i); + + PacketRecord* packet = nullptr; + for (;;) { + if (! _rxPacketQueues[i]->get(packet)) { + break; + } + if (! packet) { + break; + } + + //fprintf(stderr, "popped packet from queue %d\n", i); + + MAC sourceMac = MAC(packet->source); + MAC destMac = MAC(packet->dest); + + RR->node->putFrame(packet->tPtr, packet->nwid, packet->nuptr, sourceMac, destMac, packet->etherType, 0, (const void*)packet->data, packet->len); + { + Mutex::Lock l(_rxPacketVector_m); + _rxPacketVector.push_back(packet); + } + /* + if (ZT_ResultCode_isFatal(err)) { + char tmp[256]; + OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = tmp; + this->terminate(); + break; + } + */ + } + })); + } +}; + +} // namespace ZeroTier \ No newline at end of file diff --git a/node/PacketMultiplexer.hpp b/node/PacketMultiplexer.hpp new file mode 100644 index 000000000..152bda320 --- /dev/null +++ b/node/PacketMultiplexer.hpp @@ -0,0 +1,62 @@ +/* + * Copyright (c)2013-2021 ZeroTier, Inc. + * + * Use of this software is governed by the Business Source License included + * in the LICENSE.TXT file in the project's root directory. + * + * Change Date: 2026-01-01 + * + * On the date above, in accordance with the Business Source License, use + * of this software will be governed by version 2.0 of the Apache License. + */ +/****/ + +#ifndef ZT_PACKET_MULTIPLEXER_HPP +#define ZT_PACKET_MULTIPLEXER_HPP + +#include "../osdep/BlockingQueue.hpp" +#include "MAC.hpp" +#include "Mutex.hpp" +#include "RuntimeEnvironment.hpp" + +#include +#include + +namespace ZeroTier { + +struct PacketRecord { + void* tPtr; + uint64_t nwid; + void** nuptr; + uint64_t source; + uint64_t dest; + unsigned int etherType; + unsigned int vlanId; + uint8_t data[ZT_MAX_MTU]; + unsigned int len; + unsigned int flowId; +}; + +class PacketMultiplexer { + public: + const RuntimeEnvironment* RR; + + PacketMultiplexer(const RuntimeEnvironment* renv); + + void putFrame(void* tPtr, uint64_t nwid, void** nuptr, const MAC& source, const MAC& dest, unsigned int etherType, unsigned int vlanId, const void* data, unsigned int len, unsigned int flowId); + + std::vector*> _rxPacketQueues; + + unsigned int _concurrency; + // pool + std::vector _rxPacketVector; + std::vector _rxPacketThreads; + Mutex _rxPacketVector_m, _rxPacketThreads_m; + + std::vector _rxThreads; + unsigned int _rxThreadCount; +}; + +} // namespace ZeroTier + +#endif // ZT_PACKET_MULTIPLEXER_HPP \ No newline at end of file diff --git a/node/RuntimeEnvironment.hpp b/node/RuntimeEnvironment.hpp index 019645513..274a9f265 100644 --- a/node/RuntimeEnvironment.hpp +++ b/node/RuntimeEnvironment.hpp @@ -31,6 +31,7 @@ class NetworkController; class SelfAwareness; class Trace; class Bond; +class PacketMultiplexer; /** * Holds global state for an instance of ZeroTier::Node @@ -77,6 +78,7 @@ public: Topology *topology; SelfAwareness *sa; Bond *bc; + PacketMultiplexer *pm; // This node's identity and string representations thereof Identity identity; diff --git a/node/Switch.cpp b/node/Switch.cpp index 5ea1653c2..871a55b24 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -519,7 +519,7 @@ void Switch::onLocalEthernet(void *tPtr,const SharedPtr &network,const RR->node->putFrame(tPtr, network->id(), network->userPtr(), peerMac, from, ZT_ETHERTYPE_IPV6, 0, adv, 72); }).detach(); - + return; // NDP emulation done. We have forged a "fake" reply, so no need to send actual NDP query. } // else no NDP emulation } // else no NDP emulation diff --git a/objects.mk b/objects.mk index d07578fb3..1d8a6c0a5 100644 --- a/objects.mk +++ b/objects.mk @@ -29,7 +29,8 @@ CORE_OBJS=\ node/Topology.o \ node/Trace.o \ node/Utils.o \ - node/Bond.o + node/Bond.o \ + node/PacketMultiplexer.o ONE_OBJS=\ controller/EmbeddedNetworkController.o \ diff --git a/osdep/EthernetTap.cpp b/osdep/EthernetTap.cpp index 95ce54b0a..cdc01f7b8 100644 --- a/osdep/EthernetTap.cpp +++ b/osdep/EthernetTap.cpp @@ -58,7 +58,6 @@ namespace ZeroTier { std::shared_ptr EthernetTap::newInstance( const char *tapDeviceType, // OS-specific, NULL for default const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -89,11 +88,11 @@ std::shared_ptr EthernetTap::newInstance( return std::shared_ptr(new MacEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); } } - } + }/ #endif // __APPLE__ #ifdef __LINUX__ - return std::shared_ptr(new LinuxEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new LinuxEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __LINUX__ #ifdef __WINDOWS__ diff --git a/osdep/EthernetTap.hpp b/osdep/EthernetTap.hpp index c5e82470c..893e70c34 100644 --- a/osdep/EthernetTap.hpp +++ b/osdep/EthernetTap.hpp @@ -33,7 +33,6 @@ public: static std::shared_ptr newInstance( const char *tapDeviceType, // OS-specific, NULL for default const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index 81ebedc11..160f4d76b 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -111,7 +111,6 @@ static void _base32_5_to_8(const uint8_t *in,char *out) LinuxEthernetTap::LinuxEthernetTap( const char *homePath, - unsigned int concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -128,7 +127,6 @@ LinuxEthernetTap::LinuxEthernetTap( _fd(0), _enabled(true), _run(true), - _concurrency(concurrency), _lastIfAddrsUpdate(0) { static std::mutex s_tapCreateLock; @@ -231,12 +229,27 @@ LinuxEthernetTap::LinuxEthernetTap( } } + int _concurrency = 1; + char* concurrencyVar = std::getenv("ZT_PACKET_PROCESSING_CONCURRENCY"); + if (concurrencyVar) { + int tmp = atoi(concurrencyVar); + if (tmp > 0) { + _concurrency = tmp; + } + else { + _concurrency = std::max((unsigned int)1,std::thread::hardware_concurrency() / 2); + } + } + else { + _concurrency = std::max((unsigned int)1,std::thread::hardware_concurrency() / 2); + } + for (unsigned int i = 0; i < _concurrency; ++i) { - _rxThreads.push_back(std::thread([this, i, _enablePinning] { + _rxThreads.push_back(std::thread([this, i, _concurrency, _enablePinning] { if (_enablePinning) { int pinCore = i % _concurrency; - fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); + fprintf(stderr, "pinning tap thread %d to core %d\n", i, pinCore); pthread_t self = pthread_self(); cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -244,7 +257,7 @@ LinuxEthernetTap::LinuxEthernetTap( int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); if (rc != 0) { - fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + fprintf(stderr, "failed to pin tap thread %d to core %d: %s\n", i, pinCore, strerror(errno)); exit(1); } } diff --git a/osdep/LinuxEthernetTap.hpp b/osdep/LinuxEthernetTap.hpp index b694b277c..383c67b7f 100644 --- a/osdep/LinuxEthernetTap.hpp +++ b/osdep/LinuxEthernetTap.hpp @@ -35,7 +35,6 @@ class LinuxEthernetTap : public EthernetTap public: LinuxEthernetTap( const char *homePath, - unsigned int _concurrency, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -68,7 +67,6 @@ private: std::string _dev; std::vector _multicastGroups; unsigned int _mtu; - unsigned int _concurrency; int _fd; int _shutdownSignalPipe[2]; std::atomic_bool _enabled; diff --git a/service/OneService.cpp b/service/OneService.cpp index 0287276bc..169fd6f91 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -46,6 +46,7 @@ #include "../node/SHA512.hpp" #include "../node/Bond.hpp" #include "../node/Peer.hpp" +#include "../node/PacketMultiplexer.hpp" #include "../osdep/Phy.hpp" #include "../osdep/OSUtils.hpp" @@ -986,7 +987,7 @@ public: #if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ if (rc != 0) { - fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + fprintf(stderr, "failed to pin rx thread %d to core %d: %s\n", i, pinCore, strerror(errno)); exit(1); } #endif @@ -3131,7 +3132,6 @@ public: n.setTap(EthernetTap::newInstance( nullptr, _homePath.c_str(), - _enableMulticore ? _rxThreadCount : 1, MAC(nwc->mac), nwc->mtu, (unsigned int)ZT_IF_METRIC, From b1a30ae4ff8cfe3516a7b56d5291afa82cd7403c Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 20 Aug 2024 13:39:15 -0700 Subject: [PATCH 22/36] Switch to local.conf-based config of multithreading --- node/IncomingPacket.cpp | 133 +++++++++++++++--------------- node/Node.cpp | 6 ++ node/Node.hpp | 9 ++ node/PacketMultiplexer.cpp | 45 ++++------ node/PacketMultiplexer.hpp | 4 +- service/OneService.cpp | 163 +++++++++++++++++-------------------- 6 files changed, 177 insertions(+), 183 deletions(-) diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index b9e5d8b26..4d6d5ce8e 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -794,71 +794,68 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar { Metrics::pkt_frame_in++; int32_t _flowId = ZT_QOS_NO_FLOW; - //if (peer->flowHashingSupported()) { - if (size() > ZT_PROTO_VERB_EXT_FRAME_IDX_PAYLOAD) { - const unsigned int etherType = at(ZT_PROTO_VERB_FRAME_IDX_ETHERTYPE); - const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; - const uint8_t *const frameData = reinterpret_cast(data()) + ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; - if (etherType == ZT_ETHERTYPE_IPV4 && (frameLen >= 20)) { - uint16_t srcPort = 0; - uint16_t dstPort = 0; - uint8_t proto = (reinterpret_cast(frameData)[9]); - const unsigned int headerLen = 4 * (reinterpret_cast(frameData)[0] & 0xf); - switch(proto) { - case 0x01: // ICMP - //flowId = 0x01; - break; - // All these start with 16-bit source and destination port in that order - case 0x06: // TCP - case 0x11: // UDP - case 0x84: // SCTP - case 0x88: // UDPLite - if (frameLen > (headerLen + 4)) { - unsigned int pos = headerLen + 0; - srcPort = (reinterpret_cast(frameData)[pos++]) << 8; - srcPort |= (reinterpret_cast(frameData)[pos]); - pos++; - dstPort = (reinterpret_cast(frameData)[pos++]) << 8; - dstPort |= (reinterpret_cast(frameData)[pos]); - _flowId = dstPort ^ srcPort ^ proto; - } - break; - } - } + if (size() > ZT_PROTO_VERB_EXT_FRAME_IDX_PAYLOAD) { + const unsigned int etherType = at(ZT_PROTO_VERB_FRAME_IDX_ETHERTYPE); + const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; + const uint8_t *const frameData = reinterpret_cast(data()) + ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; - if (etherType == ZT_ETHERTYPE_IPV6 && (frameLen >= 40)) { - uint16_t srcPort = 0; - uint16_t dstPort = 0; - unsigned int pos; - unsigned int proto; - _ipv6GetPayload((const uint8_t *)frameData, frameLen, pos, proto); - switch(proto) { - case 0x3A: // ICMPv6 - //flowId = 0x3A; - break; - // All these start with 16-bit source and destination port in that order - case 0x06: // TCP - case 0x11: // UDP - case 0x84: // SCTP - case 0x88: // UDPLite - if (frameLen > (pos + 4)) { - srcPort = (reinterpret_cast(frameData)[pos++]) << 8; - srcPort |= (reinterpret_cast(frameData)[pos]); - pos++; - dstPort = (reinterpret_cast(frameData)[pos++]) << 8; - dstPort |= (reinterpret_cast(frameData)[pos]); - _flowId = dstPort ^ srcPort ^ proto; - } - break; - default: - break; - } + if (etherType == ZT_ETHERTYPE_IPV4 && (frameLen >= 20)) { + uint16_t srcPort = 0; + uint16_t dstPort = 0; + uint8_t proto = (reinterpret_cast(frameData)[9]); + const unsigned int headerLen = 4 * (reinterpret_cast(frameData)[0] & 0xf); + switch(proto) { + case 0x01: // ICMP + //flowId = 0x01; + break; + // All these start with 16-bit source and destination port in that order + case 0x06: // TCP + case 0x11: // UDP + case 0x84: // SCTP + case 0x88: // UDPLite + if (frameLen > (headerLen + 4)) { + unsigned int pos = headerLen + 0; + srcPort = (reinterpret_cast(frameData)[pos++]) << 8; + srcPort |= (reinterpret_cast(frameData)[pos]); + pos++; + dstPort = (reinterpret_cast(frameData)[pos++]) << 8; + dstPort |= (reinterpret_cast(frameData)[pos]); + _flowId = dstPort ^ srcPort ^ proto; + } + break; } } - //} - //fprintf(stderr, "IncomingPacket::_doFRAME: flowId=%d\n", _flowId); + if (etherType == ZT_ETHERTYPE_IPV6 && (frameLen >= 40)) { + uint16_t srcPort = 0; + uint16_t dstPort = 0; + unsigned int pos; + unsigned int proto; + _ipv6GetPayload((const uint8_t *)frameData, frameLen, pos, proto); + switch(proto) { + case 0x3A: // ICMPv6 + //flowId = 0x3A; + break; + // All these start with 16-bit source and destination port in that order + case 0x06: // TCP + case 0x11: // UDP + case 0x84: // SCTP + case 0x88: // UDPLite + if (frameLen > (pos + 4)) { + srcPort = (reinterpret_cast(frameData)[pos++]) << 8; + srcPort |= (reinterpret_cast(frameData)[pos]); + pos++; + dstPort = (reinterpret_cast(frameData)[pos++]) << 8; + dstPort |= (reinterpret_cast(frameData)[pos]); + _flowId = dstPort ^ srcPort ^ proto; + } + break; + default: + break; + } + } + } const uint64_t nwid = at(ZT_PROTO_VERB_FRAME_IDX_NETWORK_ID); const SharedPtr network(RR->node->network(nwid)); @@ -872,8 +869,12 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; const uint8_t *const frameData = reinterpret_cast(data()) + ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; if (network->filterIncomingPacket(tPtr,peer,RR->identity.address(),sourceMac,network->mac(),frameData,frameLen,etherType,0) > 0) { - //RR->node->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen); - RR->pm->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen, _flowId); + if (RR->node->getMultithreadingEnabled()) { + RR->pm->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen, _flowId); + } + else { + RR->node->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen); + } } } } else { @@ -946,8 +947,12 @@ bool IncomingPacket::_doEXT_FRAME(const RuntimeEnvironment *RR,void *tPtr,const } // fall through -- 2 means accept regardless of bridging checks or other restrictions case 2: - //RR->node->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen); - RR->pm->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen, flowId); + if (RR->node->getMultithreadingEnabled()) { + RR->pm->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen, flowId); + } + else { + RR->node->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen); + } break; } } diff --git a/node/Node.cpp b/node/Node.cpp index 50a3c3ff5..c7cb37df5 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -240,6 +240,12 @@ ZT_ResultCode Node::processVirtualNetworkFrame( } } +void Node::initMultithreading(bool isEnabled, unsigned int concurrency, bool cpuPinningEnabled) +{ + _multithreadingEnabled = isEnabled; + RR->pm->setUpPostDecodeReceiveThreads(concurrency, cpuPinningEnabled); +} + // Closure used to ping upstream and active/online peers class _PingPeersThatNeedPing { diff --git a/node/Node.hpp b/node/Node.hpp index 86d1aee57..da2d5427f 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -283,6 +283,14 @@ public: return _lowBandwidthMode; } + inline bool getMultithreadingEnabled() + { + return _multithreadingEnabled; + } + + void initMultithreading(bool isEnabled, unsigned int concurrency, bool cpuPinningEnabled); + + public: RuntimeEnvironment _RR; RuntimeEnvironment *RR; @@ -331,6 +339,7 @@ public: volatile int64_t _prngState[2]; bool _online; bool _lowBandwidthMode; + bool _multithreadingEnabled; }; } // namespace ZeroTier diff --git a/node/PacketMultiplexer.cpp b/node/PacketMultiplexer.cpp index 6f559c4b8..401e1db9f 100644 --- a/node/PacketMultiplexer.cpp +++ b/node/PacketMultiplexer.cpp @@ -21,6 +21,11 @@ namespace ZeroTier { +PacketMultiplexer::PacketMultiplexer(const RuntimeEnvironment* renv) +{ + RR = renv; +}; + void PacketMultiplexer::putFrame(void* tPtr, uint64_t nwid, void** nuptr, const MAC& source, const MAC& dest, unsigned int etherType, unsigned int vlanId, const void* data, unsigned int len, unsigned int flowId) { PacketRecord* packet; @@ -46,46 +51,26 @@ void PacketMultiplexer::putFrame(void* tPtr, uint64_t nwid, void** nuptr, const memcpy(packet->data, data, len); int bucket = flowId % _concurrency; - //fprintf(stderr, "bucket=%d\n", bucket); - _rxPacketQueues[bucket]->postLimit(packet, 2048); + _rxPacketQueues[bucket]->postLimit(packet, 256); } -PacketMultiplexer::PacketMultiplexer(const RuntimeEnvironment* renv) +void PacketMultiplexer::setUpPostDecodeReceiveThreads(unsigned int concurrency, bool cpuPinningEnabled) { - RR = renv; - bool _enablePinning = false; - char* pinningVar = std::getenv("ZT_CPU_PINNING"); - if (pinningVar) { - int tmp = atoi(pinningVar); - if (tmp > 0) { - _enablePinning = true; - } - } - - _concurrency = 1; - char* concurrencyVar = std::getenv("ZT_PACKET_PROCESSING_CONCURRENCY"); - if (concurrencyVar) { - int tmp = atoi(concurrencyVar); - if (tmp > 0) { - _concurrency = tmp; - } - else { - _concurrency = std::max((unsigned int)1, std::thread::hardware_concurrency() / 2); - } - } - else { - _concurrency = std::max((unsigned int)1, std::thread::hardware_concurrency() / 2); + if (! RR->node->getMultithreadingEnabled()) { + return; } + _concurrency = concurrency; + bool _enablePinning = cpuPinningEnabled; for (unsigned int i = 0; i < _concurrency; ++i) { - fprintf(stderr, "reserved queue for thread %d\n", i); + fprintf(stderr, "Reserved queue for thread %d\n", i); _rxPacketQueues.push_back(new BlockingQueue()); } // Each thread picks from its own queue to feed into the core for (unsigned int i = 0; i < _concurrency; ++i) { _rxThreads.push_back(std::thread([this, i, _enablePinning]() { - fprintf(stderr, "created post-decode packet ingestion thread %d\n", i); + fprintf(stderr, "Created post-decode packet ingestion thread %d\n", i); PacketRecord* packet = nullptr; for (;;) { @@ -96,7 +81,7 @@ PacketMultiplexer::PacketMultiplexer(const RuntimeEnvironment* renv) break; } - //fprintf(stderr, "popped packet from queue %d\n", i); + // fprintf(stderr, "popped packet from queue %d\n", i); MAC sourceMac = MAC(packet->source); MAC destMac = MAC(packet->dest); @@ -120,6 +105,6 @@ PacketMultiplexer::PacketMultiplexer(const RuntimeEnvironment* renv) } })); } -}; +} } // namespace ZeroTier \ No newline at end of file diff --git a/node/PacketMultiplexer.hpp b/node/PacketMultiplexer.hpp index 152bda320..8cd592a10 100644 --- a/node/PacketMultiplexer.hpp +++ b/node/PacketMultiplexer.hpp @@ -43,11 +43,13 @@ class PacketMultiplexer { PacketMultiplexer(const RuntimeEnvironment* renv); + void setUpPostDecodeReceiveThreads(unsigned int concurrency, bool cpuPinningEnabled); + void putFrame(void* tPtr, uint64_t nwid, void** nuptr, const MAC& source, const MAC& dest, unsigned int etherType, unsigned int vlanId, const void* data, unsigned int len, unsigned int flowId); std::vector*> _rxPacketQueues; - unsigned int _concurrency; + unsigned int _concurrency; // pool std::vector _rxPacketVector; std::vector _rxPacketThreads; diff --git a/service/OneService.cpp b/service/OneService.cpp index c783f01cd..799f31412 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -798,12 +798,13 @@ public: bool _serverThreadRunning; bool _serverThreadRunningV6; - unsigned int _rxThreadCount; BlockingQueue _rxPacketQueue; std::vector _rxPacketVector; std::vector _rxPacketThreads; Mutex _rxPacketVector_m,_rxPacketThreads_m; - bool _enableMulticore; + bool _multicoreEnabled; + bool _cpuPinningEnabled; + unsigned int _concurrency; bool _allowTcpFallbackRelay; bool _forceTcpRelay; @@ -938,89 +939,6 @@ public: _ports[1] = 0; _ports[2] = 0; - _enableMulticore = false; - char* multicoreVar = std::getenv("ZT_ENABLE_MULTICORE"); - if (multicoreVar) { - int tmp = atoi(multicoreVar); - if (tmp > 0) { - _enableMulticore = true; - } - } - if (_enableMulticore) { - bool _enablePinning = false; - char* pinningVar = std::getenv("ZT_CORE_PINNING"); - if (pinningVar) { - int tmp = atoi(pinningVar); - if (tmp > 0) { - _enablePinning = true; - } - } - char* concurrencyVar = std::getenv("ZT_CONCURRENCY"); - if (concurrencyVar) { - int tmp = atoi(concurrencyVar); - if (tmp > 0) { - _rxThreadCount = tmp; - } - else { - _rxThreadCount = std::thread::hardware_concurrency() >= 4 ? 2 : 1; - } - } - else { - _rxThreadCount = std::thread::hardware_concurrency() >= 4 ? 2 : 1; - } - fprintf(stderr, "using %d rx threads\n", _rxThreadCount); - for (unsigned int i = 0; i < _rxThreadCount; ++i) { - _rxPacketThreads.push_back(std::thread([this, i, _enablePinning]() { - - if (_enablePinning) { -#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ - int pinCore = i % _rxThreadCount; - fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); - pthread_t self = pthread_self(); - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(pinCore, &cpuset); -#endif -#ifdef __LINUX__ - int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); -#elif __FreeBSD__ - int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); -#endif -#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ - if (rc != 0) - { - fprintf(stderr, "failed to pin rx thread %d to core %d: %s\n", i, pinCore, strerror(errno)); - exit(1); - } -#endif - } - PacketRecord* packet = nullptr; - for (;;) { - if (! _rxPacketQueue.get(packet)) { - break; - } - if (! packet) { - break; - } - const ZT_ResultCode err = _node->processWirePacket(nullptr, packet->now, packet->sock, &(packet->from), packet->data, packet->size, &_nextBackgroundTaskDeadline); - { - Mutex::Lock l(_rxPacketVector_m); - _rxPacketVector.push_back(packet); - } - if (ZT_ResultCode_isFatal(err)) { - char tmp[256]; - OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); - Mutex::Lock _l(_termReason_m); - _termReason = ONE_UNRECOVERABLE_ERROR; - _fatalErrorMessage = tmp; - this->terminate(); - break; - } - } - })); - } - } - prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr); prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5)); prometheus::simpleapi::saver.set_out_file(_homePath + ZT_PATH_SEPARATOR + "metrics.prom"); @@ -1071,6 +989,64 @@ public: delete _rc; } + void setUpMultithreading() + { + _node->initMultithreading(true, _concurrency, _cpuPinningEnabled); + bool pinning = _cpuPinningEnabled; + + fprintf(stderr, "Starting %d RX threads\n", _concurrency); + for (unsigned int i = 0; i < _concurrency; ++i) { + _rxPacketThreads.push_back(std::thread([this, i, pinning]() { + + if (pinning) { +#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ + int pinCore = i % _concurrency; + fprintf(stderr, "CPU Pinning enabled. Pinning thread %d to core %d\n", i, pinCore); + pthread_t self = pthread_self(); + cpu_set_t cpuset; + CPU_ZERO(&cpuset); + CPU_SET(pinCore, &cpuset); +#endif +#ifdef __LINUX__ + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); +#elif __FreeBSD__ + int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); +#endif +#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ + if (rc != 0) + { + fprintf(stderr, "failed to pin rx thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + exit(1); + } +#endif + } + PacketRecord* packet = nullptr; + for (;;) { + if (! _rxPacketQueue.get(packet)) { + break; + } + if (! packet) { + break; + } + const ZT_ResultCode err = _node->processWirePacket(nullptr, packet->now, packet->sock, &(packet->from), packet->data, packet->size, &_nextBackgroundTaskDeadline); + { + Mutex::Lock l(_rxPacketVector_m); + _rxPacketVector.push_back(packet); + } + if (ZT_ResultCode_isFatal(err)) { + char tmp[256]; + OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = tmp; + this->terminate(); + break; + } + } + })); + } + } + virtual ReasonForTermination run() { try { @@ -2672,7 +2648,18 @@ public: fprintf(stderr,"WARNING: using manually-specified secondary and/or tertiary ports. This can cause NAT issues." ZT_EOL_S); } _portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true); - _node->setLowBandwidthMode(OSUtils::jsonBool(settings["lowBandwidthMode"],false)); + _multicoreEnabled = OSUtils::jsonBool(settings["multicoreEnabled"],false); + _concurrency = OSUtils::jsonInt(settings["concurrency"],0); + _cpuPinningEnabled = OSUtils::jsonBool(settings["cpuPinningEnabled"],false); + if (_multicoreEnabled) { + unsigned int maxConcurrency = std::thread::hardware_concurrency(); + if (_concurrency <= 1 || _concurrency >= maxConcurrency) { + unsigned int conservativeDefault = (std::thread::hardware_concurrency() >= 4 ? 2 : 1); + fprintf(stderr, "Concurrency level provided (%d) is invalid, assigning conservative default value of (%d)\n", _concurrency, conservativeDefault); + _concurrency = conservativeDefault; + } + setUpMultithreading(); + } #ifndef ZT_SDK const std::string up(OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT)); @@ -3001,7 +2988,7 @@ public: _lastDirectReceiveFromGlobal = now; } - if (_enableMulticore) { + if (_multicoreEnabled) { PacketRecord* packet; _rxPacketVector_m.lock(); if (_rxPacketVector.empty()) { @@ -3018,7 +3005,7 @@ public: memcpy(&(packet->from), from, sizeof(struct sockaddr_storage)); packet->size = (unsigned int)len; memcpy(packet->data, data, len); - _rxPacketQueue.postLimit(packet, 256 * _rxThreadCount); + _rxPacketQueue.postLimit(packet, 256 * _concurrency); } else { const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); From b7d9290de983562ee5f2f8c8922ea2d26a6aae31 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 21 Aug 2024 11:22:07 -0700 Subject: [PATCH 23/36] Fix build issue on macOS --- osdep/EthernetTap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osdep/EthernetTap.cpp b/osdep/EthernetTap.cpp index 4b695988f..02fab3d07 100644 --- a/osdep/EthernetTap.cpp +++ b/osdep/EthernetTap.cpp @@ -88,7 +88,7 @@ std::shared_ptr EthernetTap::newInstance( return std::shared_ptr(new MacEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); } } - }/ + } #endif // __APPLE__ #ifdef __LINUX__ From e734019216d531263702266d83b7fd87040f3f0b Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 21 Aug 2024 14:06:25 -0700 Subject: [PATCH 24/36] More platform-related build fixes --- osdep/EthernetTap.cpp | 10 ++++++---- osdep/EthernetTap.hpp | 2 ++ osdep/LinuxEthernetTap.cpp | 38 ++++++++------------------------------ osdep/LinuxEthernetTap.hpp | 2 ++ service/OneService.cpp | 2 ++ 5 files changed, 20 insertions(+), 34 deletions(-) diff --git a/osdep/EthernetTap.cpp b/osdep/EthernetTap.cpp index 02fab3d07..4395bc404 100644 --- a/osdep/EthernetTap.cpp +++ b/osdep/EthernetTap.cpp @@ -57,6 +57,8 @@ namespace ZeroTier { std::shared_ptr EthernetTap::newInstance( const char *tapDeviceType, // OS-specific, NULL for default + unsigned int concurrency, + bool pinning, const char *homePath, const MAC &mac, unsigned int mtu, @@ -92,7 +94,7 @@ std::shared_ptr EthernetTap::newInstance( #endif // __APPLE__ #ifdef __LINUX__ - return std::shared_ptr(new LinuxEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new LinuxEthernetTap(homePath,concurrency,pinning,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __LINUX__ #ifdef __WINDOWS__ @@ -126,15 +128,15 @@ std::shared_ptr EthernetTap::newInstance( _comInit = true; } } - return std::shared_ptr(new WindowsEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new WindowsEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __WINDOWS__ #ifdef __FreeBSD__ - return std::shared_ptr(new BSDEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new BSDEthernetTap(homePath,concurrency,pinning,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __FreeBSD__ #ifdef __NetBSD__ - return std::shared_ptr(new NetBSDEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new NetBSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __NetBSD__ #ifdef __OpenBSD__ diff --git a/osdep/EthernetTap.hpp b/osdep/EthernetTap.hpp index e6833c33d..1d97f1256 100644 --- a/osdep/EthernetTap.hpp +++ b/osdep/EthernetTap.hpp @@ -32,6 +32,8 @@ class EthernetTap public: static std::shared_ptr newInstance( const char *tapDeviceType, // OS-specific, NULL for default + unsigned int concurrency, + bool pinning, const char *homePath, const MAC &mac, unsigned int mtu, diff --git a/osdep/LinuxEthernetTap.cpp b/osdep/LinuxEthernetTap.cpp index 7479ca742..14929d176 100644 --- a/osdep/LinuxEthernetTap.cpp +++ b/osdep/LinuxEthernetTap.cpp @@ -111,6 +111,8 @@ static void _base32_5_to_8(const uint8_t *in,char *out) LinuxEthernetTap::LinuxEthernetTap( const char *homePath, + unsigned int concurrency, + bool pinning, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -220,36 +222,12 @@ LinuxEthernetTap::LinuxEthernetTap( (void)::pipe(_shutdownSignalPipe); - bool _enablePinning = false; - char* envvar = std::getenv("ZT_CORE_PINNING"); - if (envvar) { - int tmp = atoi(envvar); - if (tmp > 0) { - _enablePinning = true; - } - } + for (unsigned int i = 0; i < concurrency; ++i) { + _rxThreads.push_back(std::thread([this, i, concurrency, pinning] { - int _concurrency = 1; - char* concurrencyVar = std::getenv("ZT_PACKET_PROCESSING_CONCURRENCY"); - if (concurrencyVar) { - int tmp = atoi(concurrencyVar); - if (tmp > 0) { - _concurrency = tmp; - } - else { - _concurrency = std::max((unsigned int)1,std::thread::hardware_concurrency() / 2); - } - } - else { - _concurrency = std::max((unsigned int)1,std::thread::hardware_concurrency() / 2); - } - - for (unsigned int i = 0; i < _concurrency; ++i) { - _rxThreads.push_back(std::thread([this, i, _concurrency, _enablePinning] { - - if (_enablePinning) { - int pinCore = i % _concurrency; - fprintf(stderr, "pinning tap thread %d to core %d\n", i, pinCore); + if (pinning) { + int pinCore = i % concurrency; + fprintf(stderr, "Pinning tap thread %d to core %d\n", i, pinCore); pthread_t self = pthread_self(); cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -257,7 +235,7 @@ LinuxEthernetTap::LinuxEthernetTap( int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); if (rc != 0) { - fprintf(stderr, "failed to pin tap thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + fprintf(stderr, "Failed to pin tap thread %d to core %d: %s\n", i, pinCore, strerror(errno)); exit(1); } } diff --git a/osdep/LinuxEthernetTap.hpp b/osdep/LinuxEthernetTap.hpp index 6406d88d8..41e299823 100644 --- a/osdep/LinuxEthernetTap.hpp +++ b/osdep/LinuxEthernetTap.hpp @@ -35,6 +35,8 @@ class LinuxEthernetTap : public EthernetTap public: LinuxEthernetTap( const char *homePath, + unsigned int concurrency, + bool pinning, const MAC &mac, unsigned int mtu, unsigned int metric, diff --git a/service/OneService.cpp b/service/OneService.cpp index 799f31412..acce0ec9f 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -3239,6 +3239,8 @@ public: n.setTap(EthernetTap::newInstance( nullptr, + _concurrency, + _cpuPinningEnabled, _homePath.c_str(), MAC(nwc->mac), nwc->mtu, From b813ea70a5f9e7c2e91ec68461fdd132e8fc543a Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 22 Aug 2024 12:59:06 -0700 Subject: [PATCH 25/36] Simplify packet critical path. Plus more platform fixes --- node/IncomingPacket.cpp | 14 ++------------ node/Node.cpp | 3 +-- node/Node.hpp | 8 +------- node/PacketMultiplexer.cpp | 18 +++++++++++++++--- node/PacketMultiplexer.hpp | 1 + osdep/EthernetTap.cpp | 2 +- service/OneService.cpp | 12 ++++++++++-- 7 files changed, 31 insertions(+), 27 deletions(-) diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 4d6d5ce8e..318b05730 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -869,12 +869,7 @@ bool IncomingPacket::_doFRAME(const RuntimeEnvironment *RR,void *tPtr,const Shar const unsigned int frameLen = size() - ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; const uint8_t *const frameData = reinterpret_cast(data()) + ZT_PROTO_VERB_FRAME_IDX_PAYLOAD; if (network->filterIncomingPacket(tPtr,peer,RR->identity.address(),sourceMac,network->mac(),frameData,frameLen,etherType,0) > 0) { - if (RR->node->getMultithreadingEnabled()) { - RR->pm->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen, _flowId); - } - else { - RR->node->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen); - } + RR->pm->putFrame(tPtr,nwid,network->userPtr(),sourceMac,network->mac(),etherType,0,(const void *)frameData,frameLen, _flowId); } } } else { @@ -947,12 +942,7 @@ bool IncomingPacket::_doEXT_FRAME(const RuntimeEnvironment *RR,void *tPtr,const } // fall through -- 2 means accept regardless of bridging checks or other restrictions case 2: - if (RR->node->getMultithreadingEnabled()) { - RR->pm->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen, flowId); - } - else { - RR->node->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen); - } + RR->pm->putFrame(tPtr,nwid,network->userPtr(),from,to,etherType,0,(const void *)frameData,frameLen, flowId); break; } } diff --git a/node/Node.cpp b/node/Node.cpp index c7cb37df5..1f377c545 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -240,9 +240,8 @@ ZT_ResultCode Node::processVirtualNetworkFrame( } } -void Node::initMultithreading(bool isEnabled, unsigned int concurrency, bool cpuPinningEnabled) +void Node::initMultithreading(unsigned int concurrency, bool cpuPinningEnabled) { - _multithreadingEnabled = isEnabled; RR->pm->setUpPostDecodeReceiveThreads(concurrency, cpuPinningEnabled); } diff --git a/node/Node.hpp b/node/Node.hpp index da2d5427f..f9d05483a 100644 --- a/node/Node.hpp +++ b/node/Node.hpp @@ -283,12 +283,7 @@ public: return _lowBandwidthMode; } - inline bool getMultithreadingEnabled() - { - return _multithreadingEnabled; - } - - void initMultithreading(bool isEnabled, unsigned int concurrency, bool cpuPinningEnabled); + void initMultithreading(unsigned int concurrency, bool cpuPinningEnabled); public: @@ -339,7 +334,6 @@ public: volatile int64_t _prngState[2]; bool _online; bool _lowBandwidthMode; - bool _multithreadingEnabled; }; } // namespace ZeroTier diff --git a/node/PacketMultiplexer.cpp b/node/PacketMultiplexer.cpp index 401e1db9f..9035ccc0c 100644 --- a/node/PacketMultiplexer.cpp +++ b/node/PacketMultiplexer.cpp @@ -15,6 +15,7 @@ #include "Node.hpp" #include "RuntimeEnvironment.hpp" +#include "Constants.hpp" #include #include @@ -28,6 +29,16 @@ PacketMultiplexer::PacketMultiplexer(const RuntimeEnvironment* renv) void PacketMultiplexer::putFrame(void* tPtr, uint64_t nwid, void** nuptr, const MAC& source, const MAC& dest, unsigned int etherType, unsigned int vlanId, const void* data, unsigned int len, unsigned int flowId) { +#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__WINDOWS__) + RR->node->putFrame(tPtr,nwid,nuptr,source,dest,etherType,vlanId,(const void *)data,len); + return; +#endif + + if (!_enabled) { + RR->node->putFrame(tPtr,nwid,nuptr,source,dest,etherType,vlanId,(const void *)data,len); + return; + } + PacketRecord* packet; _rxPacketVector_m.lock(); if (_rxPacketVector.empty()) { @@ -56,9 +67,10 @@ void PacketMultiplexer::putFrame(void* tPtr, uint64_t nwid, void** nuptr, const void PacketMultiplexer::setUpPostDecodeReceiveThreads(unsigned int concurrency, bool cpuPinningEnabled) { - if (! RR->node->getMultithreadingEnabled()) { - return; - } +#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__WINDOWS__) + return; +#endif + _enabled = true; _concurrency = concurrency; bool _enablePinning = cpuPinningEnabled; diff --git a/node/PacketMultiplexer.hpp b/node/PacketMultiplexer.hpp index 8cd592a10..4753180ed 100644 --- a/node/PacketMultiplexer.hpp +++ b/node/PacketMultiplexer.hpp @@ -57,6 +57,7 @@ class PacketMultiplexer { std::vector _rxThreads; unsigned int _rxThreadCount; + bool _enabled; }; } // namespace ZeroTier diff --git a/osdep/EthernetTap.cpp b/osdep/EthernetTap.cpp index 4395bc404..0be209ecd 100644 --- a/osdep/EthernetTap.cpp +++ b/osdep/EthernetTap.cpp @@ -140,7 +140,7 @@ std::shared_ptr EthernetTap::newInstance( #endif // __NetBSD__ #ifdef __OpenBSD__ - return std::shared_ptr(new BSDEthernetTap(homePath,concurrency,mac,mtu,metric,nwid,friendlyName,handler,arg)); + return std::shared_ptr(new BSDEthernetTap(homePath,mac,mtu,metric,nwid,friendlyName,handler,arg)); #endif // __OpenBSD__ #endif // ZT_SDK? diff --git a/service/OneService.cpp b/service/OneService.cpp index acce0ec9f..8d4b5bdfd 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -991,7 +991,10 @@ public: void setUpMultithreading() { - _node->initMultithreading(true, _concurrency, _cpuPinningEnabled); +#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__WINDOWS__) + return; +#endif + _node->initMultithreading(_concurrency, _cpuPinningEnabled); bool pinning = _cpuPinningEnabled; fprintf(stderr, "Starting %d RX threads\n", _concurrency); @@ -2648,6 +2651,7 @@ public: fprintf(stderr,"WARNING: using manually-specified secondary and/or tertiary ports. This can cause NAT issues." ZT_EOL_S); } _portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true); +#if defined(__LINUX__) || defined(__FreeBSD__) _multicoreEnabled = OSUtils::jsonBool(settings["multicoreEnabled"],false); _concurrency = OSUtils::jsonInt(settings["concurrency"],0); _cpuPinningEnabled = OSUtils::jsonBool(settings["cpuPinningEnabled"],false); @@ -2660,6 +2664,7 @@ public: } setUpMultithreading(); } +#endif #ifndef ZT_SDK const std::string up(OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT)); @@ -2987,7 +2992,7 @@ public: if ((len >= 16) && (reinterpret_cast(from)->ipScope() == InetAddress::IP_SCOPE_GLOBAL)) { _lastDirectReceiveFromGlobal = now; } - +#if defined(__LINUX__) || defined(__FreeBSD__) if (_multicoreEnabled) { PacketRecord* packet; _rxPacketVector_m.lock(); @@ -3008,6 +3013,7 @@ public: _rxPacketQueue.postLimit(packet, 256 * _concurrency); } else { +#endif const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); if (ZT_ResultCode_isFatal(rc)) { char tmp[256]; @@ -3017,7 +3023,9 @@ public: _fatalErrorMessage = tmp; this->terminate(); } +#if defined(__LINUX__) || defined(__FreeBSD__) } +#endif } From c97943d69df74ca48feb5c44f570ac91817dd3c2 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 22 Aug 2024 15:28:25 -0700 Subject: [PATCH 26/36] Add packet mux source file to Windows project --- windows/ZeroTierOne/ZeroTierOne.vcxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj b/windows/ZeroTierOne/ZeroTierOne.vcxproj index fcd8b56e2..2dd05aa57 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj @@ -88,6 +88,7 @@ + From 95983ba168963fb9b67346022cf2aef42bd35808 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Mon, 26 Aug 2024 12:54:36 -0700 Subject: [PATCH 27/36] Build fix for FreeBSD --- osdep/BSDEthernetTap.cpp | 19 ++++++------------- osdep/BSDEthernetTap.hpp | 2 ++ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/osdep/BSDEthernetTap.cpp b/osdep/BSDEthernetTap.cpp index 2a8aac0fb..1a240c1a1 100644 --- a/osdep/BSDEthernetTap.cpp +++ b/osdep/BSDEthernetTap.cpp @@ -65,6 +65,7 @@ namespace ZeroTier { BSDEthernetTap::BSDEthernetTap( const char *homePath, unsigned int concurrency, + bool pinning, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -74,6 +75,7 @@ BSDEthernetTap::BSDEthernetTap( void *arg) : _handler(handler), _concurrency(concurrency), + _pinning(pinning), _arg(arg), _nwid(nwid), _mtu(mtu), @@ -425,25 +427,16 @@ void BSDEthernetTap::setMtu(unsigned int mtu) void BSDEthernetTap::threadMain() throw() { - bool _enablePinning = false; - char* envvar = std::getenv("ZT_CPU_PINNING"); - if (envvar) { - int tmp = atoi(envvar); - if (tmp > 0) { - _enablePinning = true; - } - } - // Wait for a moment after startup -- wait for Network to finish // constructing itself. Thread::sleep(500); for (unsigned int i = 0; i < _concurrency; ++i) { - _rxThreads.push_back(std::thread([this, i, _enablePinning] { + _rxThreads.push_back(std::thread([this, i, _pinning] { - if (_enablePinning) { + if (_pinning) { int pinCore = i % _concurrency; - fprintf(stderr, "pinning thread %d to core %d\n", i, pinCore); + fprintf(stderr, "Pinning thread %d to core %d\n", i, pinCore); pthread_t self = pthread_self(); cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -452,7 +445,7 @@ void BSDEthernetTap::threadMain() int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); if (rc != 0) { - fprintf(stderr, "failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); + fprintf(stderr, "Failed to pin thread %d to core %d: %s\n", i, pinCore, strerror(errno)); exit(1); } } diff --git a/osdep/BSDEthernetTap.hpp b/osdep/BSDEthernetTap.hpp index 4d1a42429..50e2e6e8b 100644 --- a/osdep/BSDEthernetTap.hpp +++ b/osdep/BSDEthernetTap.hpp @@ -36,6 +36,7 @@ public: BSDEthernetTap( const char *homePath, unsigned int concurrency, + bool pinning, const MAC &mac, unsigned int mtu, unsigned int metric, @@ -65,6 +66,7 @@ private: void (*_handler)(void *,void *,uint64_t,const MAC &,const MAC &,unsigned int,unsigned int,const void *,unsigned int); void *_arg; unsigned int _concurrency; + bool _pinning; uint64_t _nwid; Thread _thread; std::string _dev; From bf7dddbd848343131e223425d961297e7bb67bdf Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Thu, 29 Aug 2024 10:09:19 -0700 Subject: [PATCH 28/36] Fix issues that prevent user multipath preferences from being respected --- node/Bond.cpp | 41 ++++++++++++++++++++++++++--------------- node/Bond.hpp | 2 ++ node/IncomingPacket.cpp | 1 - service/OneService.cpp | 2 +- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index f5124a6a2..2a061796d 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -373,6 +373,7 @@ SharedPtr Bond::getAppropriatePath(int64_t now, int32_t flowId) */ if (_policy == ZT_BOND_POLICY_ACTIVE_BACKUP) { if (_abPathIdx != ZT_MAX_PEER_NETWORK_PATHS && _paths[_abPathIdx].p) { + //fprintf(stderr, "trying to send via (_abPathIdx=%d) %s\n", _abPathIdx, pathToStr(_paths[_abPathIdx].p).c_str()); return _paths[_abPathIdx].p; } } @@ -1032,6 +1033,13 @@ void Bond::curateBond(int64_t now, bool rebuildBond) bool satisfiedUpDelay = (now - _paths[i].lastAliveToggle) >= _upDelay; // How long since the last QoS was received (Must be less than ZT_PEER_PATH_EXPIRATION since the remote peer's _qosSendInterval isn't known) bool acceptableQoSAge = (_paths[i].lastQoSReceived == 0 && inTrial) || ((now - _paths[i].lastQoSReceived) < ZT_PEER_EXPIRED_PATH_TRIAL_PERIOD); + + // Allow active-backup to operate without the receipt of QoS records + // This may be expanded to the other modes as an option + if (_policy == ZT_BOND_POLICY_ACTIVE_BACKUP) { + acceptableQoSAge = true; + } + currEligibility = _paths[i].allowed() && ((acceptableAge && satisfiedUpDelay && acceptableQoSAge) || inTrial); if (currEligibility) { @@ -1043,12 +1051,11 @@ void Bond::curateBond(int64_t now, bool rebuildBond) */ if (currEligibility != _paths[i].eligible) { if (currEligibility == 0) { - log("link %s is no longer eligible", pathToStr(_paths[i].p).c_str()); + log("link %s is no longer eligible (reason: allowed=%d, age=%d, ud=%d, qos=%d, trial=%d)", pathToStr(_paths[i].p).c_str(), _paths[i].allowed(), acceptableAge, satisfiedUpDelay, acceptableQoSAge, inTrial); } if (currEligibility == 1) { log("link %s is eligible", pathToStr(_paths[i].p).c_str()); } - debug("\t[%d] allowed=%d, age=%d, qa=%d, ud=%d, trial=%d", i, _paths[i].allowed(), acceptableAge, acceptableQoSAge, satisfiedUpDelay, inTrial); dumpPathStatus(now, i); if (currEligibility) { rebuildBond = true; @@ -1496,7 +1503,8 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) { int prevActiveBackupPathIdx = _abPathIdx; int nonPreferredPathIdx = ZT_MAX_PEER_NETWORK_PATHS; - bool bFoundPrimaryLink = false; + bool foundPathOnPrimaryLink = false; + bool foundPreferredPath = false; if (_abPathIdx != ZT_MAX_PEER_NETWORK_PATHS && ! _paths[_abPathIdx].p) { _abPathIdx = ZT_MAX_PEER_NETWORK_PATHS; @@ -1559,15 +1567,16 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) if (! _paths[i].preferred()) { // Found path on primary link, take note in case we don't find a preferred path nonPreferredPathIdx = i; - bFoundPrimaryLink = true; + foundPathOnPrimaryLink = true; } if (_paths[i].preferred()) { _abPathIdx = i; - bFoundPrimaryLink = true; + foundPathOnPrimaryLink = true; if (_paths[_abPathIdx].p) { SharedPtr abLink = RR->bc->getLinkBySocket(_policyAlias, _paths[_abPathIdx].p->localSocket()); if (abLink) { - log("found preferred primary link %s", pathToStr(_paths[_abPathIdx].p).c_str()); + log("found preferred primary link (_abPathIdx=%d), %s", _abPathIdx, pathToStr(_paths[_abPathIdx].p).c_str()); + foundPreferredPath = true; } break; // Found preferred path on primary link } @@ -1575,8 +1584,8 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } } } - if (bFoundPrimaryLink && (nonPreferredPathIdx != ZT_MAX_PEER_NETWORK_PATHS)) { - log("found non-preferred primary link"); + if (!foundPreferredPath && foundPathOnPrimaryLink && (nonPreferredPathIdx != ZT_MAX_PEER_NETWORK_PATHS)) { + log("found non-preferred primary link (_abPathIdx=%d)", _abPathIdx); _abPathIdx = nonPreferredPathIdx; } } @@ -1614,10 +1623,10 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } if (_paths[(*it)].p && ! _paths[(*it)].eligible) { SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[(*it)].p->localSocket()); - it = _abFailoverQueue.erase(it); if (link) { - log("link %s is ineligible, removing from failover queue (%zu links remain in queue)", pathToStr(_paths[_abPathIdx].p).c_str(), _abFailoverQueue.size()); + log("link %s is ineligible, removing from failover queue (%zu links remain in queue)", pathToStr(_paths[(*it)].p).c_str(), _abFailoverQueue.size()); } + it = _abFailoverQueue.erase(it); continue; } else { @@ -1684,7 +1693,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } } if (! bFoundPathInQueue) { - _abFailoverQueue.push_front(i); + _abFailoverQueue.push_back(i); log("add link %s to failover queue (%zu links in queue)", pathToStr(_paths[i].p).c_str(), _abFailoverQueue.size()); addPathToBond(i, 0); } @@ -1734,13 +1743,14 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } } if (! bFoundPathInQueue) { - _abFailoverQueue.push_front(i); + _abFailoverQueue.push_back(i); log("add link %s to failover queue (%zu links in queue)", pathToStr(_paths[i].p).c_str(), _abFailoverQueue.size()); addPathToBond(i, 0); } } } } + /* // Sort queue based on performance if (! _abFailoverQueue.empty()) { for (int i = 0; i < _abFailoverQueue.size(); i++) { @@ -1752,7 +1762,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now) } _abFailoverQueue[hole_position] = value_to_insert; } - } + }*/ /** * Short-circuit if we have no queued paths @@ -1902,7 +1912,7 @@ void Bond::setBondParameters(int policy, SharedPtr templateBond, bool useT * Policy defaults */ _abPathIdx = ZT_MAX_PEER_NETWORK_PATHS; - _abLinkSelectMethod = ZT_BOND_RESELECTION_POLICY_OPTIMIZE; + _abLinkSelectMethod = ZT_BOND_RESELECTION_POLICY_ALWAYS; _rrPacketsSentOnCurrLink = 0; _rrIdx = 0; _packetsPerLink = 64; @@ -2021,7 +2031,8 @@ void Bond::dumpInfo(int64_t now, bool force) _lastSummaryDump = now; float overhead = (_overheadBytes / (timeSinceLastDump / 1000.0f) / 1000.0f); _overheadBytes = 0; - log("bond: bp=%d, fi=%" PRIu64 ", mi=%d, ud=%d, dd=%d, flows=%zu, leaf=%d, overhead=%f KB/s, links=(%d/%d)", + log("bond: ready=%d, bp=%d, fi=%" PRIu64 ", mi=%d, ud=%d, dd=%d, flows=%zu, leaf=%d, overhead=%f KB/s, links=(%d/%d)", + isReady(), _policy, _failoverInterval, _monitorInterval, diff --git a/node/Bond.hpp b/node/Bond.hpp index 408c1e125..d5d3f673e 100644 --- a/node/Bond.hpp +++ b/node/Bond.hpp @@ -1144,6 +1144,7 @@ class Bond { __attribute__((format(printf, 2, 3))) #endif { + //if (_peerId != 0x0 && _peerId != 0x0) { return; } #ifdef ZT_TRACE time_t rawtime; struct tm* timeinfo; @@ -1175,6 +1176,7 @@ class Bond { __attribute__((format(printf, 2, 3))) #endif { + //if (_peerId != 0x0 && _peerId != 0x0) { return; } #ifdef ZT_DEBUG time_t rawtime; struct tm* timeinfo; diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index d939fa0a1..dc268b1ab 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -334,7 +334,6 @@ bool IncomingPacket::_doACK(const RuntimeEnvironment* RR, void* tPtr, const Shar bool IncomingPacket::_doQOS_MEASUREMENT(const RuntimeEnvironment* RR, void* tPtr, const SharedPtr& peer) { Metrics::pkt_qos_in++; - SharedPtr bond = peer->bond(); if (! peer->rateGateQoS(RR->node->now(), _path)) { return true; } diff --git a/service/OneService.cpp b/service/OneService.cpp index 88a516ebd..4a4962b78 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2510,7 +2510,7 @@ public: } _node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr,ipvPref,mtu,capacity,enabled,linkMode,failoverToStr)); } - std::string linkSelectMethodStr(OSUtils::jsonString(customPolicy["activeReselect"],"optimize")); + std::string linkSelectMethodStr(OSUtils::jsonString(customPolicy["activeReselect"],"always")); if (linkSelectMethodStr == "always") { newTemplateBond->setLinkSelectMethod(ZT_BOND_RESELECTION_POLICY_ALWAYS); } From e42848d37dbb54c5bf8ac8474c0faed6d464bd00 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 4 Sep 2024 11:00:23 -0700 Subject: [PATCH 29/36] Fix bug for when no multithreaded config is given --- service/OneService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index 8d4b5bdfd..5a05c72ce 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2653,7 +2653,7 @@ public: _portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true); #if defined(__LINUX__) || defined(__FreeBSD__) _multicoreEnabled = OSUtils::jsonBool(settings["multicoreEnabled"],false); - _concurrency = OSUtils::jsonInt(settings["concurrency"],0); + _concurrency = OSUtils::jsonInt(settings["concurrency"],1); _cpuPinningEnabled = OSUtils::jsonBool(settings["cpuPinningEnabled"],false); if (_multicoreEnabled) { unsigned int maxConcurrency = std::thread::hardware_concurrency(); From c86b91c5f00811c2a9f080e9e2e74ac2cb7af8c5 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Wed, 4 Sep 2024 12:14:20 -0700 Subject: [PATCH 30/36] Fix condition where settings may be applied with multithreading is disabled --- service/OneService.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service/OneService.cpp b/service/OneService.cpp index 5a05c72ce..ff79c6f85 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2664,6 +2664,11 @@ public: } setUpMultithreading(); } + else { + // Force values in case the user accidentally defined them with multicore disabled + _concurrency = 1; + _cpuPinningEnabled = false; + } #endif #ifndef ZT_SDK From 059d05f41f8561aa5f92759b1cdef51723865291 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Fri, 6 Sep 2024 09:52:39 -0700 Subject: [PATCH 31/36] Comment out vestigial test code (improves mt performance) --- node/PacketMultiplexer.cpp | 2 +- service/OneService.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/node/PacketMultiplexer.cpp b/node/PacketMultiplexer.cpp index 9035ccc0c..a1dc835a1 100644 --- a/node/PacketMultiplexer.cpp +++ b/node/PacketMultiplexer.cpp @@ -62,7 +62,7 @@ void PacketMultiplexer::putFrame(void* tPtr, uint64_t nwid, void** nuptr, const memcpy(packet->data, data, len); int bucket = flowId % _concurrency; - _rxPacketQueues[bucket]->postLimit(packet, 256); + _rxPacketQueues[bucket]->postLimit(packet, 2048); } void PacketMultiplexer::setUpPostDecodeReceiveThreads(unsigned int concurrency, bool cpuPinningEnabled) diff --git a/service/OneService.cpp b/service/OneService.cpp index ff79c6f85..1544b8150 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -997,12 +997,13 @@ public: _node->initMultithreading(_concurrency, _cpuPinningEnabled); bool pinning = _cpuPinningEnabled; +/* fprintf(stderr, "Starting %d RX threads\n", _concurrency); for (unsigned int i = 0; i < _concurrency; ++i) { _rxPacketThreads.push_back(std::thread([this, i, pinning]() { if (pinning) { -#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ +#if defined(__LINUX__) || defined(__FreeBSD__) // || defined(__APPLE__) int pinCore = i % _concurrency; fprintf(stderr, "CPU Pinning enabled. Pinning thread %d to core %d\n", i, pinCore); pthread_t self = pthread_self(); @@ -1015,7 +1016,7 @@ public: #elif __FreeBSD__ int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); #endif -#if defined(__LINUX__) || defined(__FreeBSD__) /* || defined(__APPLE__) */ +#if defined(__LINUX__) || defined(__FreeBSD__) // || defined(__APPLE__) if (rc != 0) { fprintf(stderr, "failed to pin rx thread %d to core %d: %s\n", i, pinCore, strerror(errno)); @@ -1048,6 +1049,7 @@ public: } })); } + */ } virtual ReasonForTermination run() @@ -2997,6 +2999,7 @@ public: if ((len >= 16) && (reinterpret_cast(from)->ipScope() == InetAddress::IP_SCOPE_GLOBAL)) { _lastDirectReceiveFromGlobal = now; } + /* #if defined(__LINUX__) || defined(__FreeBSD__) if (_multicoreEnabled) { PacketRecord* packet; @@ -3015,10 +3018,11 @@ public: memcpy(&(packet->from), from, sizeof(struct sockaddr_storage)); packet->size = (unsigned int)len; memcpy(packet->data, data, len); - _rxPacketQueue.postLimit(packet, 256 * _concurrency); + _rxPacketQueue.postLimit(packet, 2048 * _concurrency); } else { #endif +*/ const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); if (ZT_ResultCode_isFatal(rc)) { char tmp[256]; @@ -3028,9 +3032,9 @@ public: _fatalErrorMessage = tmp; this->terminate(); } -#if defined(__LINUX__) || defined(__FreeBSD__) - } -#endif +//#if defined(__LINUX__) || defined(__FreeBSD__) +// } +//#endif } From 8f5cc4ed333905fd15b62418a64815fe8a3f4068 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Fri, 6 Sep 2024 15:19:06 -0700 Subject: [PATCH 32/36] Completely remove vestigial RX code --- service/OneService.cpp | 97 ++++-------------------------------------- 1 file changed, 8 insertions(+), 89 deletions(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index 1544b8150..b607f014a 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -996,60 +996,6 @@ public: #endif _node->initMultithreading(_concurrency, _cpuPinningEnabled); bool pinning = _cpuPinningEnabled; - -/* - fprintf(stderr, "Starting %d RX threads\n", _concurrency); - for (unsigned int i = 0; i < _concurrency; ++i) { - _rxPacketThreads.push_back(std::thread([this, i, pinning]() { - - if (pinning) { -#if defined(__LINUX__) || defined(__FreeBSD__) // || defined(__APPLE__) - int pinCore = i % _concurrency; - fprintf(stderr, "CPU Pinning enabled. Pinning thread %d to core %d\n", i, pinCore); - pthread_t self = pthread_self(); - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - CPU_SET(pinCore, &cpuset); -#endif -#ifdef __LINUX__ - int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); -#elif __FreeBSD__ - int rc = pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset); -#endif -#if defined(__LINUX__) || defined(__FreeBSD__) // || defined(__APPLE__) - if (rc != 0) - { - fprintf(stderr, "failed to pin rx thread %d to core %d: %s\n", i, pinCore, strerror(errno)); - exit(1); - } -#endif - } - PacketRecord* packet = nullptr; - for (;;) { - if (! _rxPacketQueue.get(packet)) { - break; - } - if (! packet) { - break; - } - const ZT_ResultCode err = _node->processWirePacket(nullptr, packet->now, packet->sock, &(packet->from), packet->data, packet->size, &_nextBackgroundTaskDeadline); - { - Mutex::Lock l(_rxPacketVector_m); - _rxPacketVector.push_back(packet); - } - if (ZT_ResultCode_isFatal(err)) { - char tmp[256]; - OSUtils::ztsnprintf(tmp, sizeof(tmp), "error processing packet: %d", (int)err); - Mutex::Lock _l(_termReason_m); - _termReason = ONE_UNRECOVERABLE_ERROR; - _fatalErrorMessage = tmp; - this->terminate(); - break; - } - } - })); - } - */ } virtual ReasonForTermination run() @@ -2999,42 +2945,15 @@ public: if ((len >= 16) && (reinterpret_cast(from)->ipScope() == InetAddress::IP_SCOPE_GLOBAL)) { _lastDirectReceiveFromGlobal = now; } - /* -#if defined(__LINUX__) || defined(__FreeBSD__) - if (_multicoreEnabled) { - PacketRecord* packet; - _rxPacketVector_m.lock(); - if (_rxPacketVector.empty()) { - packet = new PacketRecord; - } - else { - packet = _rxPacketVector.back(); - _rxPacketVector.pop_back(); - } - _rxPacketVector_m.unlock(); - - packet->sock = reinterpret_cast(sock); - packet->now = now; - memcpy(&(packet->from), from, sizeof(struct sockaddr_storage)); - packet->size = (unsigned int)len; - memcpy(packet->data, data, len); - _rxPacketQueue.postLimit(packet, 2048 * _concurrency); + const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); + if (ZT_ResultCode_isFatal(rc)) { + char tmp[256]; + OSUtils::ztsnprintf(tmp,sizeof(tmp),"fatal error code from processWirePacket: %d",(int)rc); + Mutex::Lock _l(_termReason_m); + _termReason = ONE_UNRECOVERABLE_ERROR; + _fatalErrorMessage = tmp; + this->terminate(); } - else { -#endif -*/ - const ZT_ResultCode rc = _node->processWirePacket(nullptr,now,reinterpret_cast(sock),reinterpret_cast(from),data,len,&_nextBackgroundTaskDeadline); - if (ZT_ResultCode_isFatal(rc)) { - char tmp[256]; - OSUtils::ztsnprintf(tmp,sizeof(tmp),"fatal error code from processWirePacket: %d",(int)rc); - Mutex::Lock _l(_termReason_m); - _termReason = ONE_UNRECOVERABLE_ERROR; - _fatalErrorMessage = tmp; - this->terminate(); - } -//#if defined(__LINUX__) || defined(__FreeBSD__) -// } -//#endif } From 8d474e13953bd2c6fb1d4efc909a521fe5fdfda5 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 9 Sep 2024 14:36:22 -0400 Subject: [PATCH 33/36] Add ios differentiation, and .clangd that works w/Zed and clangd. --- .clangd | 6 +++++- node/Constants.hpp | 12 +++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.clangd b/.clangd index c7a47fe97..0605ccdb7 100644 --- a/.clangd +++ b/.clangd @@ -1,2 +1,6 @@ CompileFlags: - Add: [-std=c++17] + Add: + - "-std=c++17" + - "-I../ext" + - "-I../ext/prometheus-cpp-lite-1.0/core/include" + - "-I../ext/prometheus-cpp-lite-1.0/simpleapi/include" diff --git a/node/Constants.hpp b/node/Constants.hpp index 7c80910f6..95f093b3e 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -223,11 +223,13 @@ #define ZT_PLATFORM_NAME "aix" // IBM AIX #elif defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin) #include -#if TARGET_IPHONE_SIMULATOR == 1 -#define ZT_PLATFORM_NAME "ios" // Apple iOS -#elif TARGET_OS_IPHONE == 1 -#define ZT_PLATFORM_NAME "ios" // Apple iOS -#elif TARGET_OS_MAC == 1 +#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR == 1 +#define ZT_PLATFORM_NAME "ios_sim" // Apple iOS +#elif defined(TARGET_OS_IPAD) && TARGET_OS_IPAD == 1 +#define ZT_PLATFORM_NAME "ios_ipad" +#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1 +#define ZT_PLATFORM_NAME "ios_iphone" // Apple iOS +#elif defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1 #define ZT_PLATFORM_NAME "macos" // Apple OSX #endif #elif defined(__sun) && defined(__SVR4) From 223ec0c59ddb03d74a5e0aeabb92002a0718e3f2 Mon Sep 17 00:00:00 2001 From: travisladuke Date: Tue, 10 Sep 2024 11:52:49 -0700 Subject: [PATCH 34/36] retain build artifacts cleaned up all the github action deprecation warnings. save zerotier-one binary for mac, windows, and linux --- .github/workflows/build.yml | 44 ++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82d0207af..481188053 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,13 +9,12 @@ jobs: git config --global core.autocrlf input # git config --global core.eol lf - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - target: x86_64-unknown-linux-gnu - override: true + targets: x86_64-unknown-linux-gnu components: rustfmt, clippy - name: Set up cargo cache @@ -33,6 +32,12 @@ jobs: run: | make selftest ./zerotier-selftest + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: zerotier-one-ubuntu-x64 + path: zerotier-one + retention-days: 7 build_macos: runs-on: macos-latest @@ -42,20 +47,18 @@ jobs: git config --global core.autocrlf input # git config --global core.eol lf - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust aarch64 - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: stable target: aarch64-apple-darwin - override: true components: rustfmt, clippy - name: Install Rust x86_64 - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: stable target: x86_64-apple-darwin - override: true components: rustfmt, clippy - name: Set up cargo cache uses: Swatinem/rust-cache@v2 @@ -65,13 +68,19 @@ jobs: shared-key: ${{ runner.os }}-cargo- workspaces: | rustybits/ - - name: make run: make - name: selftest run: | make selftest ./zerotier-selftest + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: zerotier-one-mac + path: zerotier-one + retention-days: 7 + build_windows: runs-on: windows-latest @@ -81,13 +90,12 @@ jobs: git config --global core.autocrlf true # git config --global core.eol lf - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: toolchain: stable target: aarch64-apple-darwin - override: true components: rustfmt, clippy - name: Set up cargo cache uses: Swatinem/rust-cache@v2 @@ -99,7 +107,13 @@ jobs: rustybits/ - name: setup msbuild - uses: microsoft/setup-msbuild@v1.1.3 + uses: microsoft/setup-msbuild@v2 - name: msbuild run: | - msbuild windows\ZeroTierOne.sln /m /p:Configuration=Release /property:Platform=x64 /t:ZeroTierOne + msbuild windows\ZeroTierOne.sln /m /p:Configuration=Release /property:Platform=x64 /t:ZeroTierOne + - name: Archive production artifacts + uses: actions/upload-artifact@v4 + with: + name: zerotier-one-windows + path: windows/Build + retention-days: 7 From 560d6fba1b4be56627e3d37d0f37f6428dc5349d Mon Sep 17 00:00:00 2001 From: travisladuke Date: Tue, 10 Sep 2024 13:45:50 -0700 Subject: [PATCH 35/36] tar mac and linux binary to keep the execute permission bit --- .github/workflows/build.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 481188053..b9e1f4904 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,11 +32,13 @@ jobs: run: | make selftest ./zerotier-selftest + - name: 'Tar files' # keeps permissions (execute) + run: tar -cvf zerotier-one.tar zerotier-one - name: Archive production artifacts uses: actions/upload-artifact@v4 with: name: zerotier-one-ubuntu-x64 - path: zerotier-one + path: zerotier-one.tar retention-days: 7 build_macos: @@ -74,11 +76,13 @@ jobs: run: | make selftest ./zerotier-selftest + - name: 'Tar files' # keeps permissions (execute) + run: tar -cvf zerotier-one.tar zerotier-one - name: Archive production artifacts uses: actions/upload-artifact@v4 with: name: zerotier-one-mac - path: zerotier-one + path: zerotier-one.tar retention-days: 7 From a0acc82e990ded7b238f822062fab7eed2cd1ab8 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Thu, 12 Sep 2024 18:48:34 -0400 Subject: [PATCH 36/36] 1.14.1 (#2362) * Bump version in most places. * Update official release steps for desktop * Version bump a bunch of Rust packages. * Windows fix for disabling MT properly. * Release notes. --- OFFICIAL-RELEASE-STEPS.md | 1 + RELEASE-NOTES.md | 16 + debian/changelog | 6 + ext/installfiles/mac/ZeroTier One.pkgproj | 2 +- rustybits/Cargo.lock | 1086 ++++++++++------- service/OneService.cpp | 4 + version.h | 2 +- .../ZeroTierOne/ZeroTierOne.vcxproj.filters | 3 + zerotier-one.spec | 2 +- 9 files changed, 686 insertions(+), 436 deletions(-) diff --git a/OFFICIAL-RELEASE-STEPS.md b/OFFICIAL-RELEASE-STEPS.md index ba7b556db..f7842e9fc 100644 --- a/OFFICIAL-RELEASE-STEPS.md +++ b/OFFICIAL-RELEASE-STEPS.md @@ -14,6 +14,7 @@ The version must be incremented in all of the following files: /debian/changelog /ext/installfiles/mac/ZeroTier One.pkgproj /ext/installfiles/windows/ZeroTier One.aip + ../DesktopUI/mac-app-template/ZeroTier.app/Contents/Info.plist The final .AIP file can only be edited on Windows with [Advanced Installer Enterprise](http://www.advancedinstaller.com/). In addition to incrementing the version be sure that a new product code is generated. (The "upgrade code" GUID on the other hand must never change.) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index dba0e6430..72ca1f3be 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,6 +1,22 @@ ZeroTier Release Notes ====== +# 2024-09-12 -- Version 1.14.1 + + * Multithreaded packet I/O support! Currently this is just for Linux and must + be enabled in local.conf. It will likely make the largest difference on small + multi-core devices where CPU is a bottleneck and high throughput is desired. + It may be enabled by default in the future but we want it to be thoroughly + tested. It's a little harder than it seems at first glance due to the need + to keep packets in sequence and balance load. + * Several multipath bug fixes. + * Updated the versions on a number of libraries related to OIDC support and HTTP. + * MacOS .app now shows the correct version in its Info.plist manifest. + * Sanitize MAC addresses in JSON format rules parser. + * Some basic information about the platform (OS, CPU architecture) is now reported + to network controllers when networks are joined so it can be displayed to + network admins and in the future used in policy checking and inventory operations. + # 2024-05-02 -- Version 1.14.0 * Linux I/O performance improvements under heavy load diff --git a/debian/changelog b/debian/changelog index 813807221..660562f94 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +zerotier-one (1.14.1) unstable; urgency=medium + + * See RELEASE-NOTES.md for release notes. + + -- Adam Ierymenko Wed, 11 Sep 2024 01:00:00 -0700 + zerotier-one (1.14.0) unstable; urgency=medium * See RELEASE-NOTES.md for release notes. diff --git a/ext/installfiles/mac/ZeroTier One.pkgproj b/ext/installfiles/mac/ZeroTier One.pkgproj index 68f4594f5..cf6af8e79 100755 --- a/ext/installfiles/mac/ZeroTier One.pkgproj +++ b/ext/installfiles/mac/ZeroTier One.pkgproj @@ -701,7 +701,7 @@ USE_HFS+_COMPRESSION VERSION - 1.14.0 + 1.14.1 TYPE 0 diff --git a/rustybits/Cargo.lock b/rustybits/Cargo.lock index d8a2f5f40..8ad2b56c3 100644 --- a/rustybits/Cargo.lock +++ b/rustybits/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" @@ -70,15 +70,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "async-stream" @@ -99,20 +99,26 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "async-trait" -version = "0.1.80" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -132,18 +138,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" -version = "0.6.20" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "itoa", "matchit", "memchr", @@ -152,25 +157,28 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", - "tower", + "sync_wrapper 1.0.1", + "tower 0.4.13", "tower-layer", "tower-service", ] [[package]] name = "axum-core" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", ] @@ -188,17 +196,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -239,9 +247,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -266,9 +274,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cbindgen" @@ -291,9 +299,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -313,7 +324,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -337,12 +348,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "core-foundation" version = "0.9.4" @@ -355,24 +360,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -388,9 +393,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-bigint" @@ -416,16 +421,15 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -439,14 +443,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "darling" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -454,27 +458,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim 0.10.0", - "syn 2.0.61", + "strsim 0.11.1", + "syn 2.0.77", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -490,6 +494,20 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "der" version = "0.7.9" @@ -513,46 +531,54 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" +checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48cda787f839151732d396ac69e3473923d54312c070ee21e9effcaa8ca0b1d" +checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "derive_builder_macro" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" +checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" dependencies = [ "derive_builder_core", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "derive_more" -version = "0.99.17" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", - "syn 1.0.109", + "syn 2.0.77", + "unicode-xid", ] [[package]] @@ -619,9 +645,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -670,7 +696,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -682,7 +708,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -693,11 +719,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b73807008a3c7f171cc40312f37d95ef0396e048b5848d775f54b1a4dd4a0d3" +checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" dependencies = [ "serde", + "typeid", ] [[package]] @@ -712,9 +739,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ff" @@ -728,9 +755,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38793c55593b33412e3ae40c2c9781ffaa6f438f6f8c10f24e71846fbd7ae01e" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "fixedbitset" @@ -830,7 +857,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -906,9 +933,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "governor" @@ -917,7 +944,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" dependencies = [ "cfg-if", - "dashmap", + "dashmap 5.5.3", "futures", "futures-timer", "no-std-compat", @@ -952,8 +979,27 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", - "indexmap 2.2.6", + "http 0.2.12", + "indexmap 2.5.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1041,6 +1087,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1048,15 +1105,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1066,17 +1146,17 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1089,15 +1169,37 @@ dependencies = [ ] [[package]] -name = "hyper-timeout" -version = "0.4.1" +name = "hyper" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ - "hyper", + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" +dependencies = [ + "hyper 1.4.1", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", ] [[package]] @@ -1107,12 +1209,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.30", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", + "pin-project-lite", + "socket2", + "tokio", + "tower 0.4.13", + "tower-service", + "tracing", +] + [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1124,7 +1246,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -1165,9 +1287,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1176,9 +1298,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -1191,9 +1313,9 @@ checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "itertools" @@ -1206,9 +1328,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1221,9 +1343,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1244,18 +1366,18 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin", ] [[package]] name = "libc" -version = "0.2.154" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libm" @@ -1265,9 +1387,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -1281,15 +1403,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" dependencies = [ "hashbrown 0.14.5", ] @@ -1311,9 +1433,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1323,34 +1445,34 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi 0.3.9", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "mockall" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43766c2b5203b10de348ffe19f7e54564b64f3d6018ff7648d1e2d6d3a0f0a48" +checksum = "d4c28b3fb6d753d28c20e826cd46ee611fda1cf3cde03a443a974043247c065a" dependencies = [ "cfg-if", "downcast", "fragile", - "lazy_static", "mockall_derive", "predicates", "predicates-tree", @@ -1358,14 +1480,14 @@ dependencies = [ [[package]] name = "mockall_derive" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cbce79ec385a1d4f54baa90a76401eb15d9cab93685f62e7e9f942aa00ae2" +checksum = "341014e7f530314e9a1fdbc7400b244efea7122662c96bfa248c31da5bfb2020" dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -1376,11 +1498,10 @@ checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -1404,6 +1525,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" +[[package]] +name = "ntapi" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1467,16 +1597,6 @@ dependencies = [ "libm", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - [[package]] name = "oauth2" version = "4.4.2" @@ -1486,7 +1606,7 @@ dependencies = [ "base64 0.13.1", "chrono", "getrandom", - "http", + "http 0.2.12", "rand", "reqwest", "serde", @@ -1499,9 +1619,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -1523,7 +1643,7 @@ dependencies = [ "dyn-clone", "ed25519-dalek", "hmac", - "http", + "http 0.2.12", "itertools 0.10.5", "log", "oauth2", @@ -1546,11 +1666,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1567,7 +1687,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -1578,9 +1698,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -1590,9 +1710,9 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" +checksum = "4c365a63eec4f55b7efeceb724f1336f26a9cf3427b70e59e2cd2a5b947fba96" dependencies = [ "futures-core", "futures-sink", @@ -1600,7 +1720,6 @@ dependencies = [ "once_cell", "pin-project-lite", "thiserror", - "urlencoding", ] [[package]] @@ -1644,9 +1763,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1662,7 +1781,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -1687,7 +1806,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap 2.5.0", +] + +[[package]] +name = "pid" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c931ef9756cd5e3fa3d395bfe09df4dfa6f0612c6ca8f6b12927d17ca34e36" +dependencies = [ + "num-traits", ] [[package]] @@ -1707,7 +1835,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -1749,17 +1877,11 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "platforms" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" - [[package]] name = "portable-atomic" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" +checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" [[package]] name = "powerfmt" @@ -1769,15 +1891,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "predicates" -version = "3.1.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b87bfd4605926cdfefc1c3b5f8fe560e3feca9d5552cf68c466d3d8236c7e8" +checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" dependencies = [ "anstyle", "predicates-core", @@ -1785,15 +1910,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" +checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" [[package]] name = "predicates-tree" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" +checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" dependencies = [ "predicates-core", "termtree", @@ -1801,12 +1926,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.20" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -1820,9 +1945,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -1844,9 +1969,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.4" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" dependencies = [ "bytes", "prost-derive", @@ -1854,13 +1979,13 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.4" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" +checksum = "f8650aabb6c35b860610e9cff5dc1af886c9e25073b7b1712a68972af4281302" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.12.1", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1869,37 +1994,37 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.61", + "syn 2.0.77", "tempfile", ] [[package]] name = "prost-derive" -version = "0.12.5" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9554e3ab233f0a932403704f1a1d08c30d5ccd931adfdfa1e8b5a19b52c1d55a" +checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "prost-types" -version = "0.12.4" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" +checksum = "60caa6738c7369b940c3d49246a8d1749323674c65cb13010134f5c9bad5b519" dependencies = [ "prost", ] [[package]] name = "prost-wkt" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fb7ec2850c138ebaa7ab682503b5d08c3cb330343e9c94776612928b6ddb53f" +checksum = "a8d84e2bee181b04c2bac339f2bfe818c46a99750488cc6728ce4181d5aa8299" dependencies = [ "chrono", "inventory", @@ -1912,9 +2037,9 @@ dependencies = [ [[package]] name = "prost-wkt-build" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598b7365952c2ed4e32902de0533653aafbe5ae3da436e8e2335c7d375a1cef3" +checksum = "8a669d5acbe719010c6f62a64e6d7d88fdedc1fe46e419747949ecb6312e9b14" dependencies = [ "heck 0.5.0", "prost", @@ -1925,9 +2050,9 @@ dependencies = [ [[package]] name = "prost-wkt-types" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a8eadc2381640a49c1fbfb9f4a857794b4e5bf5a2cbc2d858cfdb74f64dcd22" +checksum = "01ef068e9b82e654614b22e6b13699bd545b6c0e2e721736008b00b38aeb4f64" dependencies = [ "chrono", "prost", @@ -1964,9 +2089,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -2003,32 +2128,32 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "11.0.2" +version = "11.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e29830cbb1290e404f24c73af91c5d8d631ce7e128691e9477556b540cd01ecd" +checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -2042,13 +2167,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -2059,9 +2184,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -2074,10 +2199,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.30", "hyper-tls", "ipnet", "js-sys", @@ -2091,7 +2216,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -2123,16 +2248,16 @@ dependencies = [ "cfg-if", "getrandom", "libc", - "spin 0.9.8", + "spin", "untrusted", "windows-sys 0.52.0", ] [[package]] name = "ringbuf" -version = "0.3.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79abed428d1fd2a128201cec72c5f6938e2da607c6f3745f769fabea399d950a" +checksum = "46f7f1b88601a8ee13cabf203611ccdf64345dc1c5d24de8b11e1a678ee619b6" dependencies = [ "crossbeam-utils", ] @@ -2165,9 +2290,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -2175,7 +2300,7 @@ dependencies = [ [[package]] name = "rustfsm" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "rustfsm_procmacro", "rustfsm_trait", @@ -2184,27 +2309,27 @@ dependencies = [ [[package]] name = "rustfsm_procmacro" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "derive_more", "proc-macro2", "quote", "rustfsm_trait", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "rustfsm_trait" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -2213,11 +2338,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "log", + "once_cell", "ring", "rustls-pki-types", "rustls-webpki", @@ -2227,12 +2353,12 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", - "rustls-pemfile 2.1.2", + "rustls-pemfile 2.1.3", "rustls-pki-types", "schannel", "security-framework", @@ -2249,9 +2375,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64 0.22.1", "rustls-pki-types", @@ -2259,15 +2385,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -2276,9 +2402,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092474d1a01ea8278f69e6a358998405fae5b8b963ddaeb2b0b04a128bf1dfb0" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "ryu" @@ -2288,11 +2414,11 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2317,11 +2443,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -2330,9 +2456,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -2346,9 +2472,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.201" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -2365,22 +2491,23 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -2418,15 +2545,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.6", + "indexmap 2.5.0", "serde", "serde_derive", "serde_json", @@ -2436,14 +2563,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -2466,6 +2593,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -2539,12 +2672,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -2578,15 +2705,15 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2601,9 +2728,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -2616,6 +2743,25 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + +[[package]] +name = "sysinfo" +version = "0.31.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "355dbe4f8799b304b05e1b0f05fc59b2a18d36645cf169607da45bde2f69a1be" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "windows", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -2639,31 +2785,34 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "temporal-client" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "anyhow", "async-trait", "backoff", - "base64 0.21.7", + "base64 0.22.1", "derive_builder", "derive_more", "futures", "futures-retry", - "http", - "hyper", + "http 1.1.0", + "http-body-util", + "hyper 1.4.1", + "hyper-util", "once_cell", "opentelemetry", "parking_lot", @@ -2674,7 +2823,7 @@ dependencies = [ "thiserror", "tokio", "tonic", - "tower", + "tower 0.5.1", "tracing", "url", "uuid", @@ -2683,19 +2832,16 @@ dependencies = [ [[package]] name = "temporal-sdk" version = "0.1.0-alpha.1" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "anyhow", "async-trait", - "base64 0.21.7", "crossbeam-channel", "derive_more", "futures", - "once_cell", "parking_lot", "prost-wkt-types", "serde", - "sha2", "temporal-client", "temporal-sdk-core", "temporal-sdk-core-api", @@ -2704,21 +2850,20 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "tonic", "tracing", ] [[package]] name = "temporal-sdk-core" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "anyhow", "async-trait", - "base64 0.21.7", "crossbeam-channel", "crossbeam-queue", - "dashmap", + "crossbeam-utils", + "dashmap 6.1.0", "derive_builder", "derive_more", "enum-iterator", @@ -2726,12 +2871,12 @@ dependencies = [ "futures", "futures-util", "governor", - "itertools 0.12.1", - "log", + "itertools 0.13.0", "lru", "mockall", "once_cell", "parking_lot", + "pid", "pin-project", "prometheus", "prost", @@ -2743,6 +2888,7 @@ dependencies = [ "serde_json", "siphasher", "slotmap", + "sysinfo", "temporal-client", "temporal-sdk-core-api", "temporal-sdk-core-protos", @@ -2761,7 +2907,7 @@ dependencies = [ [[package]] name = "temporal-sdk-core-api" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "async-trait", "derive_builder", @@ -2779,10 +2925,10 @@ dependencies = [ [[package]] name = "temporal-sdk-core-protos" version = "0.1.0" -source = "git+https://github.com/temporalio/sdk-core?branch=master#f859376686e46c36607ea527e9fdceec481f549d" +source = "git+https://github.com/temporalio/sdk-core?branch=master#a8150d5c7c3fc1bfd5a941fd315abff1556cd9dc" dependencies = [ "anyhow", - "base64 0.21.7", + "base64 0.22.1", "derive_more", "prost", "prost-wkt", @@ -2814,22 +2960,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -2875,9 +3021,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2890,42 +3036,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", "libc", "mio", - "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -2940,9 +3075,9 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ "rustls", "rustls-pki-types", @@ -2951,9 +3086,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" dependencies = [ "futures-core", "pin-project-lite", @@ -2962,9 +3097,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -2984,30 +3119,32 @@ dependencies = [ [[package]] name = "tonic" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.1", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", "prost", "rustls-native-certs", - "rustls-pemfile 2.1.2", - "rustls-pki-types", + "rustls-pemfile 2.1.3", + "socket2", "tokio", "tokio-rustls", "tokio-stream", - "tower", + "tower 0.4.13", "tower-layer", "tower-service", "tracing", @@ -3015,15 +3152,15 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +checksum = "fe4ee8877250136bd7e3d2331632810a4df4ea5e004656990d8d66d2f5ee8a67" dependencies = [ "prettyplease", "proc-macro2", "prost-build", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -3047,16 +3184,30 @@ dependencies = [ ] [[package]] -name = "tower-layer" -version = "0.3.2" +name = "tower" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -3064,7 +3215,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3078,7 +3228,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -3127,6 +3277,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typeid" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" + [[package]] name = "typenum" version = "1.17.0" @@ -3135,9 +3291,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "typetag" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "661d18414ec032a49ece2d56eee03636e43c4e8d577047ab334c0ba892e29aaf" +checksum = "52ba3b6e86ffe0054b2c44f2d86407388b933b16cb0a70eea3929420db1d9bbe" dependencies = [ "erased-serde", "inventory", @@ -3148,13 +3304,13 @@ dependencies = [ [[package]] name = "typetag-impl" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac73887f47b9312552aa90ef477927ff014d63d1920ca8037c6c1951eab64bb1" +checksum = "70b20a22c42c8f1cd23ce5e34f165d4d37038f5b663ad20fb6adbdf029172483" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -3165,9 +3321,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -3186,9 +3342,15 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "untrusted" @@ -3198,9 +3360,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -3208,17 +3370,11 @@ dependencies = [ "serde", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "uuid" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", ] @@ -3243,9 +3399,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "want" @@ -3264,34 +3420,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -3301,9 +3458,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3311,28 +3468,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3360,13 +3517,66 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3384,7 +3594,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3404,18 +3623,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -3426,9 +3645,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -3438,9 +3657,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -3450,15 +3669,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -3468,9 +3687,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -3480,9 +3699,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -3492,9 +3711,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -3504,9 +3723,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winreg" @@ -3520,22 +3739,23 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.34" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.77", ] [[package]] @@ -3557,6 +3777,6 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/service/OneService.cpp b/service/OneService.cpp index 298b2b26e..d9f63334c 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2617,6 +2617,10 @@ public: _concurrency = 1; _cpuPinningEnabled = false; } +#else + _multicoreEnabled = false; + _concurrency = 1; + _cpuPinningEnabled = false; #endif #ifndef ZT_SDK diff --git a/version.h b/version.h index 5c6c93dc9..8fff820a9 100644 --- a/version.h +++ b/version.h @@ -27,7 +27,7 @@ /** * Revision */ -#define ZEROTIER_ONE_VERSION_REVISION 0 +#define ZEROTIER_ONE_VERSION_REVISION 1 /** * Build version diff --git a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters index de9c97fec..1b1bb507a 100644 --- a/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters +++ b/windows/ZeroTierOne/ZeroTierOne.vcxproj.filters @@ -294,6 +294,9 @@ Source Files\node + + Source Files\node + diff --git a/zerotier-one.spec b/zerotier-one.spec index 5c2c9d810..414b0b629 100644 --- a/zerotier-one.spec +++ b/zerotier-one.spec @@ -1,5 +1,5 @@ Name: zerotier-one -Version: 1.14.0 +Version: 1.14.1 Release: 1%{?dist} Summary: ZeroTier network virtualization service