#![cfg_attr(target_arch = "bpf", no_std)] #![cfg_attr(target_arch = "bpf", no_main)] use aya_ebpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; #[xdp] pub fn ihaveaverylongname(ctx: XdpContext) -> u32 { match unsafe { try_pass(ctx) } { Ok(ret) => ret, Err(_) => xdp_action::XDP_ABORTED, } } unsafe fn try_pass(_ctx: XdpContext) -> Result { Ok(xdp_action::XDP_PASS) } #[cfg(target_arch = "bpf")] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} } #[cfg(not(target_arch = "bpf"))] fn main() { panic!("This should only ever be called from its eBPF entrypoint") }