mirror of
https://github.com/jmcorgan/fips.git
synced 2026-07-30 19:46:15 +00:00
Add --wait flag and ip link debug output
- Add --wait / -w command-line flag for debugger attachment - When --wait is set, daemon blocks after init with thread::park() - Add ip link show output after TUN device creation for debugging
This commit is contained in:
+29
-1
@@ -6,8 +6,13 @@ use fips::{Config, Node};
|
||||
use tracing::{error, info, warn, Level};
|
||||
use tracing_subscriber::{fmt, EnvFilter};
|
||||
|
||||
fn parse_args() -> bool {
|
||||
std::env::args().any(|arg| arg == "--wait" || arg == "-w")
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() {
|
||||
let wait_mode = parse_args();
|
||||
// Initialize logging
|
||||
let filter = EnvFilter::builder()
|
||||
.with_default_directive(Level::INFO.into())
|
||||
@@ -87,6 +92,22 @@ async fn main() {
|
||||
address = %device.address(),
|
||||
"TUN device active"
|
||||
);
|
||||
|
||||
// Show interface details for debugging
|
||||
let output = std::process::Command::new("ip")
|
||||
.args(["link", "show", device.name()])
|
||||
.output();
|
||||
match output {
|
||||
Ok(out) => {
|
||||
if out.status.success() {
|
||||
info!("ip link show {}:\n{}", device.name(),
|
||||
String::from_utf8_lossy(&out.stdout));
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to run ip link: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(false) => {
|
||||
info!("TUN disabled");
|
||||
@@ -101,5 +122,12 @@ async fn main() {
|
||||
info!("FIPS initialized successfully");
|
||||
|
||||
// TODO: Start event loop, transports, etc.
|
||||
info!("No transports configured, nothing to do");
|
||||
if wait_mode {
|
||||
info!("Running in wait mode (--wait). Press Ctrl+C to exit.");
|
||||
info!("Attach debugger with: sudo ./scripts/lldb-attach-fips.sh");
|
||||
// Block forever (until signal)
|
||||
std::thread::park();
|
||||
} else {
|
||||
info!("No transports configured, nothing to do");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user