From 26d002bc2b38c3ce2b1c26a88fe70e1220eeda5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9F=A9=E5=98=89=E4=B9=90?= Date: Sat, 25 Oct 2025 00:17:24 +0800 Subject: [PATCH] The flowback solution of HarmonyOS 5 failed due to the anti-loop mechanism. (#1514) --- .github/workflows/ohos.yml | 4 +- easytier-contrib/easytier-ohrs/Cargo.lock | 91 +++-------------------- easytier-contrib/easytier-ohrs/Cargo.toml | 2 +- easytier-contrib/easytier-ohrs/src/lib.rs | 6 ++ easytier/src/peers/peer_manager.rs | 11 ++- 5 files changed, 26 insertions(+), 88 deletions(-) diff --git a/.github/workflows/ohos.yml b/.github/workflows/ohos.yml index 4f97691..b94f1a4 100644 --- a/.github/workflows/ohos.yml +++ b/.github/workflows/ohos.yml @@ -122,6 +122,8 @@ jobs: uses: actions/upload-artifact@v4 with: name: easytier-ohos - path: ./easytier-contrib/easytier-ohrs/easytier-ohrs.har + path: | + ./easytier-contrib/easytier-ohrs/easytier-ohrs.har + ./easytier-contrib/easytier-ohrs/dist/arm64-v8a/libeasytier_ohrs.so retention-days: 5 if-no-files-found: error diff --git a/easytier-contrib/easytier-ohrs/Cargo.lock b/easytier-contrib/easytier-ohrs/Cargo.lock index 1bb2fd0..462f5f4 100644 --- a/easytier-contrib/easytier-ohrs/Cargo.lock +++ b/easytier-contrib/easytier-ohrs/Cargo.lock @@ -133,16 +133,6 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" -[[package]] -name = "async-event" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1222afd3d2bce3995035054046a279ae7aa154d70d0766cea050073f3fd7ddf" -dependencies = [ - "loom 0.5.6", - "pin-project-lite", -] - [[package]] name = "async-recursion" version = "1.1.1" @@ -487,9 +477,9 @@ dependencies = [ [[package]] name = "cidr" -version = "0.2.3" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdf600c45bd958cf2945c445264471cca8b6c8e67bc87b71affd6d7e5682621" +checksum = "bd1b64030216239a2e7c364b13cd96a2097ebf0dfe5025f2dedee14a23f2ab60" dependencies = [ "serde", ] @@ -946,16 +936,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "diatomic-waker" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28025fb55a9d815acf7b0877555f437254f373036eec6ed265116c7a5c0825e9" -dependencies = [ - "loom 0.5.6", - "waker-fn", -] - [[package]] name = "digest" version = "0.10.7" @@ -1015,8 +995,7 @@ checksum = "7454e41ff9012c00d53cf7f475c5e3afa3b91b7c90568495495e8d9bf47a1055" [[package]] name = "easytier" -version = "2.4.4" -source = "git+https://github.com/EasyTier/EasyTier.git#4445916ba72a8340259d65f0c55f50af325c51d2" +version = "2.4.5" dependencies = [ "anyhow", "arc-swap", @@ -1056,6 +1035,7 @@ dependencies = [ "http_req", "humansize", "humantime-serde", + "idna", "kcp-sys", "machine-uid", "multimap", @@ -1071,6 +1051,7 @@ dependencies = [ "petgraph 0.8.2", "pin-project-lite", "pnet", + "prefix-trie", "prost", "prost-build", "prost-reflect", @@ -1095,7 +1076,6 @@ dependencies = [ "stun_codec", "sys-locale", "tabled", - "tachyonix", "thiserror 1.0.69", "thunk-rs", "time", @@ -1454,19 +1434,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generator" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc16584ff22b460a382b7feec54b23d2908d858152e5739a120b949293bd74e" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows 0.48.0", -] - [[package]] name = "generator" version = "0.8.7" @@ -2262,7 +2229,7 @@ dependencies = [ [[package]] name = "kcp-sys" version = "0.1.0" -source = "git+https://github.com/EasyTier/kcp-sys?rev=0f0a0558391ba391c089806c23f369651f6c9eeb#0f0a0558391ba391c089806c23f369651f6c9eeb" +source = "git+https://github.com/EasyTier/kcp-sys?rev=71eff18c573a4a71bf99c7fabc6a8b9f211c84c1#71eff18c573a4a71bf99c7fabc6a8b9f211c84c1" dependencies = [ "anyhow", "auto_impl", @@ -2398,19 +2365,6 @@ version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator 0.7.5", - "scoped-tls", - "tracing", - "tracing-subscriber", -] - [[package]] name = "loom" version = "0.7.2" @@ -2418,7 +2372,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "419e0dc8046cb947daa77eb95ae174acfbddb7673b4151f56d1eed8e93fbfaca" dependencies = [ "cfg-if", - "generator 0.8.7", + "generator", "scoped-tls", "tracing", "tracing-subscriber", @@ -2517,7 +2471,7 @@ dependencies = [ "crossbeam-channel", "crossbeam-epoch", "crossbeam-utils", - "loom 0.7.2", + "loom", "parking_lot", "portable-atomic", "rustc_version", @@ -3141,6 +3095,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85cf4c7c25f1dd66c76b451e9041a8cfce26e4ca754934fa7aed8d5a59a01d20" dependencies = [ + "cidr", "ipnet", "num-traits", ] @@ -4169,19 +4124,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "tachyonix" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86c3eafa053bbcc63bb4bfc5eb26362a33ea0bc2e589f28bce00287d1c167d45" -dependencies = [ - "async-event", - "crossbeam-utils", - "diatomic-waker", - "futures-core", - "pin-project-lite", -] - [[package]] name = "tagptr" version = "0.2.0" @@ -4785,12 +4727,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "waker-fn" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" - [[package]] name = "walkdir" version = "2.5.0" @@ -5030,15 +4966,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows" version = "0.52.0" diff --git a/easytier-contrib/easytier-ohrs/Cargo.toml b/easytier-contrib/easytier-ohrs/Cargo.toml index bef4831..08a02d9 100644 --- a/easytier-contrib/easytier-ohrs/Cargo.toml +++ b/easytier-contrib/easytier-ohrs/Cargo.toml @@ -8,7 +8,7 @@ crate-type=["cdylib"] [dependencies] ohos-hilog-binding = {version = "*", features = ["redirect"]} -easytier = { git = "https://github.com/EasyTier/EasyTier.git" } +easytier = { path = "../../easytier" } napi-derive-ohos = "1.1" napi-ohos = { version = "1.1", default-features = false, features = [ "serde-json", diff --git a/easytier-contrib/easytier-ohrs/src/lib.rs b/easytier-contrib/easytier-ohrs/src/lib.rs index fdf2591..40e8391 100644 --- a/easytier-contrib/easytier-ohrs/src/lib.rs +++ b/easytier-contrib/easytier-ohrs/src/lib.rs @@ -1,6 +1,7 @@ mod native_log; use easytier::common::config::{ConfigLoader, TomlConfigLoader}; +use easytier::common::constants::EASYTIER_VERSION; use easytier::instance_manager::NetworkInstanceManager; use easytier::launcher::ConfigSource; use napi_derive_ohos::napi; @@ -17,6 +18,11 @@ pub struct KeyValuePair { pub value: String, } +#[napi] +pub fn easytier_version() -> String { + EASYTIER_VERSION.to_string() +} + #[napi] pub fn set_tun_fd(inst_id: String, fd: i32) -> bool { match Uuid::try_parse(&inst_id) { diff --git a/easytier/src/peers/peer_manager.rs b/easytier/src/peers/peer_manager.rs index 8b222f9..852ebec 100644 --- a/easytier/src/peers/peer_manager.rs +++ b/easytier/src/peers/peer_manager.rs @@ -1218,10 +1218,13 @@ impl PeerManager { let hdr = msg.mut_peer_manager_header().unwrap(); hdr.to_peer_id.set(*peer_id); - if not_send_to_self && *peer_id == self.my_peer_id { - // the packet may be sent to vpn portal, so we just set flags instead of drop it - hdr.set_not_send_to_tun(true); - hdr.set_no_proxy(true); + #[cfg(not(target_env = "ohos"))] + { + if not_send_to_self && *peer_id == self.my_peer_id { + // the packet may be sent to vpn portal, so we just set flags instead of drop it + hdr.set_not_send_to_tun(true); + hdr.set_no_proxy(true); + } } self.self_tx_counters