diff --git a/src/bin/fips.rs b/src/bin/fips.rs index b5356bd..416f110 100644 --- a/src/bin/fips.rs +++ b/src/bin/fips.rs @@ -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"); + } }