#![no_std] #![no_main] use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; // Note: the `frags` attribute causes this probe to be incompatible with kernel versions < 5.18.0. // See https://github.com/torvalds/linux/commit/c2f2cdb. #[xdp(frags)] pub fn pass(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(not(test))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} }