diff --git a/rust/relay/server/src/ebpf/linux.rs b/rust/relay/server/src/ebpf/linux.rs index 1cf9d7a95..e217e7b94 100644 --- a/rust/relay/server/src/ebpf/linux.rs +++ b/rust/relay/server/src/ebpf/linux.rs @@ -20,7 +20,7 @@ pub struct Program { } impl Program { - pub fn try_load(interface: &'static str) -> Result { + pub fn try_load(interface: &str) -> Result { let mut ebpf = aya::Ebpf::load(aya::include_bytes_aligned!(concat!( env!("OUT_DIR"), "/ebpf-turn-router-main" diff --git a/rust/relay/server/src/main.rs b/rust/relay/server/src/main.rs index ffe71b22b..b6d64f336 100644 --- a/rust/relay/server/src/main.rs +++ b/rust/relay/server/src/main.rs @@ -82,6 +82,10 @@ struct Args { #[arg(long, env, hide = true)] google_cloud_project_id: Option, + /// Which interface to load the eBPF program onto. + #[arg(long, env, hide = true, default_value = "eth0")] + primary_interface: String, + #[command(flatten)] health_check: http_health_check::HealthCheckArgs, @@ -132,7 +136,7 @@ fn main() { async fn try_main(args: Args) -> Result<()> { setup_tracing(&args)?; - let mut ebpf = ebpf::Program::try_load("eth0") + let mut ebpf = ebpf::Program::try_load(&args.primary_interface) .inspect_err(|e| tracing::info!("Failed to load eBPF TURN router: {e:#}")) .ok();