mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-08-03 15:32:50 +02:00
Merge remote-tracking branch 'github/dev' into adam/network-specific-relays
This commit is contained in:
commit
2410389912
9 changed files with 850 additions and 659 deletions
2
.github/workflows/validate.yml
vendored
2
.github/workflows/validate.yml
vendored
|
@ -39,7 +39,7 @@ jobs:
|
||||||
CXX: 'g++'
|
CXX: 'g++'
|
||||||
BRANCH: ${{ github.ref_name }}
|
BRANCH: ${{ github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
sudo apt install -y valgrind xmlstarlet gcovr iperf3 tree
|
sudo apt update && sudo apt install -y valgrind xmlstarlet gcovr iperf3 tree
|
||||||
make one ZT_COVERAGE=1 ZT_TRACE=1
|
make one ZT_COVERAGE=1 ZT_TRACE=1
|
||||||
sudo chmod +x ./.github/workflows/validate-linux.sh
|
sudo chmod +x ./.github/workflows/validate-linux.sh
|
||||||
sudo ./.github/workflows/validate-linux.sh
|
sudo ./.github/workflows/validate-linux.sh
|
||||||
|
|
1440
rustybits/Cargo.lock
generated
1440
rustybits/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,7 @@ fn main() {
|
||||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
|
|
||||||
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||||
let output_file = target_dir().join(format!("{}.h", package_name)).display().to_string();
|
let output_file = target_dir().join(format!("{package_name}.h")).display().to_string();
|
||||||
|
|
||||||
let config = Config {
|
let config = Config {
|
||||||
language: Language::C,
|
language: Language::C,
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
* of this software will be governed by version 2.0 of the Apache License.
|
* of this software will be governed by version 2.0 of the Apache License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#![allow(clippy::uninlined_format_args, clippy::missing_safety_doc)]
|
||||||
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::os::raw::c_char;
|
use std::os::raw::c_char;
|
||||||
|
|
||||||
|
@ -17,7 +19,7 @@ use crate::NetworkJoinedParams;
|
||||||
use crate::SmeeClient;
|
use crate::SmeeClient;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn smee_client_new(
|
pub unsafe extern "C" fn smee_client_new(
|
||||||
temporal_url: *const c_char,
|
temporal_url: *const c_char,
|
||||||
namespace: *const c_char,
|
namespace: *const c_char,
|
||||||
task_queue: *const c_char,
|
task_queue: *const c_char,
|
||||||
|
@ -47,7 +49,7 @@ pub extern "C" fn smee_client_new(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
|
pub unsafe extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +62,7 @@ pub extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn smee_client_notify_network_joined(
|
pub unsafe extern "C" fn smee_client_notify_network_joined(
|
||||||
smee_instance: *mut SmeeClient,
|
smee_instance: *mut SmeeClient,
|
||||||
network_id: *const c_char,
|
network_id: *const c_char,
|
||||||
member_id: *const c_char,
|
member_id: *const c_char,
|
||||||
|
@ -85,7 +87,7 @@ pub extern "C" fn smee_client_notify_network_joined(
|
||||||
match smee.notify_network_joined(params) {
|
match smee.notify_network_joined(params) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("error notifying network joined: {0}", e.to_string());
|
println!("error notifying network joined: {0}", e);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,9 @@ impl SmeeClient {
|
||||||
id_reuse_policy: WorkflowIdReusePolicy::RejectDuplicate,
|
id_reuse_policy: WorkflowIdReusePolicy::RejectDuplicate,
|
||||||
id_conflict_policy: WorkflowIdConflictPolicy::Fail,
|
id_conflict_policy: WorkflowIdConflictPolicy::Fail,
|
||||||
execution_timeout: None,
|
execution_timeout: None,
|
||||||
|
completion_callbacks: Default::default(),
|
||||||
|
links: Default::default(),
|
||||||
|
priority: None,
|
||||||
run_timeout: None,
|
run_timeout: None,
|
||||||
task_timeout: None,
|
task_timeout: None,
|
||||||
cron_schedule: None,
|
cron_schedule: None,
|
||||||
|
|
|
@ -8,7 +8,7 @@ fn main() {
|
||||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
|
|
||||||
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||||
let output_file = target_dir().join(format!("{}.h", package_name)).display().to_string();
|
let output_file = target_dir().join(format!("{package_name}.h")).display().to_string();
|
||||||
|
|
||||||
let config = Config {
|
let config = Config {
|
||||||
language: Language::C,
|
language: Language::C,
|
||||||
|
|
|
@ -24,7 +24,7 @@ use crate::ZeroIDC;
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_new(
|
pub unsafe extern "C" fn zeroidc_new(
|
||||||
issuer: *const c_char,
|
issuer: *const c_char,
|
||||||
client_id: *const c_char,
|
client_id: *const c_char,
|
||||||
auth_endpoint: *const c_char,
|
auth_endpoint: *const c_char,
|
||||||
|
@ -78,7 +78,7 @@ pub extern "C" fn zeroidc_new(
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
pub unsafe extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ pub extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
|
pub unsafe extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
|
||||||
let idc = unsafe {
|
let idc = unsafe {
|
||||||
assert!(!ptr.is_null());
|
assert!(!ptr.is_null());
|
||||||
&mut *ptr
|
&mut *ptr
|
||||||
|
@ -117,7 +117,7 @@ pub extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
|
pub unsafe extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
|
||||||
let idc = unsafe {
|
let idc = unsafe {
|
||||||
assert!(!ptr.is_null());
|
assert!(!ptr.is_null());
|
||||||
&mut *ptr
|
&mut *ptr
|
||||||
|
@ -133,7 +133,7 @@ pub extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
|
pub unsafe extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
|
||||||
let idc = unsafe {
|
let idc = unsafe {
|
||||||
assert!(!ptr.is_null());
|
assert!(!ptr.is_null());
|
||||||
&mut *ptr
|
&mut *ptr
|
||||||
|
@ -143,7 +143,7 @@ pub extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
|
pub unsafe extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
|
||||||
let id = unsafe {
|
let id = unsafe {
|
||||||
assert!(!ptr.is_null());
|
assert!(!ptr.is_null());
|
||||||
&mut *ptr
|
&mut *ptr
|
||||||
|
@ -160,7 +160,11 @@ pub extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_set_nonce_and_csrf(ptr: *mut ZeroIDC, csrf_token: *const c_char, nonce: *const c_char) {
|
pub unsafe extern "C" fn zeroidc_set_nonce_and_csrf(
|
||||||
|
ptr: *mut ZeroIDC,
|
||||||
|
csrf_token: *const c_char,
|
||||||
|
nonce: *const c_char,
|
||||||
|
) {
|
||||||
let idc = unsafe {
|
let idc = unsafe {
|
||||||
assert!(!ptr.is_null());
|
assert!(!ptr.is_null());
|
||||||
&mut *ptr
|
&mut *ptr
|
||||||
|
@ -190,7 +194,7 @@ pub extern "C" fn zeroidc_set_nonce_and_csrf(ptr: *mut ZeroIDC, csrf_token: *con
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn free_cstr(s: *mut c_char) {
|
pub unsafe extern "C" fn free_cstr(s: *mut c_char) {
|
||||||
if s.is_null() {
|
if s.is_null() {
|
||||||
println!("passed a null object");
|
println!("passed a null object");
|
||||||
return;
|
return;
|
||||||
|
@ -209,7 +213,7 @@ pub extern "C" fn free_cstr(s: *mut c_char) {
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
pub unsafe extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
println!("passed a null object");
|
println!("passed a null object");
|
||||||
return std::ptr::null_mut();
|
return std::ptr::null_mut();
|
||||||
|
@ -228,7 +232,7 @@ pub extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char) -> *mut c_char {
|
pub unsafe extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char) -> *mut c_char {
|
||||||
if idc.is_null() {
|
if idc.is_null() {
|
||||||
println!("idc is null");
|
println!("idc is null");
|
||||||
return std::ptr::null_mut();
|
return std::ptr::null_mut();
|
||||||
|
@ -265,7 +269,7 @@ pub extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_get_url_param_value(param: *const c_char, path: *const c_char) -> *mut c_char {
|
pub unsafe extern "C" fn zeroidc_get_url_param_value(param: *const c_char, path: *const c_char) -> *mut c_char {
|
||||||
if param.is_null() {
|
if param.is_null() {
|
||||||
println!("param is null");
|
println!("param is null");
|
||||||
return std::ptr::null_mut();
|
return std::ptr::null_mut();
|
||||||
|
@ -292,7 +296,7 @@ pub extern "C" fn zeroidc_get_url_param_value(param: *const c_char, path: *const
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_network_id_from_state(state: *const c_char) -> *mut c_char {
|
pub unsafe extern "C" fn zeroidc_network_id_from_state(state: *const c_char) -> *mut c_char {
|
||||||
if state.is_null() {
|
if state.is_null() {
|
||||||
println!("state is null");
|
println!("state is null");
|
||||||
return std::ptr::null_mut();
|
return std::ptr::null_mut();
|
||||||
|
@ -318,7 +322,7 @@ pub extern "C" fn zeroidc_network_id_from_state(state: *const c_char) -> *mut c_
|
||||||
target_os = "macos",
|
target_os = "macos",
|
||||||
))]
|
))]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
|
pub unsafe extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
|
||||||
if idc.is_null() {
|
if idc.is_null() {
|
||||||
println!("idc is null");
|
println!("idc is null");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
* of this software will be governed by version 2.0 of the Apache License.
|
* of this software will be governed by version 2.0 of the Apache License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#![allow(
|
||||||
|
clippy::uninlined_format_args,
|
||||||
|
clippy::missing_safety_doc,
|
||||||
|
clippy::option_map_unit_fn
|
||||||
|
)]
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod ext;
|
pub mod ext;
|
||||||
|
|
||||||
|
@ -373,7 +379,7 @@ impl ZeroIDC {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let need_verifier = matches!(i.pkce_verifier, None);
|
let need_verifier = i.pkce_verifier.is_none();
|
||||||
|
|
||||||
let csrf_diff = if let Some(csrf) = i.csrf_token.clone() {
|
let csrf_diff = if let Some(csrf) = i.csrf_token.clone() {
|
||||||
*csrf.secret() != csrf_token
|
*csrf.secret() != csrf_token
|
||||||
|
|
|
@ -2612,7 +2612,17 @@ class OneServiceImpl : public OneService {
|
||||||
}
|
}
|
||||||
_node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr, ipvPref, mtu, capacity, enabled, linkMode, failoverToStr));
|
_node->bondController()->addCustomLink(customPolicyStr, new Link(linkNameStr, ipvPref, mtu, capacity, enabled, linkMode, failoverToStr));
|
||||||
}
|
}
|
||||||
std::string linkSelectMethodStr(OSUtils::jsonString(customPolicy["activeReselect"], "always"));
|
// Check for new field name first, fall back to legacy field name for backward compatibility
|
||||||
|
std::string linkSelectMethodStr;
|
||||||
|
if (customPolicy.contains("linkSelectMethod")) {
|
||||||
|
linkSelectMethodStr = OSUtils::jsonString(customPolicy["linkSelectMethod"], "always");
|
||||||
|
} else {
|
||||||
|
linkSelectMethodStr = OSUtils::jsonString(customPolicy["activeReselect"], "always");
|
||||||
|
if (customPolicy.contains("activeReselect")) {
|
||||||
|
fprintf(stderr, "warning: 'activeReselect' is deprecated, please use 'linkSelectMethod' instead in policy '%s'\n", customPolicyStr.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (linkSelectMethodStr == "always") {
|
if (linkSelectMethodStr == "always") {
|
||||||
newTemplateBond->setLinkSelectMethod(ZT_BOND_RESELECTION_POLICY_ALWAYS);
|
newTemplateBond->setLinkSelectMethod(ZT_BOND_RESELECTION_POLICY_ALWAYS);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue