Skip to content

Commit

Permalink
Merge branch 'cve-2019-14899-mitigation-des-461'
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Jul 16, 2024
2 parents 49ff1b4 + 71ef470 commit b6fe083
Show file tree
Hide file tree
Showing 13 changed files with 498 additions and 84 deletions.
96 changes: 35 additions & 61 deletions test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,35 @@ tokio = { version = "1.8", features = [
"rt-multi-thread",
] }
tokio-serial = "5.4.1"

# Serde and related crates
serde = "1.0"
serde_json = "1.0"
tokio-serde = { version = "0.8.0", features = ["json"] }

# Tonic and related crates
tonic = "0.10.0"
tonic-build = { version = "0.10.0", default-features = false }
tower = "0.4"
prost = "0.12.0"
prost-types = "0.12.0"
tarpc = { version = "0.30", features = ["tokio1", "serde-transport", "serde1"] }

# Logging
env_logger = "0.11.0"
thiserror = "1.0.57"
log = "0.4"
colored = "2.0.0"

# Proxy protocols
shadowsocks = { version = "1.16" }
shadowsocks-service = { version = "1.16" }

windows-sys = "0.52.0"

chrono = { version = "0.4.26", default-features = false }
clap = { version = "4.2.7", features = ["cargo", "derive"] }
once_cell = "1.16.0"
bytes = "1.3.0"
async-trait = "0.1.58"
surge-ping = "0.8"
nix = { version = "0.29", features = ["ioctl", "socket", "net"] }
6 changes: 4 additions & 2 deletions test/test-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ tokio-serde = { workspace = true }
log = { workspace = true }

pcap = { version = "1.3", features = ["capture-stream"] }
pnet_packet = "0.31.0"
pnet_packet = "0.34.0"
pnet_base = "0.34.0"

test-rpc = { path = "../test-rpc" }
socks-server = { path = "../socks-server" }
Expand All @@ -59,7 +60,8 @@ talpid-types = { path = "../../talpid-types" }

ssh2 = "0.9.4"

nix = { version = "0.25", features = ["net"] }
nix = { workspace = true }
socket2 = "0.5.6"

[target.'cfg(target_os = "macos")'.dependencies]
tun = "0.5.1"
Expand Down
35 changes: 22 additions & 13 deletions test/test-manager/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
io,
env, io,
ops::Deref,
path::{Path, PathBuf},
};
Expand Down Expand Up @@ -157,17 +157,20 @@ impl VmConfig {
Some((self.ssh_user.as_ref()?, self.ssh_password.as_ref()?))
}

pub fn get_runner_dir(&self) -> &Path {
match self.architecture {
None | Some(Architecture::X64) => self.get_x64_runner_dir(),
Some(Architecture::Aarch64) => self.get_aarch64_runner_dir(),
}
pub fn get_runner_dir(&self) -> PathBuf {
let target_dir = self.get_target_dir();
let subdir = match self.architecture {
None | Some(Architecture::X64) => self.get_x64_runner_subdir(),
Some(Architecture::Aarch64) => self.get_aarch64_runner_subdir(),
};

target_dir.join(subdir)
}

fn get_x64_runner_dir(&self) -> &Path {
pub const X64_LINUX_TARGET_DIR: &str = "./target/x86_64-unknown-linux-gnu/release";
pub const X64_WINDOWS_TARGET_DIR: &str = "./target/x86_64-pc-windows-gnu/release";
pub const X64_MACOS_TARGET_DIR: &str = "./target/x86_64-apple-darwin/release";
fn get_x64_runner_subdir(&self) -> &Path {
pub const X64_LINUX_TARGET_DIR: &str = "x86_64-unknown-linux-gnu/release";
pub const X64_WINDOWS_TARGET_DIR: &str = "x86_64-pc-windows-gnu/release";
pub const X64_MACOS_TARGET_DIR: &str = "x86_64-apple-darwin/release";

match self.os_type {
OsType::Linux => Path::new(X64_LINUX_TARGET_DIR),
Expand All @@ -176,16 +179,22 @@ impl VmConfig {
}
}

fn get_aarch64_runner_dir(&self) -> &Path {
pub const AARCH64_LINUX_TARGET_DIR: &str = "./target/aarch64-unknown-linux-gnu/release";
pub const AARCH64_MACOS_TARGET_DIR: &str = "./target/aarch64-apple-darwin/release";
fn get_aarch64_runner_subdir(&self) -> &Path {
pub const AARCH64_LINUX_TARGET_DIR: &str = "aarch64-unknown-linux-gnu/release";
pub const AARCH64_MACOS_TARGET_DIR: &str = "aarch64-apple-darwin/release";

match self.os_type {
OsType::Linux => Path::new(AARCH64_LINUX_TARGET_DIR),
OsType::Macos => Path::new(AARCH64_MACOS_TARGET_DIR),
_ => unimplemented!(),
}
}

fn get_target_dir(&self) -> PathBuf {
env::var("CARGO_TARGET_DIR")
.unwrap_or_else(|_| "./target".into())
.into()
}
}

#[derive(clap::ValueEnum, Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
Expand Down
Loading

0 comments on commit b6fe083

Please sign in to comment.