mirror of
https://github.com/cirruslabs/softnet.git
synced 2026-10-19 16:25:42 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
535e03c97f | ||
|
|
d635751948 | ||
|
|
e71b32a8dd | ||
|
|
59cd9098e0 | ||
|
|
4ab3cd7e5c | ||
|
|
cd78047d79 | ||
|
|
a1108b1b7f |
+18
-2
@@ -18,10 +18,26 @@ task:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!]
|
GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!]
|
||||||
GORELEASER_KEY: ENCRYPTED[!9b80b6ef684ceaf40edd4c7af93014ee156c8aba7e6e5795f41c482729887b5c31f36b651491d790f1f668670888d9fd!]
|
GORELEASER_KEY: ENCRYPTED[!9b80b6ef684ceaf40edd4c7af93014ee156c8aba7e6e5795f41c482729887b5c31f36b651491d790f1f668670888d9fd!]
|
||||||
|
SENTRY_ORG: cirrus-labs
|
||||||
|
SENTRY_PROJECT: persistent-workers
|
||||||
|
SENTRY_AUTH_TOKEN: ENCRYPTED[!c16a5cf7da5f856b4bc2f21fe8cb7aa2a6c981f851c094ed4d3025fd02ea59a58a86cee8b193a69a1fc20fa217e56ac3!]
|
||||||
install_rust_script:
|
install_rust_script:
|
||||||
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
install_goreleaser_script:
|
install_script:
|
||||||
- brew install go goreleaser/tap/goreleaser-pro
|
- brew install go goreleaser/tap/goreleaser-pro getsentry/tools/sentry-cli
|
||||||
build_script:
|
build_script:
|
||||||
- cargo build --profile release-with-debug
|
- cargo build --profile release-with-debug
|
||||||
release_script: goreleaser
|
release_script: goreleaser
|
||||||
|
upload_sentry_debug_files_script:
|
||||||
|
- cd target/release-with-debug/
|
||||||
|
# Generate and upload symbols
|
||||||
|
- dsymutil softnet
|
||||||
|
- sentry-cli debug-files upload -o $SENTRY_ORG -p $SENTRY_PROJECT softnet.dSYM/
|
||||||
|
# Bundle and upload sources
|
||||||
|
- sentry-cli debug-files bundle-sources softnet.dSYM/
|
||||||
|
- sentry-cli debug-files upload -o $SENTRY_ORG -p $SENTRY_PROJECT softnet.src.zip
|
||||||
|
create_sentry_release_script:
|
||||||
|
- export SENTRY_RELEASE="softnet@$CIRRUS_TAG"
|
||||||
|
- sentry-cli releases new $SENTRY_RELEASE
|
||||||
|
- sentry-cli releases set-commits $SENTRY_RELEASE --auto
|
||||||
|
- sentry-cli releases finalize $SENTRY_RELEASE
|
||||||
|
|||||||
Generated
+26
-2
@@ -275,6 +275,18 @@ dependencies = [
|
|||||||
"instant",
|
"instant",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "findshlibs"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fnv"
|
name = "fnv"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
@@ -1091,6 +1103,7 @@ dependencies = [
|
|||||||
"sentry-backtrace",
|
"sentry-backtrace",
|
||||||
"sentry-contexts",
|
"sentry-contexts",
|
||||||
"sentry-core",
|
"sentry-core",
|
||||||
|
"sentry-debug-images",
|
||||||
"sentry-panic",
|
"sentry-panic",
|
||||||
"tokio",
|
"tokio",
|
||||||
"ureq",
|
"ureq",
|
||||||
@@ -1146,6 +1159,17 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sentry-debug-images"
|
||||||
|
version = "0.29.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3995208135571444b7d5a247f42bd36677553bb64185d85b317acdc1789749b3"
|
||||||
|
dependencies = [
|
||||||
|
"findshlibs",
|
||||||
|
"once_cell",
|
||||||
|
"sentry-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sentry-panic"
|
name = "sentry-panic"
|
||||||
version = "0.29.1"
|
version = "0.29.1"
|
||||||
@@ -1400,9 +1424,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.23.0"
|
version = "1.25.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46"
|
checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
|||||||
+1
-1
@@ -25,5 +25,5 @@ ip_network = "0.4.1"
|
|||||||
users = "0.11.0"
|
users = "0.11.0"
|
||||||
system-configuration = "0.5.0"
|
system-configuration = "0.5.0"
|
||||||
num_enum = "0.5.7"
|
num_enum = "0.5.7"
|
||||||
sentry = "0.29.1"
|
sentry = { version = "0.29.1", features = ["debug-images"] }
|
||||||
sentry-anyhow = { version = "0.29.1", features = ["backtrace"] }
|
sentry-anyhow = { version = "0.29.1", features = ["backtrace"] }
|
||||||
|
|||||||
+8
-2
@@ -52,8 +52,14 @@ impl Poller {
|
|||||||
self.poller
|
self.poller
|
||||||
.wait(&mut self.events, Some(Duration::from_millis(100)))?;
|
.wait(&mut self.events, Some(Duration::from_millis(100)))?;
|
||||||
|
|
||||||
let vm_readable = self.events.iter().any(|ev| ev.key == EventKey::VM.into());
|
let vm_readable = self
|
||||||
let host_readable = self.events.iter().any(|ev| ev.key == EventKey::Host.into());
|
.events
|
||||||
|
.iter()
|
||||||
|
.any(|ev| ev.key == Into::<usize>::into(EventKey::VM));
|
||||||
|
let host_readable = self
|
||||||
|
.events
|
||||||
|
.iter()
|
||||||
|
.any(|ev| ev.key == Into::<usize>::into(EventKey::Host));
|
||||||
|
|
||||||
Ok((vm_readable, host_readable))
|
Ok((vm_readable, host_readable))
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-4
@@ -16,10 +16,24 @@ impl Proxy {
|
|||||||
self.snoop(frame);
|
self.snoop(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.vm
|
match self.vm.write(frame.as_ref()) {
|
||||||
.write(frame.as_ref())
|
Ok(_) => Ok(()),
|
||||||
.map(|_| ())
|
Err(err) => {
|
||||||
.context("failed to write to the VM")
|
if let Some(libc::ENOBUFS) = err.raw_os_error() {
|
||||||
|
if !self.enobufs_encountered {
|
||||||
|
sentry::capture_message(
|
||||||
|
"No buffer space available in VM's socket",
|
||||||
|
sentry::Level::Warning,
|
||||||
|
);
|
||||||
|
self.enobufs_encountered = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
Err(err).context("failed to write to the VM")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allowed_from_host(&mut self, frame: &EthernetFrame<&[u8]>) -> Option<()> {
|
fn allowed_from_host(&mut self, frame: &EthernetFrame<&[u8]>) -> Option<()> {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ pub struct Proxy {
|
|||||||
poller: Poller,
|
poller: Poller,
|
||||||
vm_mac_address: smoltcp::wire::EthernetAddress,
|
vm_mac_address: smoltcp::wire::EthernetAddress,
|
||||||
dhcp_snooper: DhcpSnooper,
|
dhcp_snooper: DhcpSnooper,
|
||||||
|
enobufs_encountered: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Proxy {
|
impl Proxy {
|
||||||
@@ -32,6 +33,7 @@ impl Proxy {
|
|||||||
poller,
|
poller,
|
||||||
vm_mac_address: smoltcp::wire::EthernetAddress(vm_mac_address.bytes()),
|
vm_mac_address: smoltcp::wire::EthernetAddress(vm_mac_address.bytes()),
|
||||||
dhcp_snooper: Default::default(),
|
dhcp_snooper: Default::default(),
|
||||||
|
enobufs_encountered: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
nightly
|
||||||
+4
-2
@@ -2,6 +2,7 @@ use anyhow::{anyhow, Context};
|
|||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use privdrop::PrivDrop;
|
use privdrop::PrivDrop;
|
||||||
use softnet::proxy::Proxy;
|
use softnet::proxy::Proxy;
|
||||||
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::os::raw::c_int;
|
use std::os::raw::c_int;
|
||||||
use std::os::unix::io::RawFd;
|
use std::os::unix::io::RawFd;
|
||||||
@@ -49,18 +50,19 @@ struct Args {
|
|||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
// Enable backtraces by default
|
// Enable backtraces by default
|
||||||
if env::var("RUST_BACKTRACE").is_err() {
|
if env::var("RUST_BACKTRACE").is_err() {
|
||||||
env::set_var("RUST_BACKTRACE", "1");
|
env::set_var("RUST_BACKTRACE", "full");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Sentry
|
// Initialize Sentry
|
||||||
let _sentry = sentry::init(sentry::ClientOptions {
|
let _sentry = sentry::init(sentry::ClientOptions {
|
||||||
|
release: option_env!("CIRRUS_TAG").map(|tag| { Cow::from(format!("softnet@{tag}")) }),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enrich future events with Cirrus CI-specific tags
|
// Enrich future events with Cirrus CI-specific tags
|
||||||
if let Ok(tags) = env::var("CIRRUS_SENTRY_TAGS") {
|
if let Ok(tags) = env::var("CIRRUS_SENTRY_TAGS") {
|
||||||
sentry::configure_scope(|scope| {
|
sentry::configure_scope(|scope| {
|
||||||
for (key, value) in tags.split(",").map(|tag| tag.split_once("=")).flatten() {
|
for (key, value) in tags.split(',').filter_map(|tag| tag.split_once('=')) {
|
||||||
scope.set_tag(key, value);
|
scope.set_tag(key, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user