Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.14.1 merge dev to main #2363

Merged
merged 67 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
e171384
Append noexecstack to linker flags instead of assembler flags
parona-source Oct 29, 2023
5533b82
Add ARM architectures to Synology DSM7
ChrisCarini Nov 4, 2023
1aa31e0
Fix how MAC addresses are handled by the rules parser
lel-amri Nov 14, 2023
8b44ac9
Merge branch 'dev' into ChrisCarini/addArchToSynologyDSM7
ChrisCarini Feb 5, 2024
683d332
Add multi-core concurrent packet processing
joseph-henry Feb 23, 2024
43b1415
Merge branch 'dev' into fix-mac-handling-in-rules-parser
joseph-henry Mar 5, 2024
80cfc2b
Merge branch 'dev' into fix-mac-handling-in-rules-parser
joseph-henry Mar 5, 2024
b9d0cf9
Don't pass result of void function to string constructor
joseph-henry Mar 5, 2024
280cc77
Update README.md minimal compilers
fedepell Mar 25, 2024
9de2b90
fix rebuild for x64
glimberg Mar 27, 2024
0fb9d43
Merge pull request #2282 from zerotier/main
glimberg May 3, 2024
28cf142
also install x64 rust in github action
glimberg May 9, 2024
ddb2759
Merge pull request #2287 from zerotier:actions
glimberg May 9, 2024
e915d10
cargo update rustybits (#2286)
someara May 9, 2024
9ec6c29
Respect user LDFLAGS
parona-source Oct 29, 2023
dca77cb
expand GETENV macro that needs to be modified
bostick May 21, 2024
e32fecd
Thread might actually be detached, so need to handle that
bostick May 21, 2024
2f3ea88
Merge branch 'dev' into ChrisCarini/addArchToSynologyDSM7
ChrisCarini Jun 1, 2024
f79af92
Add Rust tcp-proxy base, add .clangd
adamierymenko Jun 17, 2024
ad60d70
fix log line
glimberg Jun 17, 2024
9d57ccd
deauth all members upon network delete
glimberg Jun 17, 2024
41a4690
Merge pull request #2312 from zerotier/delete
glimberg Jun 18, 2024
f5cc774
Merge branch 'dev' into winbuild
glimberg Jun 18, 2024
f9c6ee0
macos: use more portable pwd instead of PWD
Mic92 Jun 21, 2024
8caede3
Add OS_ARCH to network config metadata.
adamierymenko Jun 24, 2024
f4edb09
Merge branch 'dev' into rusty-tcp-relay
adamierymenko Jun 24, 2024
e2840b0
undo stuff from other branch
adamierymenko Jun 24, 2024
34cc261
Merge pull request #2266 from zerotier/winbuild
glimberg Jun 28, 2024
64634c9
Fix build for macOS, tune to prevent packet re-ordering
joseph-henry Jul 3, 2024
508527f
break up redis tx inserts into smaller chunks
glimberg Jul 8, 2024
93fd93d
Merge pull request #2330 from zerotier/controller-redis
glimberg Jul 8, 2024
979bca5
Merge branch 'dev' into ChrisCarini/addArchToSynologyDSM7
ChrisCarini Jul 13, 2024
82b8a4f
Merge pull request #2314 from Mic92/pwd
joseph-henry Jul 16, 2024
24fb1ce
Merge pull request #2169 from ChrisCarini/ChrisCarini/addArchToSynolo…
joseph-henry Jul 25, 2024
d6bfb88
Merge branch 'dev' into respect-ldflags
joseph-henry Jul 31, 2024
f176e25
Merge pull request #2162 from parona-source/respect-ldflags
joseph-henry Jul 31, 2024
36adae3
Add packet multiplexer
joseph-henry Aug 18, 2024
8283a6d
Merge branch 'dev' into jh-zerotier-multithreaded
joseph-henry Aug 18, 2024
b1a30ae
Switch to local.conf-based config of multithreading
joseph-henry Aug 20, 2024
b7d9290
Fix build issue on macOS
joseph-henry Aug 21, 2024
e734019
More platform-related build fixes
joseph-henry Aug 21, 2024
b813ea7
Simplify packet critical path. Plus more platform fixes
joseph-henry Aug 22, 2024
c97943d
Add packet mux source file to Windows project
joseph-henry Aug 22, 2024
95983ba
Build fix for FreeBSD
joseph-henry Aug 26, 2024
bf7dddb
Fix issues that prevent user multipath preferences from being respected
joseph-henry Aug 29, 2024
e42848d
Fix bug for when no multithreaded config is given
joseph-henry Sep 4, 2024
c86b91c
Fix condition where settings may be applied with multithreading is di…
joseph-henry Sep 4, 2024
059d05f
Comment out vestigial test code (improves mt performance)
Sep 6, 2024
8f5cc4e
Completely remove vestigial RX code
Sep 6, 2024
52e3d9b
Merge branch 'dev' into report-os-arch
adamierymenko Sep 9, 2024
8d474e1
Add ios differentiation, and .clangd that works w/Zed and clangd.
adamierymenko Sep 9, 2024
9a8d715
Merge branch 'report-os-arch' of github.com:/zerotier/ZeroTierOne int…
adamierymenko Sep 9, 2024
c9234ee
Merge branch 'dev' into patch-1
adamierymenko Sep 9, 2024
31d2dce
Merge pull request #2263 from fedepell/patch-1
adamierymenko Sep 9, 2024
46c0d1a
Merge pull request #2320 from zerotier/report-os-arch
adamierymenko Sep 9, 2024
2762593
Merge branch 'dev' into jh-zerotier-multithreaded
adamierymenko Sep 9, 2024
763caae
Merge pull request #2161 from parona-source/execstack
adamierymenko Sep 9, 2024
861147b
Merge branch 'dev' into jh-zerotier-multithreaded
adamierymenko Sep 9, 2024
fb8cbb6
Merge pull request #2354 from zerotier/jh-misc-multipath-patches
adamierymenko Sep 10, 2024
6bc785e
Merge branch 'dev' into jh-zerotier-multithreaded
adamierymenko Sep 10, 2024
223ec0c
retain build artifacts
laduke Sep 10, 2024
560d6fb
tar mac and linux binary
laduke Sep 10, 2024
2522d29
Merge pull request #2360 from laduke/dev
laduke Sep 10, 2024
4a485df
Merge pull request #2234 from zerotier/jh-zerotier-multithreaded
adamierymenko Sep 11, 2024
e1ee3eb
Merge branch 'dev' into lel-amri-fix-mac-handling-in-rules-parser
adamierymenko Sep 11, 2024
98e532d
Merge pull request #2244 from zerotier/lel-amri-fix-mac-handling-in-r…
adamierymenko Sep 11, 2024
a0acc82
1.14.1 (#2362)
adamierymenko Sep 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CompileFlags:
Add:
- "-std=c++17"
- "-I../ext"
- "-I../ext/prometheus-cpp-lite-1.0/core/include"
- "-I../ext/prometheus-cpp-lite-1.0/simpleapi/include"
53 changes: 39 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,6 +32,14 @@ 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.tar
retention-days: 7

build_macos:
runs-on: macos-latest
Expand All @@ -42,13 +49,18 @@ jobs:
git config --global core.autocrlf input
# git config --global core.eol lf
- name: checkout
uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
uses: actions/checkout@v4
- name: Install Rust aarch64
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: aarch64-apple-darwin
override: true
components: rustfmt, clippy
- name: Install Rust x86_64
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-apple-darwin
components: rustfmt, clippy
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
Expand All @@ -58,13 +70,21 @@ jobs:
shared-key: ${{ runner.os }}-cargo-
workspaces: |
rustybits/

- name: make
run: make
- name: selftest
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.tar
retention-days: 7


build_windows:
runs-on: windows-latest
Expand All @@ -74,13 +94,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
Expand All @@ -92,7 +111,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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ attic/world/mkworld
workspace/
workspace2/
zeroidc/target/
tcp-proxy/target

#snapcraft specifics
/parts/
Expand Down
1 change: 1 addition & 0 deletions OFFICIAL-RELEASE-STEPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
16 changes: 16 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 18 additions & 0 deletions controller/DB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<nlohmann::json> 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<std::shared_mutex> 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<std::shared_mutex> l(_networks_l);
_networks.erase(networkId);
}
Expand Down
6 changes: 4 additions & 2 deletions controller/EmbeddedNetworkController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(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(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") {
Expand Down
34 changes: 29 additions & 5 deletions controller/PostgreSQL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -1180,7 +1204,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) {
Expand Down Expand Up @@ -1269,8 +1293,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) {
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
zerotier-one (1.14.1) unstable; urgency=medium

* See RELEASE-NOTES.md for release notes.

-- Adam Ierymenko <[email protected]> Wed, 11 Sep 2024 01:00:00 -0700

zerotier-one (1.14.0) unstable; urgency=medium

* See RELEASE-NOTES.md for release notes.
Expand Down
2 changes: 1 addition & 1 deletion ext/installfiles/mac/ZeroTier One.pkgproj
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@
<key>USE_HFS+_COMPRESSION</key>
<false/>
<key>VERSION</key>
<string>1.14.0</string>
<string>1.14.1</string>
</dict>
<key>TYPE</key>
<integer>0</integer>
Expand Down
58 changes: 57 additions & 1 deletion java/jni/com_zerotierone_sdk_Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -194,7 +232,25 @@ namespace {
assert(ref);
assert(ref->node == node);
JNIEnv *env;
GETENV(env, ref->jvm);

jint getEnvRet;
assert(ref->jvm);
getEnvRet = ref->jvm->GetEnv(reinterpret_cast<void**>(&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");
Expand Down
4 changes: 2 additions & 2 deletions make-linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -364,7 +364,7 @@ override CFLAGS+=-fPIC -fPIE
override CXXFLAGS+=-fPIC -fPIE

# Non-executable stack
override ASFLAGS+=--noexecstack
override LDFLAGS+=-Wl,-z,noexecstack

.PHONY: all
all: one
Expand Down
4 changes: 2 additions & 2 deletions make-mac.mk
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading
Loading