mirror of
https://github.com/rosenpass/rosenpass.git
synced 2025-12-18 21:34:37 +03:00
Compare commits
14 Commits
regression
...
macos-runn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60a411e363 | ||
|
|
caf8801004 | ||
|
|
858c0904ad | ||
|
|
e9838722b0 | ||
|
|
69043fbae7 | ||
|
|
a70b71d509 | ||
|
|
96bed38ad0 | ||
|
|
a75d7a53e0 | ||
|
|
c4314c0eff | ||
|
|
511a59fe1b | ||
|
|
5e4a7c3b7f | ||
|
|
139e62d1fb | ||
|
|
c417fafe2a | ||
|
|
8f4141a159 |
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
iterations=$1
|
|
||||||
sleep_time=$2
|
|
||||||
|
|
||||||
PWD=$(pwd)
|
|
||||||
EXEC=$PWD/target/release/rosenpass
|
|
||||||
LOGS=$PWD/output/logs
|
|
||||||
|
|
||||||
mkdir -p output/logs
|
|
||||||
|
|
||||||
run_command() {
|
|
||||||
local file=$1
|
|
||||||
local log_file="$2"
|
|
||||||
($EXEC exchange-config $file 2>&1 | sed "s/^/[$2] /" | tee -a $log_file) &
|
|
||||||
echo $!
|
|
||||||
}
|
|
||||||
|
|
||||||
pids=()
|
|
||||||
|
|
||||||
(cd output/dut && run_command "configs/dut-$iterations.toml" "dut.log") & piddut=$!
|
|
||||||
for (( x=0; x<$iterations; x++ )); do
|
|
||||||
(cd output/ate && run_command "configs/ate-$x.toml" "ate-$x.log") & pids+=($!)
|
|
||||||
done
|
|
||||||
|
|
||||||
sleep $sleep_time
|
|
||||||
|
|
||||||
lsof -i :9999 | awk 'NR!=1 {print $2}' | xargs kill
|
|
||||||
|
|
||||||
for (( x=0; x<$iterations; x++ )); do
|
|
||||||
port=$((x + 50000))
|
|
||||||
lsof -i :$port | awk 'NR!=1 {print $2}' | xargs kill
|
|
||||||
done
|
|
||||||
7
.github/workflows/qc.yaml
vendored
7
.github/workflows/qc.yaml
vendored
@@ -110,7 +110,12 @@ jobs:
|
|||||||
- run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items
|
- run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items
|
||||||
|
|
||||||
cargo-test:
|
cargo-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-13]
|
||||||
|
# - ubuntu is x86-64
|
||||||
|
# - macos-13 is also x86-64 architecture
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
|
|||||||
19
.github/workflows/regressions.yml
vendored
19
.github/workflows/regressions.yml
vendored
@@ -1,19 +0,0 @@
|
|||||||
name: QC
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
checks: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
multi-peer:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- run: cargo build --bin rosenpass --release
|
|
||||||
- run: python misc/generate_configs.py
|
|
||||||
- run: chmod +x .ci/run-regression.sh
|
|
||||||
- run: .ci/run-regression.sh 100 20
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -20,5 +20,3 @@ _markdown_*
|
|||||||
**/result
|
**/result
|
||||||
**/result-*
|
**/result-*
|
||||||
.direnv
|
.direnv
|
||||||
|
|
||||||
/output
|
|
||||||
14
Cargo.lock
generated
14
Cargo.lock
generated
@@ -1066,6 +1066,12 @@ version = "0.3.9"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hex"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "home"
|
name = "home"
|
||||||
version = "0.5.9"
|
version = "0.5.9"
|
||||||
@@ -2325,6 +2331,12 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "take-until"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4e17d8598067a8c134af59cd33c1c263470e089924a11ab61cf61690919fe3b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tempfile"
|
name = "tempfile"
|
||||||
version = "3.10.1"
|
version = "3.10.1"
|
||||||
@@ -2857,8 +2869,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "89ba4e9811befc20af3b6efb15924a7238ee5e8e8706a196576462a00b9f1af1"
|
checksum = "89ba4e9811befc20af3b6efb15924a7238ee5e8e8706a196576462a00b9f1af1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_builder 0.10.2",
|
"derive_builder 0.10.2",
|
||||||
|
"hex",
|
||||||
"libc",
|
"libc",
|
||||||
"neli",
|
"neli",
|
||||||
|
"take-until",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,6 @@ procspawn = {version = "1.0.0", features= ["test-support"]}
|
|||||||
|
|
||||||
|
|
||||||
#Broker dependencies (might need cleanup or changes)
|
#Broker dependencies (might need cleanup or changes)
|
||||||
wireguard-uapi = "3.0.0"
|
wireguard-uapi = { version = "3.0.0", features = ["xplatform"] }
|
||||||
command-fds = "0.2.3"
|
command-fds = "0.2.3"
|
||||||
rustix = { version = "0.38.27", features = ["net"] }
|
rustix = { version = "0.38.27", features = ["net"] }
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
import os
|
|
||||||
|
|
||||||
config = dict(
|
config = dict(
|
||||||
peer_counts=[1, 5, 10, 50, 100, 500],
|
peer_counts=[1, 5, 10, 50, 100, 500],
|
||||||
peer_count_max=100,
|
peer_count_max=100,
|
||||||
ate_ip="127.0.0.1",
|
ate_ip="192.168.2.1",
|
||||||
dut_ip="127.0.0.1",
|
dut_ip="192.168.2.4",
|
||||||
dut_port=9999,
|
dut_port=9999,
|
||||||
path_to_rosenpass_bin=os.getcwd() + "/target/release/rosenpass",
|
path_to_rosenpass_bin="/Users/user/src/rosenppass/rosenpass/target/debug/rosenpass",
|
||||||
)
|
)
|
||||||
|
|
||||||
print(config)
|
print(config)
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ path = "src/bin/priviledged.rs"
|
|||||||
test = false
|
test = false
|
||||||
doc = false
|
doc = false
|
||||||
required-features=["enable_broker_api"]
|
required-features=["enable_broker_api"]
|
||||||
|
cfg = { target_os = "linux" }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "rosenpass-wireguard-broker-socket-handler"
|
name = "rosenpass-wireguard-broker-socket-handler"
|
||||||
@@ -51,3 +52,4 @@ test = false
|
|||||||
path = "src/bin/socket_handler.rs"
|
path = "src/bin/socket_handler.rs"
|
||||||
doc = false
|
doc = false
|
||||||
required-features=["enable_broker_api"]
|
required-features=["enable_broker_api"]
|
||||||
|
cfg = { target_os = "linux" }
|
||||||
|
|||||||
@@ -1,56 +1,67 @@
|
|||||||
use std::io::{stdin, stdout, Read, Write};
|
fn main() {
|
||||||
use std::result::Result;
|
#[cfg(target_os = "linux")]
|
||||||
|
linux::main().unwrap();
|
||||||
|
|
||||||
use rosenpass_wireguard_broker::api::msgs;
|
#[cfg(not(target_os = "linux"))]
|
||||||
use rosenpass_wireguard_broker::api::server::BrokerServer;
|
panic!("This binary is only supported on Linux");
|
||||||
use rosenpass_wireguard_broker::brokers::netlink as wg;
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
|
||||||
pub enum BrokerAppError {
|
|
||||||
#[error(transparent)]
|
|
||||||
IoError(#[from] std::io::Error),
|
|
||||||
#[error(transparent)]
|
|
||||||
WgConnectError(#[from] wg::ConnectError),
|
|
||||||
#[error(transparent)]
|
|
||||||
WgSetPskError(#[from] wg::SetPskError),
|
|
||||||
#[error("Oversized message {}; something about the request is fatally wrong", .0)]
|
|
||||||
OversizedMessage(u64),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<(), BrokerAppError> {
|
#[cfg(target_os = "linux")]
|
||||||
let mut broker = BrokerServer::new(wg::NetlinkWireGuardBroker::new()?);
|
pub mod linux {
|
||||||
|
use std::io::{stdin, stdout, Read, Write};
|
||||||
|
use std::result::Result;
|
||||||
|
|
||||||
let mut stdin = stdin().lock();
|
use rosenpass_wireguard_broker::api::msgs;
|
||||||
let mut stdout = stdout().lock();
|
use rosenpass_wireguard_broker::api::server::BrokerServer;
|
||||||
loop {
|
use rosenpass_wireguard_broker::brokers::netlink as wg;
|
||||||
// Read the message length
|
|
||||||
let mut len = [0u8; 8];
|
|
||||||
stdin.read_exact(&mut len)?;
|
|
||||||
|
|
||||||
// Parse the message length
|
#[derive(thiserror::Error, Debug)]
|
||||||
let len = u64::from_le_bytes(len);
|
pub enum BrokerAppError {
|
||||||
if (len as usize) > msgs::REQUEST_MSG_BUFFER_SIZE {
|
#[error(transparent)]
|
||||||
return Err(BrokerAppError::OversizedMessage(len));
|
IoError(#[from] std::io::Error),
|
||||||
}
|
#[error(transparent)]
|
||||||
|
WgConnectError(#[from] wg::ConnectError),
|
||||||
|
#[error(transparent)]
|
||||||
|
WgSetPskError(#[from] wg::SetPskError),
|
||||||
|
#[error("Oversized message {}; something about the request is fatally wrong", .0)]
|
||||||
|
OversizedMessage(u64),
|
||||||
|
}
|
||||||
|
|
||||||
// Read the message itself
|
pub fn main() -> Result<(), BrokerAppError> {
|
||||||
let mut req_buf = [0u8; msgs::REQUEST_MSG_BUFFER_SIZE];
|
let mut broker = BrokerServer::new(wg::NetlinkWireGuardBroker::new()?);
|
||||||
let req_buf = &mut req_buf[..(len as usize)];
|
|
||||||
stdin.read_exact(req_buf)?;
|
|
||||||
|
|
||||||
// Process the message
|
let mut stdin = stdin().lock();
|
||||||
let mut res_buf = [0u8; msgs::RESPONSE_MSG_BUFFER_SIZE];
|
let mut stdout = stdout().lock();
|
||||||
let res = match broker.handle_message(req_buf, &mut res_buf) {
|
loop {
|
||||||
Ok(len) => &res_buf[..len],
|
// Read the message length
|
||||||
Err(e) => {
|
let mut len = [0u8; 8];
|
||||||
eprintln!("Error processing message for wireguard PSK broker: {e:?}");
|
stdin.read_exact(&mut len)?;
|
||||||
continue;
|
|
||||||
|
// Parse the message length
|
||||||
|
let len = u64::from_le_bytes(len);
|
||||||
|
if (len as usize) > msgs::REQUEST_MSG_BUFFER_SIZE {
|
||||||
|
return Err(BrokerAppError::OversizedMessage(len));
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// Write the response
|
// Read the message itself
|
||||||
stdout.write_all(&(res.len() as u64).to_le_bytes())?;
|
let mut req_buf = [0u8; msgs::REQUEST_MSG_BUFFER_SIZE];
|
||||||
stdout.write_all(&res)?;
|
let req_buf = &mut req_buf[..(len as usize)];
|
||||||
stdout.flush()?;
|
stdin.read_exact(req_buf)?;
|
||||||
|
|
||||||
|
// Process the message
|
||||||
|
let mut res_buf = [0u8; msgs::RESPONSE_MSG_BUFFER_SIZE];
|
||||||
|
let res = match broker.handle_message(req_buf, &mut res_buf) {
|
||||||
|
Ok(len) => &res_buf[..len],
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("Error processing message for wireguard PSK broker: {e:?}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Write the response
|
||||||
|
stdout.write_all(&(res.len() as u64).to_le_bytes())?;
|
||||||
|
stdout.write_all(&res)?;
|
||||||
|
stdout.flush()?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#[cfg(feature = "enable_broker_api")]
|
#[cfg(feature = "enable_broker_api")]
|
||||||
pub mod mio_client;
|
pub mod mio_client;
|
||||||
#[cfg(feature = "enable_broker_api")]
|
#[cfg(all(feature = "enable_broker_api", target_os = "linux"))]
|
||||||
pub mod netlink;
|
pub mod netlink;
|
||||||
|
|
||||||
pub mod native_unix;
|
pub mod native_unix;
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![cfg(target_os = "linux")]
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use wireguard_uapi::linux as wg;
|
use wireguard_uapi::linux as wg;
|
||||||
|
|||||||
Reference in New Issue
Block a user